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 o.FirebaseError}}),s._DEFAULT_ENTRY_NAME=s.SDK_VERSION=void 0,s._addComponent=H,s._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},s._apps=void 0,s._clearComponents=function(){$.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=z,s._isFirebaseApp=K,s._isFirebaseServerApp=function(e){return e.settings!==undefined},s._registerComponent=W,s._removeServiceInstance=function(e,t,s=R){z(e,t).clearInstance(s)},s._serverApps=void 0,s.deleteApp=X,s.getApp=function(e=R){const t=F.get(e);if(!t&&e===R&&(0,o.getDefaultAppConfig)())return Y();if(!t)throw q.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(F.values())},s.initializeApp=Y,s.initializeServerApp=function(e,t){if((0,o.isBrowser)()&&!(0,o.isWebWorker)())throw q.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let s;s=K(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 q.create("finalization-registry-not-supported",{});const r=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),i=U.get(r);var c;if(i)return i.incRefCount(t.releaseOnDeref),i;const l=new n.ComponentContainer(r);for(const e of $.values())l.addComponent(e);const u=new J(s,t,r,l);return U.set(r,u),u},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw q.create("invalid-log-argument");(0,a.setUserLogHandler)(e,t)},s.registerVersion=Z,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"),o=e("@firebase/util"),r=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",f="@firebase/app-check-compat",p="@firebase/app-check",k="@firebase/auth",b="@firebase/auth-compat",g="@firebase/database",w="@firebase/data-connect",y="@firebase/database-compat",v="@firebase/functions",x="@firebase/functions-compat",A="@firebase/installations",S="@firebase/installations-compat",_="@firebase/messaging",j="@firebase/messaging-compat",C="@firebase/performance",I="@firebase/performance-compat",E="@firebase/remote-config",T="@firebase/remote-config-compat",O="@firebase/storage",P="@firebase/storage-compat",D="@firebase/firestore",M="@firebase/vertexai",N="@firebase/firestore-compat",B="firebase",R=s._DEFAULT_ENTRY_NAME="[DEFAULT]",L={[c]:"fire-core",[d]:"fire-core-compat",[h]:"fire-analytics",[m]:"fire-analytics-compat",[p]:"fire-app-check",[f]:"fire-app-check-compat",[k]:"fire-auth",[b]:"fire-auth-compat",[g]:"fire-rtdb",[w]:"fire-data-connect",[y]:"fire-rtdb-compat",[v]:"fire-fn",[x]:"fire-fn-compat",[A]:"fire-iid",[S]:"fire-iid-compat",[_]:"fire-fcm",[j]:"fire-fcm-compat",[C]:"fire-perf",[I]:"fire-perf-compat",[E]:"fire-rc",[T]:"fire-rc-compat",[O]:"fire-gcs",[P]:"fire-gcs-compat",[D]:"fire-fst",[N]:"fire-fst-compat",[M]:"fire-vertex","fire-js":"fire-js",[B]:"fire-js-all"},F=s._apps=new Map,U=s._serverApps=new Map,$=s._components=new Map;function H(e,t){try{e.container.addComponent(t)}catch(s){u.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function W(e){const t=e.name;if($.has(t))return u.debug(`There were multiple attempts to register component ${t}.`),!1;$.set(t,e);for(const t of F.values())H(t,e);for(const t of U.values())H(t,e);return!0}function z(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}function K(e){return e.options!==undefined}const V={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},q=new o.ErrorFactory("app","Firebase",V);
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class G{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 q.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 G{constructor(e,t,s,n){const a=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,o={name:s,automaticDataCollectionEnabled:a};if(e.apiKey!==undefined)super(e,o,n);else{super(e.options,o,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,Z(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(){X(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw q.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 Y(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:R,automaticDataCollectionEnabled:!1},t),r=a.name;if("string"!=typeof r||!r)throw q.create("bad-app-name",{appName:String(r)});if(s||(s=(0,o.getDefaultAppConfig)()),!s)throw q.create("no-options");const i=F.get(r);if(i){if((0,o.deepEqual)(s,i.options)&&(0,o.deepEqual)(a,i.config))return i;throw q.create("duplicate-app",{appName:r})}const c=new n.ComponentContainer(r);for(const e of $.values())c.addComponent(e);const l=new G(s,a,c);return F.set(r,l),l}async function X(e){let t=!1;const s=e.name;if(F.has(s))t=!0,F.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 Z(e,t,s){var a;let o=null!==(a=L[e])&&void 0!==a?a:e;s&&(o+=`-${s}`);const r=o.match(/\s|\//),i=t.match(/\s|\//);if(r||i){const e=[`Unable to register library "${o}" with version "${t}":`];return r&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),r&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void u.warn(e.join(" "))}W(new n.Component(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}const Q="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,r.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Q)}catch(e){console.warn(e)}}}).catch(e=>{throw q.create("idb-open",{originalErrorMessage:e.message})})),ee}async function se(e,t){try{const s=(await te()).transaction(Q,"readwrite"),n=s.objectStore(Q);await n.put(t,ne(e)),await s.done}catch(e){if(e instanceof o.FirebaseError)u.warn(e.message);else{const t=q.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 re(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=oe();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===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=oe(),{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,o.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 oe(){return(new Date).toISOString().substring(0,10)}class re{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,o.isIndexedDBAvailable)()&&(0,o.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Q),s=await t.objectStore(Q).get(ne(e));return await t.done,s}catch(e){if(e instanceof o.FirebaseError)u.warn(e.message);else{const t=q.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,o.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:e})).length}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ce;ce="",W(new n.Component("platform-logger",e=>new i(e),"PRIVATE")),W(new n.Component("heartbeat",e=>new ae(e),"PRIVATE")),Z(c,l,ce),Z(c,l,"esm2017"),Z("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 o{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new 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 o=this.instances.get(n);return o&&e(o,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=o;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 o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/component",file:"node_modules/@firebase/component/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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 $(t,e=>e&&0===e.registrationStatus?undefined:e);if(s){if(1===s.registrationStatus)throw p.create("delete-pending-registration");if(2===s.registrationStatus){if(!navigator.onLine)throw p.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`${b(e)}/${t}`}(e,t),n=v(e,t),a={method:"DELETE",headers:n},o=await x(()=>fetch(s,a));if(!o.ok)throw await w("Delete Installation",o)}(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=Y,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=X,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){P();const s=C(e);let n=I.get(s);n||(n=new Set,I.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=C(e),n=I.get(s);if(!n)return;n.delete(t),0===n.size&&I.delete(s);D()}(s,t)}};var n=e("@firebase/app"),a=e("@firebase/component"),o=e("@firebase/util"),r=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,f={"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."},p=new o.ErrorFactory("installations","Installations",f);function k(e){return e instanceof o.FirebaseError&&e.code.includes("request-failed")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function b({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 p.create("request-failed",{requestName:e,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function y({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function v(e,{refreshToken:t}){const s=y(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 x(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 A(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}$/,_="";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:_}catch(e){return _}}function C(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 I=new Map;function E(e,t){const s=C(e);T(s,t),function(e,t){const s=P();s&&s.postMessage({key:e,fid:t});D()}(s,t)}function T(e,t){const s=I.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=>{T(e.data.key,e.data.fid)}),O}function D(){0===I.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 M="firebase-installations-database",N=1,B="firebase-installations-store";let R=null;function L(){return R||(R=(0,r.openDB)(M,N,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(B)}})),R}async function F(e,t){const s=C(e),n=(await L()).transaction(B,"readwrite"),a=n.objectStore(B),o=await a.get(s);return await a.put(t,s),await n.done,o&&o.fid===t.fid||E(e,t.fid),t}async function U(e){const t=C(e),s=(await L()).transaction(B,"readwrite");await s.objectStore(B).delete(t),await s.done}async function $(e,t){const s=C(e),n=(await L()).transaction(B,"readwrite"),a=n.objectStore(B),o=await a.get(s),r=t(o);return r===undefined?await a.delete(s):await a.put(r,s),await n.done,!r||o&&o.fid===r.fid||E(e,r.fid),r}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function H(e){let t;const s=await $(e.appConfig,s=>{const n=function(e){const t=e||{fid:j(),registrationStatus:0};return K(t)}(s),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(p.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=b(e),a=y(e),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={fid:s,authVersion:d,appId:e.appId,sdkVersion:u},i={method:"POST",headers:a,body:JSON.stringify(r)},c=await x(()=>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 F(e.appConfig,s)}catch(s){throw k(s)&&409===s.customData.serverCode?await U(e.appConfig):await F(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}(e,s);return{installationEntry:s,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:W(e)}:{installationEntry:t}}(e,n);return t=a.registrationPromise,a.installationEntry});return s.fid===_?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function W(e){let t=await z(e.appConfig);for(;1===t.registrationStatus;)await A(100),t=await z(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await H(e);return s||t}return t}function z(e){return $(e,e=>{if(!e)throw p.create("installation-not-found");return K(e)})}function K(e){return 1===(t=e).registrationStatus&&t.registrationTime+l<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}async function V({appConfig:e,heartbeatServiceProvider:t},s){const n=function(e,{fid:t}){return`${b(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),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const r={installation:{sdkVersion:u,appId:e.appId}},i={method:"POST",headers:a,body:JSON.stringify(r)},c=await x(()=>fetch(n,i));if(c.ok){return g(await c.json())}throw await w("Generate Auth Token",c)}async function q(e,t=!1){let s;const n=await $(e.appConfig,n=>{if(!J(n))throw p.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 G(e.appConfig);for(;1===s.authToken.requestStatus;)await A(100),s=await G(e.appConfig);const n=s.authToken;return 0===n.requestStatus?q(e,t):n}(e,t),n;{if(!navigator.onLine)throw p.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 V(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await F(e.appConfig,n),s}catch(s){if(!k(s)||401!==s.customData.serverCode&&404!==s.customData.serverCode){const s=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await F(e.appConfig,s)}else await U(e.appConfig);throw s}}(e,t),t}});return s?await s:n.authToken}function G(e){return $(e,e=>{if(!J(e))throw p.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 Y(e){const t=e,{installationEntry:s,registrationPromise:n}=await H(t);return n?n.catch(console.error):q(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 X(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await H(e);t&&await t}(s);return(await q(s,t)).token}function Z(e){return p.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 Q="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),s=function(e){if(!e||!e.options)throw Z("App Configuration");if(!e.name)throw Z("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw Z(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,Q).getImmediate();return{getId:()=>Y(s),getToken:e=>X(s,e)}};(0,n._registerComponent)(new a.Component(Q,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 o={debug:s.LogLevel.DEBUG,verbose:s.LogLevel.VERBOSE,info:s.LogLevel.INFO,warn:s.LogLevel.WARN,error:s.LogLevel.ERROR,silent:s.LogLevel.SILENT},r=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=r,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?o[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,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=o[t.level]),a.userLogHandler=null===e?null:(t,a,...o)=>{const r=o.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");a>=(null!=n?n:t.logLevel)&&e({level:s.LogLevel[a].toLowerCase(),message:r,args:o,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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 _(e.firebaseDependencies);t&&(await T(e.firebaseDependencies,t.token),await async function(e){const t=C(e),s=(await S()).transaction(x,"readwrite");await s.objectStore(x).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,o.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,r.getApp)()){return G().then(e=>{if(!e)throw E.create("unsupported-browser")},e=>{throw E.create("indexed-db-unsupported")}),(0,r._getProvider)((0,o.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return $(e=(0,o.getModularInstance)(e),t)},s.isSupported=G,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,o.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),o=e("@firebase/util"),r=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,f;
/**
 * @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 p(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function k(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"}(f||(f={}));const b="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 y="firebase-messaging-database",v=1,x="firebase-messaging-store";let A=null;function S(){return A||(A=(0,a.openDB)(y,v,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(x)}})),A}async function _(e){const t=C(e),s=await S(),n=await s.transaction(x).objectStore(x).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(b))return null}let t=null;return(await(0,a.openDB)(b,g,{upgrade:async(s,n,a,o)=>{var r;if(n<2)return;if(!s.objectStoreNames.contains(w))return;const i=o.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!==(r=e.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:p(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:p(e.auth),p256dh:p(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:p(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:p(e.auth),p256dh:p(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:p(e.vapidKey)}}}}})).close(),await(0,a.deleteDB)(b),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=C(e),n=(await S()).transaction(x,"readwrite");return await n.objectStore(x).put(t,s),await n.done,t}function C({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 I={"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 o.ErrorFactory("messaging","Messaging",I);async function T(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 D({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 M=6048e5;async function N(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:k(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:p(t.getKey("auth")),p256dh:p(t.getKey("p256dh"))},n=await _(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,o=t.p256dh===e.p256dh;return s&&n&&a&&o}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+M?async function(e,t){try{const s=await async function(e,t){const s=await P(e),n=D(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let o;try{const s=await fetch(`${O(e.appConfig)}/${t.token}`,a);o=await s.json()}catch(e){throw E.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw E.create("token-update-failed",{errorInfo:e})}if(!o.token)throw E.create("token-update-no-token");return o.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 T(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=D(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let o;try{const t=await fetch(O(e.appConfig),a);o=await t.json()}catch(e){throw E.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw E.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw E.create("token-subscribe-no-token");return o.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await j(e,n),n.token}function R(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 o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var s,n,a,o,r;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===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);const c=null===(r=t.fcmOptions)||void 0===r?void 0:r.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}function L(e){return 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 F{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 L("App Configuration Object");if(!e.name)throw L("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw L(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 $(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),N(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 H(e,t,s){const n=function(e){switch(e){case f.NOTIFICATION_CLICKED:return"notification_open";case f.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 W(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(R(s)):e.onMessageHandler.next(R(s)));const n=s.data;var a;"object"==typeof(a=n)&&a&&d in a&&"1"===n["google.c.a.e"]&&await H(e,s.messageType,n)}const z="@firebase/messaging",K="0.12.16",V=e=>{const t=new F(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>W(t,e)),t},q=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>$(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 G(){try{await(0,o.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,o.isIndexedDBAvailable)()&&(0,o.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,r._registerComponent)(new n.Component("messaging",V,"PUBLIC")),(0,r._registerComponent)(new n.Component("messaging-internal",q,"PRIVATE")),(0,r.registerVersion)(z,K),(0,r.registerVersion)(z,K,"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"),o=e("@firebase/util"),r=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",f="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 p="firebase-messaging-store";let k=null;function b(){return k||(k=a.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(p)}})),k}async function g(e){const t=y(e),s=await b(),n=await s.transaction(p).objectStore(p).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,o)=>{var r;if(n<2)return;if(!s.objectStoreNames.contains(f))return;const i=o.objectStore(f),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!==(r=e.createTime)&&void 0!==r?r: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=y(e),n=(await b()).transaction(p,"readwrite");return await n.objectStore(p).put(t,s),await n.done,t}function y({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const v={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},x=new o.ErrorFactory("messaging","Messaging",v);async function A(e,t){const s={method:"DELETE",headers:await _(e)};try{const n=await fetch(`${S(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw x.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw x.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function S({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function _({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 C(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,o=t.p256dh===e.p256dh;return s&&n&&a&&o}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await _(e),n=j(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let o;try{const s=await fetch(`${S(e.appConfig)}/${t.token}`,a);o=await s.json()}catch(e){throw x.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw x.create("token-update-failed",{errorInfo:e})}if(!o.token)throw x.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),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 A(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return E(e.firebaseDependencies,s)}return E(e.firebaseDependencies,s)}async function I(e){const t=await g(e.firebaseDependencies);t&&(await A(e.firebaseDependencies,t.token),await async function(e){const t=y(e),s=(await b()).transaction(p,"readwrite");await s.objectStore(p).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 _(e),n=j(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let o;try{const t=await fetch(S(e.appConfig),a);o=await t.json()}catch(e){throw x.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw x.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw x.create("token-subscribe-no-token");return o.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await w(e,n),n.token}async function T(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 T(t,s);const n=await D();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 o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var s,n,a,o,r;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===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);const c=null===(r=t.fcmOptions)||void 0===r?void 0:r.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 o=e.data,"object"==typeof o&&o&&"google.c.a.c_id"in o?self.location.origin:null;var o;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n);if(!a)return;const o=new URL(a,self.location.href),r=new URL(self.location.origin);if(o.host!==r.host)return;let i=await async function(e){const t=await D();for(const s of t){const t=new URL(s.url,self.location.href);if(e.host===t.host)return s}return null}(o);var l;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */return i?i=await i.focus():(i=await self.clients.openWindow(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 D(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function M(e){return x.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!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 N{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 M("App Configuration Object");if(!e.name)throw M("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw M(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 N(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 I(t);const o=await g(t.firebaseDependencies);await I(t),t.vapidKey=null!==(n=null===(s=null==o?void 0:o.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n:i,await C(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 R(){return o.isIndexedDBAvailable()&&await o.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */r._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=o.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getMessaging=function(e=r.getApp()){return R().then(e=>{if(!e)throw x.create("unsupported-browser")},e=>{throw x.create("indexed-db-unsupported")}),r._getProvider(o.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=R,s.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw x.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=o.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",{_process:"/home/runner/work/metamask-extension/metamask-extension/node_modules/process/browser.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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=T){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 o=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(o)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,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 o of n){if(!a.includes(o))return!1;const n=t[o],r=s[o];if(_(n)&&_(r)){if(!e(n,r))return!1}else if(n!==r)return!1}for(const e of a)if(!n.includes(e))return!1;return!0},s.deepExtend=d,s.errorPrefix=I,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=b,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 b().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=b();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(b())},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 b().indexOf("MSAppHost/")>=0},s.isValidTimestamp=s.isValidFormat=void 0,s.isWebWorker=w,s.issuedAtTime=void 0,s.jsonEval=A,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 k;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(I(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(I(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(I(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 o=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},r=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],o=t+1<e.length,r=o?e[t+1]:0,i=t+2<e.length,c=i?e[t+2]:0,l=a>>2,u=(3&a)<<4|r>>4;let d=(15&r)<<2|c>>6,m=63&c;i||(m=64,o||(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(o(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 o=e[s++];t[n++]=String.fromCharCode((31&a)<<6|63&o)}else if(a>239&&a<365){const o=((7&a)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[n++]=String.fromCharCode(55296+(o>>10)),t[n++]=String.fromCharCode(56320+(1023&o))}else{const o=e[s++],r=e[s++];t[n++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&r)}}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++)],o=t<e.length?s[e.charAt(t)]:0;++t;const r=t<e.length?s[e.charAt(t)]:64;++t;const c=t<e.length?s[e.charAt(t)]:64;if(++t,null==a||null==o||null==r||null==c)throw new i;const l=a<<2|o>>4;if(n.push(l),64!==r){const e=o<<4&240|r>>2;if(n.push(e),64!==c){const e=r<<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=o(e);return r.encodeByteArray(t,!0)};s.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};s.base64urlEncodeWithoutPadding=l;const u=function(e){try{return r.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 f=()=>{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=f;const p=e=>{var t,s;return null===(s=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===s?void 0:s[e]};s.getDefaultEmulatorHost=p;s.getDefaultEmulatorHostnameAndPort=e=>{const t=p(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=f())||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=f())||void 0===t?void 0:t[`_${e}`]};class k{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 b(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function g(){var e;const t=null===(e=f())||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=k;class y extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,v.prototype.create)}}s.FirebaseError=y;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],o=a?function(e,t){return e.replace(x,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(a,s):"Error",r=`${this.serviceName}: ${o} (${n}).`;return new y(n,r,s)}}s.ErrorFactory=v;const x=/\{\$([^}]+)}/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 A(e){return JSON.parse(e)}const S=function(e){let t={},s={},n={},a="";try{const o=e.split(".");t=A(u(o[0])||""),s=A(u(o[1])||""),a=o[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 _(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,o=this.chain_[0],r=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^r&(i^c),a=1518500249):(n=r^i^c,a=1859775393):e<60?(n=r&i|c&(r|i),a=2400959708):(n=r^i^c,a=3395469782);const t=(o<<5|o>>>27)+n+l+a+s[e]&4294967295;l=c,c=i,i=4294967295&(r<<30|r>>>2),r=o,o=t}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+r&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 o=this.inbuf_;for(;n<t;){if(0===o)for(;n<=s;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(a[o]=e.charCodeAt(n),++o,++n,o===this.blockSize){this.compress_(a),o=0;break}}else for(;n<t;)if(a[o]=e[n],++o,++n,o===this.blockSize){this.compress_(a),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let 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=C),n.error===undefined&&(n.error=C),n.complete===undefined&&(n.complete=C);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 C(){}
/**
 * @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 I(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 o=e.charCodeAt(a);if(o>=55296&&o<=56319){const t=o-55296;a++,n(a<e.length,"Surrogate pair missing trail surrogate.");o=65536+(t<<10)+(e.charCodeAt(a)-56320)}o<128?t[s++]=o:o<2048?(t[s++]=o>>6|192,t[s++]=63&o|128):o<65536?(t[s++]=o>>12|224,t[s++]=o>>6&63|128,t[s++]=63&o|128):(t[s++]=o>>18|240,t[s++]=o>>12&63|128,t[s++]=o>>6&63|128,t[s++]=63&o|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
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,T=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 o(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 o extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}s.EvalError=o}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js",{"@json-schema-tools/reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js","@json-schema-tools/traverse":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js","fast-safe-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-safe-stringify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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(r,i)}c((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)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 r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}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}),s.NonStringRefError=void 0;var i=r(e("@json-schema-tools/traverse")),c=r(e("@json-schema-tools/reference-resolver")),l=r(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,o=Object.keys(this.options.protocolHandlerMap);a<o.length;a++){var r=o[a];c.default.protocolHandlerMap[r]=this.options.protocolHandlerMap[r]}this.schema=s,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return a(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return a(this,void 0,void 0,function(){var t,s,a,r,l,u,m,h,f,p,k,b=this;return o(this,function(o){switch(o.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return b.refCache[e]===undefined}),s=[],a=0,r=t,o.label=1;case 1:return a<r.length?(l=r[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=o.sent(),o.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===(f=new e(u,h)).refs.length?[3,7]:(p=f._resolve(),s.push(p),[4,p]));case 6:return k=o.sent(),this.refCache[l]=d(u,k),[3,8];case 7:this.refCache[l]=u,o.label=8;case 8:return[3,10];case 9:this.refCache[l]=u,o.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=b.refCache[e.$ref];return d(e,t)}return e},{mutable:!0}),[4,Promise.all(s)];case 12:return o.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,i.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new 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")),o=e("./dereferencer");Object.defineProperty(s,"NonStringRefError",{enumerable:!0,get:function(){return o.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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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(r,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)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 r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}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 r=e("./errors"),i=o(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 r.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 r.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 o=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};s.InvalidRemoteURLError=o;var r=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};s.InvalidFileSystemPathError=r}}},{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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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(r,i)}c((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)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 r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}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 i=r(e("./default-protocol-handler-map")),c=r(e("./reference-resolver")),l=n(n({},i.default),{file:function(){return a(void 0,void 0,void 0,function(){return o(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,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(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(r,i)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,o,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)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 r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(6===i[0]&&r.label<a[1]){r.label=a[1],a=i;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(i);break}a[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}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 r=e("./errors"),i=o(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,o,c,l,u,d,m,h,f;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]),o=s[0],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(o,t)];case 2:return c=a.sent(),[3,4];case 3:throw l=a.sent(),new r.NonJsonRefError({$ref:e},l.message);case 4:if(c!==undefined)return f=c,n&&(f=(0,i.default)(n,f)),[2,f];if(!1===e.includes("://"))throw new r.InvalidFileSystemPathError(e);u=0,d=Object.keys(this.protocolHandlerMap),a.label=5;case 5:return u<d.length?(m=d[u],o.startsWith(m)?[4,this.protocolHandlerMap[m](o,t)]:[3,7]):[3,8];case 6:if((h=a.sent())!==undefined)return f=h,n&&(f=(0,i.default)(n,f)),[2,f];a.label=7;case 7:return u++,[3,5];case 8:throw new r.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")),o=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=o,s.default=function(e,t){try{var s=e.replace("#","");return a.default.parse(s).shmeval(t)}catch(t){throw new o(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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,o=t.length;a<o;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 o=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},r=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,f,p){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===f&&(f=[]),void 0===p&&(p=[]);var k=n(n({},s.defaultOptions),l);if(0===u&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===k.skipFirstMutation&&0===u?t:c(t,!1,o(h),i(m));var b=t;!1===k.mutable&&(b=n({},t)),m.push(b),!0===k.bfs&&(!1!==k.skipFirstMutation&&0===u||(b=c(b,!1,o(h),i(m,2)))),d.push(t),f.push([t,b]);var g=function(t,s){var n=r(t,d);return n?(p.push(n),!0===k.skipFirstMutation&&n===d[0]?c(t,!0,o(s),i(m)):f.find(function(e){var t=e[0];return n===t})[1]):e(t,c,l,u+1,d,m,s,f,p)};if(t.anyOf)b.anyOf=t.anyOf.map(function(e,t){return g(e,a(a([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)b.allOf=t.allOf.map(function(e,t){return g(e,a(a([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)b.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)b.items=t.items.map(function(e,t){return g(e,a(a([],h,!0),["items[".concat(t,"]")],!1))});else{var w=r(t.items,d);if(w)if(p.push(w),!0===k.skipFirstMutation&&w===d[0])b.items=c(t.items,!0,o(h),i(m));else{var y=f.find(function(e){var t=e[0];return w===t})[1];b.items=y}else b.items=e(t.items,c,l,u+1,d,m,a(a([],h,!0),["items"],!1),f,p)}if(t.additionalItems!==undefined&&(b.additionalItems=g(t.additionalItems,a(a([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var v=t.properties,x={};Object.keys(t.properties).forEach(function(e){x[e]=g(v[e],a(a([],h,!0),["properties",e.toString()],!1))}),b.properties=x}if(t.patternProperties!==undefined){var A=t.patternProperties,S={};Object.keys(t.patternProperties).forEach(function(e){S[e]=g(A[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),b.patternProperties=S}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(b.additionalProperties=g(t.additionalProperties,a(a([],h,!0),["additionalProperties"],!1)))}if(!0===k.skipFirstMutation&&0===u)return b;if(!0===k.bfs)return m.pop(),b;var _=-1!==p.indexOf(t);return m.pop(),c(b,_,o(h),i(m))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/AccountsController.cjs",{"./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/eth-snap-keyring":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/keyring-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,o,r,i,c,l,u,d,m,h,f,p,k,b,g=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.AccountsController=s.EMPTY_ACCOUNT=void 0;const w=e("@metamask/base-controller"),y=e("@metamask/eth-snap-keyring"),v=e("@metamask/keyring-api"),x=e("@metamask/keyring-controller"),A=e("@metamask/keyring-utils"),S=e("@metamask/utils"),_=e("lodash"),j=e("./utils.cjs"),C="AccountsController",I={internalAccounts:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},E={internalAccounts:{accounts:{},selectedAccount:""}};s.EMPTY_ACCOUNT={id:"",address:"",options:{},methods:[],type:v.EthAccountType.Eoa,scopes:[v.EthScope.Eoa],metadata:{name:"",keyring:{type:""},importTime:0}};class T extends w.BaseController{constructor({messenger:e,state:t}){super({messenger:e,name:C,metadata:I,state:{...E,...t}}),n.add(this),g(this,n,"m",k).call(this),g(this,n,"m",b).call(this)}getAccount(e){return this.state.internalAccounts.accounts[e]}getAccounts(e){return e.map(e=>this.getAccount(e))}listAccounts(){return Object.values(this.state.internalAccounts.accounts).filter(e=>(0,v.isEvmAccountType)(e.type))}listMultichainAccounts(e){const t=Object.values(this.state.internalAccounts.accounts);if(!e)return t;if(!(0,S.isCaipChainId)(e))throw new Error(`Invalid CAIP-2 chain ID: ${String(e)}`);return t.filter(t=>(0,A.isScopeEqualToAny)(e,t.scopes))}getAccountExpect(e){const t=this.getAccount(e);if(t===undefined)throw new Error(`Account Id "${e}" not found`);return t}getSelectedAccount(){const{internalAccounts:{selectedAccount:e}}=this.state;if(""===e)return s.EMPTY_ACCOUNT;const t=this.getAccountExpect(e);if((0,v.isEvmAccountType)(t.type))return t;const a=this.listAccounts();if(!a.length)throw new Error("No EVM accounts");return g(this,n,"m",m).call(this,a)}getSelectedMultichainAccount(e){const{internalAccounts:{selectedAccount:t}}=this.state;if(""===t)return s.EMPTY_ACCOUNT;if(!e)return this.getAccountExpect(t);const a=this.listMultichainAccounts(e);return g(this,n,"m",m).call(this,a)}getAccountByAddress(e){return this.listMultichainAccounts().find(t=>t.address.toLowerCase()===e.toLowerCase())}setSelectedAccount(e){const t=this.getAccountExpect(e);this.state.internalAccounts.selectedAccount!==t.id&&g(this,n,"m",l).call(this,e=>{const{internalAccounts:s}=e;s.accounts[t.id].metadata.lastSelected=Date.now(),s.selectedAccount=t.id})}setAccountName(e,t){this.updateAccountMetadata(e,{name:t,nameLastUpdatedAt:Date.now()})}setAccountNameAndSelectAccount(e,t){const s=this.getAccountExpect(e);g(this,n,"m",a).call(this,s,t);const o={...s,metadata:{...s.metadata,name:t,nameLastUpdatedAt:Date.now(),lastSelected:g(this,n,"m",h).call(this)}};g(this,n,"m",l).call(this,e=>{e.internalAccounts.accounts[s.id]=o,e.internalAccounts.selectedAccount=s.id}),this.messenger.publish("AccountsController:accountRenamed",o)}updateAccountMetadata(e,t){const s=this.getAccountExpect(e);t.name&&g(this,n,"m",a).call(this,s,t.name);const o={...s,metadata:{...s.metadata,...t}};g(this,n,"m",l).call(this,t=>{t.internalAccounts.accounts[e]=o}),t.name&&this.messenger.publish("AccountsController:accountRenamed",o)}async updateAccounts(){const e=new Map,t=this.state.internalAccounts.accounts,s={},{keyrings:a}=this.messenger.call("KeyringController:getState");for(const o of a){const a=(0,j.keyringTypeToName)(o.type);for(const r of o.accounts){const i=g(this,n,"m",f).call(this,r,o);if(!i)continue;const c=e.get(a)??1,l=t[i.id];s[i.id]={...i,metadata:{...i.metadata,name:l?.metadata.name??`${a} ${c}`,importTime:l?.metadata.importTime??Date.now(),lastSelected:l?.metadata.lastSelected??0}},e.set(a,c+1)}}g(this,n,"m",l).call(this,e=>{e.internalAccounts.accounts=s})}loadBackup(e){e.internalAccounts&&this.update(t=>{t.internalAccounts=e.internalAccounts})}getNextAvailableAccountName(e=x.KeyringTypes.hd,t){const s=(0,j.keyringTypeToName)(e),a=g(this,n,"m",d).call(this,e,t),o=a.reduce((e,t)=>{const n=new RegExp(`${s} ([0-9]+)$`,"u").exec(t.metadata.name);if(n){const t=parseInt(n[1],10);return Math.max(e,t)}return e},0),r=Math.max(a.length+1,o+1);return`${s} ${r}`}}s.AccountsController=T,n=new WeakSet,a=function(e,t){if(this.listMultichainAccounts().find(s=>s.metadata.name===t&&s.id!==e.id))throw new Error("Account name already exists")},o=function(e,t){const s=(0,j.getUUIDFromAddressOfNormalAccount)(e),n=this.getAccount(s),a={name:n?.metadata.name??"",...n?.metadata.nameLastUpdatedAt?{nameLastUpdatedAt:n?.metadata.nameLastUpdatedAt}:{},importTime:n?.metadata.importTime??Date.now(),lastSelected:n?.metadata.lastSelected??0,keyring:{type:t.type}};let o={};if((0,j.isHdKeyringType)(t.type)){const s=(0,j.getEvmGroupIndexFromAddressIndex)(t,e);if(s!==undefined){const e=(0,j.getEvmDerivationPathForIndex)(s);o={...{entropySource:t.metadata.id,derivationPath:e,groupIndex:s},...{entropy:{type:v.KeyringAccountEntropyTypeOption.Mnemonic,id:t.metadata.id,derivationPath:e,groupIndex:s}}}}}return{id:s,address:e,options:o,methods:[v.EthMethod.PersonalSign,v.EthMethod.Sign,v.EthMethod.SignTransaction,v.EthMethod.SignTypedDataV1,v.EthMethod.SignTypedDataV3,v.EthMethod.SignTypedDataV4],scopes:[v.EthScope.Eoa],type:v.EthAccountType.Eoa,metadata:a}},r=function(){const[e]=this.messenger.call("KeyringController:getKeyringsByType",y.SnapKeyring.type);return e},i=function(e,...t){this.messenger.publish(e,...t)},c=function({isUnlocked:e,keyrings:t}){if(!e||0===t.length)return;const s={snap:{previous:{},added:[],updated:[],removed:[]},normal:{previous:{},added:[],updated:[],removed:[]}},a=e=>(0,j.isSnapKeyringType)(e)?s.snap:s.normal;for(const e of this.listMultichainAccounts()){const t=e.address.toLowerCase();a(e.metadata.keyring.type).previous[t]=e}const o=new Set;for(const e of t){const t=a(e.type);for(const s of e.accounts){const n=s.toLowerCase(),a=t.previous[n];a?t.updated.push(a):t.added.push({address:n,keyring:e}),o.add(n)}}for(const e of[s.snap,s.normal])for(const[t,s]of Object.entries(e.previous))o.has(t)||e.removed.push(s);const r={removed:[],added:[]};g(this,n,"m",l).call(this,e=>{const{internalAccounts:t}=e;for(const e of[s.snap,s.normal]){for(const s of e.removed)delete t.accounts[s.id],r.removed.push(s.id);for(const s of e.added){const e=g(this,n,"m",f).call(this,s.address,s.keyring);if(e){const s=Object.values(t.accounts),a=this.getNextAvailableAccountName(e.metadata.keyring.type,s),o=0===s.length?g(this,n,"m",h).call(this):0;t.accounts[e.id]={...e,metadata:{...e.metadata,name:a,importTime:Date.now(),lastSelected:o}},r.added.push(t.accounts[e.id])}}}},()=>{for(const e of r.removed)this.messenger.publish("AccountsController:accountRemoved",e);for(const e of r.added)this.messenger.publish("AccountsController:accountAdded",e)})},l=function(e,t){const s=this.state.internalAccounts.selectedAccount;this.update(t=>{e(t);const{internalAccounts:a}=t;if(!a.accounts[s]){const e=Object.values(a.accounts),t=g(this,n,"m",m).call(this,e);t?(a.selectedAccount=t.id,a.accounts[t.id].metadata.lastSelected=g(this,n,"m",h).call(this)):a.selectedAccount=""}}),t?.();const{selectedAccount:a}=this.state.internalAccounts;if(a&&a!==s){const e=this.getSelectedMultichainAccount();e&&((0,v.isEvmAccountType)(e.type)&&this.messenger.publish("AccountsController:selectedEvmAccountChange",e),this.messenger.publish("AccountsController:selectedAccountChange",e))}},u=function(e){const{snaps:t}=e,s=[];for(const e of this.listMultichainAccounts())if(e.metadata.snap){const n=t[e.metadata.snap.id];if(n){const t=n.enabled&&!n.blocked;e.metadata.snap.enabled!==t&&s.push({id:e.id,enabled:t})}else s.push({id:e.id,enabled:!1})}s.length>0&&this.update(e=>{for(const{id:t,enabled:n}of s){const s=e.internalAccounts.accounts[t];s.metadata.snap&&(s.metadata.snap.enabled=n)}})},d=function(e,t){return(t??this.listMultichainAccounts()).filter(t=>(0,j.isHdKeyringType)(e)||(0,j.isSimpleKeyringType)(e)?(0,j.isHdKeyringType)(t.metadata.keyring.type)||(0,j.isSimpleKeyringType)(t.metadata.keyring.type):t.metadata.keyring.type===e)},m=function(e){const[t]=e.sort((e,t)=>(t.metadata.lastSelected??0)-(e.metadata.lastSelected??0));return t},h=function(){return Date.now()},f=function(e,t){if((0,j.isSnapKeyringType)(t.type)){const t=g(this,n,"m",r).call(this);if(!t)return undefined;let s=t.getAccountByAddress(e);if(s&&(s=(0,_.cloneDeep)(s),(0,j.isHdSnapKeyringAccount)(s))){const e={...s.options,entropy:{type:v.KeyringAccountEntropyTypeOption.Mnemonic,id:s.options.entropySource,groupIndex:s.options.index,derivationPath:s.options.derivationPath}};s.options=e}return s}return g(this,n,"m",o).call(this,e,t)},p=function(e){let t;if((0,S.isCaipChainId)(e)){const s=this.getSelectedMultichainAccount(e);t=s.id}else{const e=this.getSelectedAccount();t=e.id}this.state.internalAccounts.selectedAccount!==t&&this.update(e=>{e.internalAccounts.accounts[t].metadata.lastSelected=Date.now(),e.internalAccounts.selectedAccount=t})},k=function(){this.messenger.subscribe("SnapController:stateChange",e=>g(this,n,"m",u).call(this,e)),this.messenger.subscribe("KeyringController:stateChange",e=>g(this,n,"m",c).call(this,e)),this.messenger.subscribe("SnapKeyring:accountAssetListUpdated",e=>g(this,n,"m",i).call(this,"AccountsController:accountAssetListUpdated",e)),this.messenger.subscribe("SnapKeyring:accountBalancesUpdated",e=>g(this,n,"m",i).call(this,"AccountsController:accountBalancesUpdated",e)),this.messenger.subscribe("SnapKeyring:accountTransactionsUpdated",e=>g(this,n,"m",i).call(this,"AccountsController:accountTransactionsUpdated",e)),this.messenger.subscribe("MultichainNetworkController:networkDidChange",e=>g(this,n,"m",p).call(this,e))},b=function(){this.messenger.registerActionHandler(`${C}:setSelectedAccount`,this.setSelectedAccount.bind(this)),this.messenger.registerActionHandler(`${C}:listAccounts`,this.listAccounts.bind(this)),this.messenger.registerActionHandler(`${C}:listMultichainAccounts`,this.listMultichainAccounts.bind(this)),this.messenger.registerActionHandler(`${C}:setAccountName`,this.setAccountName.bind(this)),this.messenger.registerActionHandler(`${C}:setAccountNameAndSelectAccount`,this.setAccountNameAndSelectAccount.bind(this)),this.messenger.registerActionHandler(`${C}:updateAccounts`,this.updateAccounts.bind(this)),this.messenger.registerActionHandler(`${C}:getSelectedAccount`,this.getSelectedAccount.bind(this)),this.messenger.registerActionHandler(`${C}:getSelectedMultichainAccount`,this.getSelectedMultichainAccount.bind(this)),this.messenger.registerActionHandler(`${C}:getAccountByAddress`,this.getAccountByAddress.bind(this)),this.messenger.registerActionHandler(`${C}:getNextAvailableAccountName`,this.getNextAvailableAccountName.bind(this)),this.messenger.registerActionHandler("AccountsController:getAccount",this.getAccount.bind(this)),this.messenger.registerActionHandler("AccountsController:getAccounts",this.getAccounts.bind(this)),this.messenger.registerActionHandler("AccountsController:updateAccountMetadata",this.updateAccountMetadata.bind(this))}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/AccountsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/index.cjs",{"./AccountsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/AccountsController.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-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.isNormalKeyringType=s.getUUIDFromAddressOfNormalAccount=s.getUUIDOptionsFromAddressOfNormalAccount=s.keyringTypeToName=s.AccountsController=s.EMPTY_ACCOUNT=void 0;var n=e("./AccountsController.cjs");Object.defineProperty(s,"EMPTY_ACCOUNT",{enumerable:!0,get:function(){return n.EMPTY_ACCOUNT}}),Object.defineProperty(s,"AccountsController",{enumerable:!0,get:function(){return n.AccountsController}});var a=e("./utils.cjs");Object.defineProperty(s,"keyringTypeToName",{enumerable:!0,get:function(){return a.keyringTypeToName}}),Object.defineProperty(s,"getUUIDOptionsFromAddressOfNormalAccount",{enumerable:!0,get:function(){return a.getUUIDOptionsFromAddressOfNormalAccount}}),Object.defineProperty(s,"getUUIDFromAddressOfNormalAccount",{enumerable:!0,get:function(){return a.getUUIDFromAddressOfNormalAccount}}),Object.defineProperty(s,"isNormalKeyringType",{enumerable:!0,get:function(){return a.isNormalKeyringType}})}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-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","ethereum-cryptography/sha256":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isHdSnapKeyringAccount=s.HdSnapKeyringAccountOptionsStruct=s.getEvmGroupIndexFromAddressIndex=s.getEvmDerivationPathForIndex=s.isHdKeyringType=s.isSimpleKeyringType=s.isSnapKeyringType=s.isNormalKeyringType=s.getUUIDFromAddressOfNormalAccount=s.getUUIDOptionsFromAddressOfNormalAccount=s.keyringTypeToName=void 0;const n=e("@metamask/keyring-controller"),a=e("@metamask/superstruct"),o=e("@metamask/utils"),r=e("ethereum-cryptography/sha256"),i=e("uuid");function c(e){return{random:(0,r.sha256)((0,o.hexToBytes)(e)).slice(0,16)}}function l(e){return e===n.KeyringTypes.hd}s.keyringTypeToName=function(e){switch(e){case n.KeyringTypes.simple:case n.KeyringTypes.hd:return"Account";case n.KeyringTypes.trezor:return"Trezor";case n.KeyringTypes.oneKey:return"OneKey";case n.KeyringTypes.ledger:return"Ledger";case n.KeyringTypes.lattice:return"Lattice";case n.KeyringTypes.qr:return"QR";case n.KeyringTypes.snap:return"Snap Account";default:throw new Error(`Unknown keyring ${e}`)}},s.getUUIDOptionsFromAddressOfNormalAccount=c,s.getUUIDFromAddressOfNormalAccount=function(e){return(0,i.v4)(c(e))},s.isNormalKeyringType=function(e){return e!==n.KeyringTypes.snap},s.isSnapKeyringType=function(e){return e===n.KeyringTypes.snap},s.isSimpleKeyringType=function(e){return e===n.KeyringTypes.simple},s.isHdKeyringType=l,s.getEvmDerivationPathForIndex=function(e){return`m/44'/60'/0'/0/${e}`},s.getEvmGroupIndexFromAddressIndex=function(e,t){if(!l(e.type))return undefined;const s=e.accounts.findIndex(e=>e.toLowerCase()===t.toLowerCase());return-1===s?(console.warn(`! Unable to get group index for HD account: "${t}"`),undefined):s},s.HdSnapKeyringAccountOptionsStruct=(0,a.type)({entropySource:(0,a.string)(),index:(0,a.number)(),derivationPath:(0,a.string)()}),s.isHdSnapKeyringAccount=function(e){return(0,a.is)(e.options,s.HdSnapKeyringAccountOptionsStruct)}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function a(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function o(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function r(e,...t){if(!o(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(e.outputLen),n(e.blockLen)}function c(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function l(e,t){r(e);const s=t.outputLen;if(e.length<s)throw new Error(`digestInto() expects output buffer of length at least ${s}`)}Object.defineProperty(s,"__esModule",{value:!0}),s.output=s.exists=s.hash=s.bytes=s.bool=s.number=s.isBytes=void 0,s.number=n,s.bool=a,s.isBytes=o,s.bytes=r,s.hash=i,s.exists=c,s.output=l;const u={number:n,bool:a,bytes:r,hash:i,exists:c,output:l};s.default=u}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js",{"./_assert.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.HashMD=s.Maj=s.Chi=void 0;const n=e("./_assert.js"),a=e("./utils.js");s.Chi=(e,t,s)=>e&t^~e&s;s.Maj=(e,t,s)=>e&t^e&s^t&s;class o extends a.Hash{constructor(e,t,s,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=s,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,a.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:s,blockLen:o}=this,r=(e=(0,a.toBytes)(e)).length;for(let n=0;n<r;){const i=Math.min(o-this.pos,r-n);if(i===o){const t=(0,a.createView)(e);for(;o<=r-n;n+=o)this.process(t,n);continue}s.set(e.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.exists)(this),(0,n.output)(e,this),this.finished=!0;const{buffer:t,view:s,blockLen:o,isLE:r}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(s,0),i=0);for(let e=i;e<o;e++)t[e]=0;!function(e,t,s,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,s,n);const a=BigInt(32),o=BigInt(4294967295),r=Number(s>>a&o),i=Number(s&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,r,n),e.setUint32(t+l,i,n)}(s,o-8,BigInt(8*this.length),r),this.process(s,0);const c=(0,a.createView)(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,d[e],r)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const s=e.slice(0,t);return this.destroy(),s}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:s,length:n,finished:a,destroyed:o,pos:r}=this;return e.length=n,e.pos=r,e.finished=a,e.destroyed=o,n%t&&e.buffer.set(s),e}}s.HashMD=o}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.crypto=void 0,s.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js",{"./_md.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js","./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sha224=s.sha256=void 0;const n=e("./_md.js"),a=e("./utils.js"),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint32Array(64);class c extends n.HashMD{constructor(){super(64,32,8,!1),this.A=0|r[0],this.B=0|r[1],this.C=0|r[2],this.D=0|r[3],this.E=0|r[4],this.F=0|r[5],this.G=0|r[6],this.H=0|r[7]}get(){const{A:e,B:t,C:s,D:n,E:a,F:o,G:r,H:i}=this;return[e,t,s,n,a,o,r,i]}set(e,t,s,n,a,o,r,i){this.A=0|e,this.B=0|t,this.C=0|s,this.D=0|n,this.E=0|a,this.F=0|o,this.G=0|r,this.H=0|i}process(e,t){for(let s=0;s<16;s++,t+=4)i[s]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=i[e-15],s=i[e-2],n=(0,a.rotr)(t,7)^(0,a.rotr)(t,18)^t>>>3,o=(0,a.rotr)(s,17)^(0,a.rotr)(s,19)^s>>>10;i[e]=o+i[e-7]+n+i[e-16]|0}let{A:s,B:r,C:c,D:l,E:u,F:d,G:m,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,a.rotr)(u,6)^(0,a.rotr)(u,11)^(0,a.rotr)(u,25))+(0,n.Chi)(u,d,m)+o[e]+i[e]|0,f=((0,a.rotr)(s,2)^(0,a.rotr)(s,13)^(0,a.rotr)(s,22))+(0,n.Maj)(s,r,c)|0;h=m,m=d,d=u,u=l+t|0,l=c,c=r,r=s,s=t+f|0}s=s+this.A|0,r=r+this.B|0,c=c+this.C|0,l=l+this.D|0,u=u+this.E|0,d=d+this.F|0,m=m+this.G|0,h=h+this.H|0,this.set(s,r,c,l,u,d,m,h)}roundClean(){i.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends c{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}s.sha256=(0,a.wrapConstructor)(()=>new c),s.sha224=(0,a.wrapConstructor)(()=>new l)}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js",{"./_assert.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","@noble/hashes/crypto":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
Object.defineProperty(s,"__esModule",{value:!0}),s.randomBytes=s.wrapXOFConstructorWithOpts=s.wrapConstructorWithOpts=s.wrapConstructor=s.checkOpts=s.Hash=s.concatBytes=s.toBytes=s.utf8ToBytes=s.asyncLoop=s.nextTick=s.hexToBytes=s.bytesToHex=s.byteSwap32=s.byteSwapIfBE=s.byteSwap=s.isLE=s.rotl=s.rotr=s.createView=s.u32=s.u8=s.isBytes=void 0;const n=e("@noble/hashes/crypto"),a=e("./_assert.js");s.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name};s.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);s.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));s.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);s.rotr=(e,t)=>e<<32-t|e>>>t;s.rotl=(e,t)=>e<<t|e>>>32-t>>>0,s.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];s.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,s.byteSwapIfBE=s.isLE?e=>e:e=>(0,s.byteSwap)(e),s.byteSwap32=function(e){for(let t=0;t<e.length;t++)e[t]=(0,s.byteSwap)(e[t])};const o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));s.bytesToHex=function(e){(0,a.bytes)(e);let t="";for(let s=0;s<e.length;s++)t+=o[e[s]];return t};const r=48,i=57,c=65,l=70,u=97,d=102;function m(e){return e>=r&&e<=i?e-r:e>=c&&e<=l?e-(c-10):e>=u&&e<=d?e-(u-10):void 0}s.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,s=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(s);for(let t=0,a=0;t<s;t++,a+=2){const s=m(e.charCodeAt(a)),o=m(e.charCodeAt(a+1));if(s===undefined||o===undefined){const t=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+a)}n[t]=16*s+o}return n};function h(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function f(e){return"string"==typeof e&&(e=h(e)),(0,a.bytes)(e),e}s.nextTick=async()=>{},s.asyncLoop=async function(e,t,n){let a=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-a;e>=0&&e<t||(await(0,s.nextTick)(),a+=e)}},s.utf8ToBytes=h,s.toBytes=f,s.concatBytes=function(...e){let t=0;for(let s=0;s<e.length;s++){const n=e[s];(0,a.bytes)(n),t+=n.length}const s=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const a=e[t];s.set(a,n),n+=a.length}return s};s.Hash=class{clone(){return this._cloneInto()}};const p={}.toString;s.checkOpts=function(e,t){if(t!==undefined&&"[object Object]"!==p.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},s.wrapConstructor=function(e){const t=t=>e().update(f(t)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t},s.wrapConstructorWithOpts=function(e){const t=(t,s)=>e(s).update(f(t)).digest(),s=e({});return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=t=>e(t),t},s.wrapXOFConstructorWithOpts=function(e){const t=(t,s)=>e(s).update(f(t)).digest(),s=e({});return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=t=>e(t),t},s.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js",{"./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js","@noble/hashes/sha256":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sha256=void 0;const n=e("@noble/hashes/sha256"),a=e("./utils.js");s.sha256=(0,a.wrapHash)(n.sha256)}}},{package:"@metamask/accounts-controller>ethereum-cryptography",file:"node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js",{"@noble/hashes/_assert":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","@noble/hashes/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.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.crypto=s.utf8ToBytes=s.createView=s.concatBytes=s.toHex=s.bytesToHex=s.assertBytes=s.assertBool=void 0,s.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},s.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,o.hexToBytes)(t)},s.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0},s.wrapHash=function(e){return t=>(a.default.bytes(t),e(t))};const a=n(e("@noble/hashes/_assert")),o=e("@noble/hashes/utils"),r=a.default.bool;s.assertBool=r;const i=a.default.bytes;s.assertBytes=i;var c=e("@noble/hashes/utils");Object.defineProperty(s,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(s,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(s,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(s,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(s,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}}),s.crypto=(()=>{const e="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined,s=void 0!==t&&"function"==typeof t.require&&t.require.bind(t);return{node:s&&!e?s("crypto"):undefined,web:e}})()}}},{package:"@metamask/accounts-controller>ethereum-cryptography",file:"node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.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,o=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 r=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 r.BaseController{constructor({messenger:e,state:t}){const r={...(0,s.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:l,name:s.controllerName,state:r}),n.add(this),o(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 o={address:e,chainId:s,isEns:!1,memo:n,name:t,addressType:a,lastUpdatedAt:Date.now()},r=(0,i.normalizeEnsName)(t);return r&&(o.name=r,o.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[s]:{...this.state.addressBook[s],[e]:o}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",o),!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,o=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 r=e("@metamask/base-controller"),i={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class l extends r.BaseController{constructor({messenger:e,state:t,allAnnouncements:s}){const r={...i,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:r}),n.add(this),o(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/StakedBalanceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.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,o,r,i,c,l,u,d,m,h,f,p,k,b,g,w,y,v,x,A,S,_,j,C,I,E,T,O,P,D,M,N,B,R,L,F,U,$,H,W,z=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)},K=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},V=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 q=e("@metamask/base-controller"),G=e("@metamask/utils"),J=e("async-mutex"),Y=V(e("bignumber.js")),X=e("lodash"),Z=e("./data-sources/AccountsApiDataSource.cjs"),Q=e("./data-sources/BackendWebsocketDataSource.cjs"),ee=e("./data-sources/PriceDataSource.cjs"),te=e("./data-sources/RpcDataSource.cjs"),se=e("./data-sources/SnapDataSource.cjs"),ne=e("./data-sources/StakedBalanceDataSource.cjs"),ae=e("./data-sources/TokenDataSource.cjs"),oe=e("./logger.cjs"),re=e("./middlewares/DetectionMiddleware.cjs"),ie=e("./utils.cjs"),ce="AssetsController",le=["getAssets","getAssetsBalance","getAssetMetadata","getAssetsPrice","addCustomAsset","removeCustomAsset","getCustomAssets","hideAsset","unhideAsset"],ue=(0,oe.createModuleLogger)(oe.projectLogger,ce);function de(){return{assetsInfo:{},assetsBalance:{},assetsPrice:{},customAssets:{},assetPreferences:{}}}s.getDefaultAssetsControllerState=de;const me={assetsInfo:{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 he(e){return(0,G.parseCaipAssetType)(e).chainId}class fe extends q.BaseController{constructor({messenger:e,state:t={},defaultUpdateInterval:s=3e4,isEnabled:m=()=>!0,isBasicFunctionality:g,subscribeToBasicFunctionalityChange:S,queryApiClient:_,rpcDataSourceConfig:I,trackMetaMetricsEvent:E,accountsApiDataSourceConfig:T,priceDataSourceConfig:O,stakedBalanceDataSourceConfig:P}){super({name:ce,messenger:e,metadata:me,state:{assetsInfo:{},assetsBalance:{},assetsPrice:{},customAssets:{},assetPreferences:{},...t}}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,!1),l.set(this,new J.Mutex),u.set(this,new Map),d.set(this,new Set),h.set(this,void 0),f.set(this,void 0),p.set(this,void 0),k.set(this,void 0),b.set(this,void 0),w.set(this,void 0),y.set(this,void 0),v.set(this,void 0),x.set(this,null),K(this,a,m(),"f"),K(this,o,g??(()=>!0),"f"),K(this,r,s,"f"),K(this,i,E,"f");const D=I??{},M=(e,t,s)=>{this.handleActiveChainsUpdate(e,t,s)};if(K(this,h,new Q.BackendWebsocketDataSource({messenger:this.messenger,queryApiClient:_,onActiveChainsUpdated:M}),"f"),K(this,f,new Z.AccountsApiDataSource({queryApiClient:_,onActiveChainsUpdated:M,...T}),"f"),K(this,p,new se.SnapDataSource({messenger:this.messenger,onActiveChainsUpdated:M}),"f"),K(this,k,new te.RpcDataSource({messenger:this.messenger,onActiveChainsUpdated:M,...D}),"f"),K(this,b,new ne.StakedBalanceDataSource({messenger:this.messenger,onActiveChainsUpdated:M,...P}),"f"),K(this,v,new ae.TokenDataSource({queryApiClient:_}),"f"),K(this,w,new ee.PriceDataSource({queryApiClient:_,...O}),"f"),K(this,y,new re.DetectionMiddleware,"f"),z(this,a,"f")){if(ue("Initializing AssetsController",{defaultUpdateInterval:z(this,r,"f")}),z(this,n,"m",A).call(this),z(this,n,"m",j).call(this),z(this,n,"m",C).call(this),S){const e=S(e=>this.handleBasicFunctionalityChange(e));"function"==typeof e&&K(this,x,e,"f")}}else ue("AssetsController is disabled, skipping initialization")}handleActiveChainsUpdate(e,t,s){if(!z(this,a,"f"))return;ue("Data source active chains changed",{dataSourceId:e,chainCount:t.length,chains:t});const o=s,r=new Set(o),i=t.filter(e=>!r.has(e)),c=o.filter(e=>!t.includes(e));if((i.length>0||c.length>0)&&z(this,n,"m",M).call(this),i.length>0&&z(this,n,"a",m).length>0){const e=i.filter(e=>z(this,d,"f").has(e));e.length>0&&(ue("Fetching balances for newly added chains",{addedEnabledChains:e}),this.getAssets(z(this,n,"a",m),{chainIds:e,forceUpdate:!0}).catch(e=>{ue("Failed to fetch balance for added chains",{error:e})}))}}async getAssets(e,t){const s=t?.chainIds??[...z(this,d,"f")],a=t?.assetTypes??["fungible"],r=t?.dataTypes??["balance","metadata","price"],l=[];for(const t of e){const e=this.getCustomAssets(t.id);l.push(...e)}if(t?.forceUpdate){const t=Date.now(),u=z(this,n,"m",U).call(this,e,s,{assetTypes:a,dataTypes:r,customAssets:l.length>0?l:undefined,forceUpdate:!0}),d=z(this,o,"f").call(this)?[z(this,f,"f"),z(this,p,"f"),z(this,k,"f"),z(this,b,"f"),z(this,y,"f"),z(this,v,"f"),z(this,w,"f")]:[z(this,k,"f"),z(this,b,"f"),z(this,y,"f")],{response:m,durationByDataSource:h}=await z(this,n,"m",I).call(this,d,u);if(await z(this,n,"m",E).call(this,m),z(this,i,"f")&&!z(this,c,"f")){K(this,c,!0,"f");const e=Date.now()-t;z(this,i,"f").call(this,{durationMs:e,chainIds:s,durationByDataSource:h})}}return z(this,n,"m",T).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.assetsInfo[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,ie.normalizeAssetId)(t);ue("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=z(this,n,"a",m).find(t=>t.id===e);if(a){const e=he(s);await this.getAssets([a],{chainIds:[e],forceUpdate:!0})}}removeCustomAsset(e,t){const s=(0,ie.normalizeAssetId)(t);ue("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,ie.normalizeAssetId)(e);ue("Hiding asset",{assetId:t}),this.update(e=>{e.assetPreferences[t]||(e.assetPreferences[t]={}),e.assetPreferences[t].hidden=!0})}unhideAsset(e){const t=(0,ie.normalizeAssetId)(e);ue("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){if(!z(this,o,"f").call(this))return;const s="ds:PriceDataSource",a=z(this,u,"f").get(s)!==undefined,r={request:z(this,n,"m",U).call(this,e,t,{dataTypes:["price"]}),subscriptionId:s,isUpdate:a,onAssetsUpdate:e=>this.handleAssetsUpdate(e,"PriceDataSource"),getAssetsState:()=>this.state};z(this,w,"f").subscribe(r).catch(console.error);const i={chains:t,accountId:s,assetTypes:["fungible"],dataTypes:["price"],unsubscribe:()=>{z(this,u,"f").delete(s)}};z(this,u,"f").set(s,i)}unsubscribeAssetsPrice(){const e="ds:PriceDataSource",t=z(this,u,"f").get(e);t&&(z(this,w,"f").unsubscribe(e).catch(console.error),t.unsubscribe())}handleBasicFunctionalityChange(e){z(this,n,"m",D).call(this),z(this,n,"m",M).call(this)}async handleAssetsUpdate(e,t,s){ue("Assets updated from data source",{sourceId:t,hasBalance:Boolean(e.assetsBalance),hasPrice:Boolean(e.assetsPrice)});const{response:a}=await z(this,n,"m",I).call(this,[z(this,y,"f"),z(this,v,"f"),z(this,w,"f")],s??{accountsWithSupportedChains:[],chainIds:[],dataTypes:["balance","metadata","price"]},e);await z(this,n,"m",E).call(this,a)}destroy(){ue("Destroying AssetsController",{dataSourceCount:z(this,n,"a",g).length,subscriptionCount:z(this,u,"f").size}),z(this,h,"f")?.destroy?.(),z(this,f,"f")?.destroy?.(),z(this,p,"f")?.destroy?.(),z(this,k,"f")?.destroy?.(),z(this,b,"f")?.destroy?.(),z(this,n,"m",D).call(this),z(this,x,"f")&&(z(this,x,"f").call(this),K(this,x,null,"f")),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=fe,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,k=new WeakMap,b=new WeakMap,w=new WeakMap,y=new WeakMap,v=new WeakMap,x=new WeakMap,n=new WeakSet,m=function(){return this.messenger.call("AccountTreeController:getAccountsFromSelectedAccountGroup")},g=function(){return[z(this,h,"f"),z(this,f,"f"),z(this,p,"f"),z(this,k,"f")]},A=function(){const{enabledNetworkMap:e}=this.messenger.call("NetworkEnablementController:getState");K(this,d,z(this,n,"m",S).call(this,e),"f"),ue("Initialized state",{enabledNetworkMap:e,enabledChains:z(this,d,"f")})},S=function(e){const t=new Set;for(const[s,a]of Object.entries(e))for(const[e,o]of Object.entries(a))if(o)if(e.includes(":"))t.add(e);else{const a=z(this,n,"m",_).call(this,s,e);t.add(`${s}:${a}`)}return t},_=function(e,t){return"eip155"===e&&(0,G.isStrictHexString)(t)?parseInt(t,16).toString():t},j=function(){this.messenger.subscribe("AccountTreeController:selectedAccountGroupChange",()=>{z(this,n,"m",H).call(this).catch(console.error)}),this.messenger.subscribe("NetworkEnablementController:stateChange",({enabledNetworkMap:e})=>{z(this,n,"m",W).call(this,e).catch(console.error)}),this.messenger.subscribe("KeyringController:unlock",()=>z(this,n,"m",P).call(this)),this.messenger.subscribe("KeyringController:lock",()=>z(this,n,"m",D).call(this))},C=function(){this.messenger.registerMethodActionHandlers(this,le)},I=async function(e,t,s={}){const n=e.map(e=>e.getName()),a=e.map(e=>e.assetsMiddleware),o=[],r=a.map((e,t)=>async(s,n)=>{const a=Date.now();try{return await e(s,n)}finally{o[t]=Date.now()-a}}).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),i=await r({request:t,response:s,getAssetsState:()=>this.state}),c={};for(let e=0;e<o.length;e++){const t=e+1<o.length?o[e+1]??0:0,s=Math.max(0,(o[e]??0)-t),a=n[e];a!==undefined&&(c[a]=s)}return{response:i.response,durationByDataSource:c}},E=async function(e){const t=function(e){const t={};if(e.assetsInfo){t.assetsInfo={};for(const[s,n]of Object.entries(e.assetsInfo)){const e=(0,ie.normalizeAssetId)(s);t.assetsInfo[e]=n}}if(e.assetsPrice){t.assetsPrice={};for(const[s,n]of Object.entries(e.assetsPrice)){const e=(0,ie.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,ie.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,ie.normalizeAssetId)(e))}return e.errors&&(t.errors={...e.errors}),t}(e),s=await z(this,l,"f").acquire();try{const e=this.state,s={...this.state.assetsPrice},n=t.detectedAssets??{},a=[],o=[];this.update(s=>{const n=s.assetsInfo,r=s.assetsBalance,i=s.assetsPrice;if(t.assetsInfo)for(const[s,a]of Object.entries(t.assetsInfo))(0,X.isEqual)(e.assetsInfo[s],a)||o.push(s),n[s]=a;if(t.assetsBalance)for(const[s,n]of Object.entries(t.assetsBalance)){const t=e.assetsBalance[s]??{};r[s]||(r[s]={});for(const[e,o]of Object.entries(n)){const n=t[e],r=o.amount,i=n?.amount;i!==r&&a.push({accountId:s,assetId:e,oldAmount:i,newAmount:r})}Object.assign(r[s],n)}if(t.assetsPrice)for(const[e,s]of Object.entries(t.assetsPrice))i[e]=s});const r=t.assetsPrice?Object.keys(t.assetsPrice).filter(e=>!(0,X.isEqual)(s[e],t.assetsPrice?.[e])):[];(a.length>0||o.length>0||r.length>0)&&ue("State updated",{changedBalances:a.length>0?a:undefined,changedMetadataCount:o.length>0?o.length:undefined,changedPricesCount:r.length>0?r.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(r.length>0&&t.assetsPrice){const e={};for(const s of r){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()}},T=function(e,t,s){const a={},o=new Set(t),r=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.assetsInfo[e];if(!c)continue;const l=c,u=this.state.assetPreferences[e];if(u?.hidden)continue;const d=he(e);if(!o.has(d))continue;const m=z(this,n,"m",O).call(this,l.type);if(!r.has(m))continue;const h=i,f=this.state.assetsPrice[e]??{price:0,lastUpdated:0},p={id:e,chainId:d,balance:h,metadata:l,price:f,fiatValue:new Y.default(h.amount||"0").multipliedBy(f.price||0).toNumber()};a[t.id][e]=p}}return a},O=function(e){switch(e){case"native":case"erc20":case"spl":default:return"fungible";case"erc721":return"nft";case"erc1155":return"collectible"}},P=function(){ue("Starting asset tracking",{selectedAccountCount:z(this,n,"a",m).length,enabledChainCount:z(this,d,"f").size}),z(this,n,"m",M).call(this),this.getAssets(z(this,n,"a",m),{chainIds:[...z(this,d,"f")],forceUpdate:!0}).catch(e=>{ue("Failed to fetch assets",e)})},D=function(){ue("Stopping asset tracking",{activeSubscriptionCount:z(this,u,"f").size,hasPriceSubscription:z(this,u,"f").has("ds:PriceDataSource")}),K(this,c,!1,"f"),this.unsubscribeAssetsPrice();const e=[...z(this,n,"a",g),z(this,b,"f")],t=[...z(this,u,"f").keys()];for(const s of t)if(s.startsWith("ds:")){const t=s.slice(3),a=e.find(e=>e.getName()===t);a&&z(this,n,"m",F).call(this,a)}z(this,u,"f").clear()},M=function(){0!==z(this,n,"a",m).length&&(z(this,n,"m",N).call(this,z(this,n,"a",m),[...z(this,d,"f")]),z(this,n,"m",B).call(this,z(this,n,"a",m),[...z(this,d,"f")]),this.subscribeAssetsPrice(z(this,n,"a",m),[...z(this,d,"f")]))},N=function(e,t){const s=z(this,n,"m",R).call(this,e,new Set(t)),a=new Set(s.keys()),r=z(this,o,"f").call(this)?z(this,n,"a",g):[z(this,k,"f")];for(const e of r){const t=new Set(e.getActiveChainsSync()),o=[];for(const e of a)t.has(e)&&(o.push(e),a.delete(e));if(0===o.length){z(this,n,"m",F).call(this,e);continue}const r=new Set,i=o.flatMap(e=>s.get(e)??[]).filter(e=>!r.has(e.id)&&(r.add(e.id),!0));i.length>0&&z(this,n,"m",L).call(this,e,i,o)}},B=function(e,t){const s=z(this,b,"f");if(!s)return;const a=new Set(s.getActiveChainsSync()),o=t.filter(e=>a.has(e));0!==o.length?z(this,n,"m",L).call(this,s,e,o):z(this,n,"m",F).call(this,s)},R=function(e,t){const s=new Map;for(const a of e)for(const e of z(this,n,"m",$).call(this,a)){if(!t.has(e))continue;let n=s.get(e);n||(n=[],s.set(e,n)),n.push(a)}return s},L=function(e,t,s){const a=e.getName(),o=`ds:${a}`,i=z(this,u,"f").get(o)!==undefined;ue("Subscribe to data source",{sourceId:a,subscriptionKey:o,isUpdate:i,accountCount:t.length,chainCount:s.length});const c={request:z(this,n,"m",U).call(this,t,s,{assetTypes:["fungible"],dataTypes:["balance"],updateInterval:z(this,r,"f")}),subscriptionId:o,isUpdate:i,onAssetsUpdate:e=>this.handleAssetsUpdate(e,a),getAssetsState:()=>this.state};e.subscribe(c).catch(e=>{console.error(`[AssetsController] Failed to subscribe to '${a}':`,e)});const l={chains:s,accountId:o,assetTypes:["fungible"],dataTypes:["balance"],unsubscribe:()=>{z(this,u,"f").delete(o)}};z(this,u,"f").set(o,l)},F=function(e){const t=`ds:${e.getName()}`,s=z(this,u,"f").get(t);s&&(e.unsubscribe(t).catch(()=>undefined),s.unsubscribe())},U=function(e,t,s={}){const a=new Set(t);return{accountsWithSupportedChains:e.map(e=>({account:e,supportedChains:z(this,n,"m",$).call(this,e).filter(e=>a.has(e))})),chainIds:t,...s}},$=function(e){const t=e.scopes??[],s=[];for(const e of t){const t=e;if(!(0,G.isCaipChainId)(t)){s.push(e);continue}const{namespace:n,reference:a}=(0,G.parseCaipChainId)(t);if("0"===a){for(const e of z(this,d,"f"))if((0,G.isCaipChainId)(e)){(0,G.parseCaipChainId)(e).namespace===n&&s.push(e)}}else"eip155"===n&&(0,G.isStrictHexString)(a)?s.push(`eip155:${parseInt(a,16)}`):s.push(e)}return s},H=async function(){const e=z(this,n,"a",m);ue("Account group changed",{accountCount:e.length,accountIds:e.map(e=>e.id)}),z(this,n,"m",M).call(this),e.length>0&&await this.getAssets(e,{chainIds:[...z(this,d,"f")],forceUpdate:!0})},W=async function(e){const t=z(this,d,"f");K(this,d,z(this,n,"m",S).call(this,e),"f");const s=[];for(const e of z(this,d,"f"))t.has(e)||s.push(e);const a=[];for(const e of t)z(this,d,"f").has(e)||a.push(e);ue("Enabled networks changed",{previousCount:t.size,newCount:z(this,d,"f").size,addedChains:s,removedChains:a}),z(this,n,"m",M).call(this),s.length>0&&z(this,n,"a",m).length>0&&await this.getAssets(z(this,n,"a",m),{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","@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,o,r,i,c,l,u,d,m,h,f=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.AccountsApiDataSource=s.filterResponseToKnownAssets=void 0;e("@metamask/core-backend");const k=e("@metamask/utils"),b=e("./AbstractDataSource.cjs"),g=e("../logger.cjs"),w=e("../utils.cjs"),y="AccountsApiDataSource",v=(0,g.createModuleLogger)(g.projectLogger,y),x={activeChains:[]};function A(e){return"string"==typeof e?(0,k.isCaipChainId)(e)?e:(0,k.toCaipChainId)(k.KnownCaipNamespace.Eip155,e):(0,k.toCaipChainId)(k.KnownCaipNamespace.Eip155,String(e))}function S(e){return(0,k.isCaipChainId)(e)?e:(0,k.toCaipChainId)(k.KnownCaipNamespace.Eip155,e)}function _(e,t){if(!e.assetsBalance)return e;const s={};for(const[n,a]of Object.entries(e.assetsBalance)){const e=t.assetsBalance[n];if(!e)continue;const o={};for(const[t,s]of Object.entries(a))t in e&&(o[t]=s);Object.keys(o).length>0&&(s[n]=o)}return{...e,assetsBalance:Object.keys(s).length>0?s:undefined}}s.filterResponseToKnownAssets=_;class j extends b.AbstractDataSource{constructor(e){super(y,{...x,...e.state}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,null),l.set(this,void 0),f(this,a,e.onActiveChainsUpdated,"f"),f(this,o,e.pollInterval??3e4,"f"),f(this,r,e.tokenDetectionEnabled??(()=>!0),"f"),f(this,i,e.queryApiClient,"f"),p(this,n,"m",u).call(this).catch(console.error)}async fetch(e){let t={};const 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 o=await p(this,i,"f").accounts.fetchV5MultiAccountBalances(s);if(o.unprocessedNetworks.length>0){const e=o.unprocessedNetworks.map(S);t.errors=t.errors??{};for(const s of e)t.errors[s]="Unprocessed by Accounts API"}const{assetsBalance:r}=p(this,n,"m",h).call(this,o.balances,e);t.assetsBalance=r}catch(e){v("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!p(this,r,"f").call(this)&&p(this,l,"f")&&(t=_(t,p(this,l,"f").call(this))),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 o=new Set(Object.keys(t.errors??{}));a=n.chainIds.filter(e=>!o.has(e)),p(this,r,"f").call(this)||t.assetsBalance&&0!==Object.keys(t.assetsBalance).length||(a=[])}catch(e){v("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;e.getAssetsState&&f(this,l,e.getAssetsState,"f");const 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 r=t.updateInterval??p(this,o,"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){v("Subscription poll failed",{subscriptionId:s,error:e})}},c=setInterval(()=>{i().catch(console.error)},r);this.activeSubscriptions.set(s,{cleanup:()=>{clearInterval(c)},chains:a,request:t,onAssetsUpdate:e.onAssetsUpdate}),await i()}destroy(){p(this,c,"f")&&clearInterval(p(this,c,"f")),super.destroy()}}s.AccountsApiDataSource=j,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,n=new WeakSet,u=async function(){try{const e=await p(this,n,"m",m).call(this),t=[...this.state.activeChains];this.updateActiveChains(e,e=>p(this,a,"f").call(this,this.getName(),e,t)),f(this,c,setInterval(()=>{p(this,n,"m",d).call(this).catch(console.error)},12e5),"f")}catch(e){v("Failed to fetch active chains",e)}},d=async function(){try{const e=await p(this,n,"m",m).call(this),t=new Set(this.state.activeChains),s=new Set(e),o=e.filter(e=>!t.has(e)),r=Array.from(t).filter(e=>!s.has(e));if(o.length>0||r.length>0){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>p(this,a,"f").call(this,this.getName(),e,t))}}catch(e){v("Failed to refresh active chains",e)}},m=async function(){return(await p(this,i,"f").accounts.fetchV2SupportedNetworks()).fullSupport.map(A)},h=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(),o=n.get(a);if(!o)continue;s[o]||(s[o]={});const r=(0,w.normalizeAssetId)(t.assetId);s[o][r]={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","@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,o,r,i,c,l,u,d,m,h,f,p,k,b,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},y=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("@metamask/utils"),x=e("./AbstractDataSource.cjs"),A=e("../logger.cjs"),S="BackendWebsocketDataSource",_="account-activity.v1",j=(0,A.createModuleLogger)(A.projectLogger,S),C={activeChains:[]};function I(e){const[t]=e.split(":");return t}const E=["eip155","solana"];function T(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 O(e,t){const s="eip155"===e?t.toLowerCase():t;return`${_}.${e}:0:${s}`}function P(e){return"string"==typeof e?(0,v.isCaipChainId)(e)?e:(0,v.toCaipChainId)(v.KnownCaipNamespace.Eip155,e):(0,v.toCaipChainId)(v.KnownCaipNamespace.Eip155,String(e))}class D extends x.AbstractDataSource{constructor(e){super(S,{...C,...e.state}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.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,o,e.queryApiClient,"f"),w(this,r,e.onActiveChainsUpdated,"f"),y(this,n,"m",f).call(this),y(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=>y(this,r,"f").call(this,this.getName(),e,t))}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:o}=e,r=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"!==y(this,a,"f").call("BackendWebSocketService:getConnectionInfo").state)return void y(this,l,"f").set(s,e)}catch{return void y(this,l,"f").set(s,e)}if(y(this,l,"f").delete(s),o){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=r)}}await this.unsubscribe(s);const d=function(e){const t=new Set(E);for(const s of e)t.add(I(s));return Array.from(t)}(r),m=[];for(const e of d)for(const{account:s}of t.accountsWithSupportedChains){const t=T(s,e);t&&m.push(O(e,t))}try{const t=await y(this,a,"f").call("BackendWebSocketService:subscribe",{channels:m,channelType:_,callback:e=>{y(this,n,"m",b).call(this,e,s)}});y(this,c,"f").set(s,t),this.activeSubscriptions.set(s,{cleanup:()=>{const e=y(this,c,"f").get(s);e&&(e.unsubscribe().catch(e=>{j("Error unsubscribing",{subscriptionId:s,error:e})}),y(this,c,"f").delete(s)),y(this,u,"f").delete(s)},chains:r,addresses:i,onAssetsUpdate:e.onAssetsUpdate}),y(this,u,"f").set(s,e)}catch(e){j("WebSocket subscription FAILED",{subscriptionId:s,error:e,chains:r})}}destroy(){y(this,i,"f")&&(clearInterval(y(this,i,"f")),w(this,i,null,"f"));const e=[...y(this,c,"f").values()];for(const t of e)try{t.unsubscribe().catch(()=>{})}catch{}y(this,c,"f").clear(),super.destroy()}}s.BackendWebsocketDataSource=D,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,n=new WeakSet,d=async function(){try{const e=await y(this,n,"m",h).call(this),t=[...this.state.activeChains];this.updateActiveChains(e,e=>y(this,r,"f").call(this,this.getName(),e,t)),w(this,i,setInterval(()=>{y(this,n,"m",m).call(this).catch(console.error)},12e5),"f")}catch(e){j("Failed to fetch active chains",e)}},m=async function(){try{const e=await y(this,n,"m",h).call(this),t=new Set(this.state.activeChains),s=new Set(e),a=e.filter(e=>!t.has(e)),o=Array.from(t).filter(e=>!s.has(e));if(a.length>0||o.length>0){const t=[...this.state.activeChains];this.updateActiveChains(e,e=>y(this,r,"f").call(this,this.getName(),e,t))}}catch(e){j("Failed to refresh active chains",e)}},h=async function(){return(await y(this,o,"f").accounts.fetchV2SupportedNetworks()).fullSupport.map(P)},f=function(){y(this,a,"f").subscribe("BackendWebSocketService:connectionStateChanged",e=>{"connected"===e.state?y(this,n,"m",k).call(this).catch(console.error):"disconnected"===e.state&&y(this,n,"m",p).call(this)})},p=function(){j("WebSocket disconnected, preserving subscriptions for reconnect",{activeSubscriptionCount:this.activeSubscriptions.size,wsSubscriptionCount:y(this,c,"f").size});for(const[e]of this.activeSubscriptions){const t=y(this,u,"f").get(e);t&&y(this,l,"f").set(e,{...t,isUpdate:!1})}y(this,c,"f").clear(),this.activeSubscriptions.clear()},k=async function(){if(0===y(this,l,"f").size)return;const e=Array.from(y(this,l,"f").entries());for(const[t,s]of e)try{y(this,l,"f").delete(t),await this.subscribe(s)}catch(e){j("Failed to process pending subscription",{subscriptionId:t,error:e})}},b=function(e,t){try{const s=this.activeSubscriptions.get(t),a=y(this,u,"f").get(t)?.request;if(!a)return;const o=e.data,{address:r,tx:i,updates:c}=o;if(!r||!i||!c)return;const l=i.chain,d=a.accountsWithSupportedChains.map(e=>e.account).find(e=>e.address.startsWith("0x")?e.address.toLowerCase()===r.toLowerCase():e.address===r);if(!d)return;const m=d.id,h=y(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){j("Error handling notification",e)}},g=function(e,t,s){const n={[s]:{}},a={};for(const t of e){const{asset:e,postBalance:o}=t;if(!e||!o)continue;const r=e.type,i=e.type.includes("/slip44:")?"native":"erc20",c=o.amount.startsWith("0x")?BigInt(o.amount).toString():o.amount;n[s][r]={amount:c},a[r]={type:i,symbol:e.unit,name:e.unit,decimals:e.decimals}}const o={};return Object.keys(n[s]).length>0&&(o.assetsBalance=n,o.assetsInfo=a),o},s.createBackendWebsocketDataSource=function(e){return new D(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","@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,o,r,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("@metamask/utils"),h=e("../logger.cjs"),f=e("../types.cjs"),p="PriceDataSource",k=(0,h.createModuleLogger)(h.projectLogger,p),b=[/\/slip44:\d+-staked-for-/u,/\/slip44:bandwidth$/u,/\/slip44:energy$/u,/\/slip44:maximum-bandwidth$/u,/\/slip44:maximum-energy$/u];function g(e){return!b.some(t=>t.test(e))}function w(e){return"object"==typeof e&&null!==e&&"price"in e&&"number"==typeof e.price}class y{getName(){return y.controllerName}constructor(e){n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,new Map),u(this,a,e.currency??"usd","f"),u(this,o,e.pollInterval??6e4,"f"),u(this,r,e.queryApiClient,"f")}get assetsMiddleware(){return(0,f.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 o=[...a].filter(g);if(0===o.length)return t(e);try{const e=await d(this,n,"m",c).call(this,o);s.assetsPrice??(s.assetsPrice={});for(const[t,n]of Object.entries(e)){if(!w(n))continue;const e=t;s.assetsPrice[e]={...n,lastUpdated:Date.now()}}}catch(e){k("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(g);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(!w(n))continue;const e=t;s.assetsPrice[e]={...n,lastUpdated:Date.now()}}}catch(e){k("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,o,"f"),r=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){k("Subscription poll failed",{subscriptionId:s,error:e})}},c=setInterval(()=>{r().catch(console.error)},a);d(this,i,"f").set(s,{cleanup:()=>{clearInterval(c)},request:t,onAssetsUpdate:e.onAssetsUpdate,getAssetsState:e.getAssetsState}),await r()}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()}}s.PriceDataSource=y,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=async function(e){return d(this,r,"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),o=a.length>0?new Set(a):undefined,r=e.chainIds.length>0?new Set(e.chainIds):undefined;if(s?.assetsBalance)for(const[e,t]of Object.entries(s.assetsBalance))if(!o||o.has(e))for(const e of Object.keys(t)){if(r)try{const{chainId:t}=(0,m.parseCaipAssetType)(e);if(!r.has(t))continue}catch(t){k("Skipping malformed asset ID in balance state",{assetId:e,error:t});continue}n.add(e)}return[...n]}catch(e){return k("Failed to get asset IDs from balance state",{error:e}),[]}},y.controllerName=p}}},{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,o,r,i,c,l,u,d,m,h,f,p,k,b,g,w,y,v,x,A,S,_,j,C,I,E,T,O,P,D,M,N=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},B=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)},R=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 L=e("@ethersproject/providers"),F=e("@metamask/controller-utils"),U=e("@metamask/utils"),$=R(e("bignumber.js")),H=e("./AbstractDataSource.cjs"),W=e("./evm-rpc-services/index.cjs"),z=e("../logger.cjs"),K="RpcDataSource",V=(0,z.createModuleLogger)(z.projectLogger,K);s.caipChainIdToHex=e=>{if((0,U.isStrictHexString)(e))return e;if((0,U.isCaipChainId)(e))return(0,F.toHex)((0,U.parseCaipChainId)(e).reference);throw new Error("caipChainIdToHex - Failed to provide CAIP-2 or Hex chainId")};class q extends H.AbstractDataSource{constructor(e){super(K,{activeChains:[]}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,[]),u.set(this,{}),d.set(this,new Map),m.set(this,new Map),h.set(this,undefined),f.set(this,undefined),p.set(this,void 0),k.set(this,void 0),b.set(this,void 0),N(this,a,e.messenger,"f"),N(this,o,e.onActiveChainsUpdated,"f"),N(this,r,e.timeout??1e4,"f"),N(this,i,e.tokenDetectionEnabled??(()=>!0),"f"),N(this,c,e.useExternalService??(()=>!0),"f");const t=e.balanceInterval??3e4,s=e.detectionInterval??18e4;V("Initializing RpcDataSource",{timeout:B(this,r,"f"),balanceInterval:t,detectionInterval:s,tokenDetectionEnabled:B(this,i,"f").call(this),useExternalService:B(this,c,"f").call(this)}),N(this,p,new W.MulticallClient(e=>B(this,n,"m",T).call(this,e)),"f");const g={call:e=>({assetsBalance:B(this,a,"f").call("AssetsController:getState").assetsBalance??{}})},w={call:e=>B(this,a,"f").call("TokenListController:getState")};N(this,k,new W.BalanceFetcher(B(this,p,"f"),g,{pollingInterval:t}),"f"),B(this,k,"f").setOnBalanceUpdate(B(this,n,"m",y).bind(this)),N(this,b,new W.TokenDetector(B(this,p,"f"),w,{pollingInterval:s,tokenDetectionEnabled:B(this,i,"f"),useExternalService:B(this,c,"f")}),"f"),B(this,b,"f").setOnDetectionUpdate(B(this,n,"m",v).bind(this)),B(this,n,"m",x).call(this),B(this,n,"m",A).call(this),B(this,n,"m",C).call(this)}getChainStatuses(){return{...B(this,u,"f")}}getChainStatus(e){return B(this,u,"f")[e]}setBalancePollingInterval(e){V("Setting balance polling interval",{interval:e}),B(this,k,"f").setIntervalLength(e)}getBalancePollingInterval(){return B(this,k,"f").getIntervalLength()}setDetectionPollingInterval(e){V("Setting detection polling interval",{interval:e}),B(this,b,"f").setIntervalLength(e)}getDetectionPollingInterval(){return B(this,b,"f").getIntervalLength()}async fetch(e){const t={},a=e.chainIds.filter(e=>B(this,l,"f").includes(e));if(V("Fetch requested",{accounts:e.accountsWithSupportedChains.map(e=>e.account.id),requestedChains:e.chainIds,chainsToFetch:a}),0===a.length)return V("No active chains to fetch"),t;const o={},r={},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:l,id:d}=t;for(const t of e){const e=(0,s.caipChainIdToHex)(t);try{const s=await B(this,k,"f").fetchBalancesForTokens(e,d,l,[],{includeNative:!0});o[d]||(o[d]={});const a=B(this,n,"m",w).call(this,s.balances,t);Object.assign(r,a);for(const e of s.balances){const t=r[e.assetId],s=t?.decimals??18,a=B(this,n,"m",g).call(this,e.balance,s);o[d][e.assetId]={amount:a}}}catch(e){V("Failed to fetch balance",{address:l,chainId:t,error:e}),o[d]||(o[d]={});const s=B(this,n,"m",P).call(this,t);o[d][s]={amount:"0"};const a=B(this,u,"f")[t];a&&(r[s]={type:"native",symbol:a.nativeCurrency,name:a.nativeCurrency,decimals:18}),i.includes(t)||i.push(t)}}}if(i.length>0){V("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 V("Fetch SUCCESS",{chains:a,accountCount:Object.keys(o).length});return t.assetsBalance=o,Object.keys(r).length>0&&(t.assetsInfo=r),t}async detectTokens(e,t){if(!B(this,i,"f").call(this)||!B(this,c,"f").call(this))return{};const a=(0,s.caipChainIdToHex)(e),{address:o,id:r}=t;V("Running token detection",{chainId:e,accountId:r});try{const t=await B(this,b,"f").detectTokens(a,r,o,{tokenDetectionEnabled:B(this,i,"f").call(this),useExternalService:B(this,c,"f").call(this)});if(0===t.detectedAssets.length)return V("No new tokens detected"),{};V("Detected new tokens",{count:t.detectedAssets.length,chainId:e,accountId:r});const s={},l={};for(const e of t.detectedAssets)e.symbol&&e.decimals!==undefined&&(l[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),o=a?.decimals??18,r=B(this,n,"m",g).call(this,e.balance,o);s[e.assetId]={amount:r}}const u={detectedAssets:{[r]:t.detectedAssets.map(e=>e.assetId)},assetsBalance:{[r]:s}};return Object.keys(l).length>0&&(u.assetsInfo=l),u}catch(t){return V("Token detection failed",{chainId:e,accountId:r,error:t}),{}}}get assetsMiddleware(){return async(e,t)=>{var s,n,a;const{request:o}=e,r=o.chainIds.filter(e=>B(this,l,"f").includes(e));if(0===r.length)return t(e);let i=[];V("Middleware fetching",{chains:r,accounts:o.accountsWithSupportedChains.map(e=>e.account.id)});const c=await this.fetch({...o,chainIds:r});if(c.assetsBalance){(s=e.response).assetsBalance??(s.assetsBalance={});for(const[t,s]of Object.entries(c.assetsBalance))(n=e.response.assetsBalance)[t]??(n[t]={}),e.response.assetsBalance[t]={...e.response.assetsBalance[t],...s}}c.assetsInfo&&((a=e.response).assetsInfo??(a.assetsInfo={}),e.response.assetsInfo={...e.response.assetsInfo,...c.assetsInfo});const u=new Set(Object.keys(c.errors??{}));if(i=r.filter(e=>!u.has(e)),i.length>0){const s=o.chainIds.filter(e=>!i.includes(e));return t({...e,request:{...o,chainIds:s}})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:n,isUpdate:a}=e,o=t.chainIds.filter(e=>B(this,l,"f").includes(e));if(V("Subscribe requested",{subscriptionId:n,isUpdate:a,accounts:t.accountsWithSupportedChains.map(e=>e.account.id),chainsToSubscribe:o}),0===o.length)return void V("No active chains to subscribe");if(a){const e=B(this,m,"f").get(n);e&&V("Updating existing subscription - restarting polling",{subscriptionId:n,existingChains:e.chains,newChains:o})}await this.unsubscribe(n);const r=[],u=[];for(const{account:e,supportedChains:n}of t.accountsWithSupportedChains){const t=o.filter(e=>n.includes(e));if(0===t.length)continue;const{address:a,id:l}=e;for(const e of t){const t=(0,s.caipChainIdToHex)(e),n={chainId:t,accountId:l,accountAddress:a},o=B(this,k,"f").startPolling(n);if(r.push(o),B(this,i,"f").call(this)&&B(this,c,"f").call(this)){const e={chainId:t,accountId:l,accountAddress:a},s=B(this,b,"f").startPolling(e);u.push(s)}}}const d=t.accountsWithSupportedChains.map(e=>e.account);B(this,m,"f").set(n,{balancePollingTokens:r,detectionPollingTokens:u,chains:o,accounts:d,onAssetsUpdate:e.onAssetsUpdate}),V("Subscription SUCCESS",{subscriptionId:n,chains:o,balancePollingCount:r.length,detectionPollingCount:u.length})}async unsubscribe(e){const t=B(this,m,"f").get(e);if(t){for(const e of t.balancePollingTokens)B(this,k,"f").stopPollingByPollingToken(e);for(const e of t.detectionPollingTokens)B(this,b,"f").stopPollingByPollingToken(e);B(this,m,"f").delete(e),V("Unsubscribed and stopped polling",{subscriptionId:e})}}destroy(){V("Destroying RpcDataSource"),B(this,h,"f")?.call(this),B(this,f,"f")?.call(this),B(this,k,"f").stopAllPolling(),B(this,b,"f").stopAllPolling(),B(this,m,"f").clear(),B(this,d,"f").clear()}}s.RpcDataSource=q,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,k=new WeakMap,b=new WeakMap,n=new WeakSet,g=function(e,t){const s=new $.default(e),n=new $.default(10).pow(t);return s.dividedBy(n).toString()},w=function(e,t){const s={},a=B(this,n,"m",D).call(this);for(const o of e){if(o.assetId.includes("/slip44:")){const e=B(this,u,"f")[t];e&&(s[o.assetId]={type:"native",symbol:e.nativeCurrency,name:e.nativeCurrency,decimals:18})}else{const e=a[o.assetId];if(e)s[o.assetId]=e;else{const e=B(this,n,"m",M).call(this,o.assetId);s[o.assetId]=e||{type:"erc20",symbol:"",name:"",decimals:18}}}}return s},y=function(e){const t={},s=`eip155:${parseInt(e.chainId,16)}`,a=B(this,n,"m",w).call(this,e.balances,s);for(const s of e.balances){const e=a[s.assetId],o=e?.decimals??18,r=B(this,n,"m",g).call(this,s.balance,o);t[s.assetId]={amount:r}}const o={assetsBalance:{[e.accountId]:t},assetsInfo:a};V("Balance update response",{accountId:e.accountId,newBalanceCount:Object.keys(t).length});for(const e of B(this,m,"f").values())e.onAssetsUpdate(o)?.catch(e=>{V("Failed to update assets",{error:e})})},v=function(e){V("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),o=a?.decimals??18,r=B(this,n,"m",g).call(this,t.balance,o);s[t.assetId]={amount:r}}const a={detectedAssets:{[e.accountId]:e.detectedAssets.map(e=>e.assetId)},assetsInfo:t,assetsBalance:{[e.accountId]:s}};for(const e of B(this,m,"f").values())e.onAssetsUpdate(a)?.catch(e=>{V("Failed to update detected assets",{error:e})})},x=function(){B(this,a,"f").subscribe("NetworkController:stateChange",e=>{V("NetworkController state changed"),B(this,n,"m",O).call(this),B(this,n,"m",I).call(this,e)})},A=function(){const e=B(this,a,"f").subscribe("TransactionController:transactionConfirmed",B(this,n,"m",S).bind(this));N(this,h,"function"==typeof e?e:undefined,"f");const t=B(this,a,"f").subscribe("TransactionController:incomingTransactionsReceived",B(this,n,"m",_).bind(this));N(this,f,"function"==typeof t?t:undefined,"f")},S=function(e){const t=e?.chainId;if(!t)return;const s=`eip155:${parseInt(t,16)}`;B(this,n,"m",j).call(this,[s]).catch(e=>{V("Failed to refresh balance after transaction confirmed",{error:e})})},_=function(e){const t=Array.from(new Set((e??[]).map(e=>e?.chainId).filter(e=>Boolean(e)))).map(e=>`eip155:${parseInt(e,16)}`),s=t.length>0?t:[...B(this,l,"f")];B(this,n,"m",j).call(this,s).catch(e=>{V("Failed to refresh balance after incoming transactions",{error:e})})},j=async function(e){const t=new Set(e);if(0!==e.filter(e=>B(this,l,"f").includes(e)).length)for(const e of B(this,m,"f").values()){const s=e.chains.filter(e=>t.has(e));if(0===s.length)continue;const n={accountsWithSupportedChains:e.accounts.map(e=>({account:e,supportedChains:s})),chainIds:s,dataTypes:["balance"]};try{const t=await this.fetch(n);t.assetsBalance&&Object.keys(t.assetsBalance).length>0&&e.onAssetsUpdate(t)?.catch(e=>{V("Failed to report balance update after transaction",{error:e})})}catch(e){V("Failed to fetch balance after transaction",{chains:s,error:e})}}},C=function(){V("Initializing from NetworkController");try{const e=B(this,a,"f").call("NetworkController:getState");B(this,n,"m",I).call(this,e)}catch(e){V("Failed to initialize from NetworkController",e)}},I=function(e){const{networkConfigurationsByChainId:t,networksMetadata:s}=e,n={},a=[];for(const[e,o]of Object.entries(t)){const t=`eip155:${parseInt(e,16)}`,r=o.rpcEndpoints[o.defaultRpcEndpointIndex];if(!r)continue;const{networkClientId:i}=r,c=s[i],l=c?.status??"unknown";n[t]={chainId:t,status:l,name:o.name,nativeCurrency:o.nativeCurrency,networkClientId:i},"available"!==l&&"unknown"!==l||a.push(t)}V("Network state updated",{configuredChains:Object.keys(n),activeChains:a});const r=[...B(this,l,"f")],i=new Set(r),c=r.length!==a.length||a.some(e=>!i.has(e));N(this,u,n,"f"),N(this,l,a,"f"),this.state.activeChains=a,c&&B(this,o,"f").call(this,this.getName(),a,r)},E=function(e){const t=B(this,d,"f").get(e);if(t)return t;const s=B(this,u,"f")[e];if(!s)return undefined;try{const t=B(this,a,"f").call("NetworkController:getNetworkClientById",s.networkClientId);if(!t?.provider)return undefined;const n=new L.Web3Provider(t.provider);return B(this,d,"f").set(e,n),n}catch(t){return V("Failed to get provider for chain",{chainId:e,error:t}),undefined}},T=function(e){const t=`eip155:${parseInt(e,16)}`,s=B(this,n,"m",E).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)}},O=function(){B(this,d,"f").clear()},P=function(e){const{nativeAssetIdentifiers:t}=B(this,a,"f").call("NetworkEnablementController:getState");return t[e]??`${e}/slip44:60`},D=function(){try{return B(this,a,"f").call("AssetsController:getState").assetsInfo??{}}catch{return{}}},M=function(e){try{const t=(0,U.parseCaipAssetType)(e);if("erc20"!==t.assetNamespace)return undefined;const s=t.assetReference,{reference:n}=(0,U.parseCaipChainId)(t.chainId),o=(0,U.numberToHex)(parseInt(n,10)),r=B(this,a,"f").call("TokenListController:getState"),i=r?.tokensChainsCache?.[o],c=i?.data;if(!c)return undefined;const l=s.toLowerCase();for(const[e,t]of Object.entries(c))if(e.toLowerCase()===l){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 q(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","@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,o,r,i,c,l,u,d,m,h,f,p,k=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},b=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"),y=e("@metamask/utils"),v=e("./AbstractDataSource.cjs"),x=e("../logger.cjs"),A=(0,x.createModuleLogger)(x.projectLogger,"SnapDataSource");function S(e){if(!e?.caveats)return null;const t=e.caveats.find(e=>e.type===w.SnapCaveatType.ChainIds);return t?t.value:null}function _(e){return(0,y.parseCaipAssetType)(e).chainId}s.SNAP_DATA_SOURCE_NAME="SnapDataSource",s.KEYRING_PERMISSION="endowment:keyring",s.ASSETS_PERMISSION="endowment:assets",s.getChainIdsCaveat=S,s.extractChainFromAssetId=_;const j={activeChains:[],chainToSnap:{}};class C extends v.AbstractDataSource{constructor(e){super(s.SNAP_DATA_SOURCE_NAME,{...j,...e.state}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,new Map),k(this,a,e.messenger,"f"),k(this,o,e.onActiveChainsUpdated,"f"),k(this,r,b(this,n,"m",u).bind(this),"f"),k(this,i,b(this,n,"m",f).bind(this),"f"),b(this,n,"m",l).call(this),b(this,n,"m",f).call(this)}async fetch(e){var t;if(!e?.chainIds?.length)return{};if(!e?.accountsWithSupportedChains?.length)return{assetsBalance:{},assetsInfo:{}};const s={assetsBalance:{},assetsInfo:{}};for(const{account:a}of e.accountsWithSupportedChains){const o=a.metadata.snap?.id;if(!o)continue;if(!e.chainIds.some(e=>this.state.chainToSnap[e]===o))continue;const r=a.id;try{const e=b(this,n,"m",p).call(this,o),a=await e.listAccountAssets(r);if(!a||0===a.length)continue;const i=await e.getAccountBalances(r,a);if(i&&"object"==typeof i&&s.assetsBalance)for(const[e,n]of Object.entries(i)){(t=s.assetsBalance)[r]??(t[r]={});const a=s.assetsBalance[r];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 o=[];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.assetsInfo&&(e.response.assetsInfo={...e.response.assetsInfo,...t.assetsInfo}),t.assetsPrice&&(e.response.assetsPrice={...e.response.assetsPrice,...t.assetsPrice});const r=new Set(Object.keys(t.errors??{}));o=a.filter(e=>!r.has(e))}catch(e){A("Middleware fetch failed",{error:e}),o=[]}let r=e;if(o.length>0){const t=n.chainIds.filter(e=>!o.includes(e));r={...e,request:{...n,chainIds:t}}}return t(r)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:a}=e;if(!t?.chainIds)return;const o=t.chainIds.filter(e=>b(this,n,"m",d).call(this,e));if(0!==o.length){if(a){const e=this.activeSubscriptions.get(s);if(e)return e.chains=o,void this.fetch({...t,chainIds:o}).then(async t=>(Object.keys(t.assetsBalance??{}).length>0&&await e.onAssetsUpdate(t),t)).catch(e=>{A("Subscription update fetch failed",{subscriptionId:s,error:e})})}await this.unsubscribe(s),this.activeSubscriptions.set(s,{cleanup:()=>{},chains:o,onAssetsUpdate:e.onAssetsUpdate});try{const e=await this.fetch({...t,chainIds:o}),n=this.activeSubscriptions.get(s);Object.keys(e.assetsBalance??{}).length>0&&n&&await n.onAssetsUpdate(e)}catch(e){A("Initial fetch failed",{subscriptionId:s,error:e})}}}destroy(){const e=b(this,a,"f");try{e.unsubscribe("AccountsController:accountBalancesUpdated",b(this,r,"f"))}catch(e){A("Failed to unsubscribe from snap keyring events",{error:e})}try{e.unsubscribe("PermissionController:stateChange",b(this,i,"f"))}catch(e){A("Failed to unsubscribe from permission changes",{error:e})}for(const[e]of this.activeSubscriptions)this.unsubscribe(e).catch(()=>{});b(this,c,"f").clear()}}s.SnapDataSource=C,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,n=new WeakSet,l=function(){const e=b(this,a,"f");e.subscribe("AccountsController:accountBalancesUpdated",b(this,r,"f")),e.subscribe("PermissionController:stateChange",b(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)){let a;try{a=_(t)}catch(e){A("Skipping snap balance for malformed asset ID",{assetId:t,error:e});continue}b(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 b(this,a,"f").call("SnapController:getRunnableSnaps")}catch(e){return A("Failed to get runnable snaps",e),[]}},h=function(e){try{return b(this,a,"f").call("PermissionController:getPermissions",e)}catch(t){return A("Failed to get permissions for snap",{snapId:e,error:t}),undefined}},f=function(){try{const e=b(this,n,"m",m).call(this),t={},a=[];for(const o of e){const e=b(this,n,"m",h).call(this,o.id);if(!e?.[s.KEYRING_PERMISSION])continue;const r=S(e[s.ASSETS_PERMISSION]);if(r)for(const e of r)e in t||(t[e]=o.id,a.push(e))}this.state.chainToSnap=t;try{const e=[...this.state.activeChains];this.updateActiveChains(a,t=>{b(this,o,"f").call(this,this.getName(),t,e)})}catch{}}catch(e){A("Keyring snap discovery failed",{error:e}),this.state.chainToSnap={};try{const e=[...this.state.activeChains];this.updateActiveChains([],t=>{b(this,o,"f").call(this,this.getName(),t,e)})}catch{}}},p=function(e){const t=b(this,c,"f").get(e);if(t)return t;const s=new g.KeyringClient({send:async t=>await b(this,a,"f").call("SnapController:handleRequest",{snapId:e,origin:"metamask",handler:w.HandlerType.OnKeyringRequest,request:t})});return b(this,c,"f").set(e,s),s},s.createSnapDataSource=function(e){return new C(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/StakedBalanceDataSource.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","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/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){var n,a,o,r,i,c,l,u,d,m,h,f,p,k,b,g,w,y,v,x,A,S,_,j,C,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},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)};Object.defineProperty(s,"__esModule",{value:!0}),s.StakedBalanceDataSource=void 0;const T=e("@ethereumjs/util"),O=e("@ethersproject/providers"),P=e("@metamask/utils"),D=e("./AbstractDataSource.cjs"),M=e("./evm-rpc-services/index.cjs"),N=e("../logger.cjs"),B="StakedBalanceDataSource",R={type:"erc20",name:"staked ethereum",symbol:"ETH",decimals:18},L=(0,N.createModuleLogger)(N.projectLogger,B);function F(e){if((0,P.isStrictHexString)(e))return e;if((0,P.isCaipChainId)(e)){const t=(0,P.parseCaipChainId)(e).reference;return(0,P.numberToHex)(parseInt(t,10))}throw new Error("caipChainIdToHex - Failed to provide CAIP-2 or Hex chainId")}function U(e,t){return`${e}/erc20:${(0,T.toChecksumAddress)(t)}`}class $ extends D.AbstractDataSource{constructor(e){super(B,{activeChains:[]}),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,new Map),u.set(this,new Map),d.set(this,void 0),m.set(this,undefined),h.set(this,undefined),f.set(this,undefined),p.set(this,undefined),I(this,a,e.messenger,"f"),I(this,o,e.onActiveChainsUpdated,"f"),I(this,r,e.pollInterval??18e4,"f"),I(this,i,!1!==e.enabled,"f"),I(this,d,(0,M.getSupportedStakingChainIds)(),"f"),L("Initializing StakedBalanceDataSource",{enabled:E(this,i,"f"),pollInterval:E(this,r,"f")}),I(this,c,new M.StakedBalanceFetcher({pollingInterval:E(this,r,"f"),getNetworkProvider:e=>E(this,n,"m",j).call(this,e)}),"f"),E(this,c,"f").setOnStakedBalanceUpdate(E(this,n,"m",C).bind(this));const t=E(this,a,"f").subscribe("TransactionController:transactionConfirmed",E(this,n,"m",w).bind(this));I(this,m,"function"==typeof t?t:undefined,"f");const s=E(this,a,"f").subscribe("TransactionController:incomingTransactionsReceived",E(this,n,"m",y).bind(this));I(this,h,"function"==typeof s?s:undefined,"f");const g=E(this,a,"f").subscribe("NetworkController:stateChange",E(this,n,"m",k).bind(this));I(this,f,"function"==typeof g?g:undefined,"f");const v=E(this,a,"f").subscribe("NetworkEnablementController:stateChange",E(this,n,"m",b).bind(this));I(this,p,"function"==typeof v?v:undefined,"f"),E(this,n,"m",S).call(this)}async refreshStakedBalance(){if(!E(this,i,"f"))return;const e=E(this,n,"m",x).call(this);e.length>0&&await E(this,n,"m",A).call(this,e)}async fetch(e){var t;if(!E(this,i,"f"))return{};const s={},n=new Set(this.state.activeChains),a=e.chainIds.filter(e=>n.has(e));if(0===a.length)return s;const o={};for(const{account:s,supportedChains:n}of e.accountsWithSupportedChains){const e=a.filter(e=>n.includes(e));for(const n of e)try{const e=F(n),a=(0,M.getStakingContractAddress)(e);if(!a)continue;const r={chainId:e,accountId:s.id,accountAddress:s.address},i=await E(this,c,"f").fetchStakedBalance(r);o[t=s.id]??(o[t]={});const l=U(n,a);o[s.id][l]={amount:i.amount}}catch(e){L("Failed to fetch staked balance",{chainId:n,accountId:s.id,error:e})}}if(Object.keys(o).length>0){s.assetsBalance=o;const e=new Set;for(const t of Object.values(o))for(const s of Object.keys(t))e.add(s);s.assetsInfo={};for(const t of e)s.assetsInfo[t]=R}return s}get assetsMiddleware(){return async(e,t)=>{var s,n;if(!E(this,i,"f"))return t(e);const{request:a}=e;if(!a.dataTypes.includes("balance"))return t(e);if(0===a.chainIds.length)return t(e);try{const t=await this.fetch(a);if(t.assetsInfo&&((s=e.response).assetsInfo??(s.assetsInfo={}),Object.assign(e.response.assetsInfo,t.assetsInfo)),t.assetsBalance){(n=e.response).assetsBalance??(n.assetsBalance={});for(const[s,n]of Object.entries(t.assetsBalance))e.response.assetsBalance[s]={...e.response.assetsBalance[s],...n}}}catch(e){L("Middleware fetch failed",{error:e})}return t(e)}}async subscribe(e){const{request:t,subscriptionId:s,isUpdate:n}=e,a=new Set(this.state.activeChains),o=t.chainIds.filter(e=>a.has(e));if(L("Subscribe requested",{subscriptionId:s,isUpdate:n,chainsToSubscribe:o}),0===o.length)return void L("No staking chains to subscribe");if(n){E(this,l,"f").get(s)&&L("Updating existing subscription - restarting polling",{subscriptionId:s})}await this.unsubscribe(s);const r=t.accountsWithSupportedChains.map(({account:e,supportedChains:t})=>({account:e,supportedChains:o.filter(e=>t.includes(e))})).filter(({supportedChains:e})=>e.length>0),i=r.map(e=>e.account),u=[];E(this,l,"f").set(s,{pollingTokens:u,chains:o,accounts:i,accountsWithSupportedChains:r,onAssetsUpdate:e.onAssetsUpdate}),this.activeSubscriptions.set(s,{cleanup:()=>{for(const e of u)E(this,c,"f").stopPollingByPollingToken(e);E(this,l,"f").delete(s)},chains:o,request:t,onAssetsUpdate:e.onAssetsUpdate});for(const{account:e,supportedChains:s}of t.accountsWithSupportedChains){const t=o.filter(e=>s.includes(e));for(const s of t){const t={chainId:F(s),accountId:e.id,accountAddress:e.address},n=E(this,c,"f").startPolling(t);u.push(n)}}try{const t={accountsWithSupportedChains:r,chainIds:o,dataTypes:["balance"]},s=await this.fetch(t);s.assetsBalance&&Object.keys(s.assetsBalance).length>0&&e.onAssetsUpdate?.(s)?.catch(e=>{L("Initial staked balance update failed",{error:e})})}catch(e){L("Initial staked balance fetch failed",{error:e})}L("Subscription SUCCESS",{subscriptionId:s,chains:o,pollingCount:u.length})}async unsubscribe(e){const t=E(this,l,"f").get(e);if(t){for(const e of t.pollingTokens)E(this,c,"f").stopPollingByPollingToken(e);E(this,l,"f").delete(e)}await super.unsubscribe(e)}destroy(){E(this,m,"f")?.call(this),E(this,h,"f")?.call(this),E(this,f,"f")?.call(this),E(this,p,"f")?.call(this);for(const e of E(this,l,"f").values())for(const t of e.pollingTokens)E(this,c,"f").stopPollingByPollingToken(t);E(this,l,"f").clear(),E(this,u,"f").clear(),super.destroy()}}s.StakedBalanceDataSource=$,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,m=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,n=new WeakSet,k=function(){E(this,u,"f").clear(),L("Provider cache cleared after network state change")},b=function(e){const{enabledNetworkMap:t}=e??{};t&&E(this,n,"m",_).call(this,t)},g=function(e){const t=e?.chainId;if(!t)return!1;const s=(0,M.getStakingContractAddress)(t);if(!s)return!1;const n=s.toLowerCase(),a=e.txParams?.from?.toLowerCase(),o=e.txParams?.to?.toLowerCase();return a===n||o===n},w=function(e){if(!E(this,i,"f"))return;if(!E(this,n,"m",g).call(this,e))return;const t=e?.chainId;if(!t)return;const s=`eip155:${parseInt(t,16)}`,a=E(this,n,"m",v).call(this,[s]);a.length>0&&E(this,n,"m",A).call(this,a).catch(e=>{L("Failed to refresh staked balance after transaction",{error:e})})},y=function(e){if(!E(this,i,"f"))return;const t=new Set;for(const s of e??[])s?.chainId&&E(this,n,"m",g).call(this,s)&&t.add(s.chainId);const s=[...t].map(e=>`eip155:${parseInt(e,16)}`);if(0===s.length)return;const a=E(this,n,"m",v).call(this,s);a.length>0&&E(this,n,"m",A).call(this,a).catch(e=>{L("Failed to refresh staked balance after incoming transactions",{error:e})})},v=function(e){const t=[],s=new Set(e);for(const e of E(this,l,"f").values())for(const{account:n,supportedChains:a}of e.accountsWithSupportedChains)for(const e of a)s.has(e)&&t.push({account:n,chainId:e});return t},x=function(){const e=[];for(const t of E(this,l,"f").values())for(const{account:s,supportedChains:n}of t.accountsWithSupportedChains)for(const t of n)e.push({account:s,chainId:t});return e},A=async function(e){const t={},s={};for(const{account:n,chainId:a}of e)try{const e=F(a),o=(0,M.getStakingContractAddress)(e);if(!o)continue;const r={chainId:e,accountId:n.id,accountAddress:n.address},i=await E(this,c,"f").fetchStakedBalance(r),l=U(a,o);t[l]=R;const u=s[n.id];s[n.id]={...u,[l]:{amount:i.amount}}}catch(e){L("Failed to fetch staked balance in transaction refresh",{chainId:a,accountId:n.id,error:e})}if(Object.keys(s).length>0){const e={assetsInfo:t,assetsBalance:s};for(const t of E(this,l,"f").values())t.onAssetsUpdate(e)?.catch(e=>{L("Failed to report staked balance update after transaction",{error:e})})}},S=function(){try{const e=E(this,a,"f").call("NetworkEnablementController:getState");E(this,n,"m",_).call(this,e?.enabledNetworkMap??{})}catch(e){L("Failed to get NetworkEnablementController state",{error:e}),E(this,n,"m",_).call(this,{})}},_=function(e){if(!E(this,i,"f")){const e=[...this.state.activeChains];return void this.updateActiveChains([],t=>E(this,o,"f").call(this,this.getName(),t,e))}const t=[],s=e.eip155;if(s)for(const e of E(this,d,"f")){if(!(0,P.isCaipChainId)(e))continue;const{reference:n}=(0,P.parseCaipChainId)(e);s[(0,P.numberToHex)(parseInt(n,10))]&&t.push(e)}const n=[...this.state.activeChains];this.updateActiveChains(t,e=>E(this,o,"f").call(this,this.getName(),e,n))},j=function(e){const t=E(this,u,"f").get(e);if(t)return t;try{const t=E(this,a,"f").call("NetworkController:getState"),{networkConfigurationsByChainId:s}=t;if(!s)return undefined;const n=s[e];if(!n)return undefined;const{rpcEndpoints:o,defaultRpcEndpointIndex:r}=n;if(!o||0===o.length)return undefined;const i=o["number"==typeof r&&r>=0&&r<o.length?r:0],c=i?.networkClientId;if(!c)return undefined;const l=E(this,a,"f").call("NetworkController:getNetworkClientById",c);if(!l?.provider)return undefined;const d=new O.Web3Provider(l.provider);return E(this,u,"f").set(e,d),d}catch(t){return L("Failed to get provider for chain",{hexChainId:e,error:t}),undefined}},C=function(e){const t=(0,M.getStakingContractAddress)(e.chainId);if(!t)return;const s=`eip155:${parseInt(e.chainId,16)}`,n=U(s,t),a={assetsInfo:{[n]:R},assetsBalance:{[e.accountId]:{[n]:{amount:e.balance.amount}}}};L("Staked balance update",{accountId:e.accountId,chainId:s,amount:e.balance.amount});for(const e of E(this,l,"f").values())e.onAssetsUpdate(a)?.catch(e=>{L("Failed to report staked balance update",{error:e})})}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.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","./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","@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,o,r,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("./evm-rpc-services/index.cjs"),d=e("../logger.cjs"),m=e("../types.cjs"),h="TokenDataSource",f=(0,d.createModuleLogger)(d.projectLogger,h);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{getName(){return this.name}constructor(e){n.add(this),this.name=h,a.set(this,void 0),i(this,a,e.queryApiClient,"f")}get assetsMiddleware(){return(0,m.forDataTypes)(["metadata"],async(e,t)=>{const{response:s}=e;if(!s.detectedAssets)return t(e);const{assetsInfo:i}=e.getAssetsState(),l=new Set;for(const e of Object.values(s.detectedAssets))for(const t of e){const e=s.assetsInfo?.[t];if(e?.image)continue;const n=i[t];n?.image||((0,u.isStakingContractAssetId)(t)||l.add(t))}if(0===l.size)return t(e);const d=await c(this,n,"m",o).call(this),m=c(this,n,"m",r).call(this,[...l],d);if(0===m.length)return t(e);try{const e=await c(this,a,"f").tokens.fetchV3Assets(m,{includeIconUrl:!0,includeMarketData:!0,includeMetadata:!0,includeLabels:!0,includeRwaData:!0});s.assetsInfo??(s.assetsInfo={});for(const t of e){const e=t.assetId;s.assetsInfo[e]=p(t.assetId,t)}}catch(e){f("Failed to fetch metadata",{error:e})}return t(e)})}},a=new WeakMap,n=new WeakSet,o=async function(){try{const e=await c(this,a,"f").tokens.fetchTokenV2SupportedNetworks(),t=[...e.fullSupport,...e.partialSupport];return new Set(t)}catch(e){return f("Failed to fetch supported networks",{error:e}),new Set}},r=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,o,r,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"}]}]),f=new d.Interface([{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"balance",type:"uint256"}]}]),p="0x0000000000000000000000000000000000000000",k={"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 b(e){return f.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 y(e){if("0x"===e||e.length<66)return"0";return f.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),o.set(this,void 0),l(this,a,e,"f");const s=t?.maxCallsPerBatch!==undefined&&t.maxCallsPerBatch>0?t.maxCallsPerBatch:300,r=t?.timeoutMs!==undefined&&t.timeoutMs>0?t.timeoutMs:3e4;l(this,o,{maxCallsPerBatch:s,timeoutMs:r},"f")}async batchBalanceOf(e,t){if(0===t.length)return[];const s=k[e],o=u(this,a,"f").call(this,e);return s?u(this,n,"m",r).call(this,o,s,t):u(this,n,"m",i).call(this,o,t)}},a=new WeakMap,o=new WeakMap,n=new WeakSet,r=async function(e,t,s){const a=u(this,o,"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===p;return{target:s?t:e.tokenAddress,allowFailure:!0,callData:s?(n=e.accountAddress,h.encodeFunctionData("getEthBalance",[n])):b(e.accountAddress)};var n})),o=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:r,returnData:i}=o[e];r&&i&&i.length>2?s.push({tokenAddress:t,accountAddress:n,success:!0,balance:y(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,o,"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===p){return{tokenAddress:s,accountAddress:n,success:!0,balance:(await e.getBalance(n)).toString()}}const a=b(n),o=await e.call({to:s,data:a});return{tokenAddress:s,accountAddress:n,success:!0,balance:y(o)}}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.isStakingContractAssetId=s.getStakingContractAddress=s.getSupportedStakingChainIds=s.StakedBalanceFetcher=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}}),Object.defineProperty(s,"StakedBalanceFetcher",{enumerable:!0,get:function(){return a.StakedBalanceFetcher}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return a.getSupportedStakingChainIds}}),Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return a.getStakingContractAddress}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return a.isStakingContractAssetId}});var o=e("./utils/index.cjs");Object.defineProperty(s,"divideIntoBatches",{enumerable:!0,get:function(){return o.divideIntoBatches}}),Object.defineProperty(s,"reduceInBatchesSerially",{enumerable:!0,get:function(){return o.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,o,r,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"),f="0x0000000000000000000000000000000000000000";class p extends((0,m.StaticIntervalPollingControllerOnly)()){constructor(e,t,s){super(),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),u(this,a,e,"f"),u(this,o,t,"f"),u(this,r,{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,o,"f").call("AssetsController:getState");if(!s?.assetsBalance)return[];const n=s.assetsBalance[t];if(!n)return[];const a=`eip155:${parseInt(e,16)}/`,r=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();r.has(e)||r.set(e,{address:t,decimals:18,symbol:""})}}return Array.from(r.values())}async fetchBalances(e,t,s,n){const a=this.getTokensToFetch(e,t),o=a.map(e=>e.address);return this.fetchBalancesForTokens(e,t,s,o,n,a)}async fetchBalancesForTokens(e,t,s,o,i,l){const u=i?.batchSize??d(this,r,"f").defaultBatchSize,m=i?.includeNative??d(this,r,"f").includeNativeByDefault,p=Date.now(),k=new Map;if(l)for(const e of l)k.set(e.address.toLowerCase(),e);const b=[];m&&b.push({tokenAddress:f,accountAddress:s});for(const e of o)b.push({tokenAddress:e,accountAddress:s});if(0===b.length)return{chainId:e,accountId:t,accountAddress:s,balances:[],failedAddresses:[],timestamp:p};const g=await(0,h.reduceInBatchesSerially)({values:b,batchSize:u,initialResult:{balances:[],failedAddresses:[]},eachBatch:async(s,o)=>{const r=await d(this,a,"f").batchBalanceOf(e,o);return d(this,n,"m",c).call(this,r,s,e,t,p,k)}});return{chainId:e,accountId:t,accountAddress:s,...g,timestamp:p}}}s.BalanceFetcher=p,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e,t,s,a,o,r){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=r.get(t.tokenAddress.toLowerCase()),m=u?.decimals??18,h=d(this,n,"m",l).call(this,e,m),p=parseInt(s,16),k=t.tokenAddress.toLowerCase()===f.toLowerCase()?`eip155:${p}/slip44:60`:`eip155:${p}/erc20:${t.tokenAddress.toLowerCase()}`;i.push({assetId:k,accountId:a,chainId:s,balance:e,formattedBalance:h,decimals:m,timestamp:o})}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,o=(s%n).toString().padStart(t,"0").replace(/0+$/u,"");return""===o?a.toString():`${a}.${o}`}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/StakedBalanceFetcher.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","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,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},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.StakedBalanceFetcher=s.isStakingContractAssetId=s.getSupportedStakingChainIds=s.getStakingContractAddress=void 0;const i=e("@ethersproject/abi"),c=(e("@ethersproject/providers"),e("@metamask/polling-controller")),l=e("../utils/index.cjs");Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return l.getStakingContractAddress}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return l.getSupportedStakingChainIds}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return l.isStakingContractAssetId}});const u=new i.Interface([{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getShares",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"}]);class d extends((0,c.StaticIntervalPollingControllerOnly)()){constructor(e){super(),n.set(this,void 0),a.set(this,void 0),o(this,n,e?.getNetworkProvider,"f"),this.setIntervalLength(e?.pollingInterval??18e4)}setOnStakedBalanceUpdate(e){o(this,a,e,"f")}async _executePoll(e){let t;try{t=await this.fetchStakedBalance(e)}catch{return}r(this,a,"f")&&r(this,a,"f").call(this,{accountId:e.accountId,chainId:e.chainId,balance:t})}async fetchStakedBalance(e){const{chainId:t,accountAddress:s}=e,a=r(this,n,"f")?.call(this,t);if(!a)throw new Error("StakedBalanceFetcher: no provider available for chain");const o=(0,l.getStakingContractAddress)(t);if(!o)return{amount:"0"};try{const e=u.encodeFunctionData("getShares",[s]),t=await a.call({to:o,data:e}),n=u.decodeFunctionResult("getShares",t)[0],r=BigInt(n.toString());if(0n===r)return{amount:"0"};const i=u.encodeFunctionData("convertToAssets",[r]),c=await a.call({to:o,data:i}),d=u.decodeFunctionResult("convertToAssets",c)[0],m=BigInt(d.toString());return{amount:(0,l.weiToHumanReadable)(m,18)}}catch(e){throw e instanceof Error?e:new Error("StakedBalanceFetcher: failed to fetch staked balance")}}}s.StakedBalanceFetcher=d,n=new WeakMap,a=new WeakMap}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.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,o,r,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 f=e("@metamask/polling-controller"),p=e("../utils/index.cjs");class k extends((0,f.StaticIntervalPollingControllerOnly)()){constructor(e,t,s){super(),n.add(this),a.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),m(this,a,e,"f"),m(this,o,t,"f"),m(this,r,{tokenDetectionEnabled:s?.tokenDetectionEnabled??(()=>!0),useExternalService:s?.useExternalService??(()=>!0),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,o,"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,o){const i=o?.tokenDetectionEnabled??h(this,r,"f").tokenDetectionEnabled(),l=o?.useExternalService??h(this,r,"f").useExternalService();if(!i||!l)return{chainId:e,accountId:t,accountAddress:s,detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[],timestamp:Date.now()};const u=o?.batchSize??h(this,r,"f").defaultBatchSize,d=Date.now(),m=this.getTokensToCheck(e);if(0===m.length)return{chainId:e,accountId:t,accountAddress:s,detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[],timestamp:d};const f=m.map(e=>({tokenAddress:e,accountAddress:s})),k=await(0,p.reduceInBatchesSerially)({values:f,batchSize:u,initialResult:{detectedAssets:[],detectedBalances:[],zeroBalanceAddresses:[],failedAddresses:[]},eachBatch:async(s,o)=>{const r=await h(this,a,"f").batchBalanceOf(e,o);return h(this,n,"m",c).call(this,r,s,e,t,d)}});return{chainId:e,accountId:t,accountAddress:s,...k,timestamp:d}}}s.TokenDetector=k,a=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,c=function(e,t,s,a,o){const{detectedAssets:r,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 f=h(this,n,"m",u).call(this,s,t.tokenAddress),p=h(this,n,"m",d).call(this,s,t.tokenAddress,f);r.push(p);const k=f?.decimals??18,b=h(this,n,"m",l).call(this,e,k);i.push({assetId:p.assetId,accountId:a,chainId:s,balance:e,formattedBalance:b,decimals:k,timestamp:o})}return{detectedAssets:r,detectedBalances:i,zeroBalanceAddresses:c,failedAddresses:m}},l=function(e,t){try{const s=BigInt(e),n=BigInt(10**t),a=s/n,o=(s%n).toString().padStart(t,"0").replace(/0+$/u,"");return""===o?a.toString():`${a}.${o}`}catch{return e}},u=function(e,t){const s=h(this,o,"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 r=t.toLowerCase();for(const[e,t]of Object.entries(a))if(e.toLowerCase()===r)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","./StakedBalanceFetcher.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.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.isStakingContractAssetId=s.getStakingContractAddress=s.getSupportedStakingChainIds=s.StakedBalanceFetcher=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}});var o=e("./StakedBalanceFetcher.cjs");Object.defineProperty(s,"StakedBalanceFetcher",{enumerable:!0,get:function(){return o.StakedBalanceFetcher}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return o.getSupportedStakingChainIds}}),Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return o.getStakingContractAddress}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return o.isStakingContractAssetId}})}}},{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 o=n(e,{batchSize:t});let r=a;for(const[e,t]of o.entries())r=await s(r,t,e);return r}}}},{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","./parsing.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/parsing.cjs","./staking-contracts.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.STAKING_CONTRACT_ADDRESS_BY_CHAINID=s.isStakingContractAssetId=s.getSupportedStakingChainIds=s.getStakingContractAddress=s.weiToHumanReadable=s.chainIdToHex=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}});var a=e("./parsing.cjs");Object.defineProperty(s,"chainIdToHex",{enumerable:!0,get:function(){return a.chainIdToHex}}),Object.defineProperty(s,"weiToHumanReadable",{enumerable:!0,get:function(){return a.weiToHumanReadable}});var o=e("./staking-contracts.cjs");Object.defineProperty(s,"getStakingContractAddress",{enumerable:!0,get:function(){return o.getStakingContractAddress}}),Object.defineProperty(s,"getSupportedStakingChainIds",{enumerable:!0,get:function(){return o.getSupportedStakingChainIds}}),Object.defineProperty(s,"isStakingContractAssetId",{enumerable:!0,get:function(){return o.isStakingContractAssetId}}),Object.defineProperty(s,"STAKING_CONTRACT_ADDRESS_BY_CHAINID",{enumerable:!0,get:function(){return o.STAKING_CONTRACT_ADDRESS_BY_CHAINID}})}}},{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/evm-rpc-services/utils/parsing.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.chainIdToHex=s.weiToHumanReadable=void 0;const a=e("@metamask/utils"),o=n(e("bignumber.js"));s.weiToHumanReadable=function(e,t){const s="bigint"==typeof e?e.toString():e,n=new o.default(s).shiftedBy(-t).toFixed(t).replace(/\.?0+$/u,"");return""===n?"0":n},s.chainIdToHex=function(e){if((0,a.isStrictHexString)(e))return e;if((0,a.isCaipChainId)(e)){const{reference:t}=(0,a.parseCaipChainId)(e);return(0,a.numberToHex)(parseInt(t,10))}return e}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/parsing.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/staking-contracts.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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isStakingContractAssetId=s.getStakingContractAddress=s.getSupportedStakingChainIds=s.STAKING_CONTRACT_ADDRESS_BY_CHAINID=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils");function o(e){const t=function(e){if((0,a.isCaipChainId)(e))return e;const t=(0,a.isStrictHexString)(e)?(0,n.convertHexToDecimal)(e).toString():e;return(0,a.toCaipChainId)(a.KnownCaipNamespace.Eip155,t)}(e);return s.STAKING_CONTRACT_ADDRESS_BY_CHAINID[t]}s.STAKING_CONTRACT_ADDRESS_BY_CHAINID={"eip155:1":"0x4fef9d741011476750a243ac70b9789a63dd47df","eip155:560048":"0xe96ac18cfe5a7af8fe1fe7bc37ff110d88bc67ff"},s.getSupportedStakingChainIds=function(){return Object.keys(s.STAKING_CONTRACT_ADDRESS_BY_CHAINID)},s.getStakingContractAddress=o,s.isStakingContractAssetId=function(e){if(!(0,a.isCaipAssetType)(e))return!1;const t=(0,a.parseCaipAssetType)(e);if("erc20"!==t.assetNamespace)return!1;const s=t.assetReference.toLowerCase(),n=o(t.chainId)?.toLowerCase();return n!==undefined&&s===n}}}},{package:"@metamask/assets-controller",file:"node_modules/@metamask/assets-controller/dist/data-sources/evm-rpc-services/utils/staking-contracts.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","./StakedBalanceDataSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/assets-controller/dist/data-sources/StakedBalanceDataSource.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.StakedBalanceDataSource=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 o=e("./BackendWebsocketDataSource.cjs");Object.defineProperty(s,"BackendWebsocketDataSource",{enumerable:!0,get:function(){return o.BackendWebsocketDataSource}}),Object.defineProperty(s,"createBackendWebsocketDataSource",{enumerable:!0,get:function(){return o.createBackendWebsocketDataSource}});var r=e("./RpcDataSource.cjs");Object.defineProperty(s,"RpcDataSource",{enumerable:!0,get:function(){return r.RpcDataSource}}),Object.defineProperty(s,"createRpcDataSource",{enumerable:!0,get:function(){return r.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}});var u=e("./StakedBalanceDataSource.cjs");Object.defineProperty(s,"StakedBalanceDataSource",{enumerable:!0,get:function(){return u.StakedBalanceDataSource}})}}},{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 o=e("./data-sources/index.cjs");Object.defineProperty(s,"AccountsApiDataSource",{enumerable:!0,get:function(){return o.AccountsApiDataSource}});var r=e("./data-sources/index.cjs");Object.defineProperty(s,"BackendWebsocketDataSource",{enumerable:!0,get:function(){return r.BackendWebsocketDataSource}}),Object.defineProperty(s,"createBackendWebsocketDataSource",{enumerable:!0,get:function(){return r.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"),o="DetectionMiddleware";(0,n.createModuleLogger)(n.projectLogger,o);s.DetectionMiddleware=class{constructor(){this.name=o}getName(){return this.name}get assetsMiddleware(){return(0,a.forDataTypes)(["balance"],async(e,t)=>{const{response:s}=e;if(!s.assetsBalance)return t(e);const{assetsInfo: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"),o=e("@metamask/utils"),r=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 r.default(e);return t.isNaN()||!t.isFinite()?new r.default(0):t},u=(e,t)=>{if(t<=0)return e;const s=new r.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,o.isStrictHexString)(t))return Boolean(e[o.KnownCaipNamespace.Eip155]?.[t]);const{namespace:s,reference:n}=(0,o.parseCaipChainId)(t),r=e[s];if(!r)return!1;if(r[t]||r[n])return!0;if(s===o.KnownCaipNamespace.Eip155)try{const e=(0,a.toHex)(n);return Boolean(r[e])}catch{const e=Number.parseInt(n,10);if(Number.isFinite(e))return Boolean(r[`0x${e.toString(16)}`])}return!1},h=(e,t)=>{const s=e.get(t);if(s)return s;const{chainId:n}=(0,o.parseCaipAssetType)(t),{namespace:a}=(0,o.parseCaipChainId)(n),r={chainId:n,isEvm:a===o.KnownCaipNamespace.Eip155};return e.set(t,r),r};function f(e){const{out:t,accountBalances:s,metadata:n,assetPreferences:a,enabledNetworkMap:o,assetInfoCache:r}=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(r,i);if(!m(o,d.chainId))continue;const f=c(s[i]);let p=l(f);const k=n[i];if(k?.decimals!==undefined&&(p=u(p,k.decimals)),p.isZero())continue;const b=t.get(i);b?b.amount=b.amount.plus(p):t.set(i,{amount:p,decimals:k?.decimals,symbol:k?.symbol,name:k?.name})}}function p(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 k(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 o=[];for(const e of n.accounts){const s=t[e];s&&o.push(s)}return o}return[]}function b(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=p(s,t.id);if(e){const t=k(s,a,e);if(t.length>0)return t}}if(s){const e=function(e,t){const s=p(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=p,s.getInternalAccountsForGroup=k,s.getAggregatedBalanceForAccount=function(e,t,s,n,a,o){const{assetsBalance:r,assetsInfo: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=b({selectedInternalAccount:t,accountTreeState:n,internalAccountsOrAccountIds:a,accountsById:o}),p=new Map,k=new Map;for(const e of h){const t=e.id;f({out:k,accountBalances:r?.[t]??{},metadata:u,assetPreferences:c,enabledNetworkMap:s,assetInfoCache:p})}const g=new Array(k.size);let w=0,y=0,v=0;for(const[e,t]of k.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&&(y+=a,v+=a*n)}}if(m){return{entries:g,totalBalanceInFiat:y,pricePercentChange1d:y>0?v/y: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"),o=e("./base64.cjs"),r=e("./constants.cjs");s.encodeAuxiliaryFile=async function(e,t){if(t===n.AuxiliaryFileEncoding.Base64)return e;const s=await(0,o.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<r.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 o(e){return await(0,n.sha256)((0,a.getBytes)(e))}s.checksum=o,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=>o(e)));return o((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"),o=e("@metamask/utils"),r=e("cron-parser"),i=e("./time.cjs");s.CronjobRpcRequestStruct=(0,a.object)({jsonrpc:(0,a.optional)(o.JsonRpcVersionStruct),id:(0,a.optional)(o.JsonRpcIdStruct),method:(0,a.string)(),params:(0,a.optional)(o.JsonRpcParamsStruct)}),s.CronExpressionStruct=(0,a.refine)((0,a.string)(),"cronjob expression",e=>{try{return(0,r.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,o.isObject)(e)&&(0,o.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")),o=e("./array.cjs");function r(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,o.isEqual)(s.path,e));if(n)return n.name;if("secp256k1"===t&&"m"===e[0]&&"44'"===e[1]&&e[2].endsWith("'")){return r(e[2].slice(0,-1))??null}return null},s.getSlip44ProtocolName=r}}},{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(r(e,t))}function o(e,t,s){return e.set(r(e,t),s),s}function r(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 f 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),o(d,this,e),o(m,this,t),o(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=p(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 p(e){if((0,u.isObject)(e)&&"serialize"in e&&"function"==typeof e.serialize){const t=e.serialize();return(0,u.isJsonRpcError)(t)&&k(t)}return!1}function k(e){return e.code===c.SNAP_ERROR_CODE&&e.message===c.SNAP_ERROR_MESSAGE}function b(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=f,s.isSnapError=p,s.isSerializedSnapError=k,s.isWrappedSnapError=b,s.unwrapError=function(e){if(b(e)){if((0,u.isJsonRpcError)(e.data.cause)){if(k(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"),o=e("../time.cjs");s.HistoricalPriceStruct=(0,n.nonEmptyRecord)((0,a.union)([(0,a.literal)("all"),o.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"),o=e("@metamask/utils"),r=e("../time.cjs");s.PricePercentChangeStruct=(0,n.nonEmptyRecord)((0,a.union)([(0,a.literal)("all"),r.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:o.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,o.isObject)(e)&&e.fungible?s.FungibleAssetMarketDataStruct:s.NonFungibleAssetMarketDataStruct),s.OnAssetsMarketDataResponseStruct=(0,a.object)({marketData:(0,a.record)(o.CaipAssetTypeOrIdStruct,(0,a.record)(o.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"],o=t["@_width"];if(s&&o)return{height:s,width:o};const r=t["@_viewBox"];if(r){const[e,t,s,a]=r.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,o)=>{const r=document.createElement("iframe");r.setAttribute("id",t),r.setAttribute("data-testid",n),s&&r.setAttribute("sandbox","allow-scripts"),r.setAttribute("src",e),document.body.appendChild(r),r.addEventListener("load",()=>{r.contentWindow?a(r.contentWindow):o(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"),o=e("@metamask/utils"),r=(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)(r)}),"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,o.assertStruct)(e,s.RpcOriginsStruct,"Invalid JSON-RPC origins",t)},s.KeyringOriginsStruct=(0,a.object)({allowedOrigins:(0,a.optional)(r)}),s.assertIsKeyringOrigins=function(e,t){(0,o.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,o.isJsonRpcSuccess)(e)){if((0,o.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"),o=e("./json.cjs");function r(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 o=t.messages[a.trim()];if(!o)throw new Error(`Failed to translate "${e}": No translation found for "${a.trim()}" in "${t.locale}" file.`);return s.replace(n,o.message)},e)}function c(e,t,n){const a=r(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,o.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=r,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"),o=e("@metamask/utils"),r=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 f=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.`:!f.some(t=>(0,r.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,o.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)(o.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,o.inMilliseconds)(5,o.Duration.Second),s.MAXIMUM_REQUEST_TIMEOUT=(0,o.inMilliseconds)(3,o.Duration.Minute),s.MaxRequestTimeStruct=(0,a.size)((0,a.integer)(),s.MINIMUM_REQUEST_TIMEOUT,s.MAXIMUM_REQUEST_TIMEOUT),s.ProtocolScopesStruct=(0,a.record)(o.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:o.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:o.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)(o.VersionStruct),$schema:(0,a.optional)((0,a.string)())}),s.isSnapManifest=function(e){return(0,a.is)(e,s.SnapManifestStruct)},s.assertIsSnapManifest=function(e){(0,o.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"),o=e("@metamask/superstruct"),r=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,f;function p(e){const t=e.clone();return delete t.result.source.shasum,t.value=(0,c.default)(t.result),t}async function k(e){const{manifest:t,sourceCode:s,svgIcon:n,auxiliaryFiles:a,localizationFiles:o}=e,r=[p(t),s,n,...a,...o].filter(e=>e!==undefined);return i.base64.encode(await(0,d.checksumFiles)(r))}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"}(f||(s.SnapStatusEvents=f={})),s.getSnapChecksum=k,s.validateSnapShasum=async function(e,t="Invalid Snap manifest: manifest shasum does not match computed shasum."){if(e.manifest.result.source.shasum!==await k(e))throw new Error(t)},s.LOCALHOST_HOSTNAMES=["localhost","127.0.0.1","[::1]"],s.BaseSnapIdStruct=(0,r.definePattern)("Base Snap Id",/^[\x21-\x7E]*$/u);const b=(0,m.uri)({protocol:(0,o.enums)(["http:","https:"]),hostname:(0,o.enums)(s.LOCALHOST_HOSTNAMES),hash:(0,o.empty)((0,o.string)()),search:(0,o.empty)((0,o.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,o.refine)(s.BaseSnapIdStruct,"local Snap Id",e=>{if(!e.startsWith(m.SnapIdPrefixes.local))return`Expected local snap ID, got "${e}".`;const[t]=(0,o.validate)(e.slice(m.SnapIdPrefixes.local.length),b);return t??!0}),s.NpmSnapIdStruct=(0,o.intersection)([s.BaseSnapIdStruct,(0,m.uri)({protocol:(0,o.literal)(m.SnapIdPrefixes.npm),pathname:(0,o.refine)((0,o.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,r.assert)(a!==undefined),yield*a):yield*s),!0}),search:(0,o.empty)((0,o.string)()),hash:(0,o.empty)((0,o.string)())})]),s.HttpSnapIdStruct=(0,o.intersection)([s.BaseSnapIdStruct,(0,m.uri)({protocol:(0,o.enums)(["http:","https:"]),search:(0,o.empty)((0,o.string)()),hash:(0,o.empty)((0,o.string)())})]),s.SnapIdPrefixStruct=(0,o.refine)((0,o.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,o.is)(e,s.SnapIdStruct)},s.assertIsValidSnapId=function(e){(0,r.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,r.assert)((0,r.isObject)(e),"Requested permissions must be an object.");const{wallet_snap:t}=e;(0,r.assert)((0,r.isObject)(t),"wallet_snap is missing from the requested permissions.");const{caveats:s}=t;(0,r.assert)(Array.isArray(s)&&1===s.length,"wallet_snap must have a caveat property with a single-item array value.");const[n]=s;(0,r.assert)((0,r.isObject)(n)&&n.type===u.SnapCaveatType.SnapIds&&(0,r.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"),o=e("@metamask/utils"),r=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,o=!0){super(n,a),this.name="SnapsStructError",this.message=`${t}.\n\n${k(e,[...a()],o)}${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,o.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,r.green,t)):null}function f(e,t=!0){return"never"===e.type||0===e.path.length?"":`At path: ${c(e.path.join("."),r.bold,t)} — `}function p(e,t,s=!0){const n=c(JSON.stringify(t.value),r.red,s),a=f(t,s);if("union"===t.type){const o=h(m(e,t.path),s);return o?`${a}Expected the value to be one of: ${o.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",r.green,s)}\`,`).replace(/, but received: (.+)/u,`, but received: ${c("$1",r.red,s)}`)}.`}if("never"===t.type)return`Unknown key: ${c(t.path.join("."),r.bold,s)}, received: ${n}.`;if("size"===t.refinement){return`${a}${t.message.replace(/length between `(\d+)` and `(\d+)`/u,`length between ${c("$1",r.green,s)} and ${c("$2",r.green,s)},`).replace(/length of `(\d+)`/u,`length of ${c("$1",r.red,s)}`).replace(/a array/u,"an array")}.`}return t.refinement!==undefined?`${a}${t.message}.`:`${a}Expected a value of type ${c(t.type,r.green,s)}, but received: ${n}.`}function k(e,t,s=!0){return t.map(t=>(0,i.indent)(`• ${p(e,t,s)}`)).join("\n")}function b(e,t,s,r=!1){(0,o.assert)(t.schema,"Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`."),(0,o.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:r});if(l)throw new Error(p(c,l.failures()[0],!1));const u=e,d=t.schema.filter(e=>(0,a.is)(u[s],e.schema[s]));(0,o.assert)(d.length>0,"Expected a struct to match the value.");const m=d.map(e=>(0,a.validate)(u,e,{coerce:r})),h=m.find(([e])=>!e);if(h)return h[1];(0,o.assert)(m[0][0],"Expected at least one error.");const f=m.reduce((e,[t])=>((0,o.assert)(t,"Expected an error."),t.failures().length<e.failures().length?t:e),m[0][0]);throw new Error(p(t,f.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=f,s.getStructFailureMessage=p,s.getStructErrorMessage=k,s.validateUnion=b,s.createUnion=function(e,t,s){return b(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 o(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=o,s.isSvg=function(e){try{return o(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 o=e("@metamask/snaps-sdk");Object.defineProperty(s,"ISO8601DateStruct",{enumerable:!0,get:function(){return o.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"),o=e("@metamask/utils");var r,i,c;!function(e){e.PackageJson="package.json",e.Manifest="snap.manifest.json"}(r||(s.NpmSnapFileNames=r={})),s.NameStruct=(0,a.size)((0,o.definePattern)("Snap Name",/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u),1,214),s.NpmSnapPackageJsonStruct=(0,a.type)({version:o.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"),o=e("@metamask/snaps-sdk/jsx"),r=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(p)):e.href}function f(e){return m(e.flatMap(p))}function p(e){switch(e.type){case"link":return(0,n.jsx)(o.Link,{href:e.href,children:h(e)});case"text":return e.text;case"strong":return(0,n.jsx)(o.Bold,{children:f(e.tokens)});case"em":return(0,n.jsx)(o.Italic,{children:f(e.tokens)});default:return null}}function k(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(p))}}),s.filter(e=>null!==e)}function b(e,t,s){try{const n=new URL(e);if((0,r.assert)(u.includes(n.protocol),`Protocol must be one of: ${u.join(", ")}.`),"metamask:"===n.protocol){const t=(0,l.parseMetaMaskUrl)(e);t.snapId&&(0,r.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,r.assert)(!e.includes(":"));const n=`https://${e}`;(0,r.assert)(!t(n),"The specified URL is not allowed.")}return}(0,r.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,r.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 y(e){return(0,r.hasProperty)(e.props,"children")}function v(e){return Boolean(e)&&!0!==e}function x(e){if(y(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 A(e,t,s=0){if(Array.isArray(e)){for(const n of e){const e=A(n,t,s);if(e!==undefined)return e}return undefined}const n=t(e,s);if(n!==undefined)return n;if((0,r.hasProperty)(e,"props")&&(0,r.isPlainObject)(e.props)&&(0,r.hasProperty)(e.props,"children")){const n=x(e);for(const e of n)if((0,r.isPlainObject)(e)){const n=A(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=k,s.getJsxElementFromComponent=function(e){return function(e){const t=w(e);(0,r.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)(o.Address,{address:t.value});case a.NodeType.Button:return(0,n.jsx)(o.Button,{name:t.name,variant:d(t.variant),type:t.buttonType,children:t.value});case a.NodeType.Copyable:return(0,n.jsx)(o.Copyable,{value:t.value,sensitive:t.sensitive});case a.NodeType.Divider:return(0,n.jsx)(o.Divider,{});case a.NodeType.Form:return(0,n.jsx)(o.Form,{name:t.name,children:m(t.children.map(e))});case a.NodeType.Heading:return(0,n.jsx)(o.Heading,{children:t.value});case a.NodeType.Image:return(0,n.jsx)(o.Image,{src:t.value});case a.NodeType.Input:return(0,n.jsx)(o.Field,{label:t.label,error:t.error,children:(0,n.jsx)(o.Input,{name:t.name,type:t.inputType,value:t.value,placeholder:t.placeholder})});case a.NodeType.Panel:return(0,n.jsx)(o.Box,{children:m(t.children.map(e))});case a.NodeType.Row:return(0,n.jsx)(o.Row,{label:t.label,variant:t.variant,children:e(t.value)});case a.NodeType.Spinner:return(0,n.jsx)(o.Spinner,{});case a.NodeType.Text:return(0,n.jsx)(o.Text,{children:m(k(t.value))});default:return(0,r.assertExhaustive)(t)}}(e)},s.validateLink=b,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)b(e.href,t,s)},s.validateAssetSelector=g,s.validateJsxElements=function(e,{isOnPhishingList:t,getSnap:s,getAccountByAddress:n,hasPermission:a}){A(e,e=>{switch(e.type){case"Link":b(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,r.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=y,s.getJsxChildren=x,s.walkJsx=A,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:o}=t,i=s>0?"\n":"";if((0,r.hasProperty)(o,"children")){const t=e(o.children,s+1);return`${n}<${a}${S(o)}>\n${t}${n}</${a}>${i}`}return`${n}<${a}${S(o)} />${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:o}=t;if("metamask:"!==o)throw new Error(`Unable to parse URL. Expected the protocol to be "metamask:", but received "${o}".`);const[r,...i]=t.href.replace("metamask://","").split("/"),c=`/${i.join("/")}`;switch(r){case"client":return(0,n.assert)(s.CLIENT_PATHS.includes(c),`Unable to navigate to "${c}". The provided path is not allowed.`),{authority:r,path:c};case"snap":return function(e){const t="Invalid MetaMask url:",o=(0,a.stripSnapPrefix)(e.slice(1)),r=e.slice(1).startsWith("npm:")?"npm:":"local:",i=o.startsWith("@"),c=o.split("/"),l=`/${c[c.length-1]}`;let u;if("local:"===r){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=`${r}${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 "${r}".`)}}}}},{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"),o=e("./manifest/validation.cjs"),r=e("./snaps.cjs");s.validateFetchedSnap=async function(e){(0,o.assertIsSnapManifest)(e.manifest.result),await(0,r.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"),o=e("semver");s.DEFAULT_REQUESTED_SNAP_VERSION="*",s.getTargetVersion=function(e,t){const s=(0,o.maxSatisfying)(e,t);return s||(0,o.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"),o=e("@scure/base"),r=e("../deep-clone.cjs");class i{constructor(e){var t,s,a,o;let r;n(this,"value",void 0),n(this,"result",void 0),n(this,"data",void 0),n(this,"path",void 0),r="string"==typeof e||e instanceof Uint8Array?{value:e}:e,this.value=(null===(t=r)||void 0===t?void 0:t.value)??"",this.result=(null===(s=r)||void 0===s?void 0:s.result)??undefined,this.data=(null===(a=r)||void 0===a?void 0:a.data)??{},this.path=(null===(o=r)||void 0===o?void 0:o.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 o.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,r.deepClone)(this.result),e.data=(0,r.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,o=Math.floor,r="[BigNumber Error] ",i=r+"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 f(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,s,n=1,a=e.length,o=e[0]+"";n<a;){for(t=e[n++]+"",s=l-t.length;s--;t="0"+t);o+=t}for(a=o.length;48===o.charCodeAt(--a););return o.slice(0,a+1||1)}function k(e,t){var s,n,a=e.c,o=t.c,r=e.s,i=t.s,c=e.e,l=t.e;if(!r||!i)return null;if(s=a&&!a[0],n=o&&!o[0],s||n)return s?n?0:-i:r;if(r!=i)return r;if(s=r<0,n=c==l,!a||!o)return n?0:!a^s?1:-1;if(!n)return c>l^s?1:-1;for(i=(c=a.length)<(l=o.length)?c:l,r=0;r<i;r++)if(a[r]!=o[r])return a[r]>o[r]^s?1:-1;return c==l?0:c>l^s?1:-1}function b(e,t,s,n){if(e<t||e>s||e!==o(e))throw Error(r+(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 f(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 y(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,x,A,S,_,j,C,I,E,T=z.prototype={constructor:z,toString:null,valueOf:null},O=new z(1),P=20,D=4,M=-7,N=21,B=-1e7,R=1e7,L=!1,F=1,U=0,$={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},H="0123456789abcdefghijklmnopqrstuvwxyz",W=!0;function z(e,t){var s,a,r,c,d,m,h,f,p=this;if(!(p instanceof z))return new z(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>R?p.c=p.e=null:e.e<B?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((m="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,d=e;d>=10;d/=10,c++);return void(c>R?p.c=p.e=null:(p.e=c,p.c=[e]))}f=String(e)}else{if(!n.test(f=String(e)))return x(p,f,m);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(c=f.indexOf("."))>-1&&(f=f.replace(".","")),(d=f.search(/e/i))>0?(c<0&&(c=d),c+=+f.slice(d+1),f=f.substring(0,d)):c<0&&(c=f.length)}else{if(b(t,2,H.length,"Base"),10==t&&W)return G(p=new z(e),P+p.e+1,D);if(f=String(e),m="number"==typeof e){if(0*e!=0)return x(p,f,m,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,z.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(i+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(s=H.slice(0,t),c=d=0,h=f.length;d<h;d++)if(s.indexOf(a=f.charAt(d))<0){if("."==a){if(d>c){c=h;continue}}else if(!r&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){r=!0,d=-1,c=0;continue}return x(p,String(e),m,t)}m=!1,(c=(f=v(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):c=f.length}for(d=0;48===f.charCodeAt(d);d++);for(h=f.length;48===f.charCodeAt(--h););if(f=f.slice(d,++h)){if(h-=d,m&&z.DEBUG&&h>15&&(e>u||e!==o(e)))throw Error(i+p.s*e);if((c=c-d-1)>R)p.c=p.e=null;else if(c<B)p.c=[p.e=0];else{if(p.e=c,p.c=[],d=(c+1)%l,c<0&&(d+=l),d<h){for(d&&p.c.push(+f.slice(0,d)),h-=l;d<h;)p.c.push(+f.slice(d,d+=l));d=l-(f=f.slice(d)).length}else d-=h;for(;d--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function K(e,t,s,n){var a,o,r,i,c;if(null==s?s=D:b(s,0,8),!e.c)return e.toString();if(a=e.c[0],r=e.e,null==t)c=p(e.c),c=1==n||2==n&&(r<=M||r>=N)?w(c,r):y(c,r,"0");else if(o=(e=G(new z(e),t,s)).e,i=(c=p(e.c)).length,1==n||2==n&&(t<=o||o<=M)){for(;i<t;c+="0",i++);c=w(c,o)}else if(t-=r,c=y(c,o,"0"),o+1>i){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-i)>0)for(o+1==i&&(c+=".");t--;c+="0");return e.s<0&&a?"-"+c:c}function V(e,t){for(var s,n,a=1,o=new z(e[0]);a<e.length;a++)(!(n=new z(e[a])).s||(s=k(o,n))===t||0===s&&o.s===t)&&(o=n);return o}function q(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)>R?e.c=e.e=null:s<B?e.c=[e.e=0]:(e.e=s,e.c=t),e}function G(e,t,s,n){var r,i,u,m,h,f,p,k=e.c,b=d;if(k){e:{for(r=1,m=k[0];m>=10;m/=10,r++);if((i=t-r)<0)i+=l,u=t,h=k[f=0],p=o(h/b[r-u-1]%10);else if((f=a((i+1)/l))>=k.length){if(!n)break e;for(;k.length<=f;k.push(0));h=p=0,r=1,u=(i%=l)-l+1}else{for(h=m=k[f],r=1;m>=10;m/=10,r++);p=(u=(i%=l)-l+r)<0?0:o(h/b[r-u-1]%10)}if(n=n||t<0||null!=k[f+1]||(u<0?h:h%b[r-u-1]),n=s<4?(p||n)&&(0==s||s==(e.s<0?3:2)):p>5||5==p&&(4==s||n||6==s&&(i>0?u>0?h/b[r-u]:0:k[f-1])%10&1||s==(e.s<0?8:7)),t<1||!k[0])return k.length=0,n?(t-=e.e+1,k[0]=b[(l-t%l)%l],e.e=-t||0):k[0]=e.e=0,e;if(0==i?(k.length=f,m=1,f--):(k.length=f+1,m=b[l-i],k[f]=u>0?o(h/b[r-u]%b[u])*m:0),n)for(;;){if(0==f){for(i=1,u=k[0];u>=10;u/=10,i++);for(u=k[0]+=m,m=1;u>=10;u/=10,m++);i!=m&&(e.e++,k[0]==c&&(k[0]=1));break}if(k[f]+=m,k[f]!=c)break;k[f--]=0,m=1}for(i=k.length;0===k[--i];k.pop());}e.e>R?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=p(e.c),t=s<=M||s>=N?w(t,s):y(t,s,"0"),e.s<0?"-"+t:t)}return z.clone=e,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(e){var t,s;if(null!=e){if("object"!=typeof e)throw Error(r+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(s=e[t],0,h,t),P=s),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(s=e[t],0,8,t),D=s),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((s=e[t])&&s.pop?(b(s[0],-h,0,t),b(s[1],0,h,t),M=s[0],N=s[1]):(b(s,-h,h,t),M=-(N=s<0?-s:s))),e.hasOwnProperty(t="RANGE"))if((s=e[t])&&s.pop)b(s[0],-h,-1,t),b(s[1],1,h,t),B=s[0],R=s[1];else{if(b(s,-h,h,t),!s)throw Error(r+t+" cannot be zero: "+s);B=-(R=s<0?-s:s)}if(e.hasOwnProperty(t="CRYPTO")){if((s=e[t])!==!!s)throw Error(r+t+" not true or false: "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!s,Error(r+"crypto unavailable");L=s}else L=s}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(s=e[t],0,9,t),F=s),e.hasOwnProperty(t="POW_PRECISION")&&(b(s=e[t],0,h,t),U=s),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(s=e[t]))throw Error(r+t+" not an object: "+s);$=s}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(s=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(s))throw Error(r+t+" invalid: "+s);W="0123456789"==s.slice(0,10),H=s}}return{DECIMAL_PLACES:P,ROUNDING_MODE:D,EXPONENTIAL_AT:[M,N],RANGE:[B,R],CRYPTO:L,MODULO_MODE:F,POW_PRECISION:U,FORMAT:$,ALPHABET:H}},z.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!z.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===o(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!==o(s))break e;if(0!==s)return!0}}}else if(null===n&&null===a&&(null===i||1===i||-1===i))return!0;throw Error(r+"Invalid BigNumber: "+e)},z.maximum=z.max=function(){return V(arguments,-1)},z.minimum=z.min=function(){return V(arguments,1)},z.random=(A=9007199254740992,S=Math.random()*A&2097151?function(){return o(Math.random()*A)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,s,n,i,c,u=0,m=[],f=new z(O);if(null==e?e=P:b(e,0,h),i=a(e/l),L)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 L=!1,Error(r+"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(!L)for(;u<i;)(c=S())<9e15&&(m[u++]=c%1e14);for(i=m[--u],e%=l,i&&e&&(c=d[l-e],m[u]=o(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 f.e=n,f.c=m,f}),z.sum=function(){for(var e=1,t=arguments,s=new z(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,o,r=[0],i=0,c=e.length;i<c;){for(o=r.length;o--;r[o]*=t);for(r[0]+=n.indexOf(e.charAt(i++)),a=0;a<r.length;a++)r[a]>s-1&&(null==r[a+1]&&(r[a+1]=0),r[a+1]+=r[a]/s|0,r[a]%=s)}return r.reverse()}return function(n,a,o,r,i){var c,l,u,d,m,h,f,k,b=n.indexOf("."),g=P,w=D;for(b>=0&&(d=U,U=0,n=n.replace(".",""),h=(k=new z(a)).pow(n.length-b),U=d,k.c=t(y(p(h.c),h.e,"0"),10,o,e),k.e=k.c.length),u=d=(f=t(n,a,o,i?(c=H,e):(c=e,H))).length;0==f[--d];f.pop());if(!f[0])return c.charAt(0);if(b<0?--u:(h.c=f,h.e=u,h.s=r,f=(h=s(h,k,g,w,o)).c,m=h.r,u=h.e),b=f[l=u+g+1],d=o/2,m=m||l<0||null!=f[l+1],m=w<4?(null!=b||m)&&(0==w||w==(h.s<0?3:2)):b>d||b==d&&(4==w||m||6==w&&1&f[l-1]||w==(h.s<0?8:7)),l<1||!f[0])n=m?y(c.charAt(1),-g,c.charAt(0)):c.charAt(0);else{if(f.length=l,m)for(--o;++f[--l]>o;)f[l]=0,l||(++u,f=[1].concat(f));for(d=f.length;!f[--d];);for(b=0,n="";b<=d;n+=c.charAt(f[b++]));n=y(n,u,c.charAt(0))}return n}}(),s=function(){function e(e,t,s){var n,a,o,r,i=0,c=e.length,l=t%m,u=t/m|0;for(e=e.slice();c--;)i=((a=l*(o=e[c]%m)+(n=u*o+(r=e[c]/m|0)*l)%m*m+i)/s|0)+(n/m|0)+u*r,e[c]=a%s;return i&&(e=[i].concat(e)),e}function t(e,t,s,n){var a,o;if(s!=n)o=s>n?1:-1;else for(a=o=0;a<s;a++)if(e[a]!=t[a]){o=e[a]>t[a]?1:-1;break}return o}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,r,i,u){var d,m,h,p,k,b,g,w,y,v,x,A,S,_,j,C,I,E=n.s==a.s?1:-1,T=n.c,O=a.c;if(!(T&&T[0]&&O&&O[0]))return new z(n.s&&a.s&&(T?!O||T[0]!=O[0]:O)?T&&0==T[0]||!O?0*E:E/0:NaN);for(y=(w=new z(E)).c=[],E=r+(m=n.e-a.e)+1,u||(u=c,m=f(n.e/l)-f(a.e/l),E=E/l|0),h=0;O[h]==(T[h]||0);h++);if(O[h]>(T[h]||0)&&m--,E<0)y.push(1),p=!0;else{for(_=T.length,C=O.length,h=0,E+=2,(k=o(u/(O[0]+1)))>1&&(O=e(O,k,u),T=e(T,k,u),C=O.length,_=T.length),S=C,x=(v=T.slice(0,C)).length;x<C;v[x++]=0);I=O.slice(),I=[0].concat(I),j=O[0],O[1]>=u/2&&j++;do{if(k=0,(d=t(O,v,C,x))<0){if(A=v[0],C!=x&&(A=A*u+(v[1]||0)),(k=o(A/j))>1)for(k>=u&&(k=u-1),g=(b=e(O,k,u)).length,x=v.length;1==t(b,v,g,x);)k--,s(b,C<g?I:O,g,u),g=b.length,d=1;else 0==k&&(d=k=1),g=(b=O.slice()).length;if(g<x&&(b=[0].concat(b)),s(v,b,x,u),x=v.length,-1==d)for(;t(O,v,C,x)<1;)k++,s(v,C<x?I:O,x,u),x=v.length}else 0===d&&(k++,v=[0]);y[h++]=k,v[0]?v[x++]=T[S]||0:(v=[T[S]],x=1)}while((S++<_||null!=v[0])&&E--);p=null!=v[0],y[0]||y.splice(0,1)}if(u==c){for(h=1,E=y[0];E>=10;E/=10,h++);G(w,r+(w.e=h+m*l-1)+1,i,p)}else w.e=m,w.r=+p;return w}}(),_=/^(-?)0([xbo])(?=\w[\w.]*$)/i,j=/^([^.]+)\.$/,C=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g,x=function(e,t,s,n){var a,o=s?t:t.replace(E,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!s&&(o=o.replace(_,function(e,t,s){return a="x"==(s=s.toLowerCase())?16:"b"==s?2:8,n&&n!=a?e:t}),n&&(a=n,o=o.replace(j,"$1").replace(C,"0.$1")),t!=o))return new z(o,a);if(z.DEBUG)throw Error(r+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},T.absoluteValue=T.abs=function(){var e=new z(this);return e.s<0&&(e.s=1),e},T.comparedTo=function(e,t){return k(this,new z(e,t))},T.decimalPlaces=T.dp=function(e,t){var s,n,a,o=this;if(null!=e)return b(e,0,h),null==t?t=D:b(t,0,8),G(new z(o),e+o.e+1,t);if(!(s=o.c))return null;if(n=((a=s.length-1)-f(this.e/l))*l,a=s[a])for(;a%10==0;a/=10,n--);return n<0&&(n=0),n},T.dividedBy=T.div=function(e,t){return s(this,new z(e,t),P,D)},T.dividedToIntegerBy=T.idiv=function(e,t){return s(this,new z(e,t),0,1)},T.exponentiatedBy=T.pow=function(e,t){var s,n,i,c,u,d,m,h,f=this;if((e=new z(e)).c&&!e.isInteger())throw Error(r+"Exponent not an integer: "+J(e));if(null!=t&&(t=new z(t)),u=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return h=new z(Math.pow(+J(f),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 z(NaN);(n=!d&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||u&&f.c[1]>=24e7:f.c[0]<8e13||u&&f.c[0]<=9999975e7)))return c=f.s<0&&g(e)?-0:0,f.e>-1&&(c=1/c),new z(d?1/c:c);U&&(c=a(U/l+2))}for(u?(s=new z(.5),d&&(e.s=1),m=g(e)):m=(i=Math.abs(+J(e)))%2,h=new z(O);;){if(m){if(!(h=h.times(f)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(i){if(0===(i=o(i/2)))break;m=i%2}else if(G(e=e.times(s),e.e+1,1),e.e>14)m=g(e);else{if(0===(i=+J(e)))break;m=i%2}f=f.times(f),c?f.c&&f.c.length>c&&(f.c.length=c):n&&(f=f.mod(t))}return n?h:(d&&(h=O.div(h)),t?h.mod(t):c?G(h,U,D,undefined):h)},T.integerValue=function(e){var t=new z(this);return null==e?e=D:b(e,0,8),G(t,t.e+1,e)},T.isEqualTo=T.eq=function(e,t){return 0===k(this,new z(e,t))},T.isFinite=function(){return!!this.c},T.isGreaterThan=T.gt=function(e,t){return k(this,new z(e,t))>0},T.isGreaterThanOrEqualTo=T.gte=function(e,t){return 1===(t=k(this,new z(e,t)))||0===t},T.isInteger=function(){return!!this.c&&f(this.e/l)>this.c.length-2},T.isLessThan=T.lt=function(e,t){return k(this,new z(e,t))<0},T.isLessThanOrEqualTo=T.lte=function(e,t){return-1===(t=k(this,new z(e,t)))||0===t},T.isNaN=function(){return!this.s},T.isNegative=function(){return this.s<0},T.isPositive=function(){return this.s>0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.minus=function(e,t){var s,n,a,o,r=this,i=r.s;if(t=(e=new z(e,t)).s,!i||!t)return new z(NaN);if(i!=t)return e.s=-t,r.plus(e);var u=r.e/l,d=e.e/l,m=r.c,h=e.c;if(!u||!d){if(!m||!h)return m?(e.s=-t,e):new z(h?r:NaN);if(!m[0]||!h[0])return h[0]?(e.s=-t,e):new z(m[0]?r:3==D?-0:0)}if(u=f(u),d=f(d),m=m.slice(),i=u-d){for((o=i<0)?(i=-i,a=m):(d=u,a=h),a.reverse(),t=i;t--;a.push(0));a.reverse()}else for(n=(o=(i=m.length)<(t=h.length))?i:t,i=t=0;t<n;t++)if(m[t]!=h[t]){o=m[t]<h[t];break}if(o&&(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]?q(e,m,d):(e.s=3==D?-1:1,e.c=[e.e=0],e)},T.modulo=T.mod=function(e,t){var n,a,o=this;return e=new z(e,t),!o.c||!e.s||e.c&&!e.c[0]?new z(NaN):!e.c||o.c&&!o.c[0]?new z(o):(9==F?(a=e.s,e.s=1,n=s(o,e,0,3),e.s=a,n.s*=a):n=s(o,e,0,F),(e=o.minus(n.times(e))).c[0]||1!=F||(e.s=o.s),e)},T.multipliedBy=T.times=function(e,t){var s,n,a,o,r,i,u,d,h,p,k,b,g,w,y,v=this,x=v.c,A=(e=new z(e,t)).c;if(!(x&&A&&x[0]&&A[0]))return!v.s||!e.s||x&&!x[0]&&!A||A&&!A[0]&&!x?e.c=e.e=e.s=null:(e.s*=v.s,x&&A?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=f(v.e/l)+f(e.e/l),e.s*=v.s,(u=x.length)<(p=A.length)&&(g=x,x=A,A=g,a=u,u=p,p=a),a=u+p,g=[];a--;g.push(0));for(w=c,y=m,a=p;--a>=0;){for(s=0,k=A[a]%y,b=A[a]/y|0,o=a+(r=u);o>a;)s=((d=k*(d=x[--r]%y)+(i=b*d+(h=x[r]/y|0)*k)%y*y+g[o]+s)/w|0)+(i/y|0)+b*h,g[o--]=d%w;g[o]=s}return s?++n:g.splice(0,1),q(e,g,n)},T.negated=function(){var e=new z(this);return e.s=-e.s||null,e},T.plus=function(e,t){var s,n=this,a=n.s;if(t=(e=new z(e,t)).s,!a||!t)return new z(NaN);if(a!=t)return e.s=-t,n.minus(e);var o=n.e/l,r=e.e/l,i=n.c,u=e.c;if(!o||!r){if(!i||!u)return new z(a/0);if(!i[0]||!u[0])return u[0]?e:new z(i[0]?n:0*a)}if(o=f(o),r=f(r),i=i.slice(),a=o-r){for(a>0?(r=o,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),++r),q(e,i,r)},T.precision=T.sd=function(e,t){var s,n,a,o=this;if(null!=e&&e!==!!e)return b(e,1,h),null==t?t=D:b(t,0,8),G(new z(o),e,t);if(!(s=o.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&&o.e+1>n&&(n=o.e+1),n},T.shiftedBy=function(e){return b(e,-9007199254740991,u),this.times("1e"+e)},T.squareRoot=T.sqrt=function(){var e,t,n,a,o,r=this,i=r.c,c=r.s,l=r.e,u=P+4,d=new z("0.5");if(1!==c||!i||!i[0])return new z(!c||c<0&&(!i||i[0])?NaN:i?r:1/0);if(0==(c=Math.sqrt(+J(r)))||c==1/0?(((t=p(i)).length+l)%2==0&&(t+="0"),c=Math.sqrt(+t),l=f((l+1)/2)-(l<0||l%2),n=new z(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):n=new z(c+""),n.c[0])for((c=(l=n.e)+u)<3&&(c=0);;)if(o=n,n=d.times(o.plus(s(r,o,u,1))),p(o.c).slice(0,c)===(t=p(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))||(G(n,n.e+P+2,1),e=!n.times(n).eq(r));break}if(!a&&(G(o,o.e+P+2,0),o.times(o).eq(r))){n=o;break}u+=4,c+=4,a=1}return G(n,n.e+P+1,D,e)},T.toExponential=function(e,t){return null!=e&&(b(e,0,h),e++),K(this,e,t,1)},T.toFixed=function(e,t){return null!=e&&(b(e,0,h),e=e+this.e+1),K(this,e,t)},T.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=$;else if("object"!=typeof s)throw Error(r+"Argument not an object: "+s);if(n=a.toFixed(e,t),a.c){var o,i=n.split("."),c=+s.groupSize,l=+s.secondaryGroupSize,u=s.groupSeparator||"",d=i[0],m=i[1],h=a.s<0,f=h?d.slice(1):d,p=f.length;if(l&&(o=c,c=l,l=o,p-=o),c>0&&p>0){for(o=p%c||c,d=f.substr(0,o);o<p;o+=c)d+=u+f.substr(o,c);l>0&&(d+=u+f.slice(o)),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||"")},T.toFraction=function(e){var t,n,a,o,i,c,u,m,h,f,k,b,g=this,w=g.c;if(null!=e&&(!(u=new z(e)).isInteger()&&(u.c||1!==u.s)||u.lt(O)))throw Error(r+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+J(u));if(!w)return new z(g);for(t=new z(O),h=n=new z(O),a=m=new z(O),b=p(w),i=t.e=b.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=R,R=1/0,u=new z(b),m.c[0]=0;f=s(u,t,0,1),1!=(o=n.plus(f.times(a))).comparedTo(e);)n=a,a=o,h=m.plus(f.times(o=h)),m=o,t=u.minus(f.times(o=t)),u=o;return o=s(e.minus(n),a,0,1),m=m.plus(o.times(h)),n=n.plus(o.times(a)),m.s=h.s=g.s,k=s(h,a,i*=2,D).minus(g).abs().comparedTo(s(m,n,i,D).minus(g).abs())<1?[h,a]:[m,n],R=c,k},T.toNumber=function(){return+J(this)},T.toPrecision=function(e,t){return null!=e&&b(e,1,h),K(this,e,t,2)},T.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<=M||a>=N?w(p(s.c),a):y(p(s.c),a,"0"):10===e&&W?t=y(p((s=G(new z(s),P+a+1,D)).c),s.e,"0"):(b(e,2,H.length,"Base"),t=v(y(p(s.c),a,"0"),10,e,n,!0)),n<0&&s.c[0]&&(t="-"+t)),t},T.valueOf=T.toJSON=function(){return J(this)},T._isBigNumber=!0,null!=t&&z.set(t),z}(),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"}]],[],{});