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,s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"FirebaseError",{enumerable:!0,get:function(){return r.FirebaseError}}),s._DEFAULT_ENTRY_NAME=s.SDK_VERSION=void 0,s._addComponent=$,s._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},s._apps=void 0,s._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.
 */,s._components=void 0,s._getProvider=W,s._isFirebaseApp=G,s._isFirebaseServerApp=function(e){return e.settings!==undefined},s._registerComponent=q,s._removeServiceInstance=function(e,t,s=N){W(e,t).clearInstance(s)},s._serverApps=void 0,s.deleteApp=Y,s.getApp=function(e=N){const t=L.get(e);if(!t&&e===N&&(0,r.getDefaultAppConfig)())return X();if(!t)throw V.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(L.values())},s.initializeApp=X,s.initializeServerApp=function(e,t){if((0,r.isBrowser)()&&!(0,r.isWebWorker)())throw V.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let s;s=G(e)?e.options:e;const a=Object.assign(Object.assign({},t),s);a.releaseOnDeref!==undefined&&delete a.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw V.create("finalization-registry-not-supported",{});const o=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),i=U.get(o);var c;if(i)return i.incRefCount(t.releaseOnDeref),i;const l=new n.ComponentContainer(o);for(const e of H.values())l.addComponent(e);const u=new J(s,t,o,l);return U.set(o,u),u},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw V.create("invalid-log-argument");(0,a.setUserLogHandler)(e,t)},s.registerVersion=Q,s.setLogLevel=function(e){(0,a.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 n=e("@firebase/component"),a=e("@firebase/logger"),r=e("@firebase/util"),o=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",u=new a.Logger("@firebase/app"),d="@firebase/app-compat",m="@firebase/analytics-compat",h="@firebase/analytics",p="@firebase/app-check-compat",f="@firebase/app-check",b="@firebase/auth",k="@firebase/auth-compat",g="@firebase/database",w="@firebase/data-connect",x="@firebase/database-compat",v="@firebase/functions",y="@firebase/functions-compat",_="@firebase/installations",S="@firebase/installations-compat",A="@firebase/messaging",j="@firebase/messaging-compat",T="@firebase/performance",C="@firebase/performance-compat",E="@firebase/remote-config",I="@firebase/remote-config-compat",O="@firebase/storage",P="@firebase/storage-compat",M="@firebase/firestore",D="@firebase/vertexai",R="@firebase/firestore-compat",B="firebase",N=s._DEFAULT_ENTRY_NAME="[DEFAULT]",F={[c]:"fire-core",[d]:"fire-core-compat",[h]:"fire-analytics",[m]:"fire-analytics-compat",[f]:"fire-app-check",[p]:"fire-app-check-compat",[b]:"fire-auth",[k]:"fire-auth-compat",[g]:"fire-rtdb",[w]:"fire-data-connect",[x]:"fire-rtdb-compat",[v]:"fire-fn",[y]:"fire-fn-compat",[_]:"fire-iid",[S]:"fire-iid-compat",[A]:"fire-fcm",[j]:"fire-fcm-compat",[T]:"fire-perf",[C]:"fire-perf-compat",[E]:"fire-rc",[I]:"fire-rc-compat",[O]:"fire-gcs",[P]:"fire-gcs-compat",[M]:"fire-fst",[R]:"fire-fst-compat",[D]:"fire-vertex","fire-js":"fire-js",[B]:"fire-js-all"},L=s._apps=new Map,U=s._serverApps=new Map,H=s._components=new Map;function $(e,t){try{e.container.addComponent(t)}catch(s){u.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function q(e){const t=e.name;if(H.has(t))return u.debug(`There were multiple attempts to register component ${t}.`),!1;H.set(t,e);for(const t of L.values())$(t,e);for(const t of U.values())$(t,e);return!0}function W(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}function G(e){return e.options!==undefined}const z={"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."},V=new r.ErrorFactory("app","Firebase",z);
/**
 * @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 K{constructor(e,t,s){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new n.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 V.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 J extends K{constructor(e,t,s,n){const a=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,r={name:s,automaticDataCollectionEnabled:a};if(e.apiKey!==undefined)super(e,r,n);else{super(e.options,r,n)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:a},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,Q(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(){Y(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw V.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.
 */s.SDK_VERSION="11.2.0";function X(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:N,automaticDataCollectionEnabled:!1},t),o=a.name;if("string"!=typeof o||!o)throw V.create("bad-app-name",{appName:String(o)});if(s||(s=(0,r.getDefaultAppConfig)()),!s)throw V.create("no-options");const i=L.get(o);if(i){if((0,r.deepEqual)(s,i.options)&&(0,r.deepEqual)(a,i.config))return i;throw V.create("duplicate-app",{appName:o})}const c=new n.ComponentContainer(o);for(const e of H.values())c.addComponent(e);const l=new K(s,a,c);return L.set(o,l),l}async function Y(e){let t=!1;const s=e.name;if(L.has(s))t=!0,L.delete(s);else if(U.has(s)){e.decRefCount()<=0&&(U.delete(s),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function Q(e,t,s){var a;let r=null!==(a=F[e])&&void 0!==a?a:e;s&&(r+=`-${s}`);const o=r.match(/\s|\//),i=t.match(/\s|\//);if(o||i){const e=[`Unable to register library "${r}" with version "${t}":`];return o&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),o&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void u.warn(e.join(" "))}q(new n.Component(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,o.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw V.create("idb-open",{originalErrorMessage:e.message})})),ee}async function se(e,t){try{const s=(await te()).transaction(Z,"readwrite"),n=s.objectStore(Z);await n.put(t,ne(e)),await s.done}catch(e){if(e instanceof r.FirebaseError)u.warn(e.message);else{const t=V.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});u.warn(t.message)}}}function ne(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 ae{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new oe(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=re();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===n||this._heartbeatsCache.heartbeats.some(e=>e.date===n))return;return this._heartbeatsCache.heartbeats.push({date:n,agent:s}),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){u.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=re(),{heartbeatsToSend:s,unsentEntries:n}=function(e,t=1024){const s=[];let n=e.slice();for(const a of e){const e=s.find(e=>e.agent===a.agent);if(e){if(e.dates.push(a.date),ie(s)>t){e.dates.pop();break}}else if(s.push({agent:a.agent,dates:[a.date]}),ie(s)>t){s.pop();break}n=n.slice(1)}return{heartbeatsToSend:s,unsentEntries:n}}(this._heartbeatsCache.heartbeats),a=(0,r.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:s}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(e){return u.warn(e),""}}}function re(){return(new Date).toISOString().substring(0,10)}class oe{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,r.isIndexedDBAvailable)()&&(0,r.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),s=await t.objectStore(Z).get(ne(e));return await t.done,s}catch(e){if(e instanceof r.FirebaseError)u.warn(e.message);else{const t=V.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});u.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 s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}}}function ie(e){return(0,r.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 n.Component("platform-logger",e=>new i(e),"PRIVATE")),q(new n.Component("heartbeat",e=>new ae(e),"PRIVATE")),Q(c,l,ce),Q(c,l,"esm2017"),Q("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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.Provider=s.ComponentContainer=s.Component=void 0;var n=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.
 */
s.Component=class{constructor(e,t,s){this.name=e,this.instanceFactory=t,this.type=s,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 a="[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 r{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 n.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&e.resolve(s)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const s=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(s)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:s})}catch(e){if(n)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:a})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:s});t.resolve(e)}catch(e){}}}}clearInstance(e=a){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=a){return this.instances.has(e)}getOptions(e=a){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,s=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(s))throw Error(`${this.name}(${s}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:s,options:t});for(const[e,t]of this.instancesDeferred.entries()){s===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var s;const n=this.normalizeInstanceIdentifier(t),a=null!==(s=this.onInitCallbacks.get(n))&&void 0!==s?s:new Set;a.add(e),this.onInitCallbacks.set(n,a);const r=this.instances.get(n);return r&&e(r,n),()=>{a.delete(e)}}invokeOnInitCallbacks(e,t){const s=this.onInitCallbacks.get(t);if(s)for(const n of s)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let s=this.instances.get(e);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===a?undefined:n),options:t}),this.instances.set(e,s),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(s,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,s)}catch(e){}var n;return s||null}normalizeInstanceIdentifier(e=a){return this.component?this.component.multipleInstances?e:a:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}s.Provider=r;s.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 r(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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.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,s=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(s){if(1===s.registrationStatus)throw f.create("delete-pending-registration");if(2===s.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 s=function(e,{fid:t}){return`${k(e)}/${t}`}(e,t),n=v(e,t),a={method:"DELETE",headers:n},r=await y(()=>fetch(s,a));if(!r.ok)throw await w("Delete Installation",r)}(t,s),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.
 */,s.getId=X,s.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,n.getApp)()){return(0,n._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.
 */,s.getToken=Y,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){P();const s=T(e);let n=C.get(s);n||(n=new Set,C.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=T(e),n=C.get(s);if(!n)return;n.delete(t),0===n.size&&C.delete(s);M()}(s,t)}};var n=e("@firebase/app"),a=e("@firebase/component"),r=e("@firebase/util"),o=e("idb");const i="@firebase/installations",c="0.6.12",l=1e4,u=`w:${c}`,d="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 r.ErrorFactory("installations","Installations",p);function b(e){return e instanceof r.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 g(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function w(e,t){const s=(await t.json()).error;return f.create("request-failed",{requestName:e,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function x({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function v(e,{refreshToken:t}){const s=x(e);return s.append("Authorization",function(e){return`${d} ${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)),s}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 _(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 S=/^[cdef][\w-]{21}$/,A="";function j(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(s=e,btoa(String.fromCharCode(...s)).replace(/\+/g,"-").replace(/\//g,"_"));var s;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 S.test(t)?t:A}catch(e){return A}}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 C=new Map;function E(e,t){const s=T(e);I(s,t),function(e,t){const s=P();s&&s.postMessage({key:e,fid:t});M()}(s,t)}function I(e,t){const s=C.get(e);if(s)for(const e of s)e(t)}let O=null;function P(){return!O&&"BroadcastChannel"in self&&(O=new BroadcastChannel("[Firebase] FID Change"),O.onmessage=e=>{I(e.data.key,e.data.fid)}),O}function M(){0===C.size&&O&&(O.close(),O=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 D="firebase-installations-database",R=1,B="firebase-installations-store";let N=null;function F(){return N||(N=(0,o.openDB)(D,R,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(B)}})),N}async function L(e,t){const s=T(e),n=(await F()).transaction(B,"readwrite"),a=n.objectStore(B),r=await a.get(s);return await a.put(t,s),await n.done,r&&r.fid===t.fid||E(e,t.fid),t}async function U(e){const t=T(e),s=(await F()).transaction(B,"readwrite");await s.objectStore(B).delete(t),await s.done}async function H(e,t){const s=T(e),n=(await F()).transaction(B,"readwrite"),a=n.objectStore(B),r=await a.get(s),o=t(r);return o===undefined?await a.delete(s):await a.put(o,s),await n.done,!o||r&&r.fid===o.fid||E(e,o.fid),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.
 */async function $(e){let t;const s=await H(e.appConfig,s=>{const n=function(e){const t=e||{fid:j(),registrationStatus:0};return G(t)}(s),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(f.create("app-offline"))}}const s={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const s=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:s}){const n=k(e),a=x(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={fid:s,authVersion:d,appId:e.appId,sdkVersion:u},i={method:"POST",headers:a,body:JSON.stringify(o)},c=await y(()=>fetch(n,i));if(c.ok){const e=await c.json();return{fid:e.fid||s,registrationStatus:2,refreshToken:e.refreshToken,authToken:g(e.authToken)}}throw await w("Create Installation",c)}(e,t);return L(e.appConfig,s)}catch(s){throw b(s)&&409===s.customData.serverCode?await U(e.appConfig):await L(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}(e,s);return{installationEntry:s,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:q(e)}:{installationEntry:t}}(e,n);return t=a.registrationPromise,a.installationEntry});return s.fid===A?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function q(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await _(100),t=await W(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await $(e);return s||t}return t}function W(e){return H(e,e=>{if(!e)throw f.create("installation-not-found");return G(e)})}function G(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 z({appConfig:e,heartbeatServiceProvider:t},s){const n=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,s),a=v(e,s),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={installation:{sdkVersion:u,appId:e.appId}},i={method:"POST",headers:a,body:JSON.stringify(o)},c=await y(()=>fetch(n,i));if(c.ok){return g(await c.json())}throw await w("Generate Auth Token",c)}async function V(e,t=!1){let s;const n=await H(e.appConfig,n=>{if(!J(n))throw f.create("not-registered");const a=n.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)}(a))return n;if(1===a.requestStatus)return s=async function(e,t){let s=await K(e.appConfig);for(;1===s.authToken.requestStatus;)await _(100),s=await K(e.appConfig);const n=s.authToken;return 0===n.requestStatus?V(e,t):n}(e,t),n;{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})}(n);return s=async function(e,t){try{const s=await z(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await L(e.appConfig,n),s}catch(s){if(!b(s)||401!==s.customData.serverCode&&404!==s.customData.serverCode){const s=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await L(e.appConfig,s)}else await U(e.appConfig);throw s}}(e,t),t}});return s?await s:n.authToken}function K(e){return H(e,e=>{if(!J(e))throw f.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+l<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var 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 J(e){return e!==undefined&&2===e.registrationStatus}async function X(e){const t=e,{installationEntry:s,registrationPromise:n}=await $(t);return n?n.catch(console.error):V(t).catch(console.error),s.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 Y(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await $(e);t&&await t}(s);return(await V(s,t)).token}function Q(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(),s=function(e){if(!e||!e.options)throw Q("App Configuration");if(!e.name)throw Q("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw Q(s);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:s,heartbeatServiceProvider:(0,n._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),s=(0,n._getProvider)(t,Z).getImmediate();return{getId:()=>X(s),getToken:e=>Y(s,e)}};(0,n._registerComponent)(new a.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new a.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(i,c),(0,n.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,s){Object.defineProperty(s,"__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 n=[];var a;s.LogLevel=void 0,(a=s.LogLevel||(s.LogLevel={}))[a.DEBUG=0]="DEBUG",a[a.VERBOSE=1]="VERBOSE",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.SILENT=5]="SILENT";const r={debug:s.LogLevel.DEBUG,verbose:s.LogLevel.VERBOSE,info:s.LogLevel.INFO,warn:s.LogLevel.WARN,error:s.LogLevel.ERROR,silent:s.LogLevel.SILENT},o=s.LogLevel.INFO,i={[s.LogLevel.DEBUG]:"log",[s.LogLevel.VERBOSE]:"log",[s.LogLevel.INFO]:"info",[s.LogLevel.WARN]:"warn",[s.LogLevel.ERROR]:"error"},c=(e,t,...s)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),a=i[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${n}]  ${e.name}:`,...s)};s.Logger=class{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null,n.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in s.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[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,s.LogLevel.DEBUG,...e),this._logHandler(this,s.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.VERBOSE,...e),this._logHandler(this,s.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.INFO,...e),this._logHandler(this,s.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.WARN,...e),this._logHandler(this,s.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.ERROR,...e),this._logHandler(this,s.LogLevel.ERROR,...e)}},s.setLogLevel=function(e){n.forEach(t=>{t.setLogLevel(e)})},s.setUserLogHandler=function(e,t){for(const a of n){let n=null;t&&t.level&&(n=r[t.level]),a.userLogHandler=null===e?null:(t,a,...r)=>{const o=r.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(" ");a>=(null!=n?n:t.logLevel)&&e({level:s.LogLevel[a].toLowerCase(),message:o,args:r,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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.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 E.create("only-available-in-window");e.swRegistration||await U(e);return async function(e){const t=await A(e.firebaseDependencies);t&&(await I(e.firebaseDependencies,t.token),await async function(e){const t=T(e),s=(await S()).transaction(y,"readwrite");await s.objectStore(y).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();if(s)return s.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,r.getModularInstance)(e))},s.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,o.getApp)()){return K().then(e=>{if(!e)throw E.create("unsupported-browser")},e=>{throw E.create("indexed-db-unsupported")}),(0,o._getProvider)((0,r.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return H(e=(0,r.getModularInstance)(e),t)},s.isSupported=K,s.onMessage=function(e,t){return function(e,t){if(!navigator)throw E.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,r.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),r=e("@firebase/util"),o=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",u="https://fcmregistrations.googleapis.com/v1",d="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 b(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return 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(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",g=5,w="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 x="firebase-messaging-database",v=1,y="firebase-messaging-store";let _=null;function S(){return _||(_=(0,a.openDB)(x,v,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(y)}})),_}async function A(e){const t=T(e),s=await S(),n=await s.transaction(y).objectStore(y).get(t);if(n)return n;{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,a.openDB)(k,g,{upgrade:async(s,n,a,r)=>{var o;if(n<2)return;if(!s.objectStoreNames.contains(w))return;const i=r.objectStore(w),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o: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===n){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===n){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,a.deleteDB)(k),await(0,a.deleteDB)("fcm_vapid_details_db"),await(0,a.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 j(e,t),t}}async function j(e,t){const s=T(e),n=(await S()).transaction(y,"readwrite");return await n.objectStore(y).put(t,s),await n.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 C={"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."},E=new r.ErrorFactory("messaging","Messaging",C);async function I(e,t){const s={method:"DELETE",headers:await P(e)};try{const n=await fetch(`${O(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw E.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw E.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function O({projectId:e}){return`${u}/projects/${e}/registrations`}async function P({appConfig:e,installations:t}){const s=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 ${s}`})}function M({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==l&&(a.web.applicationPubKey=n),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.
 */const D=6048e5;async function R(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:b(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:f(t.getKey("auth")),p256dh:f(t.getKey("p256dh"))},n=await A(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,r=t.p256dh===e.p256dh;return s&&n&&a&&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.subscriptionOptions,s))return Date.now()>=n.createTime+D?async function(e,t){try{const s=await async function(e,t){const s=await P(e),n=M(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let r;try{const s=await fetch(`${O(e.appConfig)}/${t.token}`,a);r=await s.json()}catch(e){throw E.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw E.create("token-update-failed",{errorInfo:e})}if(!r.token)throw E.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await j(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await I(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return B(e.firebaseDependencies,s)}return B(e.firebaseDependencies,s)}async function B(e,t){const 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.
 */await async function(e,t){const s=await P(e),n=M(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let r;try{const t=await fetch(O(e.appConfig),a);r=await t.json()}catch(e){throw E.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw E.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw E.create("token-subscribe-no-token");return r.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await j(e,n),n.token}function N(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const a=t.notification.image;a&&(e.notification.image=a);const r=t.notification.icon;r&&(e.notification.icon=r)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var s,n,a,r,o;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const i=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(r=t.notification)||void 0===r?void 0:r.click_action;i&&(e.fcmOptions.link=i);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.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 F(e){return E.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 s=[];for(let n=0;n<e.length;n++)s.push(e.charAt(n)),n<t.length&&s.push(t.charAt(n));s.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 L{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw F("App Configuration Object");if(!e.name)throw F("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw F(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_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,s)=>{const n=setTimeout(()=>s(new Error(`Service worker not registered after ${m} ms`)),m),a=e.installing||e.waiting;e.active?(clearTimeout(n),t()):a?a.onstatechange=e=>{var s;"activated"===(null===(s=e.target)||void 0===s?void 0:s.state)&&(a.onstatechange=null,clearTimeout(n),t())}:(clearTimeout(n),s(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 E.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 E.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw E.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 E.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),R(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 $(e,t,s){const n=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(n,{message_id:s[d],message_name:s["google.c.a.c_l"],message_time:s["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function q(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===p.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(N(s)):e.onMessageHandler.next(N(s)));const n=s.data;var a;"object"==typeof(a=n)&&a&&d in a&&"1"===n["google.c.a.e"]&&await $(e,s.messageType,n)}const W="@firebase/messaging",G="0.12.16",z=e=>{const t=new L(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>q(t,e)),t},V=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 K(){try{await(0,r.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,r.isIndexedDBAvailable)()&&(0,r.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,o._registerComponent)(new n.Component("messaging",z,"PUBLIC")),(0,o._registerComponent)(new n.Component("messaging-internal",V,"PRIVATE")),(0,o.registerVersion)(W,G),(0,o.registerVersion)(W,G,"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,s){Object.defineProperty(s,"__esModule",{value:!0}),e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),r=e("@firebase/util"),o=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,u;
/**
 * @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 d(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,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return 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(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"}(u||(u={}));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 b=null;function k(){return b||(b=a.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(f)}})),b}async function g(e){const t=x(e),s=await k(),n=await s.transaction(f).objectStore(f).get(t);if(n)return n;{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 a.openDB(h,5,{upgrade:async(s,n,a,r)=>{var o;if(n<2)return;if(!s.objectStoreNames.contains(p))return;const i=r.objectStore(p),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:d(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}}})).close(),await a.deleteDB(h),await a.deleteDB("fcm_vapid_details_db"),await a.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 w(e,t),t}}async function w(e,t){const s=x(e),n=(await k()).transaction(f,"readwrite");return await n.objectStore(f).put(t,s),await n.done,t}function x({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."},y=new r.ErrorFactory("messaging","Messaging",v);async function _(e,t){const s={method:"DELETE",headers:await A(e)};try{const n=await fetch(`${S(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.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 S({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function A({appConfig:e,installations:t}){const s=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 ${s}`})}function j({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==i&&(a.web.applicationPubKey=n),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 T(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:m(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:d(t.getKey("auth")),p256dh:d(t.getKey("p256dh"))},n=await g(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,r=t.p256dh===e.p256dh;return s&&n&&a&&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.subscriptionOptions,s))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await A(e),n=j(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let r;try{const s=await fetch(`${S(e.appConfig)}/${t.token}`,a);r=await s.json()}catch(e){throw y.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw y.create("token-update-failed",{errorInfo:e})}if(!r.token)throw y.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await w(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await _(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return E(e.firebaseDependencies,s)}return E(e.firebaseDependencies,s)}async function C(e){const t=await g(e.firebaseDependencies);t&&(await _(e.firebaseDependencies,t.token),await async function(e){const t=x(e),s=(await k()).transaction(f,"readwrite");await s.objectStore(f).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();return!s||s.unsubscribe()}async function E(e,t){const 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.
 */await async function(e,t){const s=await A(e),n=j(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let r;try{const t=await fetch(S(e.appConfig),a);r=await t.json()}catch(e){throw y.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw y.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw y.create("token-subscribe-no-token");return r.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await w(e,n),n.token}async function I(e,t){const s=function(e,t){var s,n;const a={};e.from&&(a.project_number=e.from);e.fcmMessageId&&(a.message_id=e.fcmMessageId);a.instance_id=t,e.notification?a.message_type=l.DISPLAY_NOTIFICATION.toString():a.message_type=l.DATA_MESSAGE.toString();a.sdk_platform=3..toString(),a.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(a.collapse_key=e.collapse_key);a.event=1..toString(),!(null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label)||(a.analytics_label=null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label);return a}(t,await e.firebaseDependencies.installations.getId());!function(e,t,s){const n={};n.event_time_ms=Math.floor(Date.now()).toString(),n.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!s||(n.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(s));e.logEvents.push(n)}(e,s,t.productId)}async function O(e,t){const s=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!s)return;t.deliveryMetricsExportedToBigQueryEnabled&&await I(t,s);const n=await M();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(n))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=u.PUSH_RECEIVED;for(const s of e)s.postMessage(t)}(n,s);if(s.notification&&await function(e){var t;const{actions:s}=e,{maxActions:n}=Notification;s&&n&&s.length>n&&console.warn(`This browser only supports ${n} 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}(s)),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 s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const a=t.notification.image;a&&(e.notification.image=a);const r=t.notification.icon;r&&(e.notification.icon=r)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var s,n,a,r,o;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const i=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(r=t.notification)||void 0===r?void 0:r.click_action;i&&(e.fcmOptions.link=i);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.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}(s);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function P(e){var t,s;const n=null===(s=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===s?void 0:s[c];if(!n)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const a=function(e){var t,s,n;const a=null!==(s=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==s?s:null===(n=e.notification)||void 0===n?void 0:n.click_action;if(a)return a;return r=e.data,"object"==typeof r&&r&&"google.c.a.c_id"in r?self.location.origin:null;var 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.
 */}
/**
 * @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);if(!a)return;const r=new URL(a,self.location.href),o=new URL(self.location.origin);if(r.host!==o.host)return;let i=await async function(e){const t=await M();for(const s of t){const t=new URL(s.url,self.location.href);if(e.host===t.host)return s}return null}(r);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(a),await(l=3e3,new Promise(e=>{setTimeout(e,l)}))),i?(n.messageType=u.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,i.postMessage(n)):void 0}function M(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function D(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 s=[];for(let n=0;n<e.length;n++)s.push(e.charAt(n)),n<t.length&&s.push(t.charAt(n));s.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 R{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw D("App Configuration Object");if(!e.name)throw D("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw D(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_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 B=e=>{const t=new R(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(O(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var s,n;const{newSubscription:a}=e;if(!a)return void await C(t);const r=await g(t.firebaseDependencies);await C(t),t.vapidKey=null!==(n=null===(s=null==r?void 0:r.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n: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 N(){return r.isIndexedDBAvailable()&&await r.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.
 */o._registerComponent(new n.Component("messaging-sw",B,"PUBLIC")),s.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=r.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.
 */,s.getMessaging=function(e=o.getApp()){return N().then(e=>{if(!e)throw y.create("unsupported-browser")},e=>{throw y.create("indexed-db-unsupported")}),o._getProvider(r.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=N,s.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=r.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,s){(function(e){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.Sha1=s.RANDOM_FACTOR=s.MAX_VALUE_MILLIS=s.FirebaseError=s.ErrorFactory=s.Deferred=s.DecodeBase64StringError=s.CONSTANTS=void 0,s.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.
 */,s.assertionError=s.assert=void 0,s.async=function(e,t){return(...s)=>{Promise.resolve(!0).then(()=>{e(...s)}).catch(e=>{t&&t(e)})}},s.base64urlEncodeWithoutPadding=s.base64Encode=s.base64Decode=s.base64=void 0,s.calculateBackoffMillis=function(e,t=E,s=I){const n=t*Math.pow(s,e),a=Math.round(P*n*(Math.random()-.5)*2);return Math.min(O,n+a)}
/**
 * @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.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.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 s=t||"demo-project",n=e.iat||0,a=e.sub||e.user_id;if(!a)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const r=Object.assign({iss:`https://securetoken.google.com/${s}`,aud:s,iat:n,exp:n+3600,auth_time:n,sub:a,user_id:a,firebase:{sign_in_provider:"custom",identities:{}}},e);return[l(JSON.stringify({alg:"none",type:"JWT"})),l(JSON.stringify(r)),""].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.
 */,s.createSubscribe=function(e,t){const s=new j(e,t);return s.subscribe.bind(s)},s.decode=void 0,s.deepCopy=function(e){return d(undefined,e)},s.deepEqual=function e(t,s){if(t===s)return!0;const n=Object.keys(t),a=Object.keys(s);for(const r of n){if(!a.includes(r))return!1;const n=t[r],o=s[r];if(A(n)&&A(o)){if(!e(n,o))return!1}else if(n!==o)return!1}for(const e of a)if(!n.includes(e))return!1;return!0},s.deepExtend=d,s.errorPrefix=C,s.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const s=e.indexOf("#",t);return e.substring(t,s>0?s: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.
 */,s.getExperimentalSetting=s.getDefaults=s.getDefaultEmulatorHostnameAndPort=s.getDefaultEmulatorHost=s.getDefaultAppConfig=void 0,s.getGlobal=h,s.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},s.getUA=k,s.isAdmin=void 0,s.isBrowser=function(){return"undefined"!=typeof window||w()},s.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},s.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},s.isElectron=function(){return k().indexOf("Electron/")>=0},s.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},s.isIE=function(){const e=k();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},s.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},s.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k())},s.isNode=g,s.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},s.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},s.isSafari=function(){return!g()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},s.isUWP=function(){return k().indexOf("MSAppHost/")>=0},s.isValidTimestamp=s.isValidFormat=void 0,s.isWebWorker=w,s.issuedAtTime=void 0,s.jsonEval=_,s.map=function(e,t,s){const n={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=t.call(s,e[a],a,e));return n},s.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 s=e%10;if(1===s)return"st";if(2===s)return"nd";if(3===s)return"rd";return"th"}(e)},s.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 s=new b;return setTimeout(()=>s.reject("timeout!"),t),e.then(s.resolve,s.reject),s.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.
 */,s.querystring=function(e){const t=[];for(const[s,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(s)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(s)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""},s.querystringDecode=function(e){const t={},s=e.replace(/^\?/,"").split("&");return s.forEach(e=>{if(e){const[s,n]=e.split("=");t[decodeURIComponent(s)]=decodeURIComponent(n)}}),t},s.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},s.stringToByteArray=s.stringLength=void 0,s.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.
 */,s.validateArgCount=void 0,s.validateCallback=function(e,t,s,n){if(n&&!s)return;if("function"!=typeof s)throw new Error(C(e,t)+"must be a valid function.")},s.validateContextObject=function(e,t,s,n){if(n&&!s)return;if("object"!=typeof s||null===s)throw new Error(C(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.
 */,s.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let s=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),s||self.indexedDB.deleteDatabase(n),e(!0)},a.onupgradeneeded=()=>{s=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},s.validateNamespace=function(e,t,s){if(s&&!t)return;if("string"!=typeof t)throw new Error(C(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=s.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},n=function(e,t){if(!e)throw a(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.
 */s.assert=n;const a=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.
 */s.assertionError=a;const r=function(e){const t=[];let s=0;for(let n=0;n<e.length;n++){let a=e.charCodeAt(n);a<128?t[s++]=a:a<2048?(t[s++]=a>>6|192,t[s++]=63&a|128):55296==(64512&a)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),t[s++]=a>>18|240,t[s++]=a>>12&63|128,t[s++]=a>>6&63|128,t[s++]=63&a|128):(t[s++]=a>>12|224,t[s++]=a>>6&63|128,t[s++]=63&a|128)}return t},o=s.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 s=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const a=e[t],r=t+1<e.length,o=r?e[t+1]:0,i=t+2<e.length,c=i?e[t+2]:0,l=a>>2,u=(3&a)<<4|o>>4;let d=(15&o)<<2|c>>6,m=63&c;i||(m=64,r||(d=64)),n.push(s[l],s[u],s[d],s[m])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let s=0,n=0;for(;s<e.length;){const a=e[s++];if(a<128)t[n++]=String.fromCharCode(a);else if(a>191&&a<224){const r=e[s++];t[n++]=String.fromCharCode((31&a)<<6|63&r)}else if(a>239&&a<365){const r=((7&a)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[n++]=String.fromCharCode(55296+(r>>10)),t[n++]=String.fromCharCode(56320+(1023&r))}else{const r=e[s++],o=e[s++];t[n++]=String.fromCharCode((15&a)<<12|(63&r)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const s=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const a=s[e.charAt(t++)],r=t<e.length?s[e.charAt(t)]:0;++t;const o=t<e.length?s[e.charAt(t)]:64;++t;const c=t<e.length?s[e.charAt(t)]:64;if(++t,null==a||null==r||null==o||null==c)throw new i;const l=a<<2|r>>4;if(n.push(l),64!==o){const e=r<<4&240|o>>2;if(n.push(e),64!==c){const e=o<<6&192|c;n.push(e)}}}return n},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"}}s.DecodeBase64StringError=i;const c=function(e){const t=r(e);return o.encodeByteArray(t,!0)};s.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};s.base64urlEncodeWithoutPadding=l;const u=function(e){try{return o.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 d(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 s in t)t.hasOwnProperty(s)&&m(s)&&(e[s]=d(e[s],t[s]));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.
 */s.base64Decode=u;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&&u(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};s.getDefaults=p;const f=e=>{var t,s;return null===(s=null===(t=p())||void 0===t?void 0:t.emulatorHosts)||void 0===s?void 0:s[e]};s.getDefaultEmulatorHost=f;s.getDefaultEmulatorHostnameAndPort=e=>{const t=f(e);if(!t)return undefined;const s=t.lastIndexOf(":");if(s<=0||s+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(s+1),10);return"["===t[0]?[t.substring(1,s-1),n]:[t.substring(0,s),n]};s.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.
 */
s.getExperimentalSetting=e=>{var t;return null===(t=p())||void 0===t?void 0:t[`_${e}`]};class b{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,s)=>{t?this.reject(t):this.resolve(s),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,s))}}}
/**
 * @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 g(){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 w(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}s.Deferred=b;class x extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,x.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,v.prototype.create)}}s.FirebaseError=x;class v{constructor(e,t,s){this.service=e,this.serviceName=t,this.errors=s}create(e,...t){const s=t[0]||{},n=`${this.service}/${e}`,a=this.errors[e],r=a?function(e,t){return e.replace(y,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(a,s):"Error",o=`${this.serviceName}: ${r} (${n}).`;return new x(n,o,s)}}s.ErrorFactory=v;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 _(e){return JSON.parse(e)}const S=function(e){let t={},s={},n={},a="";try{const r=e.split(".");t=_(u(r[0])||""),s=_(u(r[1])||""),a=r[2],n=s.d||{},delete s.d}catch(e){}return{header:t,claims:s,data:n,signature:a}};s.decode=S;s.isValidTimestamp=function(e){const t=S(e).claims,s=Math.floor((new Date).getTime()/1e3);let n=0,a=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?n=t.nbf:t.hasOwnProperty("iat")&&(n=t.iat),a=t.hasOwnProperty("exp")?t.exp:n+86400),!!s&&!!n&&!!a&&s>=n&&s<=a};s.issuedAtTime=function(e){const t=S(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};s.isValidFormat=function(e){const t=S(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function A(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.
 */
s.isAdmin=function(e){const t=S(e).claims;return"object"==typeof t&&!0===t.admin};s.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 s=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)s[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)s[n]=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=s[e-3]^s[e-8]^s[e-14]^s[e-16];s[e]=4294967295&(t<<1|t>>>31)}let n,a,r=this.chain_[0],o=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?(n=c^o&(i^c),a=1518500249):(n=o^i^c,a=1859775393):e<60?(n=o&i|c&(o|i),a=2400959708):(n=o^i^c,a=3395469782);const t=(r<<5|r>>>27)+n+l+a+s[e]&4294967295;l=c,c=i,i=4294967295&(o<<30|o>>>2),o=r,r=t}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+o&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 s=t-this.blockSize;let n=0;const a=this.buf_;let r=this.inbuf_;for(;n<t;){if(0===r)for(;n<=s;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(a[r]=e.charCodeAt(n),++r,++n,r===this.blockSize){this.compress_(a),r=0;break}}else for(;n<t;)if(a[r]=e[n],++r,++n,r===this.blockSize){this.compress_(a),r=0;break}}this.inbuf_=r,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 s=0;for(let t=0;t<5;t++)for(let n=24;n>=0;n-=8)e[s]=this.chain_[t]>>n&255,++s;return e}};class j{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,s){let n;if(e===undefined&&t===undefined&&s===undefined)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const s of t)if(s in e&&"function"==typeof e[s])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:s},n.next===undefined&&(n.next=T),n.error===undefined&&(n.error=T),n.complete===undefined&&(n.complete=T);const a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),a}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 C(e,t){return`${e} failed: ${t} argument `}s.validateArgCount=function(e,t,s,n){let a;if(n<t?a="at least "+t:n>s&&(a=0===s?"none":"no more than "+s),a){throw new Error(e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+a+".")}};s.stringToByteArray=function(e){const t=[];let s=0;for(let a=0;a<e.length;a++){let r=e.charCodeAt(a);if(r>=55296&&r<=56319){const t=r-55296;a++,n(a<e.length,"Surrogate pair missing trail surrogate.");r=65536+(t<<10)+(e.charCodeAt(a)-56320)}r<128?t[s++]=r:r<2048?(t[s++]=r>>6|192,t[s++]=63&r|128):r<65536?(t[s++]=r>>12|224,t[s++]=r>>6&63|128,t[s++]=63&r|128):(t[s++]=r>>18|240,t[s++]=r>>12&63|128,t[s++]=r>>6&63|128,t[s++]=63&r|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.
 */
s.stringLength=function(e){let t=0;for(let s=0;s<e.length;s++){const n=e.charCodeAt(s);n<128?t++:n<2048?t+=2:n>=55296&&n<=56319?(t+=4,s++):t+=3}return t};const E=1e3,I=2,O=s.MAX_VALUE_MILLIS=144e5,P=s.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,s){Object.defineProperty(s,"__esModule",{value:!0});class n{static parse(e){if(""===e)return new n([]);if(!e.startsWith("/"))throw new a(e);const[,...t]=e.split("/");return new n(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 r(e,t);e=e[t]}return e}}s.default=n;class a extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}s.InvalidPtrError=a;class r extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}s.EvalError=r}}},{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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function o(e){try{c(n.next(e))}catch(e){r(e)}}function i(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=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(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var i=o(e("@json-schema-tools/traverse")),c=o(e("@json-schema-tools/reference-resolver")),l=o(e("fast-safe-stringify")),u=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")};s.NonStringRefError=u;var d=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var s=n(n({},t),e);return delete s.$ref,s}return t},m=function(){function e(e,t){var s;if(void 0===t&&(t={}),this.options=t,this.refCache={},s=!0===this.options.mutate||!0===e||!1===e?e:n({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=s),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=s),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var a=0,r=Object.keys(this.options.protocolHandlerMap);a<r.length;a++){var o=r[a];c.default.protocolHandlerMap[o]=this.options.protocolHandlerMap[o]}this.schema=s,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return a(this,void 0,void 0,function(){return r(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 a(this,void 0,void 0,function(){var t,s,a,o,l,u,m,h,p,f,b,k=this;return r(this,function(r){switch(r.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}),s=[],a=0,o=t,r.label=1;case 1:return a<o.length?(l=o[a],u=void 0,this.refCache[l]===undefined?[3,2]:(u=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 u=this.options.rootSchema,[3,5];case 3:return m=c.default.resolve(l,this.options.rootSchema),s.push(m),[4,m];case 4:u=r.sent(),r.label=5;case 5:return!0!==this.options.recursive||!0===u||!1===u||"#"===l?[3,9]:(h=n(n({},this.options),{refCache:this.refCache}),0===(p=new e(u,h)).refs.length?[3,7]:(f=p._resolve(),s.push(f),[4,f]));case 6:return b=r.sent(),this.refCache[l]=d(u,b),[3,8];case 7:this.refCache[l]=u,r.label=8;case 8:return[3,10];case 9:this.refCache[l]=u,r.label=10;case 10:return a++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=d(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 d(e,t)}return e},{mutable:!0}),[4,Promise.all(s)];case 12:return r.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 u(t);e.push(t.$ref)}return t}),e},e}();s.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,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var a=n(e("./dereferencer")),r=e("./dereferencer");Object.defineProperty(s,"NonStringRefError",{enumerable:!0,get:function(){return r.NonStringRefError}}),s.default=a.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.jsonSchema=void 0,s.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:[]}}},s.default=s.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,s){var n=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function o(e){try{c(n.next(e))}catch(e){r(e)}}function i(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=e("./errors"),i=r(e("isomorphic-fetch")),c=function(e){return n(void 0,void 0,void 0,function(){var t,s;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,i.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new o.InvalidRemoteURLError(e);case 3:return n.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,n.sent()];case 5:throw s=n.sent(),new o.NonJsonRefError({$ref:e},s.message);case 6:return[2]}})})};s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.InvalidFileSystemPathError=s.InvalidRemoteURLError=s.NotResolvableError=s.NonJsonRefError=void 0;var n=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")};s.NonJsonRefError=n;var a=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")};s.NotResolvableError=a;var r=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};s.InvalidRemoteURLError=r;var o=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};s.InvalidFileSystemPathError=o}}},{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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function o(e){try{c(n.next(e))}catch(e){r(e)}}function i(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=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(s,"__esModule",{value:!0});var i=o(e("./default-protocol-handler-map")),c=o(e("./reference-resolver")),l=n(n({},i.default),{file:function(){return a(void 0,void 0,void 0,function(){return r(this,function(e){return[2,undefined]})})}});s.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,s){var n=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function o(e){try{c(n.next(e))}catch(e){r(e)}}function i(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(o=0)),o;)try{if(s=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{s=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=e("./errors"),i=r(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return n(this,arguments,void 0,function(e,t){var s,n,r,c,l,u,d,m,h,p;return void 0===t&&(t={}),a(this,function(a){switch(a.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,i.default)(e,t))];(s=e.split("#")).length>1&&(n=s[s.length-1]),r=s[0],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(r,t)];case 2:return c=a.sent(),[3,4];case 3:throw l=a.sent(),new o.NonJsonRefError({$ref:e},l.message);case 4:if(c!==undefined)return p=c,n&&(p=(0,i.default)(n,p)),[2,p];if(!1===e.includes("://"))throw new o.InvalidFileSystemPathError(e);u=0,d=Object.keys(this.protocolHandlerMap),a.label=5;case 5:return u<d.length?(m=d[u],r.startsWith(m)?[4,this.protocolHandlerMap[m](r,t)]:[3,7]):[3,8];case 6:if((h=a.sent())!==undefined)return p=h,n&&(p=(0,i.default)(n,p)),[2,p];a.label=7;case 7:return u++,[3,5];case 8:throw new o.NotResolvableError(e)}})})},e}();s.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,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.InvalidJsonPointerRefError=void 0;var a=n(e("@json-schema-spec/json-pointer")),r=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};s.InvalidJsonPointerRefError=r,s.default=function(e,t){try{var s=e.replace("#","");return a.default.parse(s).shmeval(t)}catch(t){throw new r(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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__spreadArray||function(e,t,s){if(s||2===arguments.length)for(var n,a=0,r=t.length;a<r;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(s,"__esModule",{value:!0}),s.defaultOptions=void 0,s.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var r=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},o=function(e,t){var s=t.find(function(t){return t===e});return s||!1},i=function(e,t){return void 0===t&&(t=1),e[e.length-t]};s.default=function e(t,c,l,u,d,m,h,p,f){void 0===l&&(l=s.defaultOptions),void 0===u&&(u=0),void 0===d&&(d=[]),void 0===m&&(m=[]),void 0===h&&(h=[]),void 0===p&&(p=[]),void 0===f&&(f=[]);var b=n(n({},s.defaultOptions),l);if(0===u&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===b.skipFirstMutation&&0===u?t:c(t,!1,r(h),i(m));var k=t;!1===b.mutable&&(k=n({},t)),m.push(k),!0===b.bfs&&(!1!==b.skipFirstMutation&&0===u||(k=c(k,!1,r(h),i(m,2)))),d.push(t),p.push([t,k]);var g=function(t,s){var n=o(t,d);return n?(f.push(n),!0===b.skipFirstMutation&&n===d[0]?c(t,!0,r(s),i(m)):p.find(function(e){var t=e[0];return n===t})[1]):e(t,c,l,u+1,d,m,s,p,f)};if(t.anyOf)k.anyOf=t.anyOf.map(function(e,t){return g(e,a(a([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)k.allOf=t.allOf.map(function(e,t){return g(e,a(a([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)k.oneOf=t.oneOf.map(function(e,t){return g(e,a(a([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)k.items=t.items.map(function(e,t){return g(e,a(a([],h,!0),["items[".concat(t,"]")],!1))});else{var w=o(t.items,d);if(w)if(f.push(w),!0===b.skipFirstMutation&&w===d[0])k.items=c(t.items,!0,r(h),i(m));else{var x=p.find(function(e){var t=e[0];return w===t})[1];k.items=x}else k.items=e(t.items,c,l,u+1,d,m,a(a([],h,!0),["items"],!1),p,f)}if(t.additionalItems!==undefined&&(k.additionalItems=g(t.additionalItems,a(a([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var v=t.properties,y={};Object.keys(t.properties).forEach(function(e){y[e]=g(v[e],a(a([],h,!0),["properties",e.toString()],!1))}),k.properties=y}if(t.patternProperties!==undefined){var _=t.patternProperties,S={};Object.keys(t.patternProperties).forEach(function(e){S[e]=g(_[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=S}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(k.additionalProperties=g(t.additionalProperties,a(a([],h,!0),["additionalProperties"],!1)))}if(!0===b.skipFirstMutation&&0===u)return k;if(!0===b.bfs)return m.pop(),k;var A=-1!==f.indexOf(t);return m.pop(),c(k,A,r(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,s){var n,a,r=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.AddressBookController=s.getDefaultAddressBookControllerState=s.controllerName=s.AddressType=void 0;const o=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||(s.AddressType=c={})),s.controllerName="AddressBookController";const l={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};s.getDefaultAddressBookControllerState=()=>({addressBook:{}});class u extends o.BaseController{constructor({messenger:e,state:t}){const o={...(0,s.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:l,name:s.controllerName,state:o}),n.add(this),r(this,n,"m",a).call(this)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,s)=>{const n=s;return[...t,...Object.values(e[n])]},[])}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 s={...this.state.addressBook[e][t]};return this.update(s=>{const n=s.addressBook[e];n?.[t]&&(delete n[t],0===Object.keys(n).length&&delete s.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",s),!0}set(e,t,s=(0,i.toHex)(1),n="",a){if(e=(0,i.toChecksumHexAddress)(e),!(0,i.isValidHexAddress)(e))return!1;const r={address:e,chainId:s,isEns:!1,memo:n,name:t,addressType:a,lastUpdatedAt:Date.now()},o=(0,i.normalizeEnsName)(t);return o&&(r.name=o,r.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[s]:{...this.state.addressBook[s],[e]:r}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",r),!0}}s.AddressBookController=u,n=new WeakSet,a=function(){this.messenger.registerActionHandler(`${s.controllerName}:list`,this.list.bind(this)),this.messenger.registerActionHandler(`${s.controllerName}:set`,this.set.bind(this)),this.messenger.registerActionHandler(`${s.controllerName}:delete`,this.delete.bind(this))},s.default=u}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AddressBookController=s.getDefaultAddressBookControllerState=void 0;var n=e("./AddressBookController.cjs");Object.defineProperty(s,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return n.getDefaultAddressBookControllerState}}),Object.defineProperty(s,"AddressBookController",{enumerable:!0,get:function(){return n.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,s){var n,a,r=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.AnnouncementController=void 0;const o=e("@metamask/base-controller"),i={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class l extends o.BaseController{constructor({messenger:e,state:t,allAnnouncements:s}){const o={...i,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:o}),n.add(this),r(this,n,"m",a).call(this,s)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const s of Object.keys(e).map(Number))t[s].isShown=e[s]})}}s.AnnouncementController=l,n=new WeakSet,a=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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AnnouncementController=void 0;var n=e("./AnnouncementController.cjs");Object.defineProperty(s,"AnnouncementController",{enumerable:!0,get:function(){return n.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/AssetsController.cjs",{"./data-sources/AccountsApiDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs","./data-sources/BackendWebsocketDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs","./data-sources/PriceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs","./data-sources/RpcDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs","./data-sources/SnapDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs","./data-sources/TokenDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./middlewares/DetectionMiddleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.js",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,s){var n,a,r,o,i,c,l,u,d,m,h,p,f,b,k,g,w,x,v,y,_,S,A,j,T,C,E,I,O,P,M,D,R,B,N,F=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},L=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},U=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.AssetsController=s.getDefaultAssetsControllerState=void 0;const H=e("@metamask/base-controller"),$=e("@metamask/utils"),q=e("async-mutex"),W=U(e("bignumber.js")),G=e("lodash"),z=e("./data-sources/AccountsApiDataSource.cjs"),V=e("./data-sources/BackendWebsocketDataSource.cjs"),K=e("./data-sources/PriceDataSource.cjs"),J=e("./data-sources/RpcDataSource.cjs"),X=e("./data-sources/SnapDataSource.cjs"),Y=e("./data-sources/TokenDataSource.cjs"),Q=e("./logger.cjs"),Z=e("./middlewares/DetectionMiddleware.cjs"),ee=e("./utils.cjs"),te="AssetsController",se=["getAssets","getAssetsBalance","getAssetMetadata","getAssetsPrice","addCustomAsset","removeCustomAsset","getCustomAssets","hideAsset","unhideAsset"],ne=(0,Q.createModuleLogger)(Q.projectLogger,te);function ae(){return{assetsMetadata:{},assetsBalance:{},assetsPrice:{},customAssets:{},assetPreferences:{}}}s.getDefaultAssetsControllerState=ae;const re={assetsMetadata:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetsBalance:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetsPrice:{persist:!1,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},customAssets:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetPreferences:{persist:!0,includeInStateLogs:!1,includeInDebugSnapshot:!1,usedInUi:!0}};function oe(e){return(0,$.parseCaipAssetType)(e).chainId}class ie extends H.BaseController{constructor({messenger:e,state:t={},defaultUpdateInterval:s=3e4,isEnabled:l=()=>!0,queryApiClient:p,rpcDataSourceConfig:w}){super({name:te,messenger:e,metadata:re,state:{assetsMetadata:{},assetsBalance:{},assetsPrice:{},customAssets:{},assetPreferences:{},...t}}),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,new q.Mutex),i.set(this,new Map),c.set(this,new Set),u.set(this,void 0),d.set(this,void 0),m.set(this,void 0),h.set(this,void 0),f.set(this,void 0),b.set(this,void 0),k.set(this,void 0),L(this,a,l(),"f"),L(this,r,s,"f");const x=w??{},_=(e,t,s)=>this.handleActiveChainsUpdate(e,t,s);L(this,u,new V.BackendWebsocketDataSource({messenger:this.messenger,queryApiClient:p,onActiveChainsUpdated:_}),"f"),L(this,d,new z.AccountsApiDataSource({queryApiClient:p,onActiveChainsUpdated:_}),"f"),L(this,m,new X.SnapDataSource({messenger:this.messenger,onActiveChainsUpdated:_}),"f"),L(this,h,new J.RpcDataSource({messenger:this.messenger,onActiveChainsUpdated:_,...x}),"f"),L(this,k,new Y.TokenDataSource({queryApiClient:p}),"f"),L(this,f,new K.PriceDataSource({queryApiClient:p}),"f"),L(this,b,new Z.DetectionMiddleware,"f"),F(this,a,"f")?(ne("Initializing AssetsController",{defaultUpdateInterval:F(this,r,"f")}),F(this,n,"m",g).call(this),F(this,n,"m",v).call(this),F(this,n,"m",y).call(this)):ne("AssetsController is disabled, skipping initialization")}handleActiveChainsUpdate(e,t,s){ne("Data source active chains changed",{dataSourceId:e,chainCount:t.length,chains:t});const a=s,r=new Set(a),o=t.filter(e=>!r.has(e)),i=a.filter(e=>!t.includes(e));if((o.length>0||i.length>0)&&F(this,n,"m",E).call(this),o.length>0&&F(this,n,"a",l).length>0){const e=o.filter(e=>F(this,c,"f").has(e));e.length>0&&(ne("Fetching balances for newly added chains",{addedEnabledChains:e}),this.getAssets(F(this,n,"a",l),{chainIds:e,forceUpdate:!0}).catch(e=>{ne("Failed to fetch balance for added chains",{error:e})}))}}async getAssets(e,t){const s=t?.chainIds??[...F(this,c,"f")],a=t?.assetTypes??["fungible"],r=t?.dataTypes??["balance","metadata","price"],o=[];for(const t of e){const e=this.getCustomAssets(t.id);o.push(...e)}if(t?.forceUpdate){const t=F(this,n,"m",D).call(this,e,s,{assetTypes:a,dataTypes:r,customAssets:o.length>0?o:undefined,forceUpdate:!0}),i=await F(this,n,"m",_).call(this,[F(this,d,"f").assetsMiddleware,F(this,m,"f").assetsMiddleware,F(this,h,"f").assetsMiddleware,F(this,b,"f").assetsMiddleware,F(this,k,"f").assetsMiddleware,F(this,f,"f").assetsMiddleware],t);await F(this,n,"m",S).call(this,i)}return F(this,n,"m",A).call(this,e,s,a)}async getAssetsBalance(e,t){const s=await this.getAssets(e,{chainIds:t?.chainIds,assetTypes:t?.assetTypes,forceUpdate:t?.forceUpdate,dataTypes:["balance","metadata"]}),n={};for(const[e,t]of Object.entries(s)){n[e]={};for(const[s,a]of Object.entries(t))a.balance&&(n[e][s]=a.balance)}return n}getAssetMetadata(e){return this.state.assetsMetadata[e]}async getAssetsPrice(e,t){const s=await this.getAssets(e,{chainIds:t?.chainIds,assetTypes:t?.assetTypes,forceUpdate:t?.forceUpdate,dataTypes:["price"]}),n={};for(const e of Object.values(s))for(const[t,s]of Object.entries(e))s.price&&(n[t]=s.price);return n}async addCustomAsset(e,t){const s=(0,ee.normalizeAssetId)(t);ne("Adding custom asset",{accountId:e,assetId:s}),this.update(t=>{const n=t.customAssets;n[e]||(n[e]=[]),n[e].includes(s)||n[e].push(s);const a=t.assetPreferences[s];a?.hidden&&(delete a.hidden,0===Object.keys(a).length&&delete t.assetPreferences[s])});const a=F(this,n,"a",l).find(t=>t.id===e);if(a){const e=oe(s);await this.getAssets([a],{chainIds:[e],forceUpdate:!0})}}removeCustomAsset(e,t){const s=(0,ee.normalizeAssetId)(t);ne("Removing custom asset",{accountId:e,assetId:s}),this.update(t=>{t.customAssets[e]&&(t.customAssets[e]=t.customAssets[e].filter(e=>e!==s),0===t.customAssets[e].length&&delete t.customAssets[e])})}getCustomAssets(e){return this.state.customAssets[e]??[]}hideAsset(e){const t=(0,ee.normalizeAssetId)(e);ne("Hiding asset",{assetId:t}),this.update(e=>{e.assetPreferences[t]||(e.assetPreferences[t]={}),e.assetPreferences[t].hidden=!0})}unhideAsset(e){const t=(0,ee.normalizeAssetId)(e);ne("Unhiding asset",{assetId:t}),this.update(e=>{const s=e.assetPreferences[t];s&&(delete s.hidden,0===Object.keys(s).length&&delete e.assetPreferences[t])})}subscribeAssetsPrice(e,t,s={}){const{updateInterval:a=F(this,r,"f")}=s,o="ds:PriceDataSource",c=F(this,i,"f").get(o)!==undefined,l={request:F(this,n,"m",D).call(this,e,t,{dataTypes:["price"],updateInterval:a}),subscriptionId:o,isUpdate:c,onAssetsUpdate:e=>this.handleAssetsUpdate(e,"PriceDataSource"),getAssetsState:()=>this.state};F(this,f,"f").subscribe(l).catch(console.error);const u={chains:t,accountId:o,assetTypes:["fungible"],dataTypes:["price"],unsubscribe:()=>{F(this,i,"f").delete(o)}};F(this,i,"f").set(o,u)}unsubscribeAssetsPrice(){const e="ds:PriceDataSource",t=F(this,i,"f").get(e);t&&(F(this,f,"f").unsubscribe(e).catch(console.error),t.unsubscribe())}async handleAssetsUpdate(e,t,s){ne("Assets updated from data source",{sourceId:t,hasBalance:Boolean(e.assetsBalance),hasPrice:Boolean(e.assetsPrice)});const a=await F(this,n,"m",_).call(this,[F(this,b,"f").assetsMiddleware,F(this,k,"f").assetsMiddleware,F(this,f,"f").assetsMiddleware],s??{accountsWithSupportedChains:[],chainIds:[],dataTypes:["balance","metadata","price"]},e);await F(this,n,"m",S).call(this,a)}destroy(){ne("Destroying AssetsController",{dataSourceCount:F(this,n,"a",p).length,subscriptionCount:F(this,i,"f").size}),F(this,u,"f")?.destroy?.(),F(this,d,"f")?.destroy?.(),F(this,m,"f")?.destroy?.(),F(this,h,"f")&&"destroy"in F(this,h,"f")&&"function"==typeof F(this,h,"f").destroy&&F(this,h,"f").destroy(),F(this,n,"m",C).call(this),this.messenger.unregisterActionHandler("AssetsController:getAssets"),this.messenger.unregisterActionHandler("AssetsController:getAssetsBalance"),this.messenger.unregisterActionHandler("AssetsController:getAssetMetadata"),this.messenger.unregisterActionHandler("AssetsController:getAssetsPrice"),this.messenger.unregisterActionHandler("AssetsController:addCustomAsset"),this.messenger.unregisterActionHandler("AssetsController:removeCustomAsset"),this.messenger.unregisterActionHandler("AssetsController:getCustomAssets"),this.messenger.unregisterActionHandler("AssetsController:hideAsset"),this.messenger.unregisterActionHandler("AssetsController:unhideAsset")}}s.AssetsController=ie,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,f=new WeakMap,b=new WeakMap,k=new WeakMap,n=new WeakSet,l=function(){return this.messenger.call("AccountTreeController:getAccountsFromSelectedAccountGroup")},p=function(){return[F(this,u,"f"),F(this,d,"f"),F(this,m,"f"),F(this,h,"f")]},g=function(){const{enabledNetworkMap:e}=this.messenger.call("NetworkEnablementController:getState");L(this,c,F(this,n,"m",w).call(this,e),"f"),ne("Initialized state",{enabledNetworkMap:e,enabledChains:F(this,c,"f")})},w=function(e){const t=new Set;for(const[s,a]of Object.entries(e))for(const[e,r]of Object.entries(a))if(r)if(e.includes(":"))t.add(e);else{const a=F(this,n,"m",x).call(this,s,e);t.add(`${s}:${a}`)}return t},x=function(e,t){return"eip155"===e&&t.startsWith("0x")?parseInt(t,16).toString():t},v=function(){this.messenger.subscribe("AccountTreeController:selectedAccountGroupChange",()=>{F(this,n,"m",B).call(this).catch(console.error)}),this.messenger.subscribe("NetworkEnablementController:stateChange",({enabledNetworkMap:e})=>{F(this,n,"m",N).call(this,e).catch(console.error)}),this.messenger.subscribe("KeyringController:unlock",()=>F(this,n,"m",T).call(this)),this.messenger.subscribe("KeyringController:lock",()=>F(this,n,"m",C).call(this))},y=function(){this.messenger.registerMethodActionHandlers(this,se)},_=async function(e,t,s={}){const n=e.reduceRight((e,t)=>async s=>{try{return await t(s,e)}catch(t){return console.error("[AssetsController] Middleware failed:",t),e(s)}},async e=>e);return(await n({request:t,response:s,getAssetsState:()=>this.state})).response},S=async function(e){const t=function(e){const t={};if(e.assetsMetadata){t.assetsMetadata={};for(const[s,n]of Object.entries(e.assetsMetadata)){const e=(0,ee.normalizeAssetId)(s);t.assetsMetadata[e]=n}}if(e.assetsPrice){t.assetsPrice={};for(const[s,n]of Object.entries(e.assetsPrice)){const e=(0,ee.normalizeAssetId)(s);t.assetsPrice[e]=n}}if(e.assetsBalance){t.assetsBalance={};for(const[s,n]of Object.entries(e.assetsBalance)){t.assetsBalance[s]={};for(const[e,a]of Object.entries(n)){const n=(0,ee.normalizeAssetId)(e);t.assetsBalance[s][n]=a}}}if(e.detectedAssets){t.detectedAssets={};for(const[s,n]of Object.entries(e.detectedAssets))t.detectedAssets[s]=n.map(e=>(0,ee.normalizeAssetId)(e))}return e.errors&&(t.errors={...e.errors}),t}(e),s=await F(this,o,"f").acquire();try{const e=this.state,s={...this.state.assetsPrice},n=t.detectedAssets??{},a=[],r=[];this.update(s=>{const n=s.assetsMetadata,o=s.assetsBalance,i=s.assetsPrice;if(t.assetsMetadata)for(const[s,a]of Object.entries(t.assetsMetadata))(0,G.isEqual)(e.assetsMetadata[s],a)||r.push(s),n[s]=a;if(t.assetsBalance)for(const[s,n]of Object.entries(t.assetsBalance)){const t=e.assetsBalance[s]??{};o[s]||(o[s]={});for(const[e,r]of Object.entries(n)){const n=t[e],o=r.amount,i=n?.amount;i!==o&&a.push({accountId:s,assetId:e,oldAmount:i,newAmount:o})}Object.assign(o[s],n)}if(t.assetsPrice)for(const[e,s]of Object.entries(t.assetsPrice))i[e]=s});const o=t.assetsPrice?Object.keys(t.assetsPrice).filter(e=>!(0,G.isEqual)(s[e],t.assetsPrice?.[e])):[];(a.length>0||r.length>0||o.length>0)&&ne("State updated",{changedBalances:a.length>0?a:undefined,changedMetadataCount:r.length>0?r.length:undefined,changedPricesCount:o.length>0?o.length:undefined,newAssets:Object.keys(n).length>0?Object.entries(n).map(([e,t])=>({accountId:e,assets:t})):undefined});for(const e of a)this.messenger.publish("AssetsController:balanceChanged",{accountId:e.accountId,assetId:e.assetId,previousAmount:e.oldAmount??"0",newAmount:e.newAmount});if(o.length>0&&t.assetsPrice){const e={};for(const s of o){const n=t.assetsPrice[s];n&&(e[s]=n)}this.messenger.publish("AssetsController:priceChanged",{prices:e})}for(const[e,t]of Object.entries(n))t.length>0&&this.messenger.publish("AssetsController:assetsDetected",{accountId:e,assetIds:t})}finally{s()}},A=function(e,t,s){const a={},r=new Set(t),o=new Set(s);for(const t of e){a[t.id]={};const e=this.state.assetsBalance[t.id]??{};for(const[s,i]of Object.entries(e)){const e=s,c=this.state.assetsMetadata[e];if(!c)continue;const l=c,u=this.state.assetPreferences[e];if(u?.hidden)continue;const d=oe(e);if(!r.has(d))continue;const m=F(this,n,"m",j).call(this,l.type);if(!o.has(m))continue;const h=i,p=this.state.assetsPrice[e]??{price:0,lastUpdated:0},f={id:e,chainId:d,balance:h,metadata:l,price:p,fiatValue:new W.default(h.amount||"0").multipliedBy(p.price||0).toNumber()};a[t.id][e]=f}}return a},j=function(e){switch(e){case"native":case"erc20":case"spl":default:return"fungible";case"erc721":return"nft";case"erc1155":return"collectible"}},T=function(){ne("Starting asset tracking",{selectedAccountCount:F(this,n,"a",l).length,enabledChainCount:F(this,c,"f").size}),F(this,n,"m",E).call(this),F(this,n,"a",l).length>0&&this.getAssets(F(this,n,"a",l),{chainIds:[...F(this,c,"f")],forceUpdate:!0}).catch(e=>{ne("Failed to fetch assets",e)})},C=function(){ne("Stopping asset tracking",{activeSubscriptionCount:F(this,i,"f").size,hasPriceSubscription:F(this,i,"f").has("ds:PriceDataSource")}),this.unsubscribeAssetsPrice();const e=[...F(this,i,"f").keys()];for(const t of e)if(t.startsWith("ds:")){const e=t.slice(3),s=F(this,n,"a",p).find(t=>t.getName()===e);s&&F(this,n,"m",M).call(this,s)}F(this,i,"f").clear()},E=function(){0!==F(this,n,"a",l).length&&(F(this,n,"m",I).call(this,F(this,n,"a",l),[...F(this,c,"f")]),this.subscribeAssetsPrice(F(this,n,"a",l),[...F(this,c,"f")]))},I=function(e,t){const s=F(this,n,"m",O).call(this,e,new Set(t)),a=new Set(s.keys());for(const e of F(this,n,"a",p)){const t=new Set(e.getActiveChainsSync()),r=[];for(const e of a)t.has(e)&&(r.push(e),a.delete(e));if(0===r.length){F(this,n,"m",M).call(this,e);continue}const o=new Set,i=r.flatMap(e=>s.get(e)??[]).filter(e=>!o.has(e.id)&&(o.add(e.id),!0));i.length>0&&F(this,n,"m",P).call(this,e,i,r)}},O=function(e,t){const s=new Map;for(const a of e)for(const e of F(this,n,"m",R).call(this,a)){if(!t.has(e))continue;let n=s.get(e);n||(n=[],s.set(e,n)),n.push(a)}return s},P=function(e,t,s){const a=e.getName(),o=`ds:${a}`,c=F(this,i,"f").get(o)!==undefined;ne("Subscribe to data source",{sourceId:a,subscriptionKey:o,isUpdate:c,accountCount:t.length,chainCount:s.length});const l={request:F(this,n,"m",D).call(this,t,s,{assetTypes:["fungible"],dataTypes:["balance"],updateInterval:F(this,r,"f")}),subscriptionId:o,isUpdate:c,onAssetsUpdate:e=>this.handleAssetsUpdate(e,a),getAssetsState:()=>this.state};e.subscribe(l).catch(e=>{console.error(`[AssetsController] Failed to subscribe to '${a}':`,e)});const u={chains:s,accountId:o,assetTypes:["fungible"],dataTypes:["balance"],unsubscribe:()=>{F(this,i,"f").delete(o)}};F(this,i,"f").set(o,u)},M=function(e){const t=`ds:${e.getName()}`,s=F(this,i,"f").get(t);s&&(e.unsubscribe(t).catch(()=>undefined),s.unsubscribe())},D=function(e,t,s={}){const a=new Set(t);return{accountsWithSupportedChains:e.map(e=>({account:e,supportedChains:F(this,n,"m",R).call(this,e).filter(e=>a.has(e))})),chainIds:t,...s}},R=function(e){const t=e.scopes??[],s=[];for(const e of t){const[t,n]=e.split(":");if("0"===n)for(const e of F(this,c,"f"))e.startsWith(`${t}:`)&&s.push(e);else"eip155"===t&&n?.startsWith("0x")?s.push(`eip155:${parseInt(n,16)}`):s.push(e)}return s},B=async function(){const e=F(this,n,"a",l);ne("Account group changed",{accountCount:e.length,accountIds:e.map(e=>e.id)}),F(this,n,"m",E).call(this),e.length>0&&await this.getAssets(e,{chainIds:[...F(this,c,"f")],forceUpdate:!0})},N=async function(e){const t=F(this,c,"f");L(this,c,F(this,n,"m",w).call(this,e),"f");const s=[];for(const e of F(this,c,"f"))t.has(e)||s.push(e);const a=[];for(const e of t)F(this,c,"f").has(e)||a.push(e);ne("Enabled networks changed",{previousCount:t.size,newCount:F(this,c,"f").size,addedChains:s,removedChains:a}),F(this,n,"m",E).call(this),s.length>0&&F(this,n,"a",l).length>0&&await this.getAssets(F(this,n,"a",l),{chainIds:s,forceUpdate:!0})}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/AssetsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AbstractDataSource=void 0;s.AbstractDataSource=class{constructor(e,t){this.activeSubscriptions=new Map,this.name=e,this.state=t}getName(){return this.name}async getActiveChains(){return this.state.activeChains}getActiveChainsSync(){return this.state.activeChains}async unsubscribe(e){const t=this.activeSubscriptions.get(e);t&&(t.cleanup(),this.activeSubscriptions.delete(e))}updateActiveChains(e,t){const s=new Set(this.state.activeChains),n=new Set(e),a=s.size!==n.size||e.some(e=>!s.has(e));this.state.activeChains=e,a&&t(e)}addActiveChain(e,t){this.state.activeChains.includes(e)||(this.state.activeChains=[...this.state.activeChains,e],t(this.state.activeChains))}removeActiveChain(e,t){this.state.activeChains.includes(e)&&(this.state.activeChains=this.state.activeChains.filter(t=>t!==e),t(this.state.activeChains))}destroy(){for(const e of this.activeSubscriptions.values())e.cleanup();this.activeSubscriptions.clear()}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","@metamask/core-backend":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,c,l,u,d,m=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},h=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.AccountsApiDataSource=void 0;e("@metamask/core-backend");const p=e("./AbstractDataSource.cjs"),f=e("../logger.cjs"),b=e("../utils.cjs"),k="AccountsApiDataSource",g=(0,f.createModuleLogger)(f.projectLogger,k),w={activeChains:[]};function x(e){return"string"==typeof e&&e.startsWith("eip155:")?e:`eip155:${e}`}function v(e){return e.includes(":")?e:`eip155:${e}`}class y extends p.AbstractDataSource{constructor(e){super(k,{...w,...e.state}),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,null),m(this,a,e.onActiveChainsUpdated,"f"),m(this,r,e.pollInterval??3e4,"f"),m(this,o,e.queryApiClient,"f"),h(this,n,"m",c).call(this).catch(console.error)}async fetch(e){const t={},s=new Set(this.state.activeChains),a=e.chainIds.filter(e=>s.has(e));if(0===a.length){for(const n of e.chainIds)s.has(n)||(t.errors=t.errors??{},t.errors[n]="Chain not supported by Accounts API");return t}try{const s=e.accountsWithSupportedChains.flatMap(({account:e,supportedChains:t})=>a.filter(e=>t.includes(e)).map(t=>`${t}:${e.address}`));if(0===s.length)return t;const r=await h(this,o,"f").accounts.fetchV5MultiAccountBalances(s);if(r.unprocessedNetworks.length>0){const e=r.unprocessedNetworks.map(v);t.errors=t.errors??{};for(const s of e)t.errors[s]="Unprocessed by Accounts API"}const{assetsBalance:i}=h(this,n,"m",d).call(this,r.balances,e);t.assetsBalance=i}catch(e){g("Fetch FAILED",{error:e,chains:a}),t.errors=t.errors??{};for(const s of a)t.errors[s]=`Fetch failed: ${e instanceof Error?e.message:String(e)}`}for(const n of e.chainIds)s.has(n)||(t.errors=t.errors??{},t.errors[n]="Chain not supported by Accounts API");return t}get assetsMiddleware(){return async(e,t)=>{var s;const{request:n}=e;if(0===n.chainIds.length)return t(e);let a=[];try{const t=await this.fetch(n);if(t.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[s,n]of Object.entries(t.assetsBalance))e.response.assetsBalance[s]={...e.response.assetsBalance[s],...n}}const r=new Set(Object.keys(t.errors??{}));a=n.chainIds.filter(e=>!r.has(e))}catch(e){g("Middleware fetch failed",{error:e}),a=[]}if(a.length>0){const s=n.chainIds.filter(e=>!a.includes(e));return t({...e,request:{...n,chainIds:s}})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:n}=e,a=t.chainIds;if(0===a.length)return;if(n){const e=this.activeSubscriptions.get(s);if(e)return e.chains=a,void(e.request=t)}await this.unsubscribe(s);const o=t.updateInterval??h(this,r,"f"),i=async()=>{try{const e=this.activeSubscriptions.get(s);if(!e?.request)return;const t=await this.fetch({...e.request,chainIds:e.chains});await e.onAssetsUpdate(t)}catch(e){g("Subscription poll failed",{subscriptionId:s,error:e})}},c=setInterval(()=>{i().catch(console.error)},o);this.activeSubscriptions.set(s,{cleanup:()=>{clearInterval(c)},chains:a,request:t,onAssetsUpdate:e.onAssetsUpdate}),await i()}destroy(){h(this,i,"f")&&clearInterval(h(this,i,"f")),super.destroy()}}s.AccountsApiDataSource=y,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,n=new WeakSet,c=async function(){try{const e=await h(this,n,"m",u).call(this),t=[...this.state.activeChains];this.updateActiveChains(e,e=>h(this,a,"f").call(this,this.getName(),e,t)),m(this,i,setInterval(()=>{h(this,n,"m",l).call(this).catch(console.error)},12e5),"f")}catch(e){g("Failed to fetch active chains",e)}},l=async function(){try{const e=await h(this,n,"m",u).call(this),t=new Set(this.state.activeChains),s=new Set(e),r=e.filter(e=>!t.has(e)),o=Array.from(t).filter(e=>!s.has(e));if(r.length>0||o.length>0){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>h(this,a,"f").call(this,this.getName(),e,t))}}catch(e){g("Failed to refresh active chains",e)}},u=async function(){return(await h(this,o,"f").accounts.fetchV2SupportedNetworks()).fullSupport.map(x)},d=function(e,t){const s={},n=new Map;for(const{account:e}of t.accountsWithSupportedChains)e.address&&n.set(e.address.toLowerCase(),e.id);for(const t of e){const e=t.accountId.split(":");if(e.length<3)continue;const a=e[2].toLowerCase(),r=n.get(a);if(!r)continue;s[r]||(s[r]={});const o=(0,b.normalizeAssetId)(t.assetId);s[r][o]={amount:t.balance}}return{assetsBalance:s}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,c,l,u,d,m,h,p,f,b,k,g,w=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},x=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.createBackendWebsocketDataSource=s.BackendWebsocketDataSource=void 0;const v=e("./AbstractDataSource.cjs"),y=e("../logger.cjs"),_="BackendWebsocketDataSource",S="account-activity.v1",A=(0,y.createModuleLogger)(y.projectLogger,_),j={activeChains:[]};function T(e){const[t]=e.split(":");return t}const C=["eip155","solana"];function E(e,t){if("eip155"===t)return e.type.startsWith("eip155")?e.address:null;if("solana"===t)return e.type.startsWith("solana")?e.address:null;const s=`${t}:`;return e.type.startsWith(s)?e.address:null}function I(e,t){const s="eip155"===e?t.toLowerCase():t;return`${S}.${e}:0:${s}`}function O(e){return"string"==typeof e&&e.includes(":")?e:`eip155:${e}`}class P extends v.AbstractDataSource{constructor(e){super(_,{...j,...e.state}),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,null),c.set(this,new Map),l.set(this,new Map),u.set(this,new Map),w(this,a,e.messenger,"f"),w(this,r,e.queryApiClient,"f"),w(this,o,e.onActiveChainsUpdated,"f"),x(this,n,"m",p).call(this),x(this,n,"m",d).call(this).catch(console.error)}setActiveChainsFromAccountsApi(e){this.updateActiveChains(e,()=>undefined)}updateSupportedChains(e){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>x(this,o,"f").call(this,this.getName(),e,t))}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:r}=e,o=t.chainIds.filter(e=>this.state.activeChains.includes(e)),i=t.accountsWithSupportedChains.map(e=>e.account.address);if(0===i.length)return;try{if("connected"!==x(this,a,"f").call("BackendWebSocketService:getConnectionInfo").state)return void x(this,l,"f").set(s,e)}catch{return void x(this,l,"f").set(s,e)}if(x(this,l,"f").delete(s),r){const e=this.activeSubscriptions.get(s);if(e){const t=e.addresses??[];if(!(i.length!==t.length||i.some(e=>!t.includes(e))))return void(e.chains=o)}}await this.unsubscribe(s);const d=function(e){const t=new Set(C);for(const s of e)t.add(T(s));return Array.from(t)}(o),m=[];for(const e of d)for(const{account:s}of t.accountsWithSupportedChains){const t=E(s,e);t&&m.push(I(e,t))}try{const t=await x(this,a,"f").call("BackendWebSocketService:subscribe",{channels:m,channelType:S,callback:e=>{x(this,n,"m",k).call(this,e,s)}});x(this,c,"f").set(s,t),this.activeSubscriptions.set(s,{cleanup:()=>{const e=x(this,c,"f").get(s);e&&(e.unsubscribe().catch(e=>{A("Error unsubscribing",{subscriptionId:s,error:e})}),x(this,c,"f").delete(s)),x(this,u,"f").delete(s)},chains:o,addresses:i,onAssetsUpdate:e.onAssetsUpdate}),x(this,u,"f").set(s,e)}catch(e){A("WebSocket subscription FAILED",{subscriptionId:s,error:e,chains:o})}}destroy(){x(this,i,"f")&&(clearInterval(x(this,i,"f")),w(this,i,null,"f"));const e=[...x(this,c,"f").values()];for(const t of e)try{t.unsubscribe().catch(()=>{})}catch{}x(this,c,"f").clear(),super.destroy()}}s.BackendWebsocketDataSource=P,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,n=new WeakSet,d=async function(){try{const e=await x(this,n,"m",h).call(this),t=[...this.state.activeChains];this.updateActiveChains(e,e=>x(this,o,"f").call(this,this.getName(),e,t)),w(this,i,setInterval(()=>{x(this,n,"m",m).call(this).catch(console.error)},12e5),"f")}catch(e){A("Failed to fetch active chains",e)}},m=async function(){try{const e=await x(this,n,"m",h).call(this),t=new Set(this.state.activeChains),s=new Set(e),a=e.filter(e=>!t.has(e)),r=Array.from(t).filter(e=>!s.has(e));if(a.length>0||r.length>0){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>x(this,o,"f").call(this,this.getName(),e,t))}}catch(e){A("Failed to refresh active chains",e)}},h=async function(){return(await x(this,r,"f").accounts.fetchV2SupportedNetworks()).fullSupport.map(O)},p=function(){x(this,a,"f").subscribe("BackendWebSocketService:connectionStateChanged",e=>{"connected"===e.state?x(this,n,"m",b).call(this).catch(console.error):"disconnected"===e.state&&x(this,n,"m",f).call(this)})},f=function(){A("WebSocket disconnected, preserving subscriptions for reconnect",{activeSubscriptionCount:this.activeSubscriptions.size,wsSubscriptionCount:x(this,c,"f").size});for(const[e]of this.activeSubscriptions){const t=x(this,u,"f").get(e);t&&x(this,l,"f").set(e,{...t,isUpdate:!1})}x(this,c,"f").clear(),this.activeSubscriptions.clear()},b=async function(){if(0===x(this,l,"f").size)return;const e=Array.from(x(this,l,"f").entries());for(const[t,s]of e)try{x(this,l,"f").delete(t),await this.subscribe(s)}catch(e){A("Failed to process pending subscription",{subscriptionId:t,error:e})}},k=function(e,t){try{const s=this.activeSubscriptions.get(t),a=x(this,u,"f").get(t)?.request;if(!a)return;const r=e.data,{address:o,tx:i,updates:c}=r;if(!o||!i||!c)return;const l=i.chain,d=a.accountsWithSupportedChains.map(e=>e.account).find(e=>e.address.startsWith("0x")?e.address.toLowerCase()===o.toLowerCase():e.address===o);if(!d)return;const m=d.id,h=x(this,n,"m",g).call(this,c,l,m);Object.keys(h).length>0&&s&&Promise.resolve(s.onAssetsUpdate(h)).catch(console.error)}catch(e){A("Error handling notification",e)}},g=function(e,t,s){const n={[s]:{}},a={};for(const t of e){const{asset:e,postBalance:r}=t;if(!e||!r)continue;const o=e.type,i=e.type.includes("/slip44:")?"native":"erc20",c=r.amount.startsWith("0x")?BigInt(r.amount).toString():r.amount;n[s][o]={amount:c},a[o]={type:i,symbol:e.unit,name:e.unit,decimals:e.decimals}}const r={};return Object.keys(n[s]).length>0&&(r.assetsBalance=n,r.assetsMetadata=a),r},s.createBackendWebsocketDataSource=function(e){return new P(e)}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/types.cjs","@metamask/core-backend":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,c,l,u=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.PriceDataSource=void 0;e("@metamask/core-backend");const m=e("../logger.cjs"),h=e("../types.cjs"),p="PriceDataSource",f=(0,m.createModuleLogger)(m.projectLogger,p),b=[/\/slip44:\d+-staked-for-/u,/\/slip44:bandwidth$/u,/\/slip44:energy$/u,/\/slip44:maximum-bandwidth$/u,/\/slip44:maximum-energy$/u];function k(e){return!b.some(t=>t.test(e))}function g(e){return"object"==typeof e&&null!==e&&"price"in e&&"number"==typeof e.price}s.PriceDataSource=class{constructor(e){n.add(this),this.name=p,a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,new Map),u(this,a,e.currency??"usd","f"),u(this,r,e.pollInterval??6e4,"f"),u(this,o,e.queryApiClient,"f")}get assetsMiddleware(){return(0,h.forDataTypes)(["price"],async(e,t)=>{const{response:s}=e;if(!s.detectedAssets)return t(e);const a=new Set;for(const e of Object.values(s.detectedAssets))for(const t of e)a.add(t);if(0===a.size)return t(e);const r=[...a].filter(k);if(0===r.length)return t(e);try{const e=await d(this,n,"m",c).call(this,r);s.assetsPrice??(s.assetsPrice={});for(const[t,n]of Object.entries(e)){if(!g(n))continue;const e=t;s.assetsPrice[e]={...n,lastUpdated:Date.now()}}}catch(e){f("Failed to fetch prices via middleware",{error:e})}return t(e)})}async fetch(e,t){const s={},a=d(this,n,"m",l).call(this,e,t).filter(k);if(0===a.length)return s;try{const e=await d(this,n,"m",c).call(this,[...a]);s.assetsPrice={};for(const[t,n]of Object.entries(e)){if(!g(n))continue;const e=t;s.assetsPrice[e]={...n,lastUpdated:Date.now()}}}catch(e){f("Failed to fetch prices",{error:e})}return s}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:n}=e;if(n){const e=d(this,i,"f").get(s);if(e)return void(e.request=t)}await this.unsubscribe(s);const a=t.updateInterval??d(this,r,"f"),o=async()=>{try{const e=d(this,i,"f").get(s);if(!e)return;const t=await this.fetch(e.request,e.getAssetsState);t.assetsPrice&&Object.keys(t.assetsPrice).length>0&&await e.onAssetsUpdate(t)}catch(e){f("Subscription poll failed",{subscriptionId:s,error:e})}},c=setInterval(()=>{o().catch(console.error)},a);d(this,i,"f").set(s,{cleanup:()=>{clearInterval(c)},request:t,onAssetsUpdate:e.onAssetsUpdate,getAssetsState:e.getAssetsState}),await o()}async unsubscribe(e){const t=d(this,i,"f").get(e);t&&(t.cleanup(),d(this,i,"f").delete(e))}destroy(){for(const e of d(this,i,"f").values())e.cleanup();d(this,i,"f").clear()}},a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,n=new WeakSet,c=async function(e){return d(this,o,"f").prices.fetchV3SpotPrices(e,{currency:d(this,a,"f"),includeMarketData:!0})},l=function(e,t){if(!t)return[];try{const s=t(),n=new Set,a=e.accountsWithSupportedChains.map(e=>e.account.id),r=a.length>0?new Set(a):undefined,o=e.chainIds.length>0?new Set(e.chainIds):undefined;if(s?.assetsBalance)for(const[e,t]of Object.entries(s.assetsBalance))if(!r||r.has(e))for(const e of Object.keys(t)){if(o){const t=e.split("/")[0];if(!o.has(t))continue}n.add(e)}return[...n]}catch(e){return f("Failed to get asset IDs from balance state",{error:e}),[]}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","./evm-rpc-services/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@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","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,c,l,u,d,m,h,p,f,b,k,g,w,x,v,y,_,S,A,j,T,C=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},E=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},I=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.createRpcDataSource=s.RpcDataSource=s.caipChainIdToHex=void 0;const O=e("@ethersproject/providers"),P=e("@metamask/controller-utils"),M=e("@metamask/utils"),D=I(e("bignumber.js")),R=e("./AbstractDataSource.cjs"),B=e("./evm-rpc-services/index.cjs"),N=e("../logger.cjs"),F="RpcDataSource",L=(0,N.createModuleLogger)(N.projectLogger,F);s.caipChainIdToHex=e=>{if((0,M.isStrictHexString)(e))return e;if((0,M.isCaipChainId)(e))return(0,P.toHex)((0,M.parseCaipChainId)(e).reference);throw new Error("caipChainIdToHex - Failed to provide CAIP-2 or Hex chainId")};class U extends R.AbstractDataSource{constructor(e){super(F,{activeChains:[]}),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,[]),l.set(this,{}),u.set(this,new Map),d.set(this,new Map),m.set(this,void 0),h.set(this,void 0),p.set(this,void 0),C(this,a,e.messenger,"f"),C(this,r,e.onActiveChainsUpdated,"f"),C(this,o,e.timeout??1e4,"f"),C(this,i,e.tokenDetectionEnabled??!1,"f");const t=e.balanceInterval??3e4,s=e.detectionInterval??18e4;L("Initializing RpcDataSource",{timeout:E(this,o,"f"),balanceInterval:t,detectionInterval:s,tokenDetectionEnabled:E(this,i,"f")}),C(this,m,new B.MulticallClient(e=>E(this,n,"m",_).call(this,e)),"f");const f={call:e=>({assetsBalance:E(this,a,"f").call("AssetsController:getState").assetsBalance??{}})},b={call:e=>E(this,a,"f").call("TokenListController:getState")};C(this,h,new B.BalanceFetcher(E(this,m,"f"),f,{pollingInterval:t}),"f"),E(this,h,"f").setOnBalanceUpdate(E(this,n,"m",k).bind(this)),C(this,p,new B.TokenDetector(E(this,m,"f"),b,{pollingInterval:s}),"f"),E(this,p,"f").setOnDetectionUpdate(E(this,n,"m",g).bind(this)),E(this,n,"m",w).call(this),E(this,n,"m",x).call(this)}getChainStatuses(){return{...E(this,l,"f")}}getChainStatus(e){return E(this,l,"f")[e]}setBalancePollingInterval(e){L("Setting balance polling interval",{interval:e}),E(this,h,"f").setIntervalLength(e)}getBalancePollingInterval(){return E(this,h,"f").getIntervalLength()}setDetectionPollingInterval(e){L("Setting detection polling interval",{interval:e}),E(this,p,"f").setIntervalLength(e)}getDetectionPollingInterval(){return E(this,p,"f").getIntervalLength()}async fetch(e){const t={},a=e.chainIds.filter(e=>E(this,c,"f").includes(e));if(L("Fetch requested",{accounts:e.accountsWithSupportedChains.map(e=>e.account.id),requestedChains:e.chainIds,chainsToFetch:a}),0===a.length)return L("No active chains to fetch"),t;const r={},o={},i=[];for(const{account:t,supportedChains:c}of e.accountsWithSupportedChains){const e=a.filter(e=>c.includes(e));if(0===e.length)continue;const{address:u,id:d}=t;for(const t of e){const e=(0,s.caipChainIdToHex)(t);try{const s=await E(this,h,"f").fetchBalancesForTokens(e,d,u,[],{includeNative:!0});r[d]||(r[d]={});const a=E(this,n,"m",b).call(this,s.balances,t);Object.assign(o,a);for(const e of s.balances){const t=o[e.assetId],s=t?.decimals??18,a=E(this,n,"m",f).call(this,e.balance,s);r[d][e.assetId]={amount:a}}}catch(e){L("Failed to fetch balance",{address:u,chainId:t,error:e}),r[d]||(r[d]={});const s=E(this,n,"m",A).call(this,t);r[d][s]={amount:"0"};const a=E(this,l,"f")[t];a&&(o[s]={type:"native",symbol:a.nativeCurrency,name:a.nativeCurrency,decimals:18}),i.includes(t)||i.push(t)}}}if(i.length>0){L("Fetch PARTIAL - some chains failed",{successChains:a.filter(e=>!i.includes(e)),failedChains:i}),t.errors={};for(const e of i)t.errors[e]="RPC fetch failed"}else L("Fetch SUCCESS",{chains:a,accountCount:Object.keys(r).length});return t.assetsBalance=r,Object.keys(o).length>0&&(t.assetsMetadata=o),t}async detectTokens(e,t){if(!E(this,i,"f"))return{};const a=(0,s.caipChainIdToHex)(e),{address:r,id:o}=t;L("Running token detection",{chainId:e,accountId:o});try{const t=await E(this,p,"f").detectTokens(a,o,r);if(0===t.detectedAssets.length)return L("No new tokens detected"),{};L("Detected new tokens",{count:t.detectedAssets.length,chainId:e,accountId:o});const s={},i={};for(const e of t.detectedAssets)e.symbol&&e.decimals!==undefined&&(i[e.assetId]={type:"erc20",symbol:e.symbol,name:e.name??e.symbol,decimals:e.decimals,image:e.image});for(const e of t.detectedBalances){const a=t.detectedAssets.find(t=>t.assetId===e.assetId),r=a?.decimals??18,o=E(this,n,"m",f).call(this,e.balance,r);s[e.assetId]={amount:o}}const c={detectedAssets:{[o]:t.detectedAssets.map(e=>e.assetId)},assetsBalance:{[o]:s}};return Object.keys(i).length>0&&(c.assetsMetadata=i),c}catch(t){return L("Token detection failed",{chainId:e,accountId:o,error:t}),{}}}get assetsMiddleware(){return async(e,t)=>{var s,n,a;const{request:r}=e,o=r.chainIds.filter(e=>E(this,c,"f").includes(e));if(0===o.length)return t(e);let i=[];L("Middleware fetching",{chains:o,accounts:r.accountsWithSupportedChains.map(e=>e.account.id)});const l=await this.fetch({...r,chainIds:o});if(l.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[t,s]of Object.entries(l.assetsBalance))(n=e.response.assetsBalance)[t]??(n[t]={}),e.response.assetsBalance[t]={...e.response.assetsBalance[t],...s}}l.assetsMetadata&&((a=e.response).assetsMetadata??(a.assetsMetadata={}),e.response.assetsMetadata={...e.response.assetsMetadata,...l.assetsMetadata});const u=new Set(Object.keys(l.errors??{}));if(i=o.filter(e=>!u.has(e)),i.length>0){const s=r.chainIds.filter(e=>!i.includes(e));return t({...e,request:{...r,chainIds:s}})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:n,isUpdate:a}=e,r=t.chainIds.filter(e=>E(this,c,"f").includes(e));if(L("Subscribe requested",{subscriptionId:n,isUpdate:a,accounts:t.accountsWithSupportedChains.map(e=>e.account.id),chainsToSubscribe:r}),0===r.length)return void L("No active chains to subscribe");if(a){const e=E(this,d,"f").get(n);e&&L("Updating existing subscription - restarting polling",{subscriptionId:n,existingChains:e.chains,newChains:r})}await this.unsubscribe(n);const o=[],l=[];for(const{account:e,supportedChains:n}of t.accountsWithSupportedChains){const t=r.filter(e=>n.includes(e));if(0===t.length)continue;const{address:a,id:c}=e;for(const e of t){const t=(0,s.caipChainIdToHex)(e),n={chainId:t,accountId:c,accountAddress:a},r=E(this,h,"f").startPolling(n);if(o.push(r),E(this,i,"f")){const e={chainId:t,accountId:c,accountAddress:a},s=E(this,p,"f").startPolling(e);l.push(s)}}}const u=t.accountsWithSupportedChains.map(e=>e.account);E(this,d,"f").set(n,{balancePollingTokens:o,detectionPollingTokens:l,chains:r,accounts:u,onAssetsUpdate:e.onAssetsUpdate}),L("Subscription SUCCESS",{subscriptionId:n,chains:r,balancePollingCount:o.length,detectionPollingCount:l.length})}async unsubscribe(e){const t=E(this,d,"f").get(e);if(t){for(const e of t.balancePollingTokens)E(this,h,"f").stopPollingByPollingToken(e);for(const e of t.detectionPollingTokens)E(this,p,"f").stopPollingByPollingToken(e);E(this,d,"f").delete(e),L("Unsubscribed and stopped polling",{subscriptionId:e})}}destroy(){L("Destroying RpcDataSource"),E(this,h,"f").stopAllPolling(),E(this,p,"f").stopAllPolling(),E(this,d,"f").clear(),E(this,u,"f").clear()}}s.RpcDataSource=U,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,n=new WeakSet,f=function(e,t){const s=new D.default(e),n=new D.default(10).pow(t);return s.dividedBy(n).toString()},b=function(e,t){const s={},a=E(this,n,"m",j).call(this);for(const r of e){if(r.assetId.includes("/slip44:")){const e=E(this,l,"f")[t];e&&(s[r.assetId]={type:"native",symbol:e.nativeCurrency,name:e.nativeCurrency,decimals:18})}else{const e=a[r.assetId];if(e)s[r.assetId]=e;else{const e=E(this,n,"m",T).call(this,r.assetId);s[r.assetId]=e||{type:"erc20",symbol:"",name:"",decimals:18}}}}return s},k=function(e){const t={},s=`eip155:${parseInt(e.chainId,16)}`,a=E(this,n,"m",b).call(this,e.balances,s);for(const s of e.balances){const e=a[s.assetId],r=e?.decimals??18,o=E(this,n,"m",f).call(this,s.balance,r);t[s.assetId]={amount:o}}const r={assetsBalance:{[e.accountId]:t},assetsMetadata:a};L("Balance update response",{accountId:e.accountId,newBalanceCount:Object.keys(t).length});for(const e of E(this,d,"f").values())e.onAssetsUpdate(r)?.catch(e=>{L("Failed to update assets",{error:e})})},g=function(e){L("Detected new tokens",{count:e.detectedAssets.length});const t={};if(e.detectedAssets.length>0)for(const s of e.detectedAssets)s.symbol&&s.decimals!==undefined&&(t[s.assetId]={type:"erc20",symbol:s.symbol,name:s.name??s.symbol,decimals:s.decimals,image:s.image});const s={};if(e.detectedBalances.length>0)for(const t of e.detectedBalances){const a=e.detectedAssets.find(e=>e.assetId===t.assetId),r=a?.decimals??18,o=E(this,n,"m",f).call(this,t.balance,r);s[t.assetId]={amount:o}}const a={detectedAssets:{[e.accountId]:e.detectedAssets.map(e=>e.assetId)},assetsMetadata:t,assetsBalance:{[e.accountId]:s}};for(const e of E(this,d,"f").values())e.onAssetsUpdate(a)?.catch(e=>{L("Failed to update detected assets",{error:e})})},w=function(){E(this,a,"f").subscribe("NetworkController:stateChange",e=>{L("NetworkController state changed"),E(this,n,"m",S).call(this),E(this,n,"m",v).call(this,e)})},x=function(){L("Initializing from NetworkController");try{const e=E(this,a,"f").call("NetworkController:getState");E(this,n,"m",v).call(this,e)}catch(e){L("Failed to initialize from NetworkController",e)}},v=function(e){const{networkConfigurationsByChainId:t,networksMetadata:s}=e,n={},a=[];for(const[e,r]of Object.entries(t)){const t=`eip155:${parseInt(e,16)}`,o=r.rpcEndpoints[r.defaultRpcEndpointIndex];if(!o)continue;const{networkClientId:i}=o,c=s[i],l=c?.status??"unknown";n[t]={chainId:t,status:l,name:r.name,nativeCurrency:r.nativeCurrency,networkClientId:i},"available"!==l&&"unknown"!==l||a.push(t)}L("Network state updated",{configuredChains:Object.keys(n),activeChains:a});const o=[...E(this,c,"f")],i=new Set(o),u=o.length!==a.length||a.some(e=>!i.has(e));C(this,l,n,"f"),C(this,c,a,"f"),this.state.activeChains=a,u&&E(this,r,"f").call(this,this.getName(),a,o)},y=function(e){const t=E(this,u,"f").get(e);if(t)return t;const s=E(this,l,"f")[e];if(!s)return undefined;try{const t=E(this,a,"f").call("NetworkController:getNetworkClientById",s.networkClientId);if(!t?.provider)return undefined;const n=new O.Web3Provider(t.provider);return E(this,u,"f").set(e,n),n}catch(t){return L("Failed to get provider for chain",{chainId:e,error:t}),undefined}},_=function(e){const t=`eip155:${parseInt(e,16)}`,s=E(this,n,"m",y).call(this,t);if(!s)throw new Error(`No provider available for chain ${e}`);return{call:async e=>s.call({to:e.to,data:e.data}),getBalance:async e=>await s.getBalance(e)}},S=function(){E(this,u,"f").clear()},A=function(e){const{nativeAssetIdentifiers:t}=E(this,a,"f").call("NetworkEnablementController:getState");return t[e]??`${e}/slip44:60`},j=function(){try{return E(this,a,"f").call("AssetsController:getState").assetsMetadata??{}}catch{return{}}},T=function(e){try{const[t,s]=e.split("/");if(!s?.startsWith("erc20:"))return undefined;const n=s.slice(6),r=t.split(":")[1],o=`0x${parseInt(r,10).toString(16)}`,i=E(this,a,"f").call("TokenListController:getState"),c=i?.tokensChainsCache?.[o],l=c?.data;if(!l)return undefined;const u=n.toLowerCase();for(const[e,t]of Object.entries(l))if(e.toLowerCase()===u){const e=t;if(e.symbol&&e.decimals!==undefined)return{type:"erc20",symbol:e.symbol,name:e.name??e.symbol,decimals:e.decimals,image:e.iconUrl}}return undefined}catch{return undefined}},s.createRpcDataSource=function(e){return new U(e)}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","@metamask/keyring-snap-client":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-snap-client/dist/index.cjs","@metamask/snaps-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,c,l,u,d,m,h,p,f,b=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},k=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.createSnapDataSource=s.SnapDataSource=s.extractChainFromAssetId=s.getChainIdsCaveat=s.ASSETS_PERMISSION=s.KEYRING_PERMISSION=s.SNAP_DATA_SOURCE_NAME=void 0;const g=e("@metamask/keyring-snap-client"),w=e("@metamask/snaps-utils"),x=e("./AbstractDataSource.cjs"),v=e("../logger.cjs"),y=(0,v.createModuleLogger)(v.projectLogger,"SnapDataSource");function _(e){if(!e?.caveats)return null;const t=e.caveats.find(e=>e.type===w.SnapCaveatType.ChainIds);return t?t.value:null}function S(e){return e.split("/")[0]}s.SNAP_DATA_SOURCE_NAME="SnapDataSource",s.KEYRING_PERMISSION="endowment:keyring",s.ASSETS_PERMISSION="endowment:assets",s.getChainIdsCaveat=_,s.extractChainFromAssetId=S;const A={activeChains:[],chainToSnap:{}};class j extends x.AbstractDataSource{constructor(e){super(s.SNAP_DATA_SOURCE_NAME,{...A,...e.state}),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,new Map),b(this,a,e.messenger,"f"),b(this,r,e.onActiveChainsUpdated,"f"),b(this,o,k(this,n,"m",u).bind(this),"f"),b(this,i,k(this,n,"m",p).bind(this),"f"),k(this,n,"m",l).call(this),k(this,n,"m",p).call(this)}async fetch(e){var t;if(!e?.chainIds?.length)return{};if(!e?.accountsWithSupportedChains?.length)return{assetsBalance:{},assetsMetadata:{}};const s={assetsBalance:{},assetsMetadata:{}};for(const{account:a}of e.accountsWithSupportedChains){const r=a.metadata.snap?.id;if(!r)continue;if(!e.chainIds.some(e=>this.state.chainToSnap[e]===r))continue;const o=a.id;try{const e=k(this,n,"m",f).call(this,r),a=await e.listAccountAssets(o);if(!a||0===a.length)continue;const i=await e.getAccountBalances(o,a);if(i&&"object"==typeof i&&s.assetsBalance)for(const[e,n]of Object.entries(i)){(t=s.assetsBalance)[o]??(t[o]={});const a=s.assetsBalance[o];a&&(a[e]={amount:n.amount})}}catch{}}return s}get assetsMiddleware(){return async(e,t)=>{var s;const{request:n}=e,a=n.chainIds.filter(e=>this.state.activeChains.includes(e));if(0===a.length)return t(e);let r=[];try{const t=await this.fetch({...n,chainIds:a});if(t.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[s,n]of Object.entries(t.assetsBalance))e.response.assetsBalance[s]={...e.response.assetsBalance[s],...n}}t.assetsMetadata&&(e.response.assetsMetadata={...e.response.assetsMetadata,...t.assetsMetadata}),t.assetsPrice&&(e.response.assetsPrice={...e.response.assetsPrice,...t.assetsPrice});const o=new Set(Object.keys(t.errors??{}));r=a.filter(e=>!o.has(e))}catch(e){y("Middleware fetch failed",{error:e}),r=[]}let o=e;if(r.length>0){const t=n.chainIds.filter(e=>!r.includes(e));o={...e,request:{...n,chainIds:t}}}return t(o)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:a}=e;if(!t?.chainIds)return;const r=t.chainIds.filter(e=>k(this,n,"m",d).call(this,e));if(0!==r.length){if(a){const e=this.activeSubscriptions.get(s);if(e)return e.chains=r,void this.fetch({...t,chainIds:r}).then(async t=>(Object.keys(t.assetsBalance??{}).length>0&&await e.onAssetsUpdate(t),t)).catch(e=>{y("Subscription update fetch failed",{subscriptionId:s,error:e})})}await this.unsubscribe(s),this.activeSubscriptions.set(s,{cleanup:()=>{},chains:r,onAssetsUpdate:e.onAssetsUpdate});try{const e=await this.fetch({...t,chainIds:r}),n=this.activeSubscriptions.get(s);Object.keys(e.assetsBalance??{}).length>0&&n&&await n.onAssetsUpdate(e)}catch(e){y("Initial fetch failed",{subscriptionId:s,error:e})}}}destroy(){const e=k(this,a,"f");try{e.unsubscribe("AccountsController:accountBalancesUpdated",k(this,o,"f"))}catch(e){y("Failed to unsubscribe from snap keyring events",{error:e})}try{e.unsubscribe("PermissionController:stateChange",k(this,i,"f"))}catch(e){y("Failed to unsubscribe from permission changes",{error:e})}for(const[e]of this.activeSubscriptions)this.unsubscribe(e).catch(()=>{});k(this,c,"f").clear()}}s.SnapDataSource=j,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,n=new WeakSet,l=function(){const e=k(this,a,"f");e.subscribe("AccountsController:accountBalancesUpdated",k(this,o,"f")),e.subscribe("PermissionController:stateChange",k(this,i,"f"))},u=function(e){let t;for(const[s,a]of Object.entries(e.balances)){let e;for(const[t,s]of Object.entries(a)){const a=S(t);k(this,n,"m",d).call(this,a)&&(e??(e={}),e[t]={amount:s.amount})}e&&(t??(t={}),t[s]=e)}if(t){const e={assetsBalance:t};for(const t of this.activeSubscriptions.values())t.onAssetsUpdate(e)?.catch(console.error)}},d=function(e){return this.state.activeChains.includes(e)},m=function(){try{return k(this,a,"f").call("SnapController:getRunnableSnaps")}catch(e){return y("Failed to get runnable snaps",e),[]}},h=function(e){try{return k(this,a,"f").call("PermissionController:getPermissions",e)}catch(t){return y("Failed to get permissions for snap",{snapId:e,error:t}),undefined}},p=function(){try{const e=k(this,n,"m",m).call(this),t={},a=[];for(const r of e){const e=k(this,n,"m",h).call(this,r.id);if(!e?.[s.KEYRING_PERMISSION])continue;const o=_(e[s.ASSETS_PERMISSION]);if(o)for(const e of o)e in t||(t[e]=r.id,a.push(e))}this.state.chainToSnap=t;try{const e=[...this.state.activeChains];this.updateActiveChains(a,t=>{k(this,r,"f").call(this,this.getName(),t,e)})}catch{}}catch(e){y("Keyring snap discovery failed",{error:e}),this.state.chainToSnap={};try{const e=[...this.state.activeChains];this.updateActiveChains([],t=>{k(this,r,"f").call(this,this.getName(),t,e)})}catch{}}},f=function(e){const t=k(this,c,"f").get(e);if(t)return t;const s=new g.KeyringClient({send:async t=>await k(this,a,"f").call("SnapController:handleRequest",{snapId:e,origin:"metamask",handler:w.HandlerType.OnKeyringRequest,request:t})});return k(this,c,"f").set(e,s),s},s.createSnapDataSource=function(e){return new j(e)}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/types.cjs","@metamask/core-backend":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/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,s){var n,a,r,o,i=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},c=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.TokenDataSource=void 0;e("@metamask/core-backend");const l=e("@metamask/utils"),u=e("../logger.cjs"),d=e("../types.cjs"),m="TokenDataSource",h=(0,u.createModuleLogger)(u.projectLogger,m);function p(e,t){const s=(0,l.parseCaipAssetType)(e);let n="erc20";"slip44"===s.assetNamespace?n="native":"spl"===s.assetNamespace&&(n="spl");return{type:n,name:t.name,symbol:t.symbol,decimals:t.decimals,image:t.iconUrl,coingeckoId:t.coingeckoId,occurrences:t.occurrences,aggregators:t.aggregators,labels:t.labels,erc20Permit:t.erc20Permit,fees:t.fees,honeypotStatus:t.honeypotStatus,storage:t.storage,isContractVerified:t.isContractVerified,description:t.description}}s.TokenDataSource=class{constructor(e){n.add(this),this.name=m,a.set(this,void 0),i(this,a,e.queryApiClient,"f")}get assetsMiddleware(){return(0,d.forDataTypes)(["metadata"],async(e,t)=>{const{response:s}=e;if(!s.detectedAssets)return t(e);const{assetsMetadata:i}=e.getAssetsState(),l=new Set;for(const e of Object.values(s.detectedAssets))for(const t of e){const e=s.assetsMetadata?.[t];if(e?.image)continue;const n=i[t];n?.image||l.add(t)}if(0===l.size)return t(e);const u=await c(this,n,"m",r).call(this),d=c(this,n,"m",o).call(this,[...l],u);if(0===d.length)return t(e);try{const e=await c(this,a,"f").tokens.fetchV3Assets(d,{includeIconUrl:!0,includeMarketData:!0,includeMetadata:!0,includeLabels:!0,includeRwaData:!0});s.assetsMetadata??(s.assetsMetadata={});for(const t of e){const e=t.assetId;s.assetsMetadata[e]=p(t.assetId,t)}}catch(e){h("Failed to fetch metadata",{error:e})}return t(e)})}},a=new WeakMap,n=new WeakSet,r=async function(){try{const e=await c(this,a,"f").tokens.fetchTokenV2SupportedNetworks(),t=[...e.fullSupport,...e.partialSupport];return new Set(t)}catch(e){return h("Failed to fetch supported networks",{error:e}),new Set}},o=function(e,t){return e.filter(e=>{try{const s=(0,l.parseCaipAssetType)(e),n=`${s.chain.namespace}:${s.chain.reference}`;return t.has(n)}catch{return!1}})}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@ethersproject/abi":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/abi/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,o,i,c,l=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},u=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.MulticallClient=s.decodeAggregate3Response=s.encodeAggregate3=void 0;const d=e("@ethersproject/abi"),m=e("../utils/index.cjs"),h=new d.Interface([{name:"aggregate3",type:"function",stateMutability:"payable",inputs:[{name:"calls",type:"tuple[]",components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}]}],outputs:[{name:"returnData",type:"tuple[]",components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}]}]},{name:"getEthBalance",type:"function",stateMutability:"view",inputs:[{name:"addr",type:"address"}],outputs:[{name:"balance",type:"uint256"}]}]),p=new d.Interface([{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"balance",type:"uint256"}]}]),f="0x0000000000000000000000000000000000000000",b={"0x1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3":"0xcA11bde05977b3631167028862bE2a173976CA11","0xaa36a7":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4268":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5e9":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b6e6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18fc4a":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa":"0xcA11bde05977b3631167028862bE2a173976CA11","0x45":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1a4":"0xcA11bde05977b3631167028862bE2a173976CA11","0xaa37dc":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa4b1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa4ba":"0xcA11bde05977b3631167028862bE2a173976CA11","0x66eed":"0xcA11bde05977b3631167028862bE2a173976CA11","0x66eee":"0xcA11bde05977b3631167028862bE2a173976CA11","0x66eeb":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15f2249":"0xcA11bde05977b3631167028862bE2a173976CA11","0x89":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13881":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13882":"0xcA11bde05977b3631167028862bE2a173976CA11","0x44d":"0xca11bde05977b3631167028862be2a173976ca11","0x5a2":"0xca11bde05977b3631167028862be2a173976ca11","0x98a":"0xca11bde05977b3631167028862be2a173976ca11","0x64":"0xcA11bde05977b3631167028862bE2a173976CA11","0x27d8":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa86a":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa869":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfa2":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfa":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfaf0":"0xca11bde05977b3631167028862be2a173976ca11","0x38":"0xcA11bde05977b3631167028862bE2a173976CA11","0x61":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15eb":"0xcA11bde05977b3631167028862bE2a173976CA11","0xcc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x504":"0xcA11bde05977b3631167028862bE2a173976CA11","0x505":"0xcA11bde05977b3631167028862bE2a173976CA11","0x507":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2a15c308d":"0xca11bde05977b3631167028862be2a173976ca11","0x2a15c3083":"0xca11bde05977b3631167028862be2a173976ca11","0x63564c40":"0xcA11bde05977b3631167028862bE2a173976CA11","0x19":"0xcA11bde05977b3631167028862bE2a173976CA11","0x152":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5535072":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6c1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7a":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13":"0xcA11bde05977b3631167028862bE2a173976CA11","0x10":"0xcA11bde05977b3631167028862bE2a173976CA11","0x72":"0xcA11bde05977b3631167028862bE2a173976CA11","0x120":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4e454152":"0xcA11bde05977b3631167028862bE2a173976CA11","0x250":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5c2359":"0xcA11bde05977b3631167028862bE2a173976CA11","0xec0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x42":"0xcA11bde05977b3631167028862bE2a173976CA11","0x80":"0xcA11bde05977b3631167028862bE2a173976CA11","0x440":"0xcA11bde05977b3631167028862bE2a173976CA11","0x257":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe9fe":"0xcA11bde05977b3631167028862bE2a173976CA11","0xd3a0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x84444":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2329":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2328":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6c":"0xcA11bde05977b3631167028862bE2a173976CA11","0x12":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa516":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5afe":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa4ec":"0xcA11bde05977b3631167028862bE2a173976CA11","0xaef3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x116ea":"0xcA11bde05977b3631167028862bE2a173976CA11","0x116e9":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2019":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3e9":"0xca11bde05977b3631167028862be2a173976ca11","0x7d1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x141":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4d2":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1e14":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1e15":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1251":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7f08":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8ae":"0xcA11bde05977b3631167028862bE2a173976CA11","0x138b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1389":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1388":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f92":"0xcA11bde05977b3631167028862bE2a173976CA11","0x14a33":"0xca11bde05977b3631167028862be2a173976ca11","0x14a34":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2105":"0xca11bde05977b3631167028862be2a173976ca11","0x936":"0xcA11bde05977b3631167028862bE2a173976CA11","0xff":"0xcA11bde05977b3631167028862bE2a173976CA11","0x46a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x46b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x14f":"0xcA11bde05977b3631167028862bE2a173976CA11","0xd2af":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe9ac0ce":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe705":"0xca11bde05977b3631167028862be2a173976ca11","0xe704":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe708":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2b6f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x39":"0xcA11bde05977b3631167028862bE2a173976CA11","0x23a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1644":"0xcA11bde05977b3631167028862bE2a173976CA11","0xdea8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3af":"0xcA11bde05977b3631167028862bE2a173976CA11","0x171":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3e7":"0xcA11bde05977b3631167028862bE2a173976CA11","0x76adf1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3b9ac9ff":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2c":"0xca11bde05977b3631167028862be2a173976ca11","0x2e":"0xca11bde05977b3631167028862be2a173976ca11","0x15b3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x82751":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8274f":"0xca11bde05977b3631167028862be2a173976ca11","0x82750":"0xcA11bde05977b3631167028862bE2a173976CA11","0x96f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3cc5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4571":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe99":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7d0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1297":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1d5e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3a14269b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x561bf78b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x235ddd0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3cd156dc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5d456c62":"0xcA11bde05977b3631167028862bE2a173976CA11","0x79f99296":"0xcA11bde05977b3631167028862bE2a173976CA11","0x585eb4b1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x507aaa2a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1fc3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x32d":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a73":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a72":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8a71":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe9ac0d6":"0xca11bde05977b3631167028862be2a173976ca11","0x1069":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7e5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x53":"0xca11bde05977b3631167028862be2a173976ca11","0x52":"0xca11bde05977b3631167028862be2a173976ca11","0xe298":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1a8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x94":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2c6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2803":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2802":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa9":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c5f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c60":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13a":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4cb2f":"0xdbfa261cd7d17bb40479a0493ad6c0fee435859e","0x7f93":"0xcA11bde05977b3631167028862bE2a173976CA11","0xb660":"0xcA11bde05977b3631167028862bE2a173976CA11","0xb02113d3f":"0xcA11bde05977b3631167028862bE2a173976CA11","0xdad":"0xcA11bde05977b3631167028862bE2a173976CA11","0xdae":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15b38":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15b32":"0xcA11bde05977b3631167028862bE2a173976CA11","0x45c":"0xcA11bde05977b3631167028862bE2a173976CA11","0x45b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3d":"0xcA11bde05977b3631167028862bE2a173976CA11","0x41a6ace":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa729":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f47b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b59":"0xca11bde05977b3631167028862be2a173976ca11","0x1b58":"0xcA11bde05977b3631167028862bE2a173976CA11","0xc3":"0xca11bde05977b3631167028862be2a173976ca11","0x16fd8":"0xcA11bde05977b3631167028862bE2a173976CA11","0xc7":"0xca11bde05977b3631167028862be2a173976ca11","0x405":"0xca11bde05977b3631167028862be2a173976ca11","0x334":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1ce":"0xca11bde05977b3631167028862be2a173976ca11","0x1cf":"0xca11bde05977b3631167028862be2a173976ca11","0xa70e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x868b":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa0c71fd":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13e31":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa1337":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f2b":"0xcA11bde05977b3631167028862bE2a173976CA11","0xf63":"0xcA11bde05977b3631167028862bE2a173976CA11","0x144":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x118":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x12c":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x18995f":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x2b74":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0xfc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x9da":"0xcA11bde05977b3631167028862bE2a173976CA11","0x137":"0xcA11bde05977b3631167028862bE2a173976CA11","0x13ed":"0xcA11bde05977b3631167028862bE2a173976CA11","0x24b1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xba9302":"0xcA11bde05977b3631167028862bE2a173976CA11","0x7c8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x138d5":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6d":"0xcA11bde05977b3631167028862bE2a173976CA11","0x343b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x34a1":"0xcA11bde05977b3631167028862bE2a173976CA11","0x3109":"0xcA11bde05977b3631167028862bE2a173976CA11","0x91b":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa96":"0xcA11bde05977b3631167028862bE2a173976CA11","0x22c3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2be3":"0xcA11bde05977b3631167028862bE2a173976CA11","0xbf03":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b254":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa7b14":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2276":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1b9e":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6a63bb8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15af3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15af1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xae3f3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x531":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c61":"0xcA11bde05977b3631167028862bE2a173976CA11","0x28c58":"0xca11bde05977b3631167028862be2a173976ca11","0x1d88":"0xcA11bde05977b3631167028862bE2a173976CA11","0x5b9b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4c7e1":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa53b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1a2b":"0xcA11bde05977b3631167028862bE2a173976CA11","0x406":"0xca11bde05977b3631167028862be2a173976ca11","0x2cef":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18b2":"0xca11bde05977b3631167028862be2a173976ca11","0x182a9":"0xcA11bde05977b3631167028862bE2a173976CA11","0xc4":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfdd":"0xcA11bde05977b3631167028862bE2a173976CA11","0xfde":"0xcA11bde05977b3631167028862bE2a173976CA11","0x99c0a0f":"0xca11bde05977b3631167028862be2a173976ca11","0x22cf":"0xcA11bde05977b3631167028862bE2a173976CA11","0x310c5":"0xca11bde05977b3631167028862be2a173976ca11","0x46f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x659":"0xca11bde05977b3631167028862be2a173976ca11","0x139c968f9":"0xcA11bde05977b3631167028862bE2a173976CA11","0xed88":"0xcA11bde05977b3631167028862bE2a173976CA11","0xd036":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1f3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x31bf8c3":"0xcA11bde05977b3631167028862bE2a173976CA11","0x1cbc67bfdc":"0xcA11bde05977b3631167028862bE2a173976CA11","0x98967f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x4f588":"0xcA11bde05977b3631167028862bE2a173976CA11","0x16db":"0xca11bde05977b3631167028862be2a173976ca11","0x3a":"0xca11bde05977b3631167028862be2a173976ca11","0x59":"0xca11bde05977b3631167028862be2a173976ca11","0x1e0":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2eb":"0xcA11bde05977b3631167028862bE2a173976CA11","0x221":"0xcA11bde05977b3631167028862bE2a173976CA11","0x6f0":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa867":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2611":"0xcA11bde05977b3631167028862bE2a173976CA11","0xa6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x15f900":"0x6B5eFbC0C82eBb26CA13a4F11836f36Fc6fdBC5D","0x74c":"0xcA11bde05977b3631167028862bE2a173976CA11","0x407b":"0x90a2377F233E3461BACa6080d4837837d8762927","0xa3c3":"0xcA11bde05977b3631167028862bE2a173976CA11","0xab5":"0xF9cda624FBC7e059355ce98a31693d299FACd963","0x138de":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18c6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8173":"0xcA11bde05977b3631167028862bE2a173976CA11","0x2ba":"0xcA11bde05977b3631167028862bE2a173976CA11","0x279f":"0xcA11bde05977b3631167028862bE2a173976CA11","0xb67d2":"0xcA11bde05977b3631167028862bE2a173976CA11","0xe8":"0xcA11bde05977b3631167028862bE2a173976CA11","0x18232":"0xcA11bde05977b3631167028862bE2a173976CA11","0x8f":"0xcA11bde05977b3631167028862bE2a173976CA11","0x32":"0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF","0x18c7":"0xcA11bde05977b3631167028862bE2a173976CA11","0x10e6":"0xcA11bde05977b3631167028862bE2a173976CA11","0x10b3e":"0x99423C88EB5723A590b4C644426069042f137B9e"};function k(e){return p.encodeFunctionData("balanceOf",[e])}function g(e){return h.encodeFunctionData("aggregate3",[e.map(e=>({target:e.target,allowFailure:e.allowFailure,callData:e.callData}))])}function w(e,t){const s=h.decodeFunctionResult("aggregate3",e)[0];if(s.length!==t)throw new Error(`Expected ${t} results, got ${s.length}`);return s.map(e=>({success:e.success,returnData:e.returnData}))}function x(e){if("0x"===e||e.length<66)return"0";return p.decodeFunctionResult("balanceOf",e)[0].toString()}s.encodeAggregate3=g,s.decodeAggregate3Response=w;s.MulticallClient=class{constructor(e,t){n.add(this),a.set(this,void 0),r.set(this,void 0),l(this,a,e,"f");const s=t?.maxCallsPerBatch!==undefined&&t.maxCallsPerBatch>0?t.maxCallsPerBatch:300,o=t?.timeoutMs!==undefined&&t.timeoutMs>0?t.timeoutMs:3e4;l(this,r,{maxCallsPerBatch:s,timeoutMs:o},"f")}async batchBalanceOf(e,t){if(0===t.length)return[];const s=b[e],r=u(this,a,"f").call(this,e);return s?u(this,n,"m",o).call(this,r,s,t):u(this,n,"m",i).call(this,r,t)}},a=new WeakMap,r=new WeakMap,n=new WeakSet,o=async function(e,t,s){const a=u(this,r,"f").maxCallsPerBatch;return await(0,m.reduceInBatchesSerially)({values:s,batchSize:a,initialResult:[],eachBatch:async(s,a)=>{try{const n=g(a.map(e=>{const s=e.tokenAddress===f;return{target:s?t:e.tokenAddress,allowFailure:!0,callData:s?(n=e.accountAddress,h.encodeFunctionData("getEthBalance",[n])):k(e.accountAddress)};var n})),r=w(await e.call({to:t,data:n}),a.length);for(let e=0;e<a.length;e++){const{tokenAddress:t,accountAddress:n}=a[e],{success:o,returnData:i}=r[e];o&&i&&i.length>2?s.push({tokenAddress:t,accountAddress:n,success:!0,balance:x(i)}):s.push({tokenAddress:t,accountAddress:n,success:!1})}}catch{const t=await Promise.all(a.map(t=>u(this,n,"m",c).call(this,e,t)));for(const e of t)s.push(e)}return s}})},i=async function(e,t){const s=Math.min(u(this,r,"f").maxCallsPerBatch,50);return await(0,m.reduceInBatchesSerially)({values:t,batchSize:s,initialResult:[],eachBatch:async(t,s)=>{const a=await Promise.all(s.map(t=>u(this,n,"m",c).call(this,e,t)));for(const e of a)t.push(e);return t}})},c=async function(e,t){try{const{tokenAddress:s,accountAddress:n}=t;if(s===f){return{tokenAddress:s,accountAddress:n,success:!0,balance:(await e.getBalance(n)).toString()}}const a=k(n),r=await e.call({to:s,data:a});return{tokenAddress:s,accountAddress:n,success:!0,balance:x(r)}}catch{return{tokenAddress:t.tokenAddress,accountAddress:t.accountAddress,success:!1}}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/index.cjs",{"./MulticallClient.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.MulticallClient=s.encodeAggregate3=s.decodeAggregate3Response=void 0;var n=e("./MulticallClient.cjs");Object.defineProperty(s,"decodeAggregate3Response",{enumerable:!0,get:function(){return n.decodeAggregate3Response}}),Object.defineProperty(s,"encodeAggregate3",{enumerable:!0,get:function(){return n.encodeAggregate3}}),Object.defineProperty(s,"MulticallClient",{enumerable:!0,get:function(){return n.MulticallClient}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs",{"./clients/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/clients/index.cjs","./services/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/index.cjs","./utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.reduceInBatchesSerially=s.divideIntoBatches=s.TokenDetector=s.BalanceFetcher=s.MulticallClient=void 0;var n=e("./clients/index.cjs");Object.defineProperty(s,"MulticallClient",{enumerable:!0,get:function(){return n.MulticallClient}});var a=e("./services/index.cjs");Object.defineProperty(s,"BalanceFetcher",{enumerable:!0,get:function(){return a.BalanceFetcher}}),Object.defineProperty(s,"TokenDetector",{enumerable:!0,get:function(){return a.TokenDetector}});var r=e("./utils/index.cjs");Object.defineProperty(s,"divideIntoBatches",{enumerable:!0,get:function(){return r.divideIntoBatches}}),Object.defineProperty(s,"reduceInBatchesSerially",{enumerable:!0,get:function(){return r.reduceInBatchesSerially}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@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,s){var n,a,r,o,i,c,l,u=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BalanceFetcher=void 0;const m=e("@metamask/polling-controller"),h=e("../utils/index.cjs"),p="0x0000000000000000000000000000000000000000";class f extends((0,m.StaticIntervalPollingControllerOnly)()){constructor(e,t,s){super(),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),u(this,a,e,"f"),u(this,r,t,"f"),u(this,o,{defaultBatchSize:s?.defaultBatchSize??300,defaultTimeoutMs:s?.defaultTimeoutMs??3e4,includeNativeByDefault:s?.includeNativeByDefault??!0},"f"),this.setIntervalLength(s?.pollingInterval??3e4)}setOnBalanceUpdate(e){u(this,i,e,"f")}async _executePoll(e){const t=await this.fetchBalances(e.chainId,e.accountId,e.accountAddress);d(this,i,"f")&&t.balances.length>0&&d(this,i,"f").call(this,t)}getTokensToFetch(e,t){const s=d(this,r,"f").call("AssetsController:getState");if(!s?.assetsBalance)return[];const n=s.assetsBalance[t];if(!n)return[];const a=`eip155:${parseInt(e,16)}/`,o=new Map;for(const e of Object.keys(n))if(e.startsWith(a)&&e.includes("/erc20:")){const t=e.split("/erc20:")[1];if(t){const e=t.toLowerCase();o.has(e)||o.set(e,{address:t,decimals:18,symbol:""})}}return Array.from(o.values())}async fetchBalances(e,t,s,n){const a=this.getTokensToFetch(e,t),r=a.map(e=>e.address);return this.fetchBalancesForTokens(e,t,s,r,n,a)}async fetchBalancesForTokens(e,t,s,r,i,l){const u=i?.batchSize??d(this,o,"f").defaultBatchSize,m=i?.includeNative??d(this,o,"f").includeNativeByDefault,f=Date.now(),b=new Map;if(l)for(const e of l)b.set(e.address.toLowerCase(),e);const k=[];m&&k.push({tokenAddress:p,accountAddress:s});for(const e of r)k.push({tokenAddress:e,accountAddress:s});if(0===k.length)return{chainId:e,accountId:t,accountAddress:s,balances:[],failedAddresses:[],timestamp:f};const g=await(0,h.reduceInBatchesSerially)({values:k,batchSize:u,initialResult:{balances:[],failedAddresses:[]},eachBatch:async(s,r)=>{const o=await d(this,a,"f").batchBalanceOf(e,r);return d(this,n,"m",c).call(this,o,s,e,t,f,b)}});return{chainId:e,accountId:t,accountAddress:s,...g,timestamp:f}}}s.BalanceFetcher=f,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e,t,s,a,r,o){const{balances:i,failedAddresses:c}=t;for(const t of e){if(!t.success){c.push(t.tokenAddress);continue}const e=t.balance??"0",u=o.get(t.tokenAddress.toLowerCase()),m=u?.decimals??18,h=d(this,n,"m",l).call(this,e,m),f=parseInt(s,16),b=t.tokenAddress.toLowerCase()===p.toLowerCase()?`eip155:${f}/slip44:60`:`eip155:${f}/erc20:${t.tokenAddress.toLowerCase()}`;i.push({assetId:b,accountId:a,chainId:s,balance:e,formattedBalance:h,decimals:m,timestamp:r})}return{balances:i,failedAddresses:c}},l=function(e,t){if("0"===e)return"0";try{const s=BigInt(e),n=BigInt(10**t),a=s/n,r=(s%n).toString().padStart(t,"0").replace(/0+$/u,"");return""===r?a.toString():`${a}.${r}`}catch{return e}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs",{"../utils/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs","@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,s){var n,a,r,o,i,c,l,u,d,m=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},h=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.TokenDetector=void 0;const p=e("@metamask/polling-controller"),f=e("../utils/index.cjs");class b extends((0,p.StaticIntervalPollingControllerOnly)()){constructor(e,t,s){super(),n.add(this),a.set(this,void 0),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),m(this,a,e,"f"),m(this,r,t,"f"),m(this,o,{defaultBatchSize:s?.defaultBatchSize??300,defaultTimeoutMs:s?.defaultTimeoutMs??3e4},"f"),this.setIntervalLength(s?.pollingInterval??18e4)}setOnDetectionUpdate(e){m(this,i,e,"f")}async _executePoll(e){if(0===this.getTokensToCheck(e.chainId).length)return;const t=await this.detectTokens(e.chainId,e.accountId,e.accountAddress);h(this,i,"f")&&t.detectedAssets.length>0&&h(this,i,"f").call(this,t)}getTokensToCheck(e){const t=h(this,r,"f").call("TokenListController:getState");if(!t?.tokensChainsCache)return[];let s=t.tokensChainsCache[e];if(!s){const n=`0x${parseInt(e,16).toString(16)}`;s=t.tokensChainsCache[n]}const n=s?.data;return n?Object.keys(n):[]}async detectTokens(e,t,s,r){const i=r?.batchSize??h(this,o,"f").defaultBatchSize,l=Date.now(),u=this.getTokensToCheck(e);if(0===u.length)return{chainId:e,accountId:t,accountAddress:s,detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[],timestamp:l};const d=u.map(e=>({tokenAddress:e,accountAddress:s})),m=await(0,f.reduceInBatchesSerially)({values:d,batchSize:i,initialResult:{detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[]},eachBatch:async(s,r)=>{const o=await h(this,a,"f").batchBalanceOf(e,r);return h(this,n,"m",c).call(this,o,s,e,t,l)}});return{chainId:e,accountId:t,accountAddress:s,...m,timestamp:l}}}s.TokenDetector=b,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e,t,s,a,r){const{detectedAssets:o,detectedBalances:i,zeroBalanceAddresses:c,failedAddresses:m}=t;for(const t of e){if(!t.success){m.push(t.tokenAddress);continue}const e=t.balance??"0";if("0"===e||""===e){c.push(t.tokenAddress);continue}const p=h(this,n,"m",u).call(this,s,t.tokenAddress),f=h(this,n,"m",d).call(this,s,t.tokenAddress,p);o.push(f);const b=p?.decimals??18,k=h(this,n,"m",l).call(this,e,b);i.push({assetId:f.assetId,accountId:a,chainId:s,balance:e,formattedBalance:k,decimals:b,timestamp:r})}return{detectedAssets:o,detectedBalances:i,zeroBalanceAddresses:c,failedAddresses:m}},l=function(e,t){try{const s=BigInt(e),n=BigInt(10**t),a=s/n,r=(s%n).toString().padStart(t,"0").replace(/0+$/u,"");return""===r?a.toString():`${a}.${r}`}catch{return e}},u=function(e,t){const s=h(this,r,"f").call("TokenListController:getState");if(!s?.tokensChainsCache)return undefined;const n=s.tokensChainsCache[e],a=n?.data;if(!a)return undefined;if(a[t])return a[t];const o=t.toLowerCase();for(const[e,t]of Object.entries(a))if(e.toLowerCase()===o)return t;return undefined},d=function(e,t,s){return{assetId:`eip155:${parseInt(e,16)}/erc20:${t.toLowerCase()}`,chainId:e,address:t,type:"erc20",symbol:s?.symbol,name:s?.name,decimals:s?.decimals,image:s?.iconUrl,isNative:!1,aggregators:s?.aggregators}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/index.cjs",{"./BalanceFetcher.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs","./TokenDetector.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.BalanceFetcher=s.TokenDetector=void 0;var n=e("./TokenDetector.cjs");Object.defineProperty(s,"TokenDetector",{enumerable:!0,get:function(){return n.TokenDetector}});var a=e("./BalanceFetcher.cjs");Object.defineProperty(s,"BalanceFetcher",{enumerable:!0,get:function(){return a.BalanceFetcher}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/batch.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e,{batchSize:t}){if(t<=0)throw new Error("batchSize must be greater than 0");const s=[];for(let n=0;n<e.length;n+=t)s.push(e.slice(n,n+t));return s}Object.defineProperty(s,"__esModule",{value:!0}),s.reduceInBatchesSerially=s.divideIntoBatches=void 0,s.divideIntoBatches=n,s.reduceInBatchesSerially=async function({values:e,batchSize:t,eachBatch:s,initialResult:a}){const r=n(e,{batchSize:t});let o=a;for(const[e,t]of r.entries())o=await s(o,t,e);return o}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/batch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs",{"./batch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/batch.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.reduceInBatchesSerially=s.divideIntoBatches=void 0;var n=e("./batch.cjs");Object.defineProperty(s,"divideIntoBatches",{enumerable:!0,get:function(){return n.divideIntoBatches}}),Object.defineProperty(s,"reduceInBatchesSerially",{enumerable:!0,get:function(){return n.reduceInBatchesSerially}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/index.cjs",{"./AbstractDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AbstractDataSource.cjs","./AccountsApiDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/AccountsApiDataSource.cjs","./BackendWebsocketDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/BackendWebsocketDataSource.cjs","./PriceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/PriceDataSource.cjs","./RpcDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/RpcDataSource.cjs","./SnapDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/SnapDataSource.cjs","./TokenDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/TokenDataSource.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.extractChainFromAssetId=s.getChainIdsCaveat=s.KEYRING_PERMISSION=s.SNAP_DATA_SOURCE_NAME=s.createSnapDataSource=s.SnapDataSource=s.PriceDataSource=s.TokenDataSource=s.createRpcDataSource=s.RpcDataSource=s.createBackendWebsocketDataSource=s.BackendWebsocketDataSource=s.AccountsApiDataSource=s.AbstractDataSource=void 0;var n=e("./AbstractDataSource.cjs");Object.defineProperty(s,"AbstractDataSource",{enumerable:!0,get:function(){return n.AbstractDataSource}});var a=e("./AccountsApiDataSource.cjs");Object.defineProperty(s,"AccountsApiDataSource",{enumerable:!0,get:function(){return a.AccountsApiDataSource}});var r=e("./BackendWebsocketDataSource.cjs");Object.defineProperty(s,"BackendWebsocketDataSource",{enumerable:!0,get:function(){return r.BackendWebsocketDataSource}}),Object.defineProperty(s,"createBackendWebsocketDataSource",{enumerable:!0,get:function(){return r.createBackendWebsocketDataSource}});var o=e("./RpcDataSource.cjs");Object.defineProperty(s,"RpcDataSource",{enumerable:!0,get:function(){return o.RpcDataSource}}),Object.defineProperty(s,"createRpcDataSource",{enumerable:!0,get:function(){return o.createRpcDataSource}});var i=e("./TokenDataSource.cjs");Object.defineProperty(s,"TokenDataSource",{enumerable:!0,get:function(){return i.TokenDataSource}});var c=e("./PriceDataSource.cjs");Object.defineProperty(s,"PriceDataSource",{enumerable:!0,get:function(){return c.PriceDataSource}});var l=e("./SnapDataSource.cjs");Object.defineProperty(s,"SnapDataSource",{enumerable:!0,get:function(){return l.SnapDataSource}}),Object.defineProperty(s,"createSnapDataSource",{enumerable:!0,get:function(){return l.createSnapDataSource}}),Object.defineProperty(s,"SNAP_DATA_SOURCE_NAME",{enumerable:!0,get:function(){return l.SNAP_DATA_SOURCE_NAME}}),Object.defineProperty(s,"KEYRING_PERMISSION",{enumerable:!0,get:function(){return l.KEYRING_PERMISSION}}),Object.defineProperty(s,"getChainIdsCaveat",{enumerable:!0,get:function(){return l.getChainIdsCaveat}}),Object.defineProperty(s,"extractChainFromAssetId",{enumerable:!0,get:function(){return l.extractChainFromAssetId}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/index.cjs",{"./AssetsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/AssetsController.cjs","./data-sources/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/index.cjs","./middlewares/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/index.cjs","./selectors/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/selectors/balance.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getInternalAccountsForGroup=s.getGroupIdForAccount=s.getAggregatedBalanceForAccount=s.normalizeAssetId=s.DetectionMiddleware=s.PriceDataSource=s.TokenDataSource=s.extractChainFromAssetId=s.getChainIdsCaveat=s.KEYRING_PERMISSION=s.SNAP_DATA_SOURCE_NAME=s.createSnapDataSource=s.SnapDataSource=s.createRpcDataSource=s.RpcDataSource=s.createBackendWebsocketDataSource=s.BackendWebsocketDataSource=s.AccountsApiDataSource=s.AbstractDataSource=s.getDefaultAssetsControllerState=s.AssetsController=void 0;var n=e("./AssetsController.cjs");Object.defineProperty(s,"AssetsController",{enumerable:!0,get:function(){return n.AssetsController}}),Object.defineProperty(s,"getDefaultAssetsControllerState",{enumerable:!0,get:function(){return n.getDefaultAssetsControllerState}});var a=e("./data-sources/index.cjs");Object.defineProperty(s,"AbstractDataSource",{enumerable:!0,get:function(){return a.AbstractDataSource}});var r=e("./data-sources/index.cjs");Object.defineProperty(s,"AccountsApiDataSource",{enumerable:!0,get:function(){return r.AccountsApiDataSource}});var o=e("./data-sources/index.cjs");Object.defineProperty(s,"BackendWebsocketDataSource",{enumerable:!0,get:function(){return o.BackendWebsocketDataSource}}),Object.defineProperty(s,"createBackendWebsocketDataSource",{enumerable:!0,get:function(){return o.createBackendWebsocketDataSource}});var i=e("./data-sources/index.cjs");Object.defineProperty(s,"RpcDataSource",{enumerable:!0,get:function(){return i.RpcDataSource}}),Object.defineProperty(s,"createRpcDataSource",{enumerable:!0,get:function(){return i.createRpcDataSource}});var c=e("./data-sources/index.cjs");Object.defineProperty(s,"SnapDataSource",{enumerable:!0,get:function(){return c.SnapDataSource}}),Object.defineProperty(s,"createSnapDataSource",{enumerable:!0,get:function(){return c.createSnapDataSource}}),Object.defineProperty(s,"SNAP_DATA_SOURCE_NAME",{enumerable:!0,get:function(){return c.SNAP_DATA_SOURCE_NAME}}),Object.defineProperty(s,"KEYRING_PERMISSION",{enumerable:!0,get:function(){return c.KEYRING_PERMISSION}}),Object.defineProperty(s,"getChainIdsCaveat",{enumerable:!0,get:function(){return c.getChainIdsCaveat}}),Object.defineProperty(s,"extractChainFromAssetId",{enumerable:!0,get:function(){return c.extractChainFromAssetId}});var l=e("./data-sources/index.cjs");Object.defineProperty(s,"TokenDataSource",{enumerable:!0,get:function(){return l.TokenDataSource}}),Object.defineProperty(s,"PriceDataSource",{enumerable:!0,get:function(){return l.PriceDataSource}});var u=e("./middlewares/index.cjs");Object.defineProperty(s,"DetectionMiddleware",{enumerable:!0,get:function(){return u.DetectionMiddleware}});var d=e("./utils.cjs");Object.defineProperty(s,"normalizeAssetId",{enumerable:!0,get:function(){return d.normalizeAssetId}});var m=e("./selectors/balance.cjs");Object.defineProperty(s,"getAggregatedBalanceForAccount",{enumerable:!0,get:function(){return m.getAggregatedBalanceForAccount}}),Object.defineProperty(s,"getGroupIdForAccount",{enumerable:!0,get:function(){return m.getGroupIdForAccount}}),Object.defineProperty(s,"getInternalAccountsForGroup",{enumerable:!0,get:function(){return m.getInternalAccountsForGroup}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createModuleLogger=s.projectLogger=void 0;const n=e("@metamask/utils");Object.defineProperty(s,"createModuleLogger",{enumerable:!0,get:function(){return n.createModuleLogger}}),s.projectLogger=(0,n.createProjectLogger)("assets-controller")}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DetectionMiddleware=void 0;const n=e("../logger.cjs"),a=e("../types.cjs"),r="DetectionMiddleware";(0,n.createModuleLogger)(n.projectLogger,r);s.DetectionMiddleware=class{constructor(){this.name=r}get assetsMiddleware(){return(0,a.forDataTypes)(["balance"],async(e,t)=>{const{response:s}=e;if(!s.assetsBalance)return t(e);const{assetsMetadata:n}=e.getAssetsState(),a={};for(const[e,t]of Object.entries(s.assetsBalance)){const s=[];for(const e of Object.keys(t))n[e]||s.push(e);s.length>0&&(a[e]=s)}return Object.keys(a).length>0&&(s.detectedAssets=a),t(e)})}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/index.cjs",{"./DetectionMiddleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/middlewares/DetectionMiddleware.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DetectionMiddleware=void 0;var n=e("./DetectionMiddleware.cjs");Object.defineProperty(s,"DetectionMiddleware",{enumerable:!0,get:function(){return n.DetectionMiddleware}})}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/middlewares/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/selectors/balance.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","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.getAggregatedBalanceForAccount=s.getInternalAccountsForGroup=s.getGroupIdForAccount=void 0;const a=e("@metamask/controller-utils"),r=e("@metamask/utils"),o=n(e("bignumber.js")),i={price:0,pricePercentChange1d:0},c=e=>{if("object"==typeof e&&null!==e&&"amount"in e){const{amount:t}=e;return"string"==typeof t?t:"0"}return"0"},l=e=>{const t=new o.default(e);return t.isNaN()||!t.isFinite()?new o.default(0):t},u=(e,t)=>{if(t<=0)return e;const s=new o.default(10).pow(t);return e.lt(s)?e:e.dividedBy(s)},d=(e,t)=>{const s=e?.[t];if(!s||"object"!=typeof s)return i;const{price:n,pricePercentChange1d:a}=s;return{price:"number"==typeof n&&Number.isFinite(n)?n:0,pricePercentChange1d:"number"==typeof a&&Number.isFinite(a)?a:0}},m=(e,t)=>{if(!e)return!0;if((0,r.isStrictHexString)(t))return Boolean(e[r.KnownCaipNamespace.Eip155]?.[t]);const{namespace:s,reference:n}=(0,r.parseCaipChainId)(t),o=e[s];if(!o)return!1;if(o[t]||o[n])return!0;if(s===r.KnownCaipNamespace.Eip155)try{const e=(0,a.toHex)(n);return Boolean(o[e])}catch{const e=Number.parseInt(n,10);if(Number.isFinite(e))return Boolean(o[`0x${e.toString(16)}`])}return!1},h=(e,t)=>{const s=e.get(t);if(s)return s;const{chainId:n}=(0,r.parseCaipAssetType)(t),{namespace:a}=(0,r.parseCaipChainId)(n),o={chainId:n,isEvm:a===r.KnownCaipNamespace.Eip155};return e.set(t,o),o};function p(e){const{out:t,accountBalances:s,metadata:n,assetPreferences:a,enabledNetworkMap:r,assetInfoCache:o}=e;for(const e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;const i=e;if(a?.[i]?.hidden)continue;const d=h(o,i);if(!m(r,d.chainId))continue;const p=c(s[i]);let f=l(p);const b=n[i];if(b?.decimals!==undefined&&(f=u(f,b.decimals)),f.isZero())continue;const k=t.get(i);k?k.amount=k.amount.plus(f):t.set(i,{amount:f,decimals:b?.decimals,symbol:b?.symbol,name:b?.name})}}function f(e,t){const s=e.accountTree?.wallets;if(!s)return undefined;for(const e of Object.values(s))for(const[s,n]of Object.entries(e?.groups??{})){const e=n?.accounts;if(Array.isArray(e)&&e.includes(t))return s}return undefined}function b(e,t,s){const n=e.accountTree?.wallets;if(!n)return[];const a=e=>e?.groups??{};for(const e of Object.values(n)){const n=a(e)[s];if(!n?.accounts)continue;const r=[];for(const e of n.accounts){const s=t[e];s&&r.push(s)}return r}return[]}function k(e){const{selectedInternalAccount:t,accountTreeState:s,internalAccountsOrAccountIds:n,accountsById:a}=e;if(n&&n.length>0){if("string"==typeof n[0]){const e=n,t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]={id:e[s]};return t}return n}if(s&&a&&Object.keys(a).length>0){const e=f(s,t.id);if(e){const t=b(s,a,e);if(t.length>0)return t}}if(s){const e=function(e,t){const s=f(e,t);if(!s)return undefined;const n=e.accountTree?.wallets;if(!n)return undefined;const a=e=>e?.groups??{};for(const e of Object.values(n)){const t=a(e)[s];if(t?.accounts)return[...t.accounts]}return undefined}(s,t.id);if(e&&e.length>0){const t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]={id:e[s]};return t}}return[t]}s.getGroupIdForAccount=f,s.getInternalAccountsForGroup=b,s.getAggregatedBalanceForAccount=function(e,t,s,n,a,r){const{assetsBalance:o,assetsMetadata:i,assetPreferences:c,assetsPrice:l}=e,u=i??{},m=Boolean(l)&&(()=>{for(const e in l)if(Object.prototype.hasOwnProperty.call(l,e))return!0;return!1})(),h=k({selectedInternalAccount:t,accountTreeState:n,internalAccountsOrAccountIds:a,accountsById:r}),f=new Map,b=new Map;for(const e of h){const t=e.id;p({out:b,accountBalances:o?.[t]??{},metadata:u,assetPreferences:c,enabledNetworkMap:s,assetInfoCache:f})}const g=new Array(b.size);let w=0,x=0,v=0;for(const[e,t]of b.entries()){const{amount:s}=t,n={assetId:e,amount:s.toString(),...t.decimals===undefined?{}:{decimals:t.decimals},...t.symbol===undefined?{}:{symbol:t.symbol},...t.name===undefined?{}:{name:t.name}};if(g[w]=n,w+=1,m){const{price:t,pricePercentChange1d:n}=d(l,e),a=s.multipliedBy(t).toNumber();a>0&&(x+=a,v+=a*n)}}if(m){return{entries:g,totalBalanceInFiat:x,pricePercentChange1d:x>0?v/x:0}}return{entries:g}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/selectors/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.forDataTypes=void 0,s.forDataTypes=function(e,t){return async(s,n)=>{const a=s.request.dataTypes;return e.some(e=>a.includes(e))?t(s,n):n(s)}}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/utils.cjs",{"@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.normalizeAssetId=void 0;const n=e("@ethereumjs/util"),a=e("@metamask/utils");s.normalizeAssetId=function(e){const t=(0,a.parseCaipAssetType)(e);if("eip155"===(0,a.parseCaipChainId)(t.chainId).namespace&&"erc20"===t.assetNamespace){const e=(0,n.toChecksumAddress)(t.assetReference);return`${t.chainId}/${t.assetNamespace}:${e}`}return e}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/account.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.snapOwnsAccount=s.createChainIdList=s.createAccountList=void 0;const n=e("@metamask/utils");s.createAccountList=function(e,t){return t.map(t=>`${t}:${e}`)},s.createChainIdList=function(e,t){return t&&0!==t.length?e.reduce((e,s)=>{if("eip155:0"===s){const s=t.filter(e=>{const{namespace:t}=(0,n.parseCaipChainId)(e);return t===n.KnownCaipNamespace.Eip155});e.push(...s)}else t.includes(s)&&e.push(s);return e},[]):e},s.snapOwnsAccount=function(e,t){var s;return(null===(s=t.metadata.snap)||void 0===s?void 0:s.id)===e}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/account.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isEqual=void 0,s.isEqual=function(e,t){return e.length===t.length&&e.every((e,s)=>e===t[s])}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs",{"./base64.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateAuxiliaryFiles=s.encodeAuxiliaryFile=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/utils"),r=e("./base64.cjs"),o=e("./constants.cjs");s.encodeAuxiliaryFile=async function(e,t){if(t===n.AuxiliaryFileEncoding.Base64)return e;const s=await(0,r.decodeBase64)(e);return t===n.AuxiliaryFileEncoding.Utf8?(0,a.bytesToString)(s):(0,a.bytesToHex)(s)},s.validateAuxiliaryFiles=function(e){for(const t of e)(0,a.assert)(t.size<o.MAX_FILE_SIZE,"Static files required by the Snap must be smaller than 64 MB.")}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs",{"./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.decodeBase64=s.encodeBase64=void 0;const n=e("@metamask/utils"),a=e("./bytes.cjs");s.encodeBase64=async function(e){const t=(0,a.getBytes)(e),s="undefined"!=typeof navigator&&"ReactNative"===navigator.product;return"FileReader"in globalThis&&!s?await new Promise((e,s)=>{const n=Object.assign(new FileReader,{onload:()=>e(n.result.replace("data:application/octet-stream;base64,","")),onerror:()=>s(n.error)});n.readAsDataURL(new File([t],"",{type:"application/octet-stream"}))}):(0,n.bytesToBase64)(t)},s.decodeBase64=async function(e){const t=await fetch(`data:application/octet-stream;base64,${e}`);return new Uint8Array(await t.arrayBuffer())}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.cjs",{"./virtual-file/VirtualFile.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/VirtualFile.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getBytes=void 0;const n=e("@metamask/utils"),a=e("./virtual-file/VirtualFile.cjs");s.getBytes=function(e){const t=e instanceof a.VirtualFile?e.value:e;return"string"==typeof t?(0,n.stringToBytes)(t):t}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.SnapCaveatType=void 0,function(e){e.PermittedDerivationPaths="permittedDerivationPaths",e.PermittedCoinTypes="permittedCoinTypes",e.SnapCronjob="snapCronjob",e.TransactionOrigin="transactionOrigin",e.SignatureOrigin="signatureOrigin",e.RpcOrigin="rpcOrigin",e.KeyringOrigin="keyringOrigin",e.SnapIds="snapIds",e.ChainIds="chainIds",e.LookupMatchers="lookupMatchers",e.MaxRequestTime="maxRequestTime",e.ProtocolSnapScopes="protocolSnapScopes"}(n||(s.SnapCaveatType=n={}))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs",{"./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.checksumFiles=s.checksum=void 0;const n=e("@metamask/utils"),a=e("./bytes.cjs");async function r(e){return await(0,n.sha256)((0,a.getBytes)(e))}s.checksum=r,s.checksumFiles=async function(e){const t=await Promise.all([...e].sort((e,t)=>((0,n.assert)(e.path!==t.path,"Tried to sort files with non-unique paths."),e.path<t.path?-1:1)).map(async e=>r(e)));return r((0,n.concatBytes)(t))}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.MAX_FILE_SIZE=void 0,s.MAX_FILE_SIZE=64e6}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs",{"./time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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","cron-parser":"/home/runner/work/metamask-extension/metamask-extension/node_modules/cron-parser/lib/parser.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isCronjobSpecificationArray=s.CronjobSpecificationArrayStruct=s.isCronjobSpecification=s.CronjobSpecificationStruct=s.CronExpressionStruct=s.CronjobRpcRequestStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),r=e("@metamask/utils"),o=e("cron-parser"),i=e("./time.cjs");s.CronjobRpcRequestStruct=(0,a.object)({jsonrpc:(0,a.optional)(r.JsonRpcVersionStruct),id:(0,a.optional)(r.JsonRpcIdStruct),method:(0,a.string)(),params:(0,a.optional)(r.JsonRpcParamsStruct)}),s.CronExpressionStruct=(0,a.refine)((0,a.string)(),"cronjob expression",e=>{try{return(0,o.parseExpression)(e),!0}catch{return`Expected a cronjob expression, but received: "${e}"`}});const c=(0,a.object)({expression:s.CronExpressionStruct,request:s.CronjobRpcRequestStruct}),l=(0,a.object)({duration:i.ISO8601DurationStruct,request:s.CronjobRpcRequestStruct});s.CronjobSpecificationStruct=(0,n.selectiveUnion)(e=>(0,r.isObject)(e)&&(0,r.hasProperty)(e,"duration")?l:c),s.isCronjobSpecification=function(e){try{return(0,a.create)(e,s.CronjobSpecificationStruct),!0}catch{return!1}},s.CronjobSpecificationArrayStruct=(0,a.array)(s.CronjobSpecificationStruct),s.isCronjobSpecificationArray=function(e){try{return(0,a.create)(e,s.CronjobSpecificationArrayStruct),!0}catch{return!1}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/currency.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.currency=void 0;const n=e("@metamask/superstruct");s.currency=function(e){const t=e.toLowerCase();return(0,n.coerce)((0,n.literal)(t),(0,n.literal)(e.toUpperCase()),e=>(0,n.create)(e.toLowerCase(),(0,n.literal)(t)))}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/currency.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs",{rfdc:"/home/runner/work/metamask-extension/metamask-extension/node_modules/rfdc/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.deepClone=void 0;const a=n(e("rfdc"));s.deepClone=(0,a.default)({proto:!1,circles:!1})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_ENDOWMENTS=void 0,s.DEFAULT_ENDOWMENTS=Object.freeze(["atob","btoa","BigInt","console","crypto","Date","Math","setTimeout","clearTimeout","SubtleCrypto","TextDecoder","TextEncoder","URL","URLSearchParams","setInterval","clearInterval","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","isSecureContext","Intl","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","DataView","ArrayBuffer","AbortController","AbortSignal"])}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs",{"./array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs","@metamask/slip44":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/slip44/slip44.json"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.getSlip44ProtocolName=s.getSnapDerivationPathName=s.SNAPS_DERIVATION_PATHS=void 0;const a=n(e("@metamask/slip44")),r=e("./array.cjs");function o(e){var t;return"1"===String(e)?"Test Networks":(null===(t=a.default[e])||void 0===t?void 0:t.name)??null}s.SNAPS_DERIVATION_PATHS=[{path:["m","44'","0'"],curve:"ed25519",name:"Test BIP-32 Path (ed25519)"},{path:["m","44'","1'"],curve:"secp256k1",name:"Testnet"},{path:["m","44'","0'"],curve:"secp256k1",name:"Bitcoin Legacy"},{path:["m","49'","0'"],curve:"secp256k1",name:"Bitcoin Nested SegWit"},{path:["m","49'","1'"],curve:"secp256k1",name:"Bitcoin Testnet Nested SegWit"},{path:["m","84'","0'"],curve:"secp256k1",name:"Bitcoin Native SegWit"},{path:["m","84'","1'"],curve:"secp256k1",name:"Bitcoin Testnet Native SegWit"},{path:["m","86'","0'"],curve:"secp256k1",name:"Bitcoin Taproot"},{path:["m","86'","1'"],curve:"secp256k1",name:"Bitcoin Testnet Taproot"},{path:["m","44'","501'"],curve:"ed25519",name:"Solana"},{path:["m","44'","501'","0'","0'"],curve:"ed25519",name:"Solana"},{path:["m","44'","2'"],curve:"secp256k1",name:"Litecoin"},{path:["m","44'","3'"],curve:"secp256k1",name:"Dogecoin"},{path:["m","44'","60'"],curve:"secp256k1",name:"Ethereum"},{path:["m","44'","118'"],curve:"secp256k1",name:"Atom"},{path:["m","44'","145'"],curve:"secp256k1",name:"Bitcoin Cash"},{path:["m","44'","637'"],curve:"ed25519",name:"Aptos"},{path:["m","44'","714'"],curve:"secp256k1",name:"Binance (BNB)"},{path:["m","44'","784'"],curve:"ed25519",name:"Sui"},{path:["m","44'","931'"],curve:"secp256k1",name:"THORChain (RUNE)"},{path:["m","44'","330'"],curve:"secp256k1",name:"Terra (LUNA)"},{path:["m","44'","459'"],curve:"secp256k1",name:"Kava"},{path:["m","44'","529'"],curve:"secp256k1",name:"Secret Network"},{path:["m","44'","397'","0'"],curve:"ed25519",name:"NEAR Protocol"},{path:["m","44'","1'","0'"],curve:"ed25519",name:"Testnet"},{path:["m","44'","472'"],curve:"ed25519",name:"Arweave"},{path:["m","44'","12586'"],curve:"secp256k1",name:"Mina"},{path:["m","44'","242'"],curve:"ed25519",name:"Nimiq"},{path:["m","44'","1729'","0'","0'"],curve:"ed25519",name:"Tezos"},{path:["m","1789'","0'"],curve:"ed25519",name:"Vega"},{path:["m","1852'","1815'"],curve:"ed25519Bip32",name:"Cardano"},{path:["m","44'","508'","0'","0'","0'"],curve:"ed25519",name:"MultiversX"},{path:["m","44'","709'"],curve:"secp256k1",name:"Avail"},{path:["m","44'","626'"],curve:"ed25519",name:"Kadena"},{path:["m","44'","632'"],curve:"ed25519",name:"Massa"},{path:["m","44'","4218'"],curve:"ed25519",name:"IOTA"}],s.getSnapDerivationPathName=function(e,t){const n=s.SNAPS_DERIVATION_PATHS.find(s=>s.curve===t&&(0,r.isEqual)(s.path,e));if(n)return n.name;if("secp256k1"===t&&"m"===e[0]&&"44'"===e[1]&&e[2].endsWith("'")){return o(e[2].slice(0,-1))??null}return null},s.getSlip44ProtocolName=o}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.STATE_ENCRYPTION_MAGIC_VALUE=s.SIP_6_MAGIC_VALUE=void 0,s.SIP_6_MAGIC_VALUE="1399742832'",s.STATE_ENCRYPTION_MAGIC_VALUE="572232532'"}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/errors.cjs",{"@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){function n(e,t,s){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,s)}function a(e,t){return e.get(o(e,t))}function r(e,t,s){return e.set(o(e,t),s),s}function o(e,t,s){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:s;throw new TypeError("Private element is not present on this object")}Object.defineProperty(s,"__esModule",{value:!0}),s.TrackableErrorStruct=s.unwrapError=s.isWrappedSnapError=s.isSerializedSnapError=s.isSnapError=s.WrappedSnapError=s.SNAP_ERROR_WRAPPER_MESSAGE=s.SNAP_ERROR_WRAPPER_CODE=void 0;const i=e("@metamask/rpc-errors"),c=e("@metamask/snaps-sdk"),l=e("@metamask/superstruct"),u=e("@metamask/utils");s.SNAP_ERROR_WRAPPER_CODE=-31001,s.SNAP_ERROR_WRAPPER_MESSAGE="Wrapped Snap Error";var d=new WeakMap,m=new WeakMap,h=new WeakMap;class p extends Error{constructor(e){const t=(0,c.getErrorMessage)(e);super(t),n(this,d,void 0),n(this,m,void 0),n(this,h,void 0),r(d,this,e),r(m,this,t),r(h,this,(0,c.getErrorStack)(e)??undefined)}get name(){return"WrappedSnapError"}get message(){return a(m,this)}get stack(){return a(h,this)}toJSON(){const e=f(a(d,this))?a(d,this).serialize():(0,i.serializeCause)(a(d,this));return{code:s.SNAP_ERROR_WRAPPER_CODE,message:s.SNAP_ERROR_WRAPPER_MESSAGE,data:{cause:e}}}serialize(){return this.toJSON()}}function f(e){if((0,u.isObject)(e)&&"serialize"in e&&"function"==typeof e.serialize){const t=e.serialize();return(0,u.isJsonRpcError)(t)&&b(t)}return!1}function b(e){return e.code===c.SNAP_ERROR_CODE&&e.message===c.SNAP_ERROR_MESSAGE}function k(e){return(0,u.isJsonRpcError)(e)&&e.code===s.SNAP_ERROR_WRAPPER_CODE&&e.message===s.SNAP_ERROR_WRAPPER_MESSAGE}function g(e,t,s,n){const a=new i.JsonRpcError(e,t,n);return a.stack=s??undefined,a}s.WrappedSnapError=p,s.isSnapError=f,s.isSerializedSnapError=b,s.isWrappedSnapError=k,s.unwrapError=function(e){if(k(e)){if((0,u.isJsonRpcError)(e.data.cause)){if(b(e.data.cause)){const{code:t,message:s,stack:n,data:a}=e.data.cause.data.cause;return[g(t,s,n,a),!0]}if((0,u.isObject)(e.data.cause.data)&&(0,u.isObject)(e.data.cause.data.cause)&&e.data.cause.message===e.data.cause.data.cause.message){const t=e.data.cause.data.cause,{code:s,message:n}=e.data.cause;return[g(s,n,(0,c.getErrorStack)(t)),!1]}const{code:t,message:s,stack:n,data:a}=e.data.cause;return[g(t,s,n,a),!1]}return[g(i.errorCodes.rpc.internal,(0,c.getErrorMessage)(e.data.cause),(0,c.getErrorStack)(e.data.cause)),!1]}if((0,u.isJsonRpcError)(e)){const{code:t,message:s,stack:n,data:a}=e;return[g(t,s,n,a),!1]}return[g(i.errorCodes.rpc.internal,(0,c.getErrorMessage)(e),(0,c.getErrorStack)(e)),!1]},s.TrackableErrorStruct=(0,l.object)({name:(0,l.string)(),message:(0,l.string)(),stack:(0,l.nullable)((0,l.string)()),cause:(0,l.nullable)((0,l.lazy)(()=>s.TrackableErrorStruct))})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/asset-historical-price.cjs",{"../time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnAssetHistoricalPriceResponseStruct=s.AssetHistoricalPriceStruct=s.HistoricalPriceStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),r=e("../time.cjs");s.HistoricalPriceStruct=(0,n.nonEmptyRecord)((0,a.union)([(0,a.literal)("all"),r.ISO8601DurationStruct]),(0,a.array)((0,a.tuple)([(0,a.number)(),(0,a.string)()]))),s.AssetHistoricalPriceStruct=(0,a.nullable)((0,a.object)({intervals:s.HistoricalPriceStruct,updateTime:(0,a.number)(),expirationTime:(0,a.optional)((0,a.number)())})),s.OnAssetHistoricalPriceResponseStruct=(0,a.object)({historicalPrice:s.AssetHistoricalPriceStruct})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/asset-historical-price.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-conversion.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnAssetsConversionResponseStruct=s.AssetConversionStruct=void 0;const n=e("@metamask/superstruct"),a=e("@metamask/utils");s.AssetConversionStruct=(0,n.object)({rate:(0,n.string)(),conversionTime:(0,n.number)(),expirationTime:(0,n.optional)((0,n.number)())}),s.OnAssetsConversionResponseStruct=(0,n.object)({conversionRates:(0,n.record)(a.CaipAssetTypeStruct,(0,n.record)(a.CaipAssetTypeStruct,(0,n.nullable)(s.AssetConversionStruct)))})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-conversion.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-market-data.cjs",{"../time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnAssetsMarketDataResponseStruct=s.AssetMarketDataStruct=s.NonFungibleAssetMarketDataStruct=s.AssetValueStruct=s.FungibleAssetMarketDataStruct=s.PricePercentChangeStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),r=e("@metamask/utils"),o=e("../time.cjs");s.PricePercentChangeStruct=(0,n.nonEmptyRecord)((0,a.union)([(0,a.literal)("all"),o.ISO8601DurationStruct]),(0,a.number)()),s.FungibleAssetMarketDataStruct=(0,a.object)({fungible:(0,a.literal)(!0),marketCap:(0,a.optional)((0,a.string)()),totalVolume:(0,a.optional)((0,a.string)()),circulatingSupply:(0,a.optional)((0,a.string)()),allTimeHigh:(0,a.optional)((0,a.string)()),allTimeLow:(0,a.optional)((0,a.string)()),pricePercentChange:(0,a.optional)(s.PricePercentChangeStruct)}),s.AssetValueStruct=(0,a.object)({asset:r.CaipAssetTypeOrIdStruct,amount:(0,a.string)()}),s.NonFungibleAssetMarketDataStruct=(0,a.object)({fungible:(0,a.literal)(!1),lastSale:(0,a.optional)(s.AssetValueStruct),topBid:(0,a.optional)(s.AssetValueStruct),floorPrice:(0,a.optional)(s.AssetValueStruct),rarity:(0,a.optional)((0,a.object)({ranking:(0,a.optional)((0,a.object)({source:(0,a.string)(),rank:(0,a.number)()})),metadata:(0,a.optional)((0,a.record)((0,a.string)(),(0,a.number)()))}))}),s.AssetMarketDataStruct=(0,n.selectiveUnion)(e=>(0,r.isObject)(e)&&e.fungible?s.FungibleAssetMarketDataStruct:s.NonFungibleAssetMarketDataStruct),s.OnAssetsMarketDataResponseStruct=(0,a.object)({marketData:(0,a.record)(r.CaipAssetTypeOrIdStruct,(0,a.record)(r.CaipAssetTypeStruct,(0,a.nullable)(s.AssetMarketDataStruct)))})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-market-data.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/exports.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SNAP_EXPORT_NAMES=s.SNAP_EXPORTS=void 0;const n=e("./types.cjs");s.SNAP_EXPORTS={[n.HandlerType.OnRpcRequest]:{type:n.HandlerType.OnRpcRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnTransaction]:{type:n.HandlerType.OnTransaction,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnCronjob]:{type:n.HandlerType.OnCronjob,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnNameLookup]:{type:n.HandlerType.OnNameLookup,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnInstall]:{type:n.HandlerType.OnInstall,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnUpdate]:{type:n.HandlerType.OnUpdate,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnStart]:{type:n.HandlerType.OnStart,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnActive]:{type:n.HandlerType.OnActive,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnInactive]:{type:n.HandlerType.OnInactive,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnKeyringRequest]:{type:n.HandlerType.OnKeyringRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnHomePage]:{type:n.HandlerType.OnHomePage,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnSettingsPage]:{type:n.HandlerType.OnSettingsPage,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnSignature]:{type:n.HandlerType.OnSignature,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnUserInput]:{type:n.HandlerType.OnUserInput,required:!1,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetHistoricalPrice]:{type:n.HandlerType.OnAssetHistoricalPrice,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetsLookup]:{type:n.HandlerType.OnAssetsLookup,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetsConversion]:{type:n.HandlerType.OnAssetsConversion,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnAssetsMarketData]:{type:n.HandlerType.OnAssetsMarketData,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnProtocolRequest]:{type:n.HandlerType.OnProtocolRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnClientRequest]:{type:n.HandlerType.OnClientRequest,required:!0,validator:e=>"function"==typeof e},[n.HandlerType.OnWebSocketEvent]:{type:n.HandlerType.OnWebSocketEvent,required:!0,validator:e=>"function"==typeof e}},s.SNAP_EXPORT_NAMES=Object.values(n.HandlerType)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/exports.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnHomePageResponseStruct=s.OnHomePageResponseWithIdStruct=s.OnHomePageResponseWithContentStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct");s.OnHomePageResponseWithContentStruct=(0,a.object)({content:n.ComponentOrElementStruct}),s.OnHomePageResponseWithIdStruct=(0,a.object)({id:(0,a.string)()}),s.OnHomePageResponseStruct=(0,a.union)([s.OnHomePageResponseWithContentStruct,s.OnHomePageResponseWithIdStruct])}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/index.cjs",{"./asset-historical-price.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/asset-historical-price.cjs","./assets-conversion.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-conversion.cjs","./assets-market-data.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/assets-market-data.cjs","./exports.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/exports.cjs","./home-page.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs","./name-lookup.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/name-lookup.cjs","./settings-page.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/settings-page.cjs","./signature.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/signature.cjs","./transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./asset-historical-price.cjs"),s),a(e("./assets-conversion.cjs"),s),a(e("./assets-market-data.cjs"),s),a(e("./exports.cjs"),s),a(e("./home-page.cjs"),s),a(e("./name-lookup.cjs"),s),a(e("./settings-page.cjs"),s),a(e("./signature.cjs"),s),a(e("./transaction.cjs"),s),a(e("./types.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/name-lookup.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnNameLookupResponseStruct=s.DomainResolutionResponseStruct=s.AddressResolutionResponseStruct=s.DomainResolutionStruct=s.AddressResolutionStruct=void 0;const n=e("@metamask/superstruct");s.AddressResolutionStruct=(0,n.object)({protocol:(0,n.string)(),resolvedDomain:(0,n.string)()}),s.DomainResolutionStruct=(0,n.object)({protocol:(0,n.string)(),resolvedAddress:(0,n.string)(),domainName:(0,n.string)()}),s.AddressResolutionResponseStruct=(0,n.object)({resolvedDomains:(0,n.size)((0,n.array)(s.AddressResolutionStruct),1,Infinity)}),s.DomainResolutionResponseStruct=(0,n.object)({resolvedAddresses:(0,n.size)((0,n.array)(s.DomainResolutionStruct),1,Infinity)}),s.OnNameLookupResponseStruct=(0,n.nullable)((0,n.union)([s.AddressResolutionResponseStruct,s.DomainResolutionResponseStruct]))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/name-lookup.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/settings-page.cjs",{"./home-page.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/home-page.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnSettingsPageResponseStruct=void 0;const n=e("./home-page.cjs");s.OnSettingsPageResponseStruct=n.OnHomePageResponseStruct}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/settings-page.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/signature.cjs",{"./transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnSignatureResponseStruct=void 0;const n=e("./transaction.cjs");s.OnSignatureResponseStruct=n.OnTransactionResponseStruct}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/signature.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OnTransactionResponseStruct=s.OnTransactionResponseWithContentStruct=s.OnTransactionResponseWithIdStruct=s.OnTransactionSeverityResponseStruct=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct");s.OnTransactionSeverityResponseStruct=(0,a.object)({severity:(0,a.optional)((0,a.literal)(n.SeverityLevel.Critical))}),s.OnTransactionResponseWithIdStruct=(0,a.assign)(s.OnTransactionSeverityResponseStruct,(0,a.object)({id:(0,a.string)()})),s.OnTransactionResponseWithContentStruct=(0,a.assign)(s.OnTransactionSeverityResponseStruct,(0,a.object)({content:n.ComponentOrElementStruct})),s.OnTransactionResponseStruct=(0,a.nullable)((0,a.union)([s.OnTransactionResponseWithContentStruct,s.OnTransactionResponseWithIdStruct]))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/transaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.HandlerType=void 0,function(e){e.OnRpcRequest="onRpcRequest",e.OnSignature="onSignature",e.OnTransaction="onTransaction",e.OnCronjob="onCronjob",e.OnInstall="onInstall",e.OnUpdate="onUpdate",e.OnStart="onStart",e.OnActive="onActive",e.OnInactive="onInactive",e.OnNameLookup="onNameLookup",e.OnKeyringRequest="onKeyringRequest",e.OnHomePage="onHomePage",e.OnSettingsPage="onSettingsPage",e.OnUserInput="onUserInput",e.OnAssetsLookup="onAssetsLookup",e.OnAssetsConversion="onAssetsConversion",e.OnAssetHistoricalPrice="onAssetHistoricalPrice",e.OnAssetsMarketData="onAssetsMarketData",e.OnProtocolRequest="onProtocolRequest",e.OnClientRequest="onClientRequest",e.OnWebSocketEvent="onWebSocketEvent"}(n||(s.HandlerType=n={}))}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/icon.cjs",{"./svg.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/svg.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getSvgDimensions=s.assertIsSnapIcon=s.SVG_MAX_BYTE_SIZE_TEXT=s.SVG_MAX_BYTE_SIZE=void 0;const n=e("@metamask/utils"),a=e("./svg.cjs");s.SVG_MAX_BYTE_SIZE=1e5,s.SVG_MAX_BYTE_SIZE_TEXT=`${Math.floor(s.SVG_MAX_BYTE_SIZE/1e3)}kb`,s.assertIsSnapIcon=function(e){(0,n.assert)(e.path.endsWith(".svg"),'Expected snap icon to end in ".svg".');const t="string"==typeof e.value?(0,n.stringToBytes)(e.value).byteLength:e.value.byteLength;(0,n.assert)(t<=s.SVG_MAX_BYTE_SIZE,`The specified SVG icon exceeds the maximum size of ${s.SVG_MAX_BYTE_SIZE_TEXT}.`),(0,n.assert)((0,a.isSvg)(e.toString()),"Snap icon must be a valid SVG.")},s.getSvgDimensions=function(e){try{const t=(0,a.parseSvg)(e),s=t["@_height"],r=t["@_width"];if(s&&r)return{height:s,width:r};const o=t["@_viewBox"];if(o){const[e,t,s,a]=o.split(" ");if(s&&a){const e=parseInt(s,10),t=parseInt(a,10);return(0,n.assert)(Number.isInteger(e)&&e>0),(0,n.assert)(Number.isInteger(t)&&t>0),{width:e,height:t}}}}catch{throw new Error("Snap icon must be a valid SVG.")}return null}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/icon.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/iframe.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createWindow=void 0,s.createWindow=async function({uri:e,id:t,sandbox:s=!0,testId:n="snaps-iframe"}){return await new Promise((a,r)=>{const o=document.createElement("iframe");o.setAttribute("id",t),o.setAttribute("data-testid",n),s&&o.setAttribute("sandbox","allow-scripts"),o.setAttribute("src",e),document.body.appendChild(o),o.addEventListener("load",()=>{o.contentWindow?a(o.contentWindow):r(new Error(`iframe.contentWindow not present on load for job "${t}".`))},{once:!0})})}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/iframe.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/index.cjs",{"./account.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/account.cjs","./array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs","./auxiliary-files.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs","./base64.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/base64.cjs","./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/bytes.cjs","./caveats.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs","./checksum.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/constants.cjs","./cronjob.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs","./currency.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/currency.cjs","./deep-clone.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs","./default-endowments.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs","./derivation-paths.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs","./entropy.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs","./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/errors.cjs","./handlers/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/handlers/index.cjs","./iframe.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/iframe.cjs","./json-rpc.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs","./json.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.cjs","./localization.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs","./logging.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/logging.cjs","./manifest/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/index.cjs","./path.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/path.cjs","./platform-version.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/platform-version.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs","./strings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs","./structs.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs","./time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","./ui.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/ui.cjs","./url.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/url.cjs","./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/validation.cjs","./versions.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/versions.cjs","./virtual-file/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./account.cjs"),s),a(e("./array.cjs"),s),a(e("./auxiliary-files.cjs"),s),a(e("./base64.cjs"),s),a(e("./bytes.cjs"),s),a(e("./caveats.cjs"),s),a(e("./checksum.cjs"),s),a(e("./constants.cjs"),s),a(e("./cronjob.cjs"),s),a(e("./currency.cjs"),s),a(e("./deep-clone.cjs"),s),a(e("./default-endowments.cjs"),s),a(e("./derivation-paths.cjs"),s),a(e("./entropy.cjs"),s),a(e("./errors.cjs"),s),a(e("./handlers/index.cjs"),s),a(e("./iframe.cjs"),s),a(e("./json.cjs"),s),a(e("./json-rpc.cjs"),s),a(e("./localization.cjs"),s),a(e("./logging.cjs"),s),a(e("./manifest/index.cjs"),s),a(e("./path.cjs"),s),a(e("./platform-version.cjs"),s),a(e("./snaps.cjs"),s),a(e("./strings.cjs"),s),a(e("./structs.cjs"),s),a(e("./time.cjs"),s),a(e("./types.cjs"),s),a(e("./ui.cjs"),s),a(e("./url.cjs"),s),a(e("./validation.cjs"),s),a(e("./versions.cjs"),s),a(e("./virtual-file/index.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs",{"@metamask/permission-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/permission-controller/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.assertIsJsonRpcSuccess=s.isOriginAllowed=s.assertIsKeyringOrigins=s.KeyringOriginsStruct=s.assertIsRpcOrigins=s.RpcOriginsStruct=void 0;const n=e("@metamask/permission-controller"),a=e("@metamask/superstruct"),r=e("@metamask/utils"),o=(0,a.array)((0,a.refine)((0,a.string)(),"Allowed origin",e=>!(e.split("*").length-1>2)||'No more than two wildcards ("*") are allowed in an origin specifier.'));function i(e,t){if("*"===e||e===t)return!0;const s=function(e){const t=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&").replace(/\\\*/gu,".*");return RegExp(`^${t}$`,"u")}(e);return s.test(t)}s.RpcOriginsStruct=(0,a.refine)((0,a.object)({dapps:(0,a.optional)((0,a.boolean)()),snaps:(0,a.optional)((0,a.boolean)()),allowedOrigins:(0,a.optional)(o)}),"RPC origins",e=>!!Boolean(!0===e.snaps||!0===e.dapps||e.allowedOrigins&&e.allowedOrigins.length>0)||"Must specify at least one JSON-RPC origin."),s.assertIsRpcOrigins=function(e,t){(0,r.assertStruct)(e,s.RpcOriginsStruct,"Invalid JSON-RPC origins",t)},s.KeyringOriginsStruct=(0,a.object)({allowedOrigins:(0,a.optional)(o)}),s.assertIsKeyringOrigins=function(e,t){(0,r.assertStruct)(e,s.KeyringOriginsStruct,"Invalid keyring origins",t)},s.isOriginAllowed=function(e,t,s){var a;return"metamask"===s||(!(null===(a=e.allowedOrigins)||void 0===a||!a.some(e=>i(e,s)))||(!(t!==n.SubjectType.Website||!e.dapps)||Boolean(t===n.SubjectType.Snap&&e.snaps)))},s.assertIsJsonRpcSuccess=function(e){if(!(0,r.isJsonRpcSuccess)(e)){if((0,r.isJsonRpcFailure)(e))throw new Error(`JSON-RPC request failed: ${e.error.message}`);throw new Error("Invalid JSON-RPC response.")}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getJsonSizeUnsafe=s.parseJson=void 0;const n=e("@metamask/utils");s.parseJson=function(e){return(0,n.getSafeJson)(JSON.parse(e))},s.getJsonSizeUnsafe=function(e,t=!1){const s=JSON.stringify(e);return t?(new TextEncoder).encode(s).byteLength:s.length}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs",{"./json.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateSnapManifestLocalizations=s.getLocalizedSnapManifest=s.translate=s.TRANSLATION_REGEX=s.getLocalizationFile=s.getValidatedLocalizationFiles=s.LocalizationFileStruct=s.LOCALIZABLE_FIELDS=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),r=e("./json.cjs");function o(e,t){const s=t.find(t=>t.locale===e);return s||t.find(e=>"en"===e.locale)}function i(e,t){const n=e.matchAll(s.TRANSLATION_REGEX);return Array.from(n).reduce((s,[n,a])=>{if(!t)throw new Error(`Failed to translate "${e}": No localization file found.`);const r=t.messages[a.trim()];if(!r)throw new Error(`Failed to translate "${e}": No translation found for "${a.trim()}" in "${t.locale}" file.`);return s.replace(n,r.message)},e)}function c(e,t,n){const a=o(t,n);return s.LOCALIZABLE_FIELDS.reduce((e,t)=>{const s=i(e[t],a);return{...e,[t]:s}},e)}s.LOCALIZABLE_FIELDS=["description","proposedName"],s.LocalizationFileStruct=(0,a.object)({locale:(0,a.string)(),messages:(0,a.record)((0,a.string)(),(0,a.object)({message:(0,a.string)(),description:(0,a.optional)((0,a.string)())}))}),s.getValidatedLocalizationFiles=function(e){for(const t of e)try{t.result=(0,a.create)((0,r.parseJson)(t.toString()),s.LocalizationFileStruct)}catch(e){if(e instanceof a.StructError)throw new Error(`Failed to validate localization file "${t.path}": ${e.message}.`);if(e instanceof SyntaxError)throw new Error(`Failed to parse localization file "${t.path}" as JSON.`);throw e}return e},s.getLocalizationFile=o,s.TRANSLATION_REGEX=/\{\{\s?([a-zA-Z0-9-_\s]+)\s?\}\}/gu,s.translate=i,s.getLocalizedSnapManifest=c,s.validateSnapManifestLocalizations=function(e,t){try{t.filter(e=>"en"!==e.locale).forEach(s=>{c(e,s.locale,t)}),c(e,"en",t)}catch(e){throw new Error(`Failed to localize Snap manifest: ${(0,n.getErrorMessage)(e)}`)}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/logging.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.logWarning=s.logError=s.logInfo=s.snapsLogger=void 0;const n=e("@metamask/utils");s.snapsLogger=(0,n.createProjectLogger)("snaps"),s.logInfo=function(e,...t){console.log(e,...t)},s.logError=function(e,...t){console.error(e,...t)},s.logWarning=function(e,...t){console.warn(e,...t)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/logging.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/index.cjs",{"./validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./validation.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs",{"../array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/array.cjs","../cronjob.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/cronjob.cjs","../entropy.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/entropy.cjs","../json-rpc.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/json-rpc.cjs","../snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs","../structs.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","@metamask/key-tree":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/key-tree/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createSnapManifest=s.assertIsSnapManifest=s.isSnapManifest=s.SnapManifestStruct=s.InitialConnectionsStruct=s.SnapAuxilaryFilesStruct=s.SnapAuxiliaryFilesStruct=s.PermissionsStruct=s.EmptyObjectStruct=s.HandlerCaveatsStruct=s.ProtocolScopesStruct=s.MaxRequestTimeStruct=s.MAXIMUM_REQUEST_TIMEOUT=s.MINIMUM_REQUEST_TIMEOUT=s.LookupMatchersStruct=s.ChainIdsStruct=s.SnapIdsStruct=s.SemVerRangeStruct=s.SnapGetBip32EntropyPermissionsStruct=s.Bip32EntropyStruct=s.CurveStruct=s.bip32entropy=s.Bip32PathStruct=s.FORBIDDEN_COIN_TYPES=void 0;const n=e("@metamask/key-tree"),a=e("@metamask/superstruct"),r=e("@metamask/utils"),o=e("../array.cjs"),i=e("../cronjob.cjs"),c=e("../entropy.cjs"),l=e("../json-rpc.cjs"),u=e("../snaps.cjs"),d=e("../structs.cjs"),m=e("../types.cjs"),h=[c.SIP_6_MAGIC_VALUE,c.STATE_ENCRYPTION_MAGIC_VALUE];s.FORBIDDEN_COIN_TYPES=[60];const p=s.FORBIDDEN_COIN_TYPES.map(e=>["m","44'",`${e}'`]);s.Bip32PathStruct=(0,a.refine)((0,a.array)((0,a.string)()),"BIP-32 path",e=>0===e.length?"Path must be a non-empty BIP-32 derivation path array":"m"!==e[0]?'Path must start with "m".':e.length<3?"Paths must have a length of at least three.":e.slice(1).some(e=>!(0,n.isValidBIP32PathSegment)(e))?"Path must be a valid BIP-32 derivation path array.":h.includes(e[1])?`The purpose "${e[1]}" is not allowed for entropy derivation.`:!p.some(t=>(0,o.isEqual)(e.slice(0,t.length),t))||`The path "${e.join("/")}" is not allowed for entropy derivation.`);s.bip32entropy=e=>(0,a.refine)(e,"BIP-32 entropy",e=>"ed25519"!==e.curve||!e.path.slice(1).some(e=>!e.endsWith("'"))||"Ed25519 does not support unhardened paths."),s.CurveStruct=(0,a.enums)(["ed25519","secp256k1","ed25519Bip32"]),s.Bip32EntropyStruct=(0,s.bip32entropy)((0,a.type)({path:s.Bip32PathStruct,curve:s.CurveStruct})),s.SnapGetBip32EntropyPermissionsStruct=(0,a.size)((0,a.array)(s.Bip32EntropyStruct),1,Infinity),s.SemVerRangeStruct=(0,a.refine)((0,a.string)(),"SemVer range",e=>!!(0,r.isValidSemVerRange)(e)||"Expected a valid SemVer range."),s.SnapIdsStruct=(0,a.refine)((0,a.record)(u.SnapIdStruct,(0,a.object)({version:(0,a.optional)(s.SemVerRangeStruct)})),"SnapIds",e=>0!==Object.keys(e).length),s.ChainIdsStruct=(0,a.size)((0,a.array)(r.CaipChainIdStruct),1,Infinity),s.LookupMatchersStruct=(0,a.union)([(0,a.object)({tlds:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity)}),(0,a.object)({schemes:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity)}),(0,a.object)({tlds:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity),schemes:(0,a.size)((0,a.array)((0,a.string)()),1,Infinity)})]),s.MINIMUM_REQUEST_TIMEOUT=(0,r.inMilliseconds)(5,r.Duration.Second),s.MAXIMUM_REQUEST_TIMEOUT=(0,r.inMilliseconds)(3,r.Duration.Minute),s.MaxRequestTimeStruct=(0,a.size)((0,a.integer)(),s.MINIMUM_REQUEST_TIMEOUT,s.MAXIMUM_REQUEST_TIMEOUT),s.ProtocolScopesStruct=(0,a.record)(r.CaipChainIdStruct,(0,a.object)({methods:(0,a.array)((0,a.string)())})),s.HandlerCaveatsStruct=(0,a.object)({maxRequestTime:(0,a.optional)(s.MaxRequestTimeStruct)}),s.EmptyObjectStruct=(0,a.object)({}),s.PermissionsStruct=(0,a.type)({"endowment:assets":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({scopes:s.ChainIdsStruct}))),"endowment:cronjob":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({jobs:(0,a.optional)(i.CronjobSpecificationArrayStruct)}))),"endowment:ethereum-provider":(0,a.optional)(s.EmptyObjectStruct),"endowment:keyring":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,l.KeyringOriginsStruct)),"endowment:protocol":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({scopes:s.ProtocolScopesStruct}))),"endowment:lifecycle-hooks":(0,a.optional)(s.HandlerCaveatsStruct),"endowment:name-lookup":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({chains:(0,a.optional)(s.ChainIdsStruct),matchers:(0,a.optional)(s.LookupMatchersStruct)}))),"endowment:network-access":(0,a.optional)(s.EmptyObjectStruct),"endowment:page-home":(0,a.optional)(s.HandlerCaveatsStruct),"endowment:rpc":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,l.RpcOriginsStruct)),"endowment:signature-insight":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({allowSignatureOrigin:(0,a.optional)((0,a.boolean)())}))),"endowment:transaction-insight":(0,a.optional)((0,d.mergeStructs)(s.HandlerCaveatsStruct,(0,a.object)({allowTransactionOrigin:(0,a.optional)((0,a.boolean)())}))),"endowment:webassembly":(0,a.optional)(s.EmptyObjectStruct),snap_dialog:(0,a.optional)(s.EmptyObjectStruct),snap_manageState:(0,a.optional)(s.EmptyObjectStruct),snap_manageAccounts:(0,a.optional)(s.EmptyObjectStruct),snap_notify:(0,a.optional)(s.EmptyObjectStruct),snap_getBip32Entropy:(0,a.optional)(s.SnapGetBip32EntropyPermissionsStruct),snap_getBip32PublicKey:(0,a.optional)(s.SnapGetBip32EntropyPermissionsStruct),snap_getBip44Entropy:(0,a.optional)((0,a.size)((0,a.array)((0,a.object)({coinType:(0,a.size)((0,a.integer)(),0,2**32-1)})),1,Infinity)),snap_getEntropy:(0,a.optional)(s.EmptyObjectStruct),snap_getLocale:(0,a.optional)(s.EmptyObjectStruct),wallet_snap:(0,a.optional)(s.SnapIdsStruct)}),s.SnapAuxiliaryFilesStruct=(0,a.array)((0,a.string)()),s.SnapAuxilaryFilesStruct=s.SnapAuxiliaryFilesStruct,s.InitialConnectionsStruct=(0,a.record)((0,a.intersection)([(0,a.string)(),(0,m.uri)()]),(0,a.object)({})),s.SnapManifestStruct=(0,a.object)({version:r.VersionStruct,description:(0,a.size)((0,a.string)(),1,280),proposedName:(0,a.size)((0,a.string)(),1,214),repository:(0,a.optional)((0,a.type)({type:(0,a.size)((0,a.string)(),1,Infinity),url:(0,a.size)((0,a.string)(),1,Infinity)})),source:(0,a.object)({shasum:r.ChecksumStruct,location:(0,a.object)({npm:(0,a.object)({filePath:(0,a.size)((0,a.string)(),1,Infinity),iconPath:(0,a.optional)((0,a.size)((0,a.string)(),1,Infinity)),packageName:m.NameStruct,registry:(0,a.union)([(0,a.literal)("https://registry.npmjs.org"),(0,a.literal)("https://registry.npmjs.org/")])})}),files:(0,a.optional)(s.SnapAuxiliaryFilesStruct),locales:(0,a.optional)(s.SnapAuxiliaryFilesStruct)}),initialConnections:(0,a.optional)(s.InitialConnectionsStruct),initialPermissions:s.PermissionsStruct,manifestVersion:(0,a.literal)("0.1"),platformVersion:(0,a.optional)(r.VersionStruct),$schema:(0,a.optional)((0,a.string)())}),s.isSnapManifest=function(e){return(0,a.is)(e,s.SnapManifestStruct)},s.assertIsSnapManifest=function(e){(0,r.assertStruct)(e,s.SnapManifestStruct,`"${m.NpmSnapFileNames.Manifest}" is invalid`)},s.createSnapManifest=function(e){return(0,a.create)(e,s.SnapManifestStruct)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/path.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.normalizeRelative=void 0;const n=e("@metamask/utils");s.normalizeRelative=function(e){return(0,n.assert)(!e.startsWith("/")),(0,n.assert)(-1===e.search(/:|\/\//u),`Path "${e}" potentially an URI instead of local relative`),e.startsWith("./")?e.slice(2):e}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/path.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/platform-version.cjs",{"@metamask/snaps-sdk/package.json":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/package.json"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.getPlatformVersion=void 0;const a=n(e("@metamask/snaps-sdk/package.json"));s.getPlatformVersion=function(){return a.default.version}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/platform-version.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs",{"./caveats.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/caveats.cjs","./checksum.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/checksum.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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","@scure/base":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@scure/base/lib/index.js","fast-json-stable-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-json-stable-stringify/index.js","validate-npm-package-name":"/home/runner/work/metamask-extension/metamask-extension/node_modules/validate-npm-package-name/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.verifyRequestedSnapPermissions=s.isSnapPermitted=s.assertIsValidSnapId=s.isSnapId=s.stripSnapPrefix=s.getSnapPrefix=s.SnapIdStruct=s.SnapIdPrefixStruct=s.HttpSnapIdStruct=s.NpmSnapIdStruct=s.LocalSnapIdStruct=s.BaseSnapIdStruct=s.LOCALHOST_HOSTNAMES=s.validateSnapShasum=s.getSnapChecksum=s.SnapStatusEvents=s.SnapStatus=s.PROPOSED_NAME_REGEX=void 0;const a=e("@metamask/snaps-sdk"),r=e("@metamask/superstruct"),o=e("@metamask/utils"),i=e("@scure/base"),c=n(e("fast-json-stable-stringify")),l=n(e("validate-npm-package-name")),u=e("./caveats.cjs"),d=e("./checksum.cjs"),m=e("./types.cjs");var h,p;function f(e){const t=e.clone();return delete t.result.source.shasum,t.value=(0,c.default)(t.result),t}async function b(e){const{manifest:t,sourceCode:s,svgIcon:n,auxiliaryFiles:a,localizationFiles:r}=e,o=[f(t),s,n,...a,...r].filter(e=>e!==undefined);return i.base64.encode(await(0,d.checksumFiles)(o))}s.PROPOSED_NAME_REGEX=/^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u,function(e){e.Installing="installing",e.Updating="updating",e.Running="running",e.Stopped="stopped",e.Crashed="crashed"}(h||(s.SnapStatus=h={})),function(e){e.Start="START",e.Stop="STOP",e.Crash="CRASH",e.Update="UPDATE"}(p||(s.SnapStatusEvents=p={})),s.getSnapChecksum=b,s.validateSnapShasum=async function(e,t="Invalid Snap manifest: manifest shasum does not match computed shasum."){if(e.manifest.result.source.shasum!==await b(e))throw new Error(t)},s.LOCALHOST_HOSTNAMES=["localhost","127.0.0.1","[::1]"],s.BaseSnapIdStruct=(0,o.definePattern)("Base Snap Id",/^[\x21-\x7E]*$/u);const k=(0,m.uri)({protocol:(0,r.enums)(["http:","https:"]),hostname:(0,r.enums)(s.LOCALHOST_HOSTNAMES),hash:(0,r.empty)((0,r.string)()),search:(0,r.empty)((0,r.string)())});function g(e){const t=Object.values(m.SnapIdPrefixes).find(t=>e.startsWith(t));if(t!==undefined)return t;throw new Error(`Invalid or no prefix found for "${e}"`)}s.LocalSnapIdStruct=(0,r.refine)(s.BaseSnapIdStruct,"local Snap Id",e=>{if(!e.startsWith(m.SnapIdPrefixes.local))return`Expected local snap ID, got "${e}".`;const[t]=(0,r.validate)(e.slice(m.SnapIdPrefixes.local.length),k);return t??!0}),s.NpmSnapIdStruct=(0,r.intersection)([s.BaseSnapIdStruct,(0,m.uri)({protocol:(0,r.literal)(m.SnapIdPrefixes.npm),pathname:(0,r.refine)((0,r.string)(),"package name",function*(e){const t=e.startsWith("/")?e.slice(1):e,{errors:s,validForNewPackages:n,warnings:a}=(0,l.default)(t);return n||(s===undefined?((0,o.assert)(a!==undefined),yield*a):yield*s),!0}),search:(0,r.empty)((0,r.string)()),hash:(0,r.empty)((0,r.string)())})]),s.HttpSnapIdStruct=(0,r.intersection)([s.BaseSnapIdStruct,(0,m.uri)({protocol:(0,r.enums)(["http:","https:"]),search:(0,r.empty)((0,r.string)()),hash:(0,r.empty)((0,r.string)())})]),s.SnapIdPrefixStruct=(0,r.refine)((0,r.string)(),"Snap ID prefix",e=>{if(Object.values(m.SnapIdPrefixes).some(t=>e.startsWith(t)))return!0;return`Invalid or no prefix found. Expected Snap ID to start with one of: ${Object.values(m.SnapIdPrefixes).map(e=>`"${e}"`).join(", ")}, but received: "${e}"`}),s.SnapIdStruct=(0,a.selectiveUnion)(e=>"string"==typeof e&&e.startsWith(m.SnapIdPrefixes.npm)?s.NpmSnapIdStruct:"string"==typeof e&&e.startsWith(m.SnapIdPrefixes.local)?s.LocalSnapIdStruct:s.SnapIdPrefixStruct),s.getSnapPrefix=g,s.stripSnapPrefix=function(e){return e.replace(g(e),"")},s.isSnapId=function(e){return(0,r.is)(e,s.SnapIdStruct)},s.assertIsValidSnapId=function(e){(0,o.assertStruct)(e,s.SnapIdStruct,"Invalid snap ID")},s.isSnapPermitted=function(e,t){var s,n;return Boolean(null===(s=((null==e||null===(n=e.wallet_snap)||void 0===n||null===(n=n.caveats)||void 0===n?void 0:n.find(e=>e.type===u.SnapCaveatType.SnapIds))??{}).value)||void 0===s?void 0:s[t])},s.verifyRequestedSnapPermissions=function(e){(0,o.assert)((0,o.isObject)(e),"Requested permissions must be an object.");const{wallet_snap:t}=e;(0,o.assert)((0,o.isObject)(t),"wallet_snap is missing from the requested permissions.");const{caveats:s}=t;(0,o.assert)(Array.isArray(s)&&1===s.length,"wallet_snap must have a caveat property with a single-item array value.");const[n]=s;(0,o.assert)((0,o.isObject)(n)&&n.type===u.SnapCaveatType.SnapIds&&(0,o.isObject)(n.value),`The requested permissions do not have a valid ${u.SnapCaveatType.SnapIds} caveat.`)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.indent=void 0,s.indent=function(e,t=2){return e.replace(/^/gmu," ".repeat(t))}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs",{"./strings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/strings.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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",chalk:"/home/runner/work/metamask-extension/metamask-extension/node_modules/chalk/source/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.mergeStructs=s.createUnion=s.validateUnion=s.getStructErrorMessage=s.getStructFailureMessage=s.getStructErrorPrefix=s.getUnionStructNames=s.getStructFromPath=s.createFromStruct=s.getError=s.arrayToGenerator=s.SnapsStructError=s.named=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),r=e("@metamask/utils"),o=e("chalk"),i=e("./strings.cjs");function c(e,t,s){return s?t(e):e}s.named=function(e,t){return new a.Struct({...t,type:e})};class l extends a.StructError{constructor(e,t,s,n,a,r=!0){super(n,a),this.name="SnapsStructError",this.message=`${t}.\n\n${b(e,[...a()],r)}${s?`\n\n${s}`:""}`}}function*u(e){for(const t of e)yield t}function d({struct:e,prefix:t,suffix:s="",error:n,colorize:a}){return new l(e,t,s,n,()=>u(n.failures()),a)}function m(e,t){return t.reduce((t,s)=>(0,r.isObject)(e.schema)&&e.schema[s]?e.schema[s]:t,e)}function h(e,t=!0){return Array.isArray(e.schema)?e.schema.map(({type:e})=>c(e,o.green,t)):null}function p(e,t=!0){return"never"===e.type||0===e.path.length?"":`At path: ${c(e.path.join("."),o.bold,t)} — `}function f(e,t,s=!0){const n=c(JSON.stringify(t.value),o.red,s),a=p(t,s);if("union"===t.type){const r=h(m(e,t.path),s);return r?`${a}Expected the value to be one of: ${r.join(", ")}, but received: ${n}.`:`${a}${t.message}.`}if("literal"===t.type){return`${a}${t.message.replace(/the literal `(.+)`,/u,`the value to be \`${c("$1",o.green,s)}\`,`).replace(/, but received: (.+)/u,`, but received: ${c("$1",o.red,s)}`)}.`}if("never"===t.type)return`Unknown key: ${c(t.path.join("."),o.bold,s)}, received: ${n}.`;if("size"===t.refinement){return`${a}${t.message.replace(/length between `(\d+)` and `(\d+)`/u,`length between ${c("$1",o.green,s)} and ${c("$2",o.green,s)},`).replace(/length of `(\d+)`/u,`length of ${c("$1",o.red,s)}`).replace(/a array/u,"an array")}.`}return t.refinement!==undefined?`${a}${t.message}.`:`${a}Expected a value of type ${c(t.type,o.green,s)}, but received: ${n}.`}function b(e,t,s=!0){return t.map(t=>(0,i.indent)(`• ${f(e,t,s)}`)).join("\n")}function k(e,t,s,o=!1){(0,r.assert)(t.schema,"Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`."),(0,r.assert)(t.schema.length>0,"Expected a non-empty array of structs.");const i=t.schema.map(e=>e.schema[s]),c=(0,a.type)({[s]:(0,n.union)(i)}),[l]=(0,a.validate)(e,c,{coerce:o});if(l)throw new Error(f(c,l.failures()[0],!1));const u=e,d=t.schema.filter(e=>(0,a.is)(u[s],e.schema[s]));(0,r.assert)(d.length>0,"Expected a struct to match the value.");const m=d.map(e=>(0,a.validate)(u,e,{coerce:o})),h=m.find(([e])=>!e);if(h)return h[1];(0,r.assert)(m[0][0],"Expected at least one error.");const p=m.reduce((e,[t])=>((0,r.assert)(t,"Expected an error."),t.failures().length<e.failures().length?t:e),m[0][0]);throw new Error(f(t,p.failures()[0],!1))}s.SnapsStructError=l,s.arrayToGenerator=u,s.getError=d,s.createFromStruct=function(e,t,s,n=""){try{return(0,a.create)(e,t)}catch(e){if(e instanceof a.StructError)throw d({struct:t,prefix:s,suffix:n,error:e});throw e}},s.getStructFromPath=m,s.getUnionStructNames=h,s.getStructErrorPrefix=p,s.getStructFailureMessage=f,s.getStructErrorMessage=b,s.validateUnion=k,s.createUnion=function(e,t,s){return k(e,t,s,!0)},s.mergeStructs=function(...e){const t=a.assign(...e);return new a.Struct({...t,*refiner(t,s){for(const n of e)yield*n.refiner(t,s)}})}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/structs.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/svg.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","fast-xml-parser":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-xml-parser/lib/fxp.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isSvg=s.parseSvg=void 0;const n=e("@metamask/utils"),a=e("fast-xml-parser");function r(e){try{const t=e.trim();(0,n.assert)(t.length>0);const s=new a.XMLParser({ignoreAttributes:!1,parseAttributeValue:!0}).parse(t,!0);return(0,n.assert)((0,n.hasProperty)(s,"svg")),(0,n.isObject)(s.svg)?s.svg:{}}catch{throw new Error("Snap icon must be a valid SVG.")}}s.parseSvg=r,s.isSvg=function(e){try{return r(e),!0}catch{return!1}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/svg.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs",luxon:"/home/runner/work/metamask-extension/metamask-extension/node_modules/luxon/build/cjs-browser/luxon.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ISO8601DateStruct=s.toCensoredISO8601String=s.ISO8601DurationStruct=void 0;const n=e("@metamask/superstruct"),a=e("luxon");s.ISO8601DurationStruct=(0,n.refine)((0,n.string)(),"ISO 8601 duration",e=>!!a.Duration.fromISO(e).isValid||"Not a valid ISO 8601 duration"),s.toCensoredISO8601String=function(e){return a.DateTime.fromISO(e,{setZone:!0}).startOf("second").toISO({suppressMilliseconds:!0})};var r=e("@metamask/snaps-sdk");Object.defineProperty(s,"ISO8601DateStruct",{enumerable:!0,get:function(){return r.ISO8601DateStruct}})}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/time.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs",{"@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.WALLET_SNAP_PERMISSION_KEY=s.isValidUrl=s.uri=s.SNAP_STREAM_NAMES=s.SnapIdPrefixes=s.NpmSnapPackageJsonStruct=s.NameStruct=s.NpmSnapFileNames=void 0;const n=e("@metamask/snaps-sdk"),a=e("@metamask/superstruct"),r=e("@metamask/utils");var o,i,c;!function(e){e.PackageJson="package.json",e.Manifest="snap.manifest.json"}(o||(s.NpmSnapFileNames=o={})),s.NameStruct=(0,a.size)((0,r.definePattern)("Snap Name",/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u),1,214),s.NpmSnapPackageJsonStruct=(0,a.type)({version:r.VersionStruct,name:s.NameStruct,main:(0,a.optional)((0,a.size)((0,a.string)(),1,Infinity)),repository:(0,a.optional)((0,a.type)({type:(0,a.size)((0,a.string)(),1,Infinity),url:(0,a.size)((0,a.string)(),1,Infinity)}))}),function(e){e.npm="npm:",e.local="local:"}(i||(s.SnapIdPrefixes=i={})),function(e){e.JSON_RPC="jsonRpc",e.COMMAND="command"}(c||(s.SNAP_STREAM_NAMES=c={}));var l=e("@metamask/snaps-sdk");Object.defineProperty(s,"uri",{enumerable:!0,get:function(){return l.uri}}),s.isValidUrl=function(e,t={}){return(0,a.is)(e,(0,n.uri)(t))},s.WALLET_SNAP_PERMISSION_KEY="wallet_snap"}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/ui.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/types.cjs","./url.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/url.cjs","@metamask/snaps-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/dist/index.cjs","@metamask/snaps-sdk/jsx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/jsx.js","@metamask/snaps-sdk/jsx-runtime":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/snaps-sdk/jsx-runtime.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",marked:"/home/runner/work/metamask-extension/metamask-extension/node_modules/marked/lib/marked.umd.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.serialiseJsx=s.walkJsx=s.getJsxChildren=s.hasChildren=s.getTotalTextLength=s.validateJsxElements=s.validateAssetSelector=s.validateTextLinks=s.validateLink=s.getJsxElementFromComponent=s.getTextChildren=void 0;const n=e("@metamask/snaps-sdk/jsx-runtime"),a=e("@metamask/snaps-sdk"),r=e("@metamask/snaps-sdk/jsx"),o=e("@metamask/utils"),i=e("marked"),c=e("./types.cjs"),l=e("./url.cjs"),u=["https:","mailto:","metamask:"];function d(e){switch(e){case"primary":return"primary";case"secondary":return"destructive";default:return undefined}}function m(e){return 1===e.length?e[0]:e}function h(e){return e.tokens&&e.tokens.length>0?m(e.tokens.flatMap(f)):e.href}function p(e){return m(e.flatMap(f))}function f(e){switch(e.type){case"link":return(0,n.jsx)(r.Link,{href:e.href,children:h(e)});case"text":return e.text;case"strong":return(0,n.jsx)(r.Bold,{children:p(e.tokens)});case"em":return(0,n.jsx)(r.Italic,{children:p(e.tokens)});default:return null}}function b(e){const t=(0,i.lexer)(e,{gfm:!1}),s=[];return(0,i.walkTokens)(t,e=>{if("paragraph"===e.type){s.length>0&&s.push("\n\n");const{tokens:t}=e;s.push(...t.flatMap(f))}}),s.filter(e=>null!==e)}function k(e,t,s){try{const n=new URL(e);if((0,o.assert)(u.includes(n.protocol),`Protocol must be one of: ${u.join(", ")}.`),"metamask:"===n.protocol){const t=(0,l.parseMetaMaskUrl)(e);t.snapId&&(0,o.assert)(s(t.snapId),"The Snap being navigated to is not installed.")}else if("mailto:"===n.protocol){const e=n.pathname.split(",");for(const s of e){const e=s.split("@")[1];(0,o.assert)(!e.includes(":"));const n=`https://${e}`;(0,o.assert)(!t(n),"The specified URL is not allowed.")}return}(0,o.assert)(!t(n.href),"The specified URL is not allowed.")}catch(e){throw new Error(`Invalid URL: ${"ERR_ASSERTION"===(null==e?void 0:e.code)?e.message:"Unable to parse URL."}`)}}function g(e,t){const s=t(e);(0,o.assert)(s,`Could not find account for address: ${e}`)}function w(e){const{type:t}=e;switch(t){case a.NodeType.Panel:return e.children.reduce((e,t)=>e+w(t),0);case a.NodeType.Row:return w(e.value);case a.NodeType.Text:return e.value.length;default:return 0}}function x(e){return(0,o.hasProperty)(e.props,"children")}function v(e){return Boolean(e)&&!0!==e}function y(e){if(x(e)){if(Array.isArray(e.props.children))return e.props.children.filter(v).flat(Infinity);if(e.props.children)return[e.props.children]}return[]}function _(e,t,s=0){if(Array.isArray(e)){for(const n of e){const e=_(n,t,s);if(e!==undefined)return e}return undefined}const n=t(e,s);if(n!==undefined)return n;if((0,o.hasProperty)(e,"props")&&(0,o.isPlainObject)(e.props)&&(0,o.hasProperty)(e.props,"children")){const n=y(e);for(const e of n)if((0,o.isPlainObject)(e)){const n=_(e,t,s+1);if(n!==undefined)return n}}return undefined}function S(e){return Object.entries(e).filter(([e])=>"children"!==e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{return` ${e}=${s=t,"string"==typeof s?`"${s}"`:`{${JSON.stringify(s)}}`}`;var s}).join("")}s.getTextChildren=b,s.getJsxElementFromComponent=function(e){return function(e){const t=w(e);(0,o.assert)(t<=5e4,"The text in a Snap UI may not be larger than 50 kB.")}(e),function e(t){switch(t.type){case a.NodeType.Address:return(0,n.jsx)(r.Address,{address:t.value});case a.NodeType.Button:return(0,n.jsx)(r.Button,{name:t.name,variant:d(t.variant),type:t.buttonType,children:t.value});case a.NodeType.Copyable:return(0,n.jsx)(r.Copyable,{value:t.value,sensitive:t.sensitive});case a.NodeType.Divider:return(0,n.jsx)(r.Divider,{});case a.NodeType.Form:return(0,n.jsx)(r.Form,{name:t.name,children:m(t.children.map(e))});case a.NodeType.Heading:return(0,n.jsx)(r.Heading,{children:t.value});case a.NodeType.Image:return(0,n.jsx)(r.Image,{src:t.value});case a.NodeType.Input:return(0,n.jsx)(r.Field,{label:t.label,error:t.error,children:(0,n.jsx)(r.Input,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case a.NodeType.Panel:return(0,n.jsx)(r.Box,{children:m(t.children.map(e))});case a.NodeType.Row:return(0,n.jsx)(r.Row,{label:t.label,variant:t.variant,children:e(t.value)});case a.NodeType.Spinner:return(0,n.jsx)(r.Spinner,{});case a.NodeType.Text:return(0,n.jsx)(r.Text,{children:m(b(t.value))});default:return(0,o.assertExhaustive)(t)}}(e)},s.validateLink=k,s.validateTextLinks=function(e,t,s){const n=function(e){const t=(0,i.lexer)(e,{gfm:!1}),s=[];return(0,i.walkTokens)(t,e=>{"link"===e.type&&s.push(e)}),s}(e);for(const e of n)k(e.href,t,s)},s.validateAssetSelector=g,s.validateJsxElements=function(e,{isOnPhishingList:t,getSnap:s,getAccountByAddress:n,hasPermission:a}){_(e,e=>{switch(e.type){case"Link":k(e.props.href,t,s);break;case"AssetSelector":g(e.props.addresses[0],n);break;case"Image":{const{src:t}=e.props,s=(0,c.isValidUrl)(t);(0,o.assert)(!s||s&&a("endowment:network-access"),"Using external images is only permitted with the `endowment:network-access` permission.");break}}})},s.getTotalTextLength=w,s.hasChildren=x,s.getJsxChildren=y,s.walkJsx=_,s.serialiseJsx=function e(t,s=0){if(Array.isArray(t))return t.map(t=>e(t,s)).join("");const n="  ".repeat(s);if("string"==typeof t)return`${n}${t}\n`;if(!t)return"";const{type:a,props:r}=t,i=s>0?"\n":"";if((0,o.hasProperty)(r,"children")){const t=e(r.children,s+1);return`${n}<${a}${S(r)}>\n${t}${n}</${a}>${i}`}return`${n}<${a}${S(r)} />${i}`}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/ui.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/url.cjs",{"./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.parseMetaMaskUrl=s.SNAP_PATHS=s.CLIENT_PATHS=void 0;const n=e("@metamask/utils"),a=e("./snaps.cjs");s.CLIENT_PATHS=["/"],s.SNAP_PATHS=["/home"],s.parseMetaMaskUrl=function(e){const t=new URL(e),{protocol:r}=t;if("metamask:"!==r)throw new Error(`Unable to parse URL. Expected the protocol to be "metamask:", but received "${r}".`);const[o,...i]=t.href.replace("metamask://","").split("/"),c=`/${i.join("/")}`;switch(o){case"client":return(0,n.assert)(s.CLIENT_PATHS.includes(c),`Unable to navigate to "${c}". The provided path is not allowed.`),{authority:o,path:c};case"snap":return function(e){const t="Invalid MetaMask url:",r=(0,a.stripSnapPrefix)(e.slice(1)),o=e.slice(1).startsWith("npm:")?"npm:":"local:",i=r.startsWith("@"),c=r.split("/"),l=`/${c[c.length-1]}`;let u;if("local:"===o){const[e,,...a]=c.slice(0,-1);u=`${e}//${a.join("/")}`,(0,n.assert)(s.SNAP_PATHS.includes(l),`${t} invalid snap path.`)}else u=i?`${c[0]}/${c[1]}`:c[0],(0,n.assert)(i?3===c.length&&s.SNAP_PATHS.includes(l):2===c.length&&s.SNAP_PATHS.includes(l),`${t} invalid snap path.`);const d=`${o}${u}`;return(0,a.assertIsValidSnapId)(d),{authority:"snap",snapId:d,path:l}}(c);default:throw new Error(`Expected "metamask:" URL to start with "client" or "snap", but received "${o}".`)}}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/url.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/validation.cjs",{"./icon.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/icon.cjs","./localization.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/localization.cjs","./manifest/validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/manifest/validation.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/snaps.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateFetchedSnap=void 0;const n=e("./icon.cjs"),a=e("./localization.cjs"),r=e("./manifest/validation.cjs"),o=e("./snaps.cjs");s.validateFetchedSnap=async function(e){(0,r.assertIsSnapManifest)(e.manifest.result),await(0,o.validateSnapShasum)(e),(0,a.validateSnapManifestLocalizations)(e.manifest.result,e.localizationFiles.map(e=>e.result)),e.svgIcon&&(0,n.assertIsSnapIcon)(e.svgIcon)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/validation.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/versions.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",semver:"/home/runner/work/metamask-extension/metamask-extension/node_modules/semver/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.resolveVersionRange=s.getTargetVersion=s.DEFAULT_REQUESTED_SNAP_VERSION=void 0;const n=e("@metamask/superstruct"),a=e("@metamask/utils"),r=e("semver");s.DEFAULT_REQUESTED_SNAP_VERSION="*",s.getTargetVersion=function(e,t){const s=(0,r.maxSatisfying)(e,t);return s||(0,r.maxSatisfying)(e,t,{includePrerelease:!0})},s.resolveVersionRange=function(e){return e===undefined||"latest"===e?[undefined,s.DEFAULT_REQUESTED_SNAP_VERSION]:(0,n.validate)(e,a.VersionRangeStruct)}}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/versions.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/VirtualFile.cjs",{"../deep-clone.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","@scure/base":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@scure/base/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}Object.defineProperty(s,"__esModule",{value:!0}),s.VirtualFile=void 0;const a=e("@metamask/utils"),r=e("@scure/base"),o=e("../deep-clone.cjs");class i{constructor(e){var t,s,a,r;let o;n(this,"value",void 0),n(this,"result",void 0),n(this,"data",void 0),n(this,"path",void 0),o="string"==typeof e||e instanceof Uint8Array?{value:e}:e,this.value=(null===(t=o)||void 0===t?void 0:t.value)??"",this.result=(null===(s=o)||void 0===s?void 0:s.result)??undefined,this.data=(null===(a=o)||void 0===a?void 0:a.data)??{},this.path=(null===(r=o)||void 0===r?void 0:r.path)??"/"}get size(){return"string"==typeof this.value?this.value.length:this.value.byteLength}toString(e){if("string"==typeof this.value)return(0,a.assert)(e===undefined,"Tried to encode string."),this.value;if(this.value instanceof Uint8Array&&"hex"===e)return(0,a.bytesToHex)(this.value);if(this.value instanceof Uint8Array&&"base64"===e)return r.base64.encode(this.value);return new TextDecoder(e).decode(this.value)}clone(){const e=new i;return"string"==typeof this.value?e.value=this.value:e.value=this.value.slice(0),e.result=(0,o.deepClone)(this.result),e.data=(0,o.deepClone)(this.data),e.path=this.path,e}}s.VirtualFile=i}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/VirtualFile.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/index.cjs",{"./VirtualFile.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/VirtualFile.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=Object.create?function(e,t,s,n){n===undefined&&(n=s);var a=Object.getOwnPropertyDescriptor(t,s);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,a)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]},a=function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(s,"__esModule",{value:!0}),a(e("./VirtualFile.cjs"),s)}}},{package:"@metamask/assets-controller>@metamask/snaps-utils",file:"node_modules/@metamask/assets-controller/node_modules/@metamask/snaps-utils/dist/virtual-file/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){!function(e){var s,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,r=Math.floor,o="[BigNumber Error] ",i=o+"Number primitive has more than 15 significant digits: ",c=1e14,l=14,u=9007199254740991,d=[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,s,n=1,a=e.length,r=e[0]+"";n<a;){for(t=e[n++]+"",s=l-t.length;s--;t="0"+t);r+=t}for(a=r.length;48===r.charCodeAt(--a););return r.slice(0,a+1||1)}function b(e,t){var s,n,a=e.c,r=t.c,o=e.s,i=t.s,c=e.e,l=t.e;if(!o||!i)return null;if(s=a&&!a[0],n=r&&!r[0],s||n)return s?n?0:-i:o;if(o!=i)return o;if(s=o<0,n=c==l,!a||!r)return n?0:!a^s?1:-1;if(!n)return c>l^s?1:-1;for(i=(c=a.length)<(l=r.length)?c:l,o=0;o<i;o++)if(a[o]!=r[o])return a[o]>r[o]^s?1:-1;return c==l?0:c>l^s?1:-1}function k(e,t,s,n){if(e<t||e>s||e!==r(e))throw Error(o+(n||"Argument")+("number"==typeof e?e<t||e>s?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function g(e){var t=e.c.length-1;return p(e.e/l)==t&&e.c[t]%2!=0}function w(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function x(e,t,s){var n,a;if(t<0){for(a=s+".";++t;a+=s);e=a+e}else if(++t>(n=e.length)){for(a=s,t-=n;--t;a+=s);e+=a}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var s,v,y,_,S,A,j,T,C,E,I=W.prototype={constructor:W,toString:null,valueOf:null},O=new W(1),P=20,M=4,D=-7,R=21,B=-1e7,N=1e7,F=!1,L=1,U=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},$="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function W(e,t){var s,a,o,c,d,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>N?f.c=f.e=null:e.e<B?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,d=e;d>=10;d/=10,c++);return void(c>N?f.c=f.e=null:(f.e=c,f.c=[e]))}p=String(e)}else{if(!n.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(".","")),(d=p.search(/e/i))>0?(c<0&&(c=d),c+=+p.slice(d+1),p=p.substring(0,d)):c<0&&(c=p.length)}else{if(k(t,2,$.length,"Base"),10==t&&q)return K(f=new W(e),P+f.e+1,M);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(s=$.slice(0,t),c=d=0,h=p.length;d<h;d++)if(s.indexOf(a=p.charAt(d))<0){if("."==a){if(d>c){c=h;continue}}else if(!o&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){o=!0,d=-1,c=0;continue}return y(f,String(e),m,t)}m=!1,(c=(p=v(p,t,10,f.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(d=0;48===p.charCodeAt(d);d++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(d,++h)){if(h-=d,m&&W.DEBUG&&h>15&&(e>u||e!==r(e)))throw Error(i+f.s*e);if((c=c-d-1)>N)f.c=f.e=null;else if(c<B)f.c=[f.e=0];else{if(f.e=c,f.c=[],d=(c+1)%l,c<0&&(d+=l),d<h){for(d&&f.c.push(+p.slice(0,d)),h-=l;d<h;)f.c.push(+p.slice(d,d+=l));d=l-(p=p.slice(d)).length}else d-=h;for(;d--;p+="0");f.c.push(+p)}}else f.c=[f.e=0]}function G(e,t,s,n){var a,r,o,i,c;if(null==s?s=M:k(s,0,8),!e.c)return e.toString();if(a=e.c[0],o=e.e,null==t)c=f(e.c),c=1==n||2==n&&(o<=D||o>=R)?w(c,o):x(c,o,"0");else if(r=(e=K(new W(e),t,s)).e,i=(c=f(e.c)).length,1==n||2==n&&(t<=r||r<=D)){for(;i<t;c+="0",i++);c=w(c,r)}else if(t-=o,c=x(c,r,"0"),r+1>i){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=r-i)>0)for(r+1==i&&(c+=".");t--;c+="0");return e.s<0&&a?"-"+c:c}function z(e,t){for(var s,n,a=1,r=new W(e[0]);a<e.length;a++)(!(n=new W(e[a])).s||(s=b(r,n))===t||0===s&&r.s===t)&&(r=n);return r}function V(e,t,s){for(var n=1,a=t.length;!t[--a];t.pop());for(a=t[0];a>=10;a/=10,n++);return(s=n+s*l-1)>N?e.c=e.e=null:s<B?e.c=[e.e=0]:(e.e=s,e.c=t),e}function K(e,t,s,n){var o,i,u,m,h,p,f,b=e.c,k=d;if(b){e:{for(o=1,m=b[0];m>=10;m/=10,o++);if((i=t-o)<0)i+=l,u=t,h=b[p=0],f=r(h/k[o-u-1]%10);else if((p=a((i+1)/l))>=b.length){if(!n)break e;for(;b.length<=p;b.push(0));h=f=0,o=1,u=(i%=l)-l+1}else{for(h=m=b[p],o=1;m>=10;m/=10,o++);f=(u=(i%=l)-l+o)<0?0:r(h/k[o-u-1]%10)}if(n=n||t<0||null!=b[p+1]||(u<0?h:h%k[o-u-1]),n=s<4?(f||n)&&(0==s||s==(e.s<0?3:2)):f>5||5==f&&(4==s||n||6==s&&(i>0?u>0?h/k[o-u]:0:b[p-1])%10&1||s==(e.s<0?8:7)),t<1||!b[0])return b.length=0,n?(t-=e.e+1,b[0]=k[(l-t%l)%l],e.e=-t||0):b[0]=e.e=0,e;if(0==i?(b.length=p,m=1,p--):(b.length=p+1,m=k[l-i],b[p]=u>0?r(h/k[o-u]%k[u])*m:0),n)for(;;){if(0==p){for(i=1,u=b[0];u>=10;u/=10,i++);for(u=b[0]+=m,m=1;u>=10;u/=10,m++);i!=m&&(e.e++,b[0]==c&&(b[0]=1));break}if(b[p]+=m,b[p]!=c)break;b[p--]=0,m=1}for(i=b.length;0===b[--i];b.pop());}e.e>N?e.c=e.e=null:e.e<B&&(e.c=[e.e=0])}return e}function J(e){var t,s=e.e;return null===s?e.toString():(t=f(e.c),t=s<=D||s>=R?w(t,s):x(t,s,"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,s;if(null!=e){if("object"!=typeof e)throw Error(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(s=e[t],0,h,t),P=s),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(s=e[t],0,8,t),M=s),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((s=e[t])&&s.pop?(k(s[0],-h,0,t),k(s[1],0,h,t),D=s[0],R=s[1]):(k(s,-h,h,t),D=-(R=s<0?-s:s))),e.hasOwnProperty(t="RANGE"))if((s=e[t])&&s.pop)k(s[0],-h,-1,t),k(s[1],1,h,t),B=s[0],N=s[1];else{if(k(s,-h,h,t),!s)throw Error(o+t+" cannot be zero: "+s);B=-(N=s<0?-s:s)}if(e.hasOwnProperty(t="CRYPTO")){if((s=e[t])!==!!s)throw Error(o+t+" not true or false: "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!s,Error(o+"crypto unavailable");F=s}else F=s}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(s=e[t],0,9,t),L=s),e.hasOwnProperty(t="POW_PRECISION")&&(k(s=e[t],0,h,t),U=s),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(s=e[t]))throw Error(o+t+" not an object: "+s);H=s}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(s=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(s))throw Error(o+t+" invalid: "+s);q="0123456789"==s.slice(0,10),$=s}}return{DECIMAL_PLACES:P,ROUNDING_MODE:M,EXPONENTIAL_AT:[D,R],RANGE:[B,N],CRYPTO:F,MODULO_MODE:L,POW_PRECISION:U,FORMAT:H,ALPHABET:$}},W.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!W.DEBUG)return!0;var t,s,n=e.c,a=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&a>=-h&&a<=h&&a===r(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%l)<1&&(t+=l),String(n[0]).length==t){for(t=0;t<n.length;t++)if((s=n[t])<0||s>=c||s!==r(s))break e;if(0!==s)return!0}}}else if(null===n&&null===a&&(null===i||1===i||-1===i))return!0;throw Error(o+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return z(arguments,-1)},W.minimum=W.min=function(){return z(arguments,1)},W.random=(_=9007199254740992,S=Math.random()*_&2097151?function(){return r(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,s,n,i,c,u=0,m=[],p=new W(O);if(null==e?e=P:k(e,0,h),i=a(e/l),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(c=131072*t[u]+(t[u+1]>>>11))>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),t[u]=s[0],t[u+1]=s[1]):(m.push(c%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(c=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(m.push(c%1e14),u+=7);u=i/7}if(!F)for(;u<i;)(c=S())<9e15&&(m[u++]=c%1e14);for(i=m[--u],e%=l,i&&e&&(c=d[l-e],m[u]=r(i/c)*c);0===m[u];m.pop(),u--);if(u<0)m=[n=0];else{for(n=-1;0===m[0];m.splice(0,1),n-=l);for(u=1,c=m[0];c>=10;c/=10,u++);u<l&&(n-=l-u)}return p.e=n,p.c=m,p}),W.sum=function(){for(var e=1,t=arguments,s=new W(t[0]);e<t.length;)s=s.plus(t[e++]);return s},v=function(){var e="0123456789";function t(e,t,s,n){for(var a,r,o=[0],i=0,c=e.length;i<c;){for(r=o.length;r--;o[r]*=t);for(o[0]+=n.indexOf(e.charAt(i++)),a=0;a<o.length;a++)o[a]>s-1&&(null==o[a+1]&&(o[a+1]=0),o[a+1]+=o[a]/s|0,o[a]%=s)}return o.reverse()}return function(n,a,r,o,i){var c,l,u,d,m,h,p,b,k=n.indexOf("."),g=P,w=M;for(k>=0&&(d=U,U=0,n=n.replace(".",""),h=(b=new W(a)).pow(n.length-k),U=d,b.c=t(x(f(h.c),h.e,"0"),10,r,e),b.e=b.c.length),u=d=(p=t(n,a,r,i?(c=$,e):(c=e,$))).length;0==p[--d];p.pop());if(!p[0])return c.charAt(0);if(k<0?--u:(h.c=p,h.e=u,h.s=o,p=(h=s(h,b,g,w,r)).c,m=h.r,u=h.e),k=p[l=u+g+1],d=r/2,m=m||l<0||null!=p[l+1],m=w<4?(null!=k||m)&&(0==w||w==(h.s<0?3:2)):k>d||k==d&&(4==w||m||6==w&&1&p[l-1]||w==(h.s<0?8:7)),l<1||!p[0])n=m?x(c.charAt(1),-g,c.charAt(0)):c.charAt(0);else{if(p.length=l,m)for(--r;++p[--l]>r;)p[l]=0,l||(++u,p=[1].concat(p));for(d=p.length;!p[--d];);for(k=0,n="";k<=d;n+=c.charAt(p[k++]));n=x(n,u,c.charAt(0))}return n}}(),s=function(){function e(e,t,s){var n,a,r,o,i=0,c=e.length,l=t%m,u=t/m|0;for(e=e.slice();c--;)i=((a=l*(r=e[c]%m)+(n=u*r+(o=e[c]/m|0)*l)%m*m+i)/s|0)+(n/m|0)+u*o,e[c]=a%s;return i&&(e=[i].concat(e)),e}function t(e,t,s,n){var a,r;if(s!=n)r=s>n?1:-1;else for(a=r=0;a<s;a++)if(e[a]!=t[a]){r=e[a]>t[a]?1:-1;break}return r}function s(e,t,s,n){for(var a=0;s--;)e[s]-=a,a=e[s]<t[s]?1:0,e[s]=a*n+e[s]-t[s];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,a,o,i,u){var d,m,h,f,b,k,g,w,x,v,y,_,S,A,j,T,C,E=n.s==a.s?1:-1,I=n.c,O=a.c;if(!(I&&I[0]&&O&&O[0]))return new W(n.s&&a.s&&(I?!O||I[0]!=O[0]:O)?I&&0==I[0]||!O?0*E:E/0:NaN);for(x=(w=new W(E)).c=[],E=o+(m=n.e-a.e)+1,u||(u=c,m=p(n.e/l)-p(a.e/l),E=E/l|0),h=0;O[h]==(I[h]||0);h++);if(O[h]>(I[h]||0)&&m--,E<0)x.push(1),f=!0;else{for(A=I.length,T=O.length,h=0,E+=2,(b=r(u/(O[0]+1)))>1&&(O=e(O,b,u),I=e(I,b,u),T=O.length,A=I.length),S=T,y=(v=I.slice(0,T)).length;y<T;v[y++]=0);C=O.slice(),C=[0].concat(C),j=O[0],O[1]>=u/2&&j++;do{if(b=0,(d=t(O,v,T,y))<0){if(_=v[0],T!=y&&(_=_*u+(v[1]||0)),(b=r(_/j))>1)for(b>=u&&(b=u-1),g=(k=e(O,b,u)).length,y=v.length;1==t(k,v,g,y);)b--,s(k,T<g?C:O,g,u),g=k.length,d=1;else 0==b&&(d=b=1),g=(k=O.slice()).length;if(g<y&&(k=[0].concat(k)),s(v,k,y,u),y=v.length,-1==d)for(;t(O,v,T,y)<1;)b++,s(v,T<y?C:O,y,u),y=v.length}else 0===d&&(b++,v=[0]);x[h++]=b,v[0]?v[y++]=I[S]||0:(v=[I[S]],y=1)}while((S++<A||null!=v[0])&&E--);f=null!=v[0],x[0]||x.splice(0,1)}if(u==c){for(h=1,E=x[0];E>=10;E/=10,h++);K(w,o+(w.e=h+m*l-1)+1,i,f)}else w.e=m,w.r=+f;return w}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,j=/^([^.]+)\.$/,T=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g,y=function(e,t,s,n){var a,r=s?t:t.replace(E,"");if(C.test(r))e.s=isNaN(r)?null:r<0?-1:1;else{if(!s&&(r=r.replace(A,function(e,t,s){return a="x"==(s=s.toLowerCase())?16:"b"==s?2:8,n&&n!=a?e:t}),n&&(a=n,r=r.replace(j,"$1").replace(T,"0.$1")),t!=r))return new W(r,a);if(W.DEBUG)throw Error(o+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},I.absoluteValue=I.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},I.comparedTo=function(e,t){return b(this,new W(e,t))},I.decimalPlaces=I.dp=function(e,t){var s,n,a,r=this;if(null!=e)return k(e,0,h),null==t?t=M:k(t,0,8),K(new W(r),e+r.e+1,t);if(!(s=r.c))return null;if(n=((a=s.length-1)-p(this.e/l))*l,a=s[a])for(;a%10==0;a/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(e,t){return s(this,new W(e,t),P,M)},I.dividedToIntegerBy=I.idiv=function(e,t){return s(this,new W(e,t),0,1)},I.exponentiatedBy=I.pow=function(e,t){var s,n,i,c,u,d,m,h,p=this;if((e=new W(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+J(e));if(null!=t&&(t=new W(t)),u=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(+J(p),u?e.s*(2-g(e)):+J(e))),t?h.mod(t):h;if(d=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new W(NaN);(n=!d&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||u&&p.c[1]>=24e7:p.c[0]<8e13||u&&p.c[0]<=9999975e7)))return c=p.s<0&&g(e)?-0:0,p.e>-1&&(c=1/c),new W(d?1/c:c);U&&(c=a(U/l+2))}for(u?(s=new W(.5),d&&(e.s=1),m=g(e)):m=(i=Math.abs(+J(e)))%2,h=new W(O);;){if(m){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(i){if(0===(i=r(i/2)))break;m=i%2}else if(K(e=e.times(s),e.e+1,1),e.e>14)m=g(e);else{if(0===(i=+J(e)))break;m=i%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):n&&(p=p.mod(t))}return n?h:(d&&(h=O.div(h)),t?h.mod(t):c?K(h,U,M,undefined):h)},I.integerValue=function(e){var t=new W(this);return null==e?e=M:k(e,0,8),K(t,t.e+1,e)},I.isEqualTo=I.eq=function(e,t){return 0===b(this,new W(e,t))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(e,t){return b(this,new W(e,t))>0},I.isGreaterThanOrEqualTo=I.gte=function(e,t){return 1===(t=b(this,new W(e,t)))||0===t},I.isInteger=function(){return!!this.c&&p(this.e/l)>this.c.length-2},I.isLessThan=I.lt=function(e,t){return b(this,new W(e,t))<0},I.isLessThanOrEqualTo=I.lte=function(e,t){return-1===(t=b(this,new W(e,t)))||0===t},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(e,t){var s,n,a,r,o=this,i=o.s;if(t=(e=new W(e,t)).s,!i||!t)return new W(NaN);if(i!=t)return e.s=-t,o.plus(e);var u=o.e/l,d=e.e/l,m=o.c,h=e.c;if(!u||!d){if(!m||!h)return m?(e.s=-t,e):new W(h?o:NaN);if(!m[0]||!h[0])return h[0]?(e.s=-t,e):new W(m[0]?o:3==M?-0:0)}if(u=p(u),d=p(d),m=m.slice(),i=u-d){for((r=i<0)?(i=-i,a=m):(d=u,a=h),a.reverse(),t=i;t--;a.push(0));a.reverse()}else for(n=(r=(i=m.length)<(t=h.length))?i:t,i=t=0;t<n;t++)if(m[t]!=h[t]){r=m[t]<h[t];break}if(r&&(a=m,m=h,h=a,e.s=-e.s),(t=(n=h.length)-(s=m.length))>0)for(;t--;m[s++]=0);for(t=c-1;n>i;){if(m[--n]<h[n]){for(s=n;s&&!m[--s];m[s]=t);--m[s],m[n]+=c}m[n]-=h[n]}for(;0==m[0];m.splice(0,1),--d);return m[0]?V(e,m,d):(e.s=3==M?-1:1,e.c=[e.e=0],e)},I.modulo=I.mod=function(e,t){var n,a,r=this;return e=new W(e,t),!r.c||!e.s||e.c&&!e.c[0]?new W(NaN):!e.c||r.c&&!r.c[0]?new W(r):(9==L?(a=e.s,e.s=1,n=s(r,e,0,3),e.s=a,n.s*=a):n=s(r,e,0,L),(e=r.minus(n.times(e))).c[0]||1!=L||(e.s=r.s),e)},I.multipliedBy=I.times=function(e,t){var s,n,a,r,o,i,u,d,h,f,b,k,g,w,x,v=this,y=v.c,_=(e=new W(e,t)).c;if(!(y&&_&&y[0]&&_[0]))return!v.s||!e.s||y&&!y[0]&&!_||_&&!_[0]&&!y?e.c=e.e=e.s=null:(e.s*=v.s,y&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(v.e/l)+p(e.e/l),e.s*=v.s,(u=y.length)<(f=_.length)&&(g=y,y=_,_=g,a=u,u=f,f=a),a=u+f,g=[];a--;g.push(0));for(w=c,x=m,a=f;--a>=0;){for(s=0,b=_[a]%x,k=_[a]/x|0,r=a+(o=u);r>a;)s=((d=b*(d=y[--o]%x)+(i=k*d+(h=y[o]/x|0)*b)%x*x+g[r]+s)/w|0)+(i/x|0)+k*h,g[r--]=d%w;g[r]=s}return s?++n:g.splice(0,1),V(e,g,n)},I.negated=function(){var e=new W(this);return e.s=-e.s||null,e},I.plus=function(e,t){var s,n=this,a=n.s;if(t=(e=new W(e,t)).s,!a||!t)return new W(NaN);if(a!=t)return e.s=-t,n.minus(e);var r=n.e/l,o=e.e/l,i=n.c,u=e.c;if(!r||!o){if(!i||!u)return new W(a/0);if(!i[0]||!u[0])return u[0]?e:new W(i[0]?n:0*a)}if(r=p(r),o=p(o),i=i.slice(),a=r-o){for(a>0?(o=r,s=u):(a=-a,s=i),s.reverse();a--;s.push(0));s.reverse()}for((a=i.length)-(t=u.length)<0&&(s=u,u=i,i=s,t=a),a=0;t;)a=(i[--t]=i[t]+u[t]+a)/c|0,i[t]=c===i[t]?0:i[t]%c;return a&&(i=[a].concat(i),++o),V(e,i,o)},I.precision=I.sd=function(e,t){var s,n,a,r=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=M:k(t,0,8),K(new W(r),e,t);if(!(s=r.c))return null;if(n=(a=s.length-1)*l+1,a=s[a]){for(;a%10==0;a/=10,n--);for(a=s[0];a>=10;a/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},I.shiftedBy=function(e){return k(e,-9007199254740991,u),this.times("1e"+e)},I.squareRoot=I.sqrt=function(){var e,t,n,a,r,o=this,i=o.c,c=o.s,l=o.e,u=P+4,d=new W("0.5");if(1!==c||!i||!i[0])return new W(!c||c<0&&(!i||i[0])?NaN:i?o:1/0);if(0==(c=Math.sqrt(+J(o)))||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),n=new W(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):n=new W(c+""),n.c[0])for((c=(l=n.e)+u)<3&&(c=0);;)if(r=n,n=d.times(r.plus(s(o,r,u,1))),f(r.c).slice(0,c)===(t=f(n.c)).slice(0,c)){if(n.e<l&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(a||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(K(n,n.e+P+2,1),e=!n.times(n).eq(o));break}if(!a&&(K(r,r.e+P+2,0),r.times(r).eq(o))){n=r;break}u+=4,c+=4,a=1}return K(n,n.e+P+1,M,e)},I.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),G(this,e,t,1)},I.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),G(this,e,t)},I.toFormat=function(e,t,s){var n,a=this;if(null==s)null!=e&&t&&"object"==typeof t?(s=t,t=null):e&&"object"==typeof e?(s=e,e=t=null):s=H;else if("object"!=typeof s)throw Error(o+"Argument not an object: "+s);if(n=a.toFixed(e,t),a.c){var r,i=n.split("."),c=+s.groupSize,l=+s.secondaryGroupSize,u=s.groupSeparator||"",d=i[0],m=i[1],h=a.s<0,p=h?d.slice(1):d,f=p.length;if(l&&(r=c,c=l,l=r,f-=r),c>0&&f>0){for(r=f%c||c,d=p.substr(0,r);r<f;r+=c)d+=u+p.substr(r,c);l>0&&(d+=u+p.slice(r)),h&&(d="-"+d)}n=m?d+(s.decimalSeparator||"")+((l=+s.fractionGroupSize)?m.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(s.fractionGroupSeparator||"")):m):d}return(s.prefix||"")+n+(s.suffix||"")},I.toFraction=function(e){var t,n,a,r,i,c,u,m,h,p,b,k,g=this,w=g.c;if(null!=e&&(!(u=new W(e)).isInteger()&&(u.c||1!==u.s)||u.lt(O)))throw Error(o+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+J(u));if(!w)return new W(g);for(t=new W(O),h=n=new W(O),a=m=new W(O),k=f(w),i=t.e=k.length-g.e-1,t.c[0]=d[(c=i%l)<0?l+c:c],e=!e||u.comparedTo(t)>0?i>0?t:h:u,c=N,N=1/0,u=new W(k),m.c[0]=0;p=s(u,t,0,1),1!=(r=n.plus(p.times(a))).comparedTo(e);)n=a,a=r,h=m.plus(p.times(r=h)),m=r,t=u.minus(p.times(r=t)),u=r;return r=s(e.minus(n),a,0,1),m=m.plus(r.times(h)),n=n.plus(r.times(a)),m.s=h.s=g.s,b=s(h,a,i*=2,M).minus(g).abs().comparedTo(s(m,n,i,M).minus(g).abs())<1?[h,a]:[m,n],N=c,b},I.toNumber=function(){return+J(this)},I.toPrecision=function(e,t){return null!=e&&k(e,1,h),G(this,e,t,2)},I.toString=function(e){var t,s=this,n=s.s,a=s.e;return null===a?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=a<=D||a>=R?w(f(s.c),a):x(f(s.c),a,"0"):10===e&&q?t=x(f((s=K(new W(s),P+a+1,M)).c),s.e,"0"):(k(e,2,$.length,"Base"),t=v(x(f(s.c),a,"0"),10,e,n,!0)),n<0&&s.c[0]&&(t="-"+t)),t},I.valueOf=I.toJSON=function(){return J(this)},I._isBigNumber=!0,null!=t&&W.set(t),W}(),s.default=s.BigNumber=s,"function"==typeof define&&define.amd?define(function(){return s}):void 0!==t&&t.exports?t.exports=s:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=s)}(this)}}},{package:"@metamask/assets-controller>bignumber.js",file:"node_modules/@metamask/assets-controller/node_modules/bignumber.js/bignumber.js"}],["/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,s){var n,a,r,o,i,c,l,u,d,m,h,p,f,b,k,g,w,x,v,y,_,S,A,j,T,C,E,I,O=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},P=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusController=void 0;const M=e("@metamask/bridge-controller"),D=e("@metamask/controller-utils"),R=e("@metamask/polling-controller"),B=e("@metamask/transaction-controller"),N=e("@metamask/utils"),F=e("./constants.cjs"),L=e("./types.cjs"),U=e("./utils/bridge-status.cjs"),H=e("./utils/gas.cjs"),$=e("./utils/metrics.cjs"),q=e("./utils/transaction.cjs"),W={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class G extends((0,R.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,fetchFn:R,addTransactionFn:G,addTransactionBatchFn:z,updateTransactionFn:V,estimateGasFeeFn:K,config:J,traceFn:X}){super({name:F.BRIDGE_STATUS_CONTROLLER_NAME,metadata:W,messenger:e,state:{...F.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),n.add(this),a.set(this,{}),r.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),u.set(this,void 0),d.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=M.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=F.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=F.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),s=this.messenger.call("NetworkController:getNetworkClientById",t).configuration.chainId;P(this,y,"f").call(this,e,s)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:s}=e;if(!t&&!s)throw new Error("Either txMetaId or txHash must be provided");let n;if(t?this.state.txHistory[t]&&(n=t):s&&(n=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===s)),!n)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${s}`));const r=this.state.txHistory[n];this.update(e=>{n&&(e.txHistory[n].attempts=undefined)});if((0,M.isCrossChain)(r.quote.srcChainId,r.quote.destChainId)){P(this,a,"f")[n]||P(this,b,"f").call(this,n)}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],p.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===M.StatusTypes.PENDING||e.status.status===M.StatusTypes.UNKNOWN).filter(e=>!P(this,a,"f")[e.txMetaId]).filter(e=>(0,M.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)).forEach(e=>{const t=e.txMetaId;(0,U.shouldSkipFetchDueToFetchFailures)(e.attempts)||P(this,b,"f").call(this,t)})}),f.set(this,e=>{const{bridgeTxMeta:t,statusRequest:s,quoteResponse:n,startTime:a,slippagePercentage:r,initialDestAssetBalance:o,targetContractAddress:i,approvalTxId:c,isStxEnabled:l,accountAddress:u}=e,d={txMetaId:t.id,batchId:t.batchId,quote:n.quote,startTime:a,estimatedProcessingTimeInSeconds:n.estimatedProcessingTimeInSeconds,slippagePercentage:r,pricingData:{amountSent:n.sentAmount?.amount??"0",amountSentInUsd:n.sentAmount?.usd??undefined,quotedGasInUsd:n.gasFee?.effective?.usd??undefined,quotedReturnInUsd:n.toTokenAmount?.usd??undefined,quotedGasAmount:n.gasFee?.effective?.amount??undefined},initialDestAssetBalance:o,targetContractAddress:i,account:u,status:{status:M.StatusTypes.PENDING,srcChain:{chainId:s.srcChainId,txHash:s.srcTxHash}},hasApprovalTx:Boolean(n.approval),approvalTxId:c,isStxEnabled:l??!1,featureId:n.featureId};this.update(e=>{e.txHistory[t.id]=d})}),b.set(this,e=>{const t=P(this,a,"f")[e];t&&this.stopPollingByPollingToken(t);const s=this.state.txHistory[e];if(!s)return;const{quote:n}=s;(0,M.isCrossChain)(n.srcChainId,n.destChainId)&&(P(this,a,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;P(this,f,"f").call(this,e),P(this,b,"f").call(this,t.id)},this._executePoll=async e=>{await P(this,w,"f").call(this,e)},g.set(this,e=>{const{attempts:t}=this.state.txHistory[e],s=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},n=P(this,a,"f")[e];s.counter>=F.MAX_ATTEMPTS&&n&&(this.stopPollingByPollingToken(n),delete P(this,a,"f")[e]),this.update(t=>{t.txHistory[e].attempts=s})}),w.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state;if(!(0,U.shouldSkipFetchDueToFetchFailures)(t[e]?.attempts))try{const s=t[e],n=P(this,x,"f").call(this,e);if(!n)return;P(this,v,"f").call(this,e,n);const c=(0,U.getStatusRequestWithSrcTxHash)(s.quote,n),{status:l,validationFailures:u}=await(0,U.fetchBridgeTxStatus)(c,P(this,r,"f"),P(this,o,"f"),P(this,i,"f").customBridgeApiBaseUrl);if(u.length>0)throw P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:u}),new Error(`Bridge status validation failed: ${u.join(", ")}`);const d={...s,status:l,completionTime:l.status===M.StatusTypes.COMPLETE||l.status===M.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=d});const m=P(this,a,"f")[e];if((l.status===M.StatusTypes.COMPLETE||l.status===M.StatusTypes.FAILED)&&m){if(this.stopPollingByPollingToken(m),delete P(this,a,"f")[e],s.featureId)return;l.status===M.StatusTypes.COMPLETE&&(P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",s.quote.destAsset.assetId)),l.status===M.StatusTypes.FAILED&&P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),P(this,g,"f").call(this,e)}}),x.set(this,e=>{const{txHistory:t}=this.state,s=t[e].status.srcChain.txHash;if(s)return s;const n=this.messenger.call("TransactionController:getState").transactions.find(t=>t.id===e);return n?.hash}),v.set(this,(e,t)=>{const{txHistory:s}=this.state;s[e].status.srcChain.txHash||this.update(s=>{s.txHistory[e].status.srcChain.txHash=t})}),y.set(this,(e,t)=>{const s=Object.keys(this.state.txHistory).filter(s=>{const n=this.state.txHistory[s],a=(0,N.numberToHex)(n.quote.srcChainId);return n.account===e&&a===t});s.forEach(e=>{P(this,a,"f")[e]&&this.stopPollingByPollingToken(P(this,a,"f")[e])}),this.update(e=>{e.txHistory=s.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),_.set(this,async(e,t,s)=>{if(!s.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const n=(0,q.getClientRequest)(e,t.quote.srcChainId,s),a=await this.messenger.call("SnapController:handleRequest",n),r={...t,trade:e};return(0,q.handleNonEvmTxResponse)(a,r,s)}),S.set(this,async e=>{const t=await e,s=this.messenger.call("TransactionController:getState").transactions.find(e=>e.hash===t);if(!s)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return s}),A.set(this,async(e,t,s,n,a)=>{if(s){const r=async()=>{await P(this,T,"f").call(this,n);const r=await P(this,j,"f").call(this,{transactionType:e?B.TransactionType.bridgeApproval:B.TransactionType.swapApproval,trade:s,requireApproval:a});return await(0,q.handleApprovalDelay)(t),r};return await P(this,m,"f").call(this,{name:e?F.TraceName.BridgeTransactionApprovalCompleted:F.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,M.formatChainIdToCaip)(t),stxEnabled:!1}},r)}return undefined}),j.set(this,async({transactionType:e,trade:t,requireApproval:s=!1,txFee:n})=>{const a=(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 r=(0,M.formatChainIdToHex)(t.chainId),o=this.messenger.call("NetworkController:findNetworkClientIdByChainId",r),i={actionId:a,networkClientId:o,requireApproval:s,type:e,origin:"metamask"},l={...t,chainId:r,gasLimit:t.gasLimit?.toString(),gas:t.gasLimit?.toString()},u={...l,...await P(this,C,"f").call(this,l,o,r,n)},{result:d}=await P(this,c,"f").call(this,u,i);return await P(this,S,"f").call(this,d)}),T.set(this,async e=>{e&&await P(this,j,"f").call(this,{transactionType:B.TransactionType.bridgeApproval,trade:e})}),C.set(this,async(e,t,s,n)=>{const a=(0,D.toHex)(e.gas??0);if(n)return{maxFeePerGas:(0,D.toHex)(n.maxFeePerGas??0),maxPriorityFeePerGas:(0,D.toHex)(n.maxPriorityFeePerGas??0),gas:a};const{gasFeeEstimates:r}=this.messenger.call("GasFeeController:getState"),{estimates:o}=await P(this,d,"f").call(this,{transactionParams:e,chainId:s,networkClientId:t}),{maxFeePerGas:i,maxPriorityFeePerGas:c}=(0,H.getTxGasEstimates)({networkGasFeeEstimates:r,txGasFeeEstimates:o});return{maxFeePerGas:i,maxPriorityFeePerGas:c,gas:a}}),E.set(this,async e=>{const t=await(0,q.getAddTransactionBatchParams)({messenger:this.messenger,estimateGasFeeFn:P(this,d,"f"),...e}),s={[B.TransactionType.bridgeApproval]:t.transactions.find(({type:e})=>e===B.TransactionType.bridgeApproval)?.params.data,[B.TransactionType.swapApproval]:t.transactions.find(({type:e})=>e===B.TransactionType.swapApproval)?.params.data,[B.TransactionType.bridge]:t.transactions.find(({type:e})=>e===B.TransactionType.bridge)?.params.data,[B.TransactionType.swap]:t.transactions.find(({type:e})=>e===B.TransactionType.swap)?.params.data},{batchId:n}=await P(this,l,"f").call(this,t),{approvalMeta:a,tradeMeta:r}=(0,q.findAndUpdateTransactionsInBatch)({messenger:this.messenger,updateTransactionFn:P(this,u,"f"),batchId:n,txDataByType:s});if(!r)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:a,tradeMeta:r}}),this.submitTx=async(e,t,s,a)=>{this.messenger.call("BridgeController:stopPollingForQuotes",M.AbortReason.TransactionSubmitted,t.featureId?undefined:a);const o=P(this,n,"m",k).call(this,e);if(!o)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const i=(0,M.isHardwareWallet)(o),c=(0,$.getPreConfirmationPropertiesFromQuote)(t,s,i);let l,u;!t.featureId&&P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Submitted,undefined,c);const d=Date.now(),h=(0,M.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);if((0,M.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,M.isTronTrade)(t.approval)){const e=await P(this,m,"f").call(this,{name:h?F.TraceName.BridgeTransactionApprovalCompleted:F.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,M.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{return t.approval&&(0,M.isTronTrade)(t.approval)?await P(this,_,"f").call(this,t.approval,t,o):undefined}catch(e){throw!t.featureId&&P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...c}),e}});u=e?.id,await(0,q.handleApprovalDelay)(t.quote.srcChainId)}l=await P(this,m,"f").call(this,{name:h?F.TraceName.BridgeTransactionCompleted:F.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,M.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{if(!(0,M.isTronTrade)(t.trade)&&!(0,M.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,_,"f").call(this,t.trade,t,o)}catch(e){throw!t.featureId&&P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Failed,l?.id,{error_message:e?.message,...c}),e}})}else{const e=P(this,r,"f")===L.BridgeClientId.MOBILE&&i;l=await P(this,m,"f").call(this,{name:h?F.TraceName.BridgeTransactionCompleted:F.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,M.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:s}},async()=>{if(!(0,M.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");if(s||t.quote.gasIncluded7702){const{tradeMeta:s,approvalMeta:n}=await P(this,E,"f").call(this,{isBridgeTx:h,resetApproval:t.resetApproval,approval:t.approval&&(0,M.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e});return u=n?.id,s}const n=await P(this,A,"f").call(this,h,t.quote.srcChainId,t.approval&&(0,M.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);return u=n?.id,await(0,q.handleMobileHardwareWalletDelay)(e),await P(this,j,"f").call(this,{transactionType:h?B.TransactionType.bridge:B.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined})})}try{P(this,f,"f").call(this,{accountAddress:o.address,bridgeTxMeta:l,statusRequest:{...(0,q.getStatusRequestParams)(t),srcTxHash:l.hash},quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:d,approvalTxId:u}),(0,M.isNonEvmChainId)(t.quote.srcChainId)&&(P(this,b,"f").call(this,l.id),h||P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Completed,l.id))}catch{}return l},I.set(this,(e,t,s)=>{const n={action_type:M.MetricsActionType.SWAPBRIDGE_V1,...s??{}};if(!t)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,n);const a=this.state.txHistory[t];if(!a)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,s??{});const r=(0,$.getRequestParamFromHistory)(a);if(e===M.UnifiedSwapBridgeEventName.StatusValidationFailed){const{chain_id_source:t,chain_id_destination:s,token_address_source:o,token_address_destination:i}=r;return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,{...n,chain_id_source:t,chain_id_destination:s,token_address_source:o,token_address_destination:i,refresh_count:a.attempts?.counter??0})}if(a.featureId)return;const o=this.messenger.call("AccountsController:getAccountByAddress",a.account),{transactions:i}=this.messenger.call("TransactionController:getState"),c=i?.find(({id:e})=>e===t),l=i?.find(({id:e})=>e===a.approvalTxId),u={...n,...r,...(0,$.getRequestMetadataFromHistory)(a,o),...(0,$.getTradeDataFromHistory)(a),...(0,$.getTxStatusesFromHistory)(a),...(0,$.getFinalizedTxProperties)(a,c,l),...(0,$.getPriceImpactFromQuote)(a.quote)};this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,u)}),O(this,r,s,"f"),O(this,o,R,"f"),O(this,c,G,"f"),O(this,l,z,"f"),O(this,u,V,"f"),O(this,d,K,"f"),O(this,i,{customBridgeApiBaseUrl:J?.customBridgeApiBaseUrl??F.BRIDGE_PROD_API_BASE_URL},"f"),O(this,m,X??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${F.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength(F.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:s,id:n}=e;t&&[B.TransactionType.bridge,B.TransactionType.swap,B.TransactionType.bridgeApproval,B.TransactionType.swapApproval].includes(t)&&[B.TransactionStatus.failed,B.TransactionStatus.dropped,B.TransactionStatus.rejected].includes(s)&&(P(this,h,"f").call(this,e),s!==B.TransactionStatus.rejected&&P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Failed,n,(0,$.getEVMTxPropertiesFromTransactionMeta)(e)))}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:s,chainId:n}=e;t===B.TransactionType.swap&&P(this,I,"f").call(this,M.UnifiedSwapBridgeEventName.Completed,s),t!==B.TransactionType.bridge||(0,M.isNonEvmChainId)(n)||P(this,b,"f").call(this,s)}),P(this,p,"f").call(this)}}s.BridgeStatusController=G,a=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,b=new WeakMap,g=new WeakMap,w=new WeakMap,x=new WeakMap,v=new WeakMap,y=new WeakMap,_=new WeakMap,S=new WeakMap,A=new WeakMap,j=new WeakMap,T=new WeakMap,C=new WeakMap,E=new WeakMap,I=new WeakMap,n=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,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=s.APPROVAL_DELAY_MS=s.BRIDGE_PROD_API_BASE_URL=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.BRIDGE_STATUS_CONTROLLER_NAME=s.MAX_ATTEMPTS=s.REFRESH_INTERVAL_MS=void 0,s.REFRESH_INTERVAL_MS=1e4,s.MAX_ATTEMPTS=7,s.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",s.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"}(n||(s.TraceName=n={}))}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getTxMetaFields=s.BridgeStatusController=s.BridgeStatusAction=s.BridgeId=s.MAX_ATTEMPTS=s.BRIDGE_STATUS_CONTROLLER_NAME=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.REFRESH_INTERVAL_MS=void 0;var n=e("./constants.cjs");Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return n.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(s,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return n.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(s,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return n.MAX_ATTEMPTS}});var a=e("./types.cjs");Object.defineProperty(s,"BridgeId",{enumerable:!0,get:function(){return a.BridgeId}}),Object.defineProperty(s,"BridgeStatusAction",{enumerable:!0,get:function(){return a.BridgeStatusAction}});var r=e("./bridge-status-controller.cjs");Object.defineProperty(s,"BridgeStatusController",{enumerable:!0,get:function(){return r.BridgeStatusController}});var o=e("./utils/transaction.cjs");Object.defineProperty(s,"getTxMetaFields",{enumerable:!0,get:function(){return o.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,s){var n,a,r;Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusAction=s.BridgeId=s.BridgeClientId=void 0,function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(n||(s.BridgeClientId=n={})),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"}(a||(s.BridgeId=a={})),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"}(r||(s.BridgeStatusAction=r={}))}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.shouldSkipFetchDueToFetchFailures=s.getStatusRequestWithSrcTxHash=s.fetchBridgeTxStatus=s.getStatusRequestDto=s.getBridgeStatusUrl=s.getClientIdHeader=void 0;const n=e("@metamask/superstruct"),a=e("./validators.cjs"),r=e("../constants.cjs");s.getClientIdHeader=e=>({"X-Client-Id":e});s.getBridgeStatusUrl=e=>`${e}/getTxStatus`;s.getStatusRequestDto=e=>{const{quote:t,...s}=e;return{...Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};s.fetchBridgeTxStatus=async(e,t,r,o)=>{const i=(0,s.getStatusRequestDto)(e),c=new URLSearchParams(i),l=`${(0,s.getBridgeStatusUrl)(o)}?${c.toString()}`,u=await r(l,{headers:(0,s.getClientIdHeader)(t)}),d=[];try{(0,a.validateBridgeStatusResponse)(u)}catch(t){t instanceof n.StructError&&t.failures().forEach(({branch:t,path:s})=>{const n=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||u?.bridge||e.bridge||e.bridgeId||"unknown",a=s?.join(".")||"unknown";d.push([n,a].join("|"))})}return{status:u,validationFailures:d}};s.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:s,bridges:n,srcChainId:a,destChainId:r,refuel:o}=e;return{bridgeId:s,srcTxHash:t,bridge:n[0],srcChainId:a,destChainId:r,quote:e,refuel:Boolean(o)}};s.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=r.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.calcActualGasUsed=s.calculateGasFees=s.getTxGasEstimates=void 0;const n=e("@metamask/controller-utils"),a=e("bignumber.js");s.getTxGasEstimates=({txGasFeeEstimates:e,networkGasFeeEstimates:t})=>{const{estimatedBaseFee:s="0"}=t;return((e,t)=>{const{maxFeePerGas:s,maxPriorityFeePerGas:n}=e?.high??{};return{baseAndPriorityFeePerGas:n?new a.BigNumber(t,10).times(10**9).plus(n,16):undefined,maxFeePerGas:s,maxPriorityFeePerGas:n}})(e,s)};s.calculateGasFees=async(e,t,a,{chainId:r,gasLimit:o,...i},c,l,u)=>{if(!e)return{};if(u)return{...u,gas:o?.toString()};const d={...i,gas:o?.toString(),data:i.data,to:i.to,value:i.value},{gasFeeEstimates:m}=t.call("GasFeeController:getState"),{estimates:h}=await a({transactionParams:d,chainId:l,networkClientId:c}),{maxFeePerGas:p,maxPriorityFeePerGas:f}=(0,s.getTxGasEstimates)({networkGasFeeEstimates:m,txGasFeeEstimates:h});return{maxFeePerGas:p,maxPriorityFeePerGas:f,gas:(0,n.toHex)(d.gas??0)}};const r=(e,t)=>e&&t?new a.BigNumber(e,16).times(new a.BigNumber(t,16)):null;s.calcActualGasUsed=({pricingData:e},t,s)=>{const n=e?.quotedGasInUsd&&e?.quotedGasAmount?new a.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,o=r(t?.gasUsed,t?.effectiveGasPrice)?.plus(r(s?.gasUsed,s?.effectiveGasPrice)??0),i=o?.div(new a.BigNumber(10).pow(18)).toString(10);return o&&i?{amount:o.toString(10),usd:n?.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getEVMTxPropertiesFromTransactionMeta=s.getRequestMetadataFromHistory=s.getTradeDataFromHistory=s.getPreConfirmationPropertiesFromQuote=s.getPriceImpactFromQuote=s.getTradeDataFromQuote=s.getRequestParamFromHistory=s.getFinalizedTxProperties=s.getTxStatusesFromHistory=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/transaction-controller"),r=e("bignumber.js"),o=e("./gas.cjs"),i=e("./swap-received-amount.cjs");s.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:s,quote:a})=>{const r=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING,o=e.destChain?.txHash?e.status:n.StatusTypes.PENDING,i=(0,n.formatChainIdToHex)(a.srcChainId),c=(0,n.isEthUsdt)(i,a.srcAsset.address),l=e.srcChain.txHash?n.StatusTypes.COMPLETE:undefined,u=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING;return{allowance_reset_transaction:c?l:undefined,approval_transaction:t||s?u:undefined,source_transaction:r,destination_transaction:e.status===n.StatusTypes.FAILED?n.StatusTypes.FAILED:o}};s.getFinalizedTxProperties=(e,t,s)=>{const n=s?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===a.TransactionType.swap?t?.time:e.completionTime,l=(0,o.calcActualGasUsed)(e,t?.txReceipt,s?.txReceipt),u=t?.type===a.TransactionType.swap?(0,i.getActualSwapReceivedAmount)(e,l,t):(0,i.getActualBridgeReceivedAmount)(e),d=e.pricingData?.quotedGasAmount&&l?.amount?new r.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new r.BigNumber(10).pow(18)).div(l.amount).toNumber():0,m=e.pricingData?.quotedReturnInUsd&&u?.usd?new r.BigNumber(e.pricingData.quotedReturnInUsd).div(u.usd).toNumber():0;return{actual_time_minutes:c&&n?(c-n)/6e4:0,usd_actual_return:Number(u?.usd??0),usd_actual_gas:l?.usd??0,quote_vs_execution_ratio:m,quoted_vs_used_gas_ratio:d}};s.getRequestParamFromHistory=e=>({chain_id_source:(0,n.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,n.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});s.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,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});s.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});s.getPreConfirmationPropertiesFromQuote=(e,t,a)=>{const{quote:r}=e;return{...(0,s.getPriceImpactFromQuote)(r),...(0,s.getTradeDataFromQuote)(e),chain_id_source:(0,n.formatChainIdToCaip)(r.srcChainId),token_symbol_source:r.srcAsset.symbol,chain_id_destination:(0,n.formatChainIdToCaip)(r.destChainId),token_symbol_destination:r.destAsset.symbol,is_hardware_wallet:a,swap_type:(0,n.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:n.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1}};s.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,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});s.getRequestMetadataFromHistory=(e,t)=>{const{quote:s,slippagePercentage:a,isStxEnabled:r}=e;return{slippage_limit:a,custom_slippage:(0,n.isCustomSlippage)(a),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,n.getSwapType)(s.srcChainId,s.destChainId),is_hardware_wallet:(0,n.isHardwareWallet)(t),stx_enabled:r??!1,security_warnings:[]}};s.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[a.TransactionStatus.failed,a.TransactionStatus.dropped,a.TransactionStatus.rejected].includes(e.status)?n.StatusTypes.FAILED:n.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,n.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,n.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:100,stx_enabled:!1,token_address_source:(0,n.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,n.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[a.TransactionType.swap,a.TransactionType.swapApproval].includes(e.type)?n.MetricsSwapType.SINGLE:n.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:n.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createClientTransactionRequest=void 0;const n=e("uuid");s.createClientTransactionRequest=(e,t,s,a,r)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,n.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:s,accountId:a,...r&&{options:r}}}})}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getActualBridgeReceivedAmount=s.getActualSwapReceivedAmount=void 0;const n=e("@metamask/bridge-controller"),a=e("bignumber.js");s.getActualSwapReceivedAmount=(e,t,s)=>{const{pricingData:r}=e,o=e.quote.destTokenAmount;if(!s?.txReceipt)return null;const i=(0,n.isNativeAddress)(e.quote.destAsset.address)?((e,t,s)=>{const{preTxBalance:n,postTxBalance:r}=s;return n&&r&&n!==r?t&&r&&n?new a.BigNumber(r,16).minus(n,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new a.BigNumber(e.quote.destTokenAmount).div(new a.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,s):((e,t)=>{const{txReceipt:s}=t;if(!s?.logs||"0x0"===s.status)return null;const{account:n,quote:r}=e,o=s.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),s=e.address?.toLowerCase()===r.destAsset.address?.toLowerCase(),a=e.topics?.[2]&&(e.topics[2]===n||e.topics[2].match(n?.slice(2)));return t&&s&&a});return o?.data?new a.BigNumber(o.data,16).div(new a.BigNumber(10).pow(r.destAsset.decimals)):null})(e,s),c=r?.quotedReturnInUsd&&o?new a.BigNumber(r.quotedReturnInUsd).div(o).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:i,usd:i&&c?c.multipliedBy(i):null}};s.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:s,status:n}=e,r=s?.quotedReturnInUsd?new a.BigNumber(s.quotedReturnInUsd).div(t.destTokenAmount):null,o=n.destChain?.amount;return o&&r?{amount:o,usd:r.multipliedBy(o).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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.findAndUpdateTransactionsInBatch=s.getAddTransactionBatchParams=s.toBatchTxParams=s.getClientRequest=s.handleMobileHardwareWalletDelay=s.handleApprovalDelay=s.handleNonEvmTxResponse=s.getTxMetaFields=s.getStatusRequestParams=s.generateActionId=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),r=e("@metamask/transaction-controller"),o=e("@metamask/utils"),i=e("uuid"),c=e("./gas.cjs"),l=e("./snaps.cjs"),u=e("../constants.cjs");s.generateActionId=()=>(Date.now()+Math.random()).toString();s.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)});s.getTxMetaFields=(e,t)=>{let s;try{s=(0,n.formatChainIdToHex)(e.quote.destChainId)}catch{s="0x1"}return{destinationChainId:s,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}};s.handleNonEvmTxResponse=(e,t,a)=>{const o=a.address,c=a.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 u=(0,n.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);let d;try{d=(0,n.formatChainIdToHex)(t.quote.srcChainId)}catch{d="0x1"}const m=(0,n.extractTradeData)(t.trade);return{...(0,s.getTxMetaFields)(t),time:Date.now(),id:l??(0,i.v4)(),chainId:d,networkClientId:c??d,txParams:{from:o,data:m},type:u?r.TransactionType.bridge:r.TransactionType.swap,status:r.TransactionStatus.submitted,hash:l,origin:c,isSolana:!0,isBridgeTx:u}};s.handleApprovalDelay=async e=>{if([n.ChainId.LINEA,n.ChainId.BASE].includes(e)){(0,o.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,u.APPROVAL_DELAY_MS));await e}};s.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};s.getClientRequest=(e,t,s)=>{const a=(0,n.formatChainIdToCaip)(t),r=(0,n.extractTradeData)(e),o=(0,n.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,l.createClientTransactionRequest)(s.metadata.snap?.id,r,a,s.id,o)};s.toBatchTxParams=(e,{chainId:t,gasLimit:s,...n},{maxFeePerGas:r,maxPriorityFeePerGas:o,gas:i})=>{const c={...n,data:n.data,to:n.to,value:n.value};return e?{...c,gas:(0,a.toHex)(i??0),maxFeePerGas:(0,a.toHex)(r??0),maxPriorityFeePerGas:(0,a.toHex)(o??0)}:c};s.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:a,resetApproval:o,trade:i,quoteResponse:{quote:{feeData:{txFee:l},gasIncluded:u,gasIncluded7702:d,gasSponsored:m},sentAmount:h,toTokenAmount:p},requireApproval:f=!1,estimateGasFeeFn:b})=>{const k=u||d;if(!e.call("AccountsController:getAccountByAddress",i.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const g=(0,n.formatChainIdToHex)(i.chainId),w=e.call("NetworkController:findNetworkClientIdByChainId",g),x=!0!==d,v=[];if(o){const n=await(0,c.calculateGasFees)(x,e,b,o,w,g,k?l:undefined);v.push({type:t?r.TransactionType.bridgeApproval:r.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(x,o,n)})}if(a){const n=await(0,c.calculateGasFees)(x,e,b,a,w,g,k?l:undefined);v.push({type:t?r.TransactionType.bridgeApproval:r.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(x,a,n)})}const y=await(0,c.calculateGasFees)(x,e,b,i,w,g,k?l:undefined);v.push({type:t?r.TransactionType.bridge:r.TransactionType.swap,params:(0,s.toBatchTxParams)(x,i,y),assetsFiatValues:{sending:h?.valueInCurrency?.toString(),receiving:p?.valueInCurrency?.toString()}});return{disable7702:x,isGasFeeIncluded:Boolean(d),isGasFeeSponsored:Boolean(m),networkClientId:w,requireApproval:f,origin:"metamask",from:i.from,transactions:v}};s.findAndUpdateTransactionsInBatch=({messenger:e,updateTransactionFn:t,batchId:s,txDataByType:n})=>{const a=e.call("TransactionController:getState").transactions,o={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(n).forEach(([e,n])=>{const i=a.find(t=>{if(t.batchId!==s)return!1;if(Array.isArray(t.txParams.authorizationList)&&t.txParams.authorizationList.length>0||Boolean(t.delegationAddress)){if(e===r.TransactionType.swap&&t.type===r.TransactionType.batch)return!0;if(e===r.TransactionType.swapApproval&&t.txParams.data===n)return!0}return t.txParams.data===n});if(i){const s={...i,type:e};t(s,`Update tx type to ${e}`),o[[r.TransactionType.bridgeApproval,r.TransactionType.swapApproval].includes(e)?"approvalMeta":"tradeMeta"]=s}}),o}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateBridgeStatusResponse=s.StatusResponseSchema=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),r=(0,a.number)(),o=(0,a.type)({}),i=(0,a.type)({chainId:r,txHash:(0,a.optional)((0,a.string)()),amount:(0,a.optional)((0,a.string)()),token:(0,a.optional)((0,a.union)([o,n.BridgeAssetSchema]))}),c=(0,a.type)({chainId:r,txHash:(0,a.optional)((0,a.string)()),amount:(0,a.optional)((0,a.string)()),token:(0,a.optional)((0,a.union)([o,n.BridgeAssetSchema]))}),l=(0,a.type)({});s.StatusResponseSchema=(0,a.type)({status:(0,a.enums)(Object.values(n.StatusTypes)),srcChain:i,destChain:(0,a.optional)(c),bridge:(0,a.optional)((0,a.string)()),isExpectedToken:(0,a.optional)((0,a.boolean)()),isUnrecognizedRouterAddress:(0,a.optional)((0,a.boolean)()),refuel:(0,a.optional)(l)});s.validateBridgeStatusResponse=e=>((0,a.assert)(e,s.StatusResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}]],[],{});