LavaPack.loadBundle([["/home/runner/work/metamask-extension/metamask-extension/node_modules/@ensdomains/content-hash/src/profiles.js",{buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",cids:"/home/runner/work/metamask-extension/metamask-extension/node_modules/cids/src/index.js","js-base64":"/home/runner/work/metamask-extension/metamask-extension/node_modules/js-base64/base64.js",multihashes:"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ensdomains/content-hash/node_modules/multihashes/src/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(t){(function(){const n=e("cids"),r=e("multihashes"),a=e("js-base64"),i=e=>{let t=e.slice(0,2),s=e.slice(2),n="";return n="0x"===t?s:e,r.fromHexString(n)},o=e=>{try{const{multihash:t}=e;if(t.length<38){const e=r.decode(t);if("identity"===e.name&&e.length<36)return!1}return!0}catch(e){return!1}},c={skynet:e=>a.toUint8Array(e),swarm:e=>{const t=r.encode(i(e),"keccak-256");return new n(1,"swarm-manifest",t).bytes},ipfs:e=>new n(e).toV1().bytes,ipns:e=>{const t=new n(e);if(!o(t))throw Error("ipns-ns allows only valid cryptographic libp2p-key identifiers, try using ED25519 pubkey instead");return new n(1,"libp2p-key",t.multihash).bytes},utf8:e=>t.from(e,"utf8"),arweave:e=>a.toUint8Array(e)},d={hexMultiHash:e=>{const t=new n(e);return r.decode(t.multihash).digest.toString("hex")},ipfs:e=>{const t=new n(e).toV1();return t.toString("libp2p-key"===t.codec?"base36":"base32")},ipns:e=>{const t=new n(e).toV1();return o(t)?t.toString("base36"):(console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key"),String(r.decode(new n(e).multihash).digest))},utf8:e=>e.toString("utf8"),base64:e=>a.fromUint8Array(e,!0)},l={"skynet-ns":{encode:c.skynet,decode:d.base64},"swarm-ns":{encode:c.swarm,decode:d.hexMultiHash},"ipfs-ns":{encode:c.ipfs,decode:d.ipfs},"ipns-ns":{encode:c.ipns,decode:d.ipns},"arweave-ns":{encode:c.arweave,decode:d.base64},default:{encode:c.utf8,decode:d.utf8}};s.hexStringToBuffer=i,s.profiles=l}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@ensdomains/content-hash",file:"node_modules/@ensdomains/content-hash/src/profiles.js"}],["/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 a.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(){G.clear()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s._components=void 0,s._getProvider=W,s._isFirebaseApp=$,s._isFirebaseServerApp=function(e){return e.settings!==undefined},s._registerComponent=q,s._removeServiceInstance=function(e,t,s=B){W(e,t).clearInstance(s)},s._serverApps=void 0,s.deleteApp=J,s.getApp=function(e=B){const t=F.get(e);if(!t&&e===B&&(0,a.getDefaultAppConfig)())return Q();if(!t)throw K.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(F.values())},s.initializeApp=Q,s.initializeServerApp=function(e,t){if((0,a.isBrowser)()&&!(0,a.isWebWorker)())throw K.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let s;s=$(e)?e.options:e;const r=Object.assign(Object.assign({},t),s);r.releaseOnDeref!==undefined&&delete r.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw K.create("finalization-registry-not-supported",{});const i=""+(c=JSON.stringify(r),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),o=U.get(i);var c;if(o)return o.incRefCount(t.releaseOnDeref),o;const d=new n.ComponentContainer(i);for(const e of G.values())d.addComponent(e);const l=new z(s,t,i,d);return U.set(i,l),l},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw K.create("invalid-log-argument");(0,r.setUserLogHandler)(e,t)},s.registerVersion=X,s.setLogLevel=function(e){(0,r.setLogLevel)(e)}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */;var n=e("@firebase/component"),r=e("@firebase/logger"),a=e("@firebase/util"),i=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 o{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",d="0.10.18",l=new r.Logger("@firebase/app"),u="@firebase/app-compat",m="@firebase/analytics-compat",h="@firebase/analytics",p="@firebase/app-check-compat",f="@firebase/app-check",g="@firebase/auth",k="@firebase/auth-compat",w="@firebase/database",_="@firebase/data-connect",b="@firebase/database-compat",y="@firebase/functions",A="@firebase/functions-compat",v="@firebase/installations",E="@firebase/installations-compat",S="@firebase/messaging",x="@firebase/messaging-compat",T="@firebase/performance",I="@firebase/performance-compat",C="@firebase/remote-config",j="@firebase/remote-config-compat",P="@firebase/storage",N="@firebase/storage-compat",D="@firebase/firestore",O="@firebase/vertexai",M="@firebase/firestore-compat",R="firebase",B=s._DEFAULT_ENTRY_NAME="[DEFAULT]",L={[c]:"fire-core",[u]:"fire-core-compat",[h]:"fire-analytics",[m]:"fire-analytics-compat",[f]:"fire-app-check",[p]:"fire-app-check-compat",[g]:"fire-auth",[k]:"fire-auth-compat",[w]:"fire-rtdb",[_]:"fire-data-connect",[b]:"fire-rtdb-compat",[y]:"fire-fn",[A]:"fire-fn-compat",[v]:"fire-iid",[E]:"fire-iid-compat",[S]:"fire-fcm",[x]:"fire-fcm-compat",[T]:"fire-perf",[I]:"fire-perf-compat",[C]:"fire-rc",[j]:"fire-rc-compat",[P]:"fire-gcs",[N]:"fire-gcs-compat",[D]:"fire-fst",[M]:"fire-fst-compat",[O]:"fire-vertex","fire-js":"fire-js",[R]:"fire-js-all"},F=s._apps=new Map,U=s._serverApps=new Map,G=s._components=new Map;function H(e,t){try{e.container.addComponent(t)}catch(s){l.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function q(e){const t=e.name;if(G.has(t))return l.debug(`There were multiple attempts to register component ${t}.`),!1;G.set(t,e);for(const t of F.values())H(t,e);for(const t of U.values())H(t,e);return!0}function W(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}function $(e){return e.options!==undefined}const V={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},K=new a.ErrorFactory("app","Firebase",V);
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class Y{constructor(e,t,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 K.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class z extends Y{constructor(e,t,s,n){const r=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,a={name:s,automaticDataCollectionEnabled:r};if(e.apiKey!==undefined)super(e,a,n);else{super(e.options,a,n)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:r},t),this._finalizationRegistry=null,"undefined"!=typeof FinalizationRegistry&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=undefined,t.releaseOnDeref=undefined,X(c,d,"serverapp")}toJSON(){return undefined}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==undefined&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){J(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw K.create("server-app-deleted")}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.SDK_VERSION="11.2.0";function Q(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:B,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw K.create("bad-app-name",{appName:String(i)});if(s||(s=(0,a.getDefaultAppConfig)()),!s)throw K.create("no-options");const o=F.get(i);if(o){if((0,a.deepEqual)(s,o.options)&&(0,a.deepEqual)(r,o.config))return o;throw K.create("duplicate-app",{appName:i})}const c=new n.ComponentContainer(i);for(const e of G.values())c.addComponent(e);const d=new Y(s,r,c);return F.set(i,d),d}async function J(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 X(e,t,s){var r;let a=null!==(r=L[e])&&void 0!==r?r:e;s&&(a+=`-${s}`);const i=a.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${a}" with version "${t}":`];return i&&e.push(`library name "${a}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void l.warn(e.join(" "))}q(new n.Component(`${a}-version`,()=>({library:a,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,i.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw K.create("idb-open",{originalErrorMessage:e.message})})),ee}async function se(e,t){try{const s=(await te()).transaction(Z,"readwrite"),n=s.objectStore(Z);await n.put(t,ne(e)),await s.done}catch(e){if(e instanceof a.FirebaseError)l.warn(e.message);else{const t=K.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});l.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 re{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ie(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=ae();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){l.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=ae(),{heartbeatsToSend:s,unsentEntries:n}=function(e,t=1024){const s=[];let n=e.slice();for(const r of e){const e=s.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),oe(s)>t){e.dates.pop();break}}else if(s.push({agent:r.agent,dates:[r.date]}),oe(s)>t){s.pop();break}n=n.slice(1)}return{heartbeatsToSend:s,unsentEntries:n}}(this._heartbeatsCache.heartbeats),r=(0,a.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)),r}catch(e){return l.warn(e),""}}}function ae(){return(new Date).toISOString().substring(0,10)}class ie{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,a.isIndexedDBAvailable)()&&(0,a.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),s=await t.objectStore(Z).get(ne(e));return await t.done,s}catch(e){if(e instanceof a.FirebaseError)l.warn(e.message);else{const t=K.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});l.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 oe(e){return(0,a.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:e})).length}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ce;ce="",q(new n.Component("platform-logger",e=>new o(e),"PRIVATE")),q(new n.Component("heartbeat",e=>new re(e),"PRIVATE")),X(c,d,ce),X(c,d,"esm2017"),X("fire-js","")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app",file:"node_modules/@firebase/app/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js",{"@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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 r="[DEFAULT]";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class a{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:r})}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=r){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=r){return this.instances.has(e)}getOptions(e=r){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,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),r=null!==(s=this.onInitCallbacks.get(n))&&void 0!==s?s:new Set;r.add(e),this.onInitCallbacks.set(n,r);const a=this.instances.get(n);return a&&e(a,n),()=>{r.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===r?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=r){return this.component?this.component.multipleInstances?e:r:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}s.Provider=a;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 a(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 G(t,e=>e&&0===e.registrationStatus?undefined:e);if(s){if(1===s.registrationStatus)throw f.create("delete-pending-registration");if(2===s.registrationStatus){if(!navigator.onLine)throw f.create("app-offline");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
await async function(e,t){const s=function(e,{fid:t}){return`${k(e)}/${t}`}(e,t),n=y(e,t),r={method:"DELETE",headers:n},a=await A(()=>fetch(s,r));if(!a.ok)throw await _("Delete Installation",a)}(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=Q,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=J,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){N();const s=T(e);let n=I.get(s);n||(n=new Set,I.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=T(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"),r=e("@firebase/component"),a=e("@firebase/util"),i=e("idb");const o="@firebase/installations",c="0.6.12",d=1e4,l=`w:${c}`,u="FIS_v2",m="https://firebaseinstallations.googleapis.com/v1",h=36e5,p={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},f=new a.ErrorFactory("installations","Installations",p);function g(e){return e instanceof a.FirebaseError&&e.code.includes("request-failed")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function k({projectId:e}){return`${m}/projects/${e}/installations`}function w(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function _(e,t){const s=(await t.json()).error;return f.create("request-failed",{requestName:e,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function b({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function y(e,{refreshToken:t}){const s=b(e);return s.append("Authorization",function(e){return`${u} ${e}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t)),s}async function A(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 v(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 E=/^[cdef][\w-]{21}$/,S="";function x(){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 E.test(t)?t:S}catch(e){return S}}function T(e){return`${e.appName}!${e.appId}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const I=new Map;function C(e,t){const s=T(e);j(s,t),function(e,t){const s=N();s&&s.postMessage({key:e,fid:t});D()}(s,t)}function j(e,t){const s=I.get(e);if(s)for(const e of s)e(t)}let P=null;function N(){return!P&&"BroadcastChannel"in self&&(P=new BroadcastChannel("[Firebase] FID Change"),P.onmessage=e=>{j(e.data.key,e.data.fid)}),P}function D(){0===I.size&&P&&(P.close(),P=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 O="firebase-installations-database",M=1,R="firebase-installations-store";let B=null;function L(){return B||(B=(0,i.openDB)(O,M,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(R)}})),B}async function F(e,t){const s=T(e),n=(await L()).transaction(R,"readwrite"),r=n.objectStore(R),a=await r.get(s);return await r.put(t,s),await n.done,a&&a.fid===t.fid||C(e,t.fid),t}async function U(e){const t=T(e),s=(await L()).transaction(R,"readwrite");await s.objectStore(R).delete(t),await s.done}async function G(e,t){const s=T(e),n=(await L()).transaction(R,"readwrite"),r=n.objectStore(R),a=await r.get(s),i=t(a);return i===undefined?await r.delete(s):await r.put(i,s),await n.done,!i||a&&a.fid===i.fid||C(e,i.fid),i}
/**
 * @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 G(e.appConfig,s=>{const n=function(e){const t=e||{fid:x(),registrationStatus:0};return $(t)}(s),r=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(f.create("app-offline"))}}const s={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const s=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:s}){const n=k(e),r=b(e),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const i={fid:s,authVersion:u,appId:e.appId,sdkVersion:l},o={method:"POST",headers:r,body:JSON.stringify(i)},c=await A(()=>fetch(n,o));if(c.ok){const e=await c.json();return{fid:e.fid||s,registrationStatus:2,refreshToken:e.refreshToken,authToken:w(e.authToken)}}throw await _("Create Installation",c)}(e,t);return F(e.appConfig,s)}catch(s){throw g(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:q(e)}:{installationEntry:t}}(e,n);return t=r.registrationPromise,r.installationEntry});return s.fid===S?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function q(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await v(100),t=await W(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await H(e);return s||t}return t}function W(e){return G(e,e=>{if(!e)throw f.create("installation-not-found");return $(e)})}function $(e){return 1===(t=e).registrationStatus&&t.registrationTime+d<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`${k(e)}/${t}/authTokens:generate`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e,s),r=y(e,s),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const i={installation:{sdkVersion:l,appId:e.appId}},o={method:"POST",headers:r,body:JSON.stringify(i)},c=await A(()=>fetch(n,o));if(c.ok){return w(await c.json())}throw await _("Generate Auth Token",c)}async function K(e,t=!1){let s;const n=await G(e.appConfig,n=>{if(!z(n))throw f.create("not-registered");const r=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)}(r))return n;if(1===r.requestStatus)return s=async function(e,t){let s=await Y(e.appConfig);for(;1===s.authToken.requestStatus;)await v(100),s=await Y(e.appConfig);const n=s.authToken;return 0===n.requestStatus?K(e,t):n}(e,t),n;{if(!navigator.onLine)throw f.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(n);return s=async function(e,t){try{const s=await V(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await F(e.appConfig,n),s}catch(s){if(!g(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 Y(e){return G(e,e=>{if(!z(e))throw f.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+d<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 z(e){return e!==undefined&&2===e.registrationStatus}async function Q(e){const t=e,{installationEntry:s,registrationPromise:n}=await H(t);return n?n.catch(console.error):K(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 J(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await H(e);t&&await t}(s);return(await K(s,t)).token}function X(e){return f.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Z="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),s=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw X(s);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:s,heartbeatServiceProvider:(0,n._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),s=(0,n._getProvider)(t,Z).getImmediate();return{getId:()=>Q(s),getToken:e=>J(s,e)}};(0,n._registerComponent)(new r.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new r.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(o,c),(0,n.registerVersion)(o,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 r;s.LogLevel=void 0,(r=s.LogLevel||(s.LogLevel={}))[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const a={debug:s.LogLevel.DEBUG,verbose:s.LogLevel.VERBOSE,info:s.LogLevel.INFO,warn:s.LogLevel.WARN,error:s.LogLevel.ERROR,silent:s.LogLevel.SILENT},i=s.LogLevel.INFO,o={[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(),r=o[t];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[r](`[${n}]  ${e.name}:`,...s)};s.Logger=class{constructor(e){this.name=e,this._logLevel=i,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?a[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 r of n){let n=null;t&&t.level&&(n=a[t.level]),r.userLogHandler=null===e?null:(t,r,...a)=>{const i=a.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");r>=(null!=n?n:t.logLevel)&&e({level:s.LogLevel[r].toLowerCase(),message:i,args:a,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 C.create("only-available-in-window");e.swRegistration||await U(e);return async function(e){const t=await S(e.firebaseDependencies);t&&(await j(e.firebaseDependencies,t.token),await async function(e){const t=T(e),s=(await E()).transaction(A,"readwrite");await s.objectStore(A).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,a.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,i.getApp)()){return Y().then(e=>{if(!e)throw C.create("unsupported-browser")},e=>{throw C.create("indexed-db-unsupported")}),(0,i._getProvider)((0,a.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return G(e=(0,a.getModularInstance)(e),t)},s.isSupported=Y,s.onMessage=function(e,t){return function(e,t){if(!navigator)throw C.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,a.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),r=e("idb"),a=e("@firebase/util"),i=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 o="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",d="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",l="https://fcmregistrations.googleapis.com/v1",u="google.c.a.c_id",m=1e4;var h,p;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function f(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function g(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return n}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(p||(p={}));const k="fcm_token_details_db",w=5,_="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 b="firebase-messaging-database",y=1,A="firebase-messaging-store";let v=null;function E(){return v||(v=(0,r.openDB)(b,y,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(A)}})),v}async function S(e){const t=T(e),s=await E(),n=await s.transaction(A).objectStore(A).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(k))return null}let t=null;return(await(0,r.openDB)(k,w,{upgrade:async(s,n,r,a)=>{var i;if(n<2)return;if(!s.objectStoreNames.contains(_))return;const o=a.objectStore(_),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(i=e.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:f(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:f(e.auth),p256dh:f(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:f(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:f(e.auth),p256dh:f(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:f(e.vapidKey)}}}}})).close(),await(0,r.deleteDB)(k),await(0,r.deleteDB)("fcm_vapid_details_db"),await(0,r.deleteDB)("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await x(e,t),t}}async function x(e,t){const s=T(e),n=(await E()).transaction(A,"readwrite");return await n.objectStore(A).put(t,s),await n.done,t}function T({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const 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."},C=new a.ErrorFactory("messaging","Messaging",I);async function j(e,t){const s={method:"DELETE",headers:await N(e)};try{const n=await fetch(`${P(e.appConfig)}/${t}`,s),r=await n.json();if(r.error){const e=r.error.message;throw C.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw C.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function P({projectId:e}){return`${l}/projects/${e}/registrations`}async function N({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 r={web:{endpoint:s,auth:t,p256dh:e}};return n!==d&&(r.web.applicationPubKey=n),r}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const O=6048e5;async function M(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:g(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:f(t.getKey("auth")),p256dh:f(t.getKey("p256dh"))},n=await S(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,r=t.auth===e.auth,a=t.p256dh===e.p256dh;return s&&n&&r&&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.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+O?async function(e,t){try{const s=await async function(e,t){const s=await N(e),n=D(t.subscriptionOptions),r={method:"PATCH",headers:s,body:JSON.stringify(n)};let a;try{const s=await fetch(`${P(e.appConfig)}/${t.token}`,r);a=await s.json()}catch(e){throw C.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw C.create("token-update-failed",{errorInfo:e})}if(!a.token)throw C.create("token-update-no-token");return a.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await x(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await j(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return R(e.firebaseDependencies,s)}return R(e.firebaseDependencies,s)}async function R(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 N(e),n=D(t),r={method:"POST",headers:s,body:JSON.stringify(n)};let a;try{const t=await fetch(P(e.appConfig),r);a=await t.json()}catch(e){throw C.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw C.create("token-subscribe-failed",{errorInfo:e})}if(!a.token)throw C.create("token-subscribe-no-token");return a.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await x(e,n),n.token}function B(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const r=t.notification.image;r&&(e.notification.image=r);const a=t.notification.icon;a&&(e.notification.icon=a)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var s,n,r,a,i;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(r=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==r?r:null===(a=t.notification)||void 0===a?void 0:a.click_action;o&&(e.fcmOptions.link=o);const c=null===(i=t.fcmOptions)||void 0===i?void 0:i.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 C.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(o,{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),r=e.installing||e.waiting;e.active?(clearTimeout(n),t()):r?r.onstatechange=e=>{var s;"activated"===(null===(s=e.target)||void 0===s?void 0:s.state)&&(r.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 C.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 G(e,t){if(!navigator)throw C.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw C.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=d)}(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 C.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),M(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 p.NOTIFICATION_CLICKED:return"notification_open";case p.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(n,{message_id:s[u],message_name:s["google.c.a.c_l"],message_time:s["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function q(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===p.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(B(s)):e.onMessageHandler.next(B(s)));const n=s.data;var r;"object"==typeof(r=n)&&r&&u in r&&"1"===n["google.c.a.e"]&&await H(e,s.messageType,n)}const W="@firebase/messaging",$="0.12.16",V=e=>{const t=new F(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>q(t,e)),t},K=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>G(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function Y(){try{await(0,a.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,a.isIndexedDBAvailable)()&&(0,a.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,i._registerComponent)(new n.Component("messaging",V,"PUBLIC")),(0,i._registerComponent)(new n.Component("messaging-internal",K,"PRIVATE")),(0,i.registerVersion)(W,$),(0,i.registerVersion)(W,$,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/index.sw.cjs",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),e("@firebase/installations");var n=e("@firebase/component"),r=e("idb"),a=e("@firebase/util"),i=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 o="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var d,l;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function u(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function m(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),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"}(d||(d={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(l||(l={}));const h="fcm_token_details_db",p="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const f="firebase-messaging-store";let g=null;function k(){return g||(g=r.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(f)}})),g}async function w(e){const t=b(e),s=await k(),n=await s.transaction(f).objectStore(f).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(h))return null}let t=null;return(await r.openDB(h,5,{upgrade:async(s,n,r,a)=>{var i;if(n<2)return;if(!s.objectStoreNames.contains(p))return;const o=a.objectStore(p),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(i=e.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:u(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:u(e.auth),p256dh:u(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:u(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:u(e.auth),p256dh:u(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:u(e.vapidKey)}}}}})).close(),await r.deleteDB(h),await r.deleteDB("fcm_vapid_details_db"),await r.deleteDB("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await _(e,t),t}}async function _(e,t){const s=b(e),n=(await k()).transaction(f,"readwrite");return await n.objectStore(f).put(t,s),await n.done,t}function b({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 y={"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."},A=new a.ErrorFactory("messaging","Messaging",y);async function v(e,t){const s={method:"DELETE",headers:await S(e)};try{const n=await fetch(`${E(e.appConfig)}/${t}`,s),r=await n.json();if(r.error){const e=r.error.message;throw A.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw A.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function E({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function S({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 x({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const r={web:{endpoint:s,auth:t,p256dh:e}};return n!==o&&(r.web.applicationPubKey=n),r}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function T(e){const t=await async function(e,t){const 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:u(t.getKey("auth")),p256dh:u(t.getKey("p256dh"))},n=await w(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,r=t.auth===e.auth,a=t.p256dh===e.p256dh;return s&&n&&r&&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.
 */(n.subscriptionOptions,s))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await S(e),n=x(t.subscriptionOptions),r={method:"PATCH",headers:s,body:JSON.stringify(n)};let a;try{const s=await fetch(`${E(e.appConfig)}/${t.token}`,r);a=await s.json()}catch(e){throw A.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw A.create("token-update-failed",{errorInfo:e})}if(!a.token)throw A.create("token-update-no-token");return a.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await _(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await v(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return C(e.firebaseDependencies,s)}return C(e.firebaseDependencies,s)}async function I(e){const t=await w(e.firebaseDependencies);t&&(await v(e.firebaseDependencies,t.token),await async function(e){const t=b(e),s=(await k()).transaction(f,"readwrite");await s.objectStore(f).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();return!s||s.unsubscribe()}async function C(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 S(e),n=x(t),r={method:"POST",headers:s,body:JSON.stringify(n)};let a;try{const t=await fetch(E(e.appConfig),r);a=await t.json()}catch(e){throw A.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw A.create("token-subscribe-failed",{errorInfo:e})}if(!a.token)throw A.create("token-subscribe-no-token");return a.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await _(e,n),n.token}async function j(e,t){const s=function(e,t){var s,n;const r={};e.from&&(r.project_number=e.from);e.fcmMessageId&&(r.message_id=e.fcmMessageId);r.instance_id=t,e.notification?r.message_type=d.DISPLAY_NOTIFICATION.toString():r.message_type=d.DATA_MESSAGE.toString();r.sdk_platform=3..toString(),r.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(r.collapse_key=e.collapse_key);r.event=1..toString(),!(null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label)||(r.analytics_label=null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label);return r}(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 P(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 j(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=l.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 r=t.notification.image;r&&(e.notification.image=r);const a=t.notification.icon;a&&(e.notification.icon=a)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var s,n,r,a,i;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(r=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==r?r:null===(a=t.notification)||void 0===a?void 0:a.click_action;o&&(e.fcmOptions.link=o);const c=null===(i=t.fcmOptions)||void 0===i?void 0:i.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 N(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 r=function(e){var t,s,n;const r=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(r)return r;return a=e.data,"object"==typeof a&&a&&"google.c.a.c_id"in a?self.location.origin:null;var 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.
 */}
/**
 * @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(!r)return;const a=new URL(r,self.location.href),i=new URL(self.location.origin);if(a.host!==i.host)return;let o=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}(a);var d;
/**
 * @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 o?o=await o.focus():(o=await self.clients.openWindow(r),await(d=3e3,new Promise(e=>{setTimeout(e,d)}))),o?(n.messageType=l.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,o.postMessage(n)):void 0}function D(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function O(e){return A.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 M{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 O("App Configuration Object");if(!e.name)throw O("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw O(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 R=e=>{const t=new M(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(P(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var s,n;const{newSubscription:r}=e;if(!r)return void await I(t);const a=await w(t.firebaseDependencies);await I(t),t.vapidKey=null!==(n=null===(s=null==a?void 0:a.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n:o,await T(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(N(e))}),t};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function B(){return a.isIndexedDBAvailable()&&await a.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.
 */i._registerComponent(new n.Component("messaging-sw",R,"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=a.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=i.getApp()){return B().then(e=>{if(!e)throw A.create("unsupported-browser")},e=>{throw A.create("indexed-db-unsupported")}),i._getProvider(a.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=B,s.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw A.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=a.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=C,s=j){const n=t*Math.pow(s,e),r=Math.round(N*n*(Math.random()-.5)*2);return Math.min(P,n+r)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,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,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a=Object.assign({iss:`https://securetoken.google.com/${s}`,aud:s,iat:n,exp:n+3600,auth_time:n,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[d(JSON.stringify({alg:"none",type:"JWT"})),d(JSON.stringify(a)),""].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 x(e,t);return s.subscribe.bind(s)},s.decode=void 0,s.deepCopy=function(e){return u(undefined,e)},s.deepEqual=function e(t,s){if(t===s)return!0;const n=Object.keys(t),r=Object.keys(s);for(const a of n){if(!r.includes(a))return!1;const n=t[a],i=s[a];if(S(n)&&S(i)){if(!e(n,i))return!1}else if(n!==i)return!1}for(const e of r)if(!n.includes(e))return!1;return!0},s.deepExtend=u,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=k,s.isAdmin=void 0,s.isBrowser=function(){return"undefined"!=typeof window||_()},s.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},s.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},s.isElectron=function(){return k().indexOf("Electron/")>=0},s.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},s.isIE=function(){const e=k();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},s.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},s.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k())},s.isNode=w,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!w()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},s.isUWP=function(){return k().indexOf("MSAppHost/")>=0},s.isValidTimestamp=s.isValidFormat=void 0,s.isWebWorker=_,s.issuedAtTime=void 0,s.jsonEval=v,s.map=function(e,t,s){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=t.call(s,e[r],r,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 g;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",r=self.indexedDB.open(n);r.onsuccess=()=>{r.result.close(),s||self.indexedDB.deleteDatabase(n),e(!0)},r.onupgradeneeded=()=>{s=!1},r.onerror=()=>{var e;t((null===(e=r.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 r(t)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.assert=n;const r=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */s.assertionError=r;const a=function(e){const t=[];let s=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t[s++]=r:r<2048?(t[s++]=r>>6|192,t[s++]=63&r|128):55296==(64512&r)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n)),t[s++]=r>>18|240,t[s++]=r>>12&63|128,t[s++]=r>>6&63|128,t[s++]=63&r|128):(t[s++]=r>>12|224,t[s++]=r>>6&63|128,t[s++]=63&r|128)}return t},i=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 r=e[t],a=t+1<e.length,i=a?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,d=r>>2,l=(3&r)<<4|i>>4;let u=(15&i)<<2|c>>6,m=63&c;o||(m=64,a||(u=64)),n.push(s[d],s[l],s[u],s[m])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(a(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 r=e[s++];if(r<128)t[n++]=String.fromCharCode(r);else if(r>191&&r<224){const a=e[s++];t[n++]=String.fromCharCode((31&r)<<6|63&a)}else if(r>239&&r<365){const a=((7&r)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[n++]=String.fromCharCode(55296+(a>>10)),t[n++]=String.fromCharCode(56320+(1023&a))}else{const a=e[s++],i=e[s++];t[n++]=String.fromCharCode((15&r)<<12|(63&a)<<6|63&i)}}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 r=s[e.charAt(t++)],a=t<e.length?s[e.charAt(t)]:0;++t;const i=t<e.length?s[e.charAt(t)]:64;++t;const c=t<e.length?s[e.charAt(t)]:64;if(++t,null==r||null==a||null==i||null==c)throw new o;const d=r<<2|a>>4;if(n.push(d),64!==i){const e=a<<4&240|i>>2;if(n.push(e),64!==c){const e=i<<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 o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}s.DecodeBase64StringError=o;const c=function(e){const t=a(e);return i.encodeByteArray(t,!0)};s.base64Encode=c;const d=function(e){return c(e).replace(/\./g,"")};s.base64urlEncodeWithoutPadding=d;const l=function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function u(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===undefined&&(e={});break;case Array:e=[];break;default:return t}for(const s in t)t.hasOwnProperty(s)&&m(s)&&(e[s]=u(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=l;const p=()=>{try{return h().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&l(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};s.getDefaults=p;const f=e=>{var t,s;return null===(s=null===(t=p())||void 0===t?void 0:t.emulatorHosts)||void 0===s?void 0:s[e]};s.getDefaultEmulatorHost=f;s.getDefaultEmulatorHostnameAndPort=e=>{const t=f(e);if(!t)return undefined;const s=t.lastIndexOf(":");if(s<=0||s+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(s+1),10);return"["===t[0]?[t.substring(1,s-1),n]:[t.substring(0,s),n]};s.getDefaultAppConfig=()=>{var e;return null===(e=p())||void 0===e?void 0:e.config};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
s.getExperimentalSetting=e=>{var t;return null===(t=p())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,s)=>{t?this.reject(t):this.resolve(s),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,s))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function k(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function w(){var e;const t=null===(e=p())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function _(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}s.Deferred=g;class b extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,b.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,y.prototype.create)}}s.FirebaseError=b;class y{constructor(e,t,s){this.service=e,this.serviceName=t,this.errors=s}create(e,...t){const s=t[0]||{},n=`${this.service}/${e}`,r=this.errors[e],a=r?function(e,t){return e.replace(A,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(r,s):"Error",i=`${this.serviceName}: ${a} (${n}).`;return new b(n,i,s)}}s.ErrorFactory=y;const A=/\{\$([^}]+)}/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 v(e){return JSON.parse(e)}const E=function(e){let t={},s={},n={},r="";try{const a=e.split(".");t=v(l(a[0])||""),s=v(l(a[1])||""),r=a[2],n=s.d||{},delete s.d}catch(e){}return{header:t,claims:s,data:n,signature:r}};s.decode=E;s.isValidTimestamp=function(e){const t=E(e).claims,s=Math.floor((new Date).getTime()/1e3);let n=0,r=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?n=t.nbf:t.hasOwnProperty("iat")&&(n=t.iat),r=t.hasOwnProperty("exp")?t.exp:n+86400),!!s&&!!n&&!!r&&s>=n&&s<=r};s.issuedAtTime=function(e){const t=E(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};s.isValidFormat=function(e){const t=E(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function S(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=E(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,r,a=this.chain_[0],i=this.chain_[1],o=this.chain_[2],c=this.chain_[3],d=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=c^i&(o^c),r=1518500249):(n=i^o^c,r=1859775393):e<60?(n=i&o|c&(i|o),r=2400959708):(n=i^o^c,r=3395469782);const t=(a<<5|a>>>27)+n+d+r+s[e]&4294967295;d=c,c=o,o=4294967295&(i<<30|i>>>2),i=a,a=t}this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+d&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const s=t-this.blockSize;let n=0;const r=this.buf_;let a=this.inbuf_;for(;n<t;){if(0===a)for(;n<=s;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(r[a]=e.charCodeAt(n),++a,++n,a===this.blockSize){this.compress_(r),a=0;break}}else for(;n<t;)if(r[a]=e[n],++a,++n,a===this.blockSize){this.compress_(r),a=0;break}}this.inbuf_=a,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 x{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,s){let n;if(e===undefined&&t===undefined&&s===undefined)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const s of t)if(s in e&&"function"==typeof e[s])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:s},n.next===undefined&&(n.next=T),n.error===undefined&&(n.error=T),n.complete===undefined&&(n.complete=T);const r=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),r}unsubscribeOne(e){this.observers!==undefined&&this.observers[e]!==undefined&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&this.onNoObservers!==undefined&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==undefined&&this.observers[e]!==undefined)try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,e!==undefined&&(this.finalError=e),this.task.then(()=>{this.observers=undefined,this.onNoObservers=undefined}))}}function T(){}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function I(e,t){return`${e} failed: ${t} argument `}s.validateArgCount=function(e,t,s,n){let r;if(n<t?r="at least "+t:n>s&&(r=0===s?"none":"no more than "+s),r){throw new Error(e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+r+".")}};s.stringToByteArray=function(e){const t=[];let s=0;for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(a>=55296&&a<=56319){const t=a-55296;r++,n(r<e.length,"Surrogate pair missing trail surrogate.");a=65536+(t<<10)+(e.charCodeAt(r)-56320)}a<128?t[s++]=a:a<2048?(t[s++]=a>>6|192,t[s++]=63&a|128):a<65536?(t[s++]=a>>12|224,t[s++]=a>>6&63|128,t[s++]=63&a|128):(t[s++]=a>>18|240,t[s++]=a>>12&63|128,t[s++]=a>>6&63|128,t[s++]=63&a|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 C=1e3,j=2,P=s.MAX_VALUE_MILLIS=144e5,N=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 r(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 a(e,t);e=e[t]}return e}}s.default=n;class r extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}s.InvalidPtrError=r;class a extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}s.EvalError=a}}},{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 r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(r,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(6===o[0]&&i.label<r[1]){i.label=r[1],r=o;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(o);break}r[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var o=i(e("@json-schema-tools/traverse")),c=i(e("@json-schema-tools/reference-resolver")),d=i(e("fast-safe-stringify")),l=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,d.default)(e))].join("\n")};s.NonStringRefError=l;var u=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 r=0,a=Object.keys(this.options.protocolHandlerMap);r<a.length;r++){var i=a[r];c.default.protocolHandlerMap[i]=this.options.protocolHandlerMap[i]}this.schema=s,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return r(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return r(this,void 0,void 0,function(){var t,s,r,i,d,l,m,h,p,f,g,k=this;return a(this,function(a){switch(a.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return k.refCache[e]===undefined}),s=[],r=0,i=t,a.label=1;case 1:return r<i.length?(d=i[r],l=void 0,this.refCache[d]===undefined?[3,2]:(l=this.refCache[d],[3,5])):[3,11];case 2:if("#"!==d)return[3,3];if(this.options.rootSchema===undefined)throw new Error("options.rootSchema was not provided, but one of the schemas references '#'");return l=this.options.rootSchema,[3,5];case 3:return m=c.default.resolve(d,this.options.rootSchema),s.push(m),[4,m];case 4:l=a.sent(),a.label=5;case 5:return!0!==this.options.recursive||!0===l||!1===l||"#"===d?[3,9]:(h=n(n({},this.options),{refCache:this.refCache}),0===(p=new e(l,h)).refs.length?[3,7]:(f=p._resolve(),s.push(f),[4,f]));case 6:return g=a.sent(),this.refCache[d]=u(l,g),[3,8];case 7:this.refCache[d]=l,a.label=8;case 8:return[3,10];case 9:this.refCache[d]=l,a.label=10;case 10:return r++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=u(this.schema,this.refCache[this.schema.$ref]):(0,o.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=k.refCache[e.$ref];return u(e,t)}return e},{mutable:!0}),[4,Promise.all(s)];case 12:return a.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,o.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 l(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 r=n(e("./dereferencer")),a=e("./dereferencer");Object.defineProperty(s,"NonStringRefError",{enumerable:!0,get:function(){return a.NonStringRefError}}),s.default=r.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/meta-schema/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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(r,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(6===o[0]&&i.label<r[1]){i.label=r[1],r=o;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(o);break}r[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var i=e("./errors"),o=a(e("isomorphic-fetch")),c=function(e){return n(void 0,void 0,void 0,function(){var t,s;return r(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,o.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new i.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 i.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 r=function(e){this.name="NotResolvableError",this.message=["NotResolvableError","Could not resolve the reference: ".concat(e),"No protocol handler was found, and it was not found to be an internal reference"].join("\n")};s.NotResolvableError=r;var a=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};s.InvalidRemoteURLError=a;var i=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};s.InvalidFileSystemPathError=i}}},{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 r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(r,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(6===o[0]&&i.label<r[1]){i.label=r[1],r=o;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(o);break}r[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=i(e("./default-protocol-handler-map")),c=i(e("./reference-resolver")),d=n(n({},o.default),{file:function(){return r(void 0,void 0,void 0,function(){return a(this,function(e){return[2,undefined]})})}});s.default=new c.default(d)}}},{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(r,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(6===o[0]&&i.label<r[1]){i.label=r[1],r=o;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(o);break}r[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var i=e("./errors"),o=a(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,a,c,d,l,u,m,h,p;return void 0===t&&(t={}),r(this,function(r){switch(r.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,o.default)(e,t))];(s=e.split("#")).length>1&&(n=s[s.length-1]),a=s[0],r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(a,t)];case 2:return c=r.sent(),[3,4];case 3:throw d=r.sent(),new i.NonJsonRefError({$ref:e},d.message);case 4:if(c!==undefined)return p=c,n&&(p=(0,o.default)(n,p)),[2,p];if(!1===e.includes("://"))throw new i.InvalidFileSystemPathError(e);l=0,u=Object.keys(this.protocolHandlerMap),r.label=5;case 5:return l<u.length?(m=u[l],a.startsWith(m)?[4,this.protocolHandlerMap[m](a,t)]:[3,7]):[3,8];case 6:if((h=r.sent())!==undefined)return p=h,n&&(p=(0,o.default)(n,p)),[2,p];r.label=7;case 7:return l++,[3,5];case 8:throw new i.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 r=n(e("@json-schema-spec/json-pointer")),a=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=a,s.default=function(e,t){try{var s=e.replace("#","");return r.default.parse(s).shmeval(t)}catch(t){throw new a(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 r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,s){if(s||2===arguments.length)for(var n,r=0,a=t.length;r<a;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);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 a=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},i=function(e,t){var s=t.find(function(t){return t===e});return s||!1},o=function(e,t){return void 0===t&&(t=1),e[e.length-t]};s.default=function e(t,c,d,l,u,m,h,p,f){void 0===d&&(d=s.defaultOptions),void 0===l&&(l=0),void 0===u&&(u=[]),void 0===m&&(m=[]),void 0===h&&(h=[]),void 0===p&&(p=[]),void 0===f&&(f=[]);var g=n(n({},s.defaultOptions),d);if(0===l&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===l?t:c(t,!1,a(h),o(m));var k=t;!1===g.mutable&&(k=n({},t)),m.push(k),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===l||(k=c(k,!1,a(h),o(m,2)))),u.push(t),p.push([t,k]);var w=function(t,s){var n=i(t,u);return n?(f.push(n),!0===g.skipFirstMutation&&n===u[0]?c(t,!0,a(s),o(m)):p.find(function(e){var t=e[0];return n===t})[1]):e(t,c,d,l+1,u,m,s,p,f)};if(t.anyOf)k.anyOf=t.anyOf.map(function(e,t){return w(e,r(r([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)k.allOf=t.allOf.map(function(e,t){return w(e,r(r([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)k.oneOf=t.oneOf.map(function(e,t){return w(e,r(r([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)k.items=t.items.map(function(e,t){return w(e,r(r([],h,!0),["items[".concat(t,"]")],!1))});else{var _=i(t.items,u);if(_)if(f.push(_),!0===g.skipFirstMutation&&_===u[0])k.items=c(t.items,!0,a(h),o(m));else{var b=p.find(function(e){var t=e[0];return _===t})[1];k.items=b}else k.items=e(t.items,c,d,l+1,u,m,r(r([],h,!0),["items"],!1),p,f)}if(t.additionalItems!==undefined&&(k.additionalItems=w(t.additionalItems,r(r([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var y=t.properties,A={};Object.keys(t.properties).forEach(function(e){A[e]=w(y[e],r(r([],h,!0),["properties",e.toString()],!1))}),k.properties=A}if(t.patternProperties!==undefined){var v=t.patternProperties,E={};Object.keys(t.patternProperties).forEach(function(e){E[e]=w(v[e],r(r([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=E}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(k.additionalProperties=w(t.additionalProperties,r(r([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===l)return k;if(!0===g.bfs)return m.pop(),k;var S=-1!==f.indexOf(t);return m.pop(),c(k,S,a(h),o(m))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=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 i=e("@metamask/base-controller"),o=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 d={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};s.getDefaultAddressBookControllerState=()=>({addressBook:{}});class l extends i.BaseController{constructor({messenger:e,state:t}){const i={...(0,s.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:d,name:s.controllerName,state:i}),n.add(this),a(this,n,"m",r).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,o.toChecksumHexAddress)(t),!([e,t].every(e=>(0,o.isSafeDynamicKey)(e))&&(0,o.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,o.toHex)(1),n="",r){if(e=(0,o.toChecksumHexAddress)(e),!(0,o.isValidHexAddress)(e))return!1;const a={address:e,chainId:s,isEns:!1,memo:n,name:t,addressType:r,lastUpdatedAt:Date.now()},i=(0,o.normalizeEnsName)(t);return i&&(a.name=i,a.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[s]:{...this.state.addressBook[s],[e]:a}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",a),!0}}s.AddressBookController=l,n=new WeakSet,r=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=l}}},{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,r,a=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 i=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class d extends i.BaseController{constructor({messenger:e,state:t,allAnnouncements:s}){const i={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:i}),n.add(this),a(this,n,"m",r).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=d,n=new WeakSet,r=function(e){this.update(t=>{Object.values(e).forEach(e=>{t.announcements[e.id]=t.announcements[e.id]??{...e,isShown:!1}})})}}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/index.cjs",{"./AnnouncementController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,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/bridge-status-controller/dist/bridge-status-controller.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/bridge-status.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./utils/metrics.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m,h,p,f,g,k,w,_,b,y,A,v,E,S,x,T,I,C,j,P=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},N=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusController=void 0;const D=e("@metamask/bridge-controller"),O=e("@metamask/controller-utils"),M=e("@metamask/polling-controller"),R=e("@metamask/transaction-controller"),B=e("@metamask/utils"),L=e("./constants.cjs"),F=e("./types.cjs"),U=e("./utils/bridge-status.cjs"),G=e("./utils/gas.cjs"),H=e("./utils/metrics.cjs"),q=e("./utils/transaction.cjs"),W={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class $ extends((0,M.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,fetchFn:M,addTransactionFn:$,addTransactionBatchFn:V,updateTransactionFn:K,estimateGasFeeFn:Y,config:z,traceFn:Q}){super({name:L.BRIDGE_STATUS_CONTROLLER_NAME,metadata:W,messenger:e,state:{...L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),n.add(this),r.set(this,{}),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),m.set(this,void 0),h.set(this,({id:e})=>{const t=this.state.txHistory[e]?e:Object.keys(this.state.txHistory).find(t=>this.state.txHistory[t].approvalTxId===e);t&&this.update(e=>{e.txHistory[t].status.status=D.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),s=this.messenger.call("NetworkController:getNetworkClientById",t).configuration.chainId;N(this,A,"f").call(this,e,s)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:s}=e;if(!t&&!s)throw new Error("Either txMetaId or txHash must be provided");let n;if(t?this.state.txHistory[t]&&(n=t):s&&(n=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===s)),!n)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${s}`));const a=this.state.txHistory[n];this.update(e=>{n&&(e.txHistory[n].attempts=undefined)});if((0,D.isCrossChain)(a.quote.srcChainId,a.quote.destChainId)){N(this,r,"f")[n]||N(this,g,"f").call(this,n)}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],p.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===D.StatusTypes.PENDING||e.status.status===D.StatusTypes.UNKNOWN).filter(e=>!N(this,r,"f")[e.txMetaId]).filter(e=>(0,D.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)).forEach(e=>{const t=e.txMetaId;(0,U.shouldSkipFetchDueToFetchFailures)(e.attempts)||N(this,g,"f").call(this,t)})}),f.set(this,e=>{const{bridgeTxMeta:t,statusRequest:s,quoteResponse:n,startTime:r,slippagePercentage:a,initialDestAssetBalance:i,targetContractAddress:o,approvalTxId:c,isStxEnabled:d,accountAddress:l}=e,u={txMetaId:t.id,batchId:t.batchId,quote:n.quote,startTime:r,estimatedProcessingTimeInSeconds:n.estimatedProcessingTimeInSeconds,slippagePercentage:a,pricingData:{amountSent:n.sentAmount?.amount??"0",amountSentInUsd:n.sentAmount?.usd??undefined,quotedGasInUsd:n.gasFee?.effective?.usd??undefined,quotedReturnInUsd:n.toTokenAmount?.usd??undefined,quotedGasAmount:n.gasFee?.effective?.amount??undefined},initialDestAssetBalance:i,targetContractAddress:o,account:l,status:{status:D.StatusTypes.PENDING,srcChain:{chainId:s.srcChainId,txHash:s.srcTxHash}},hasApprovalTx:Boolean(n.approval),approvalTxId:c,isStxEnabled:d??!1,featureId:n.featureId};this.update(e=>{e.txHistory[t.id]=u})}),g.set(this,e=>{const t=N(this,r,"f")[e];t&&this.stopPollingByPollingToken(t);const s=this.state.txHistory[e];if(!s)return;const{quote:n}=s;(0,D.isCrossChain)(n.srcChainId,n.destChainId)&&(N(this,r,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;N(this,f,"f").call(this,e),N(this,g,"f").call(this,t.id)},this._executePoll=async e=>{await N(this,_,"f").call(this,e)},w.set(this,e=>{const{attempts:t}=this.state.txHistory[e],s=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},n=N(this,r,"f")[e];s.counter>=L.MAX_ATTEMPTS&&n&&(this.stopPollingByPollingToken(n),delete N(this,r,"f")[e]),this.update(t=>{t.txHistory[e].attempts=s})}),_.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state;if(!(0,U.shouldSkipFetchDueToFetchFailures)(t[e]?.attempts))try{const s=t[e],n=N(this,b,"f").call(this,e);if(!n)return;N(this,y,"f").call(this,e,n);const c=(0,U.getStatusRequestWithSrcTxHash)(s.quote,n),{status:d,validationFailures:l}=await(0,U.fetchBridgeTxStatus)(c,N(this,a,"f"),N(this,i,"f"),N(this,o,"f").customBridgeApiBaseUrl);if(l.length>0)throw N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:l}),new Error(`Bridge status validation failed: ${l.join(", ")}`);const u={...s,status:d,completionTime:d.status===D.StatusTypes.COMPLETE||d.status===D.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=u});const m=N(this,r,"f")[e];if((d.status===D.StatusTypes.COMPLETE||d.status===D.StatusTypes.FAILED)&&m){if(this.stopPollingByPollingToken(m),delete N(this,r,"f")[e],s.featureId)return;d.status===D.StatusTypes.COMPLETE&&(N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",s.quote.destAsset.assetId)),d.status===D.StatusTypes.FAILED&&N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),N(this,w,"f").call(this,e)}}),b.set(this,e=>{const{txHistory:t}=this.state,s=t[e].status.srcChain.txHash;if(s)return s;const n=this.messenger.call("TransactionController:getState").transactions.find(t=>t.id===e);return n?.hash}),y.set(this,(e,t)=>{const{txHistory:s}=this.state;s[e].status.srcChain.txHash||this.update(s=>{s.txHistory[e].status.srcChain.txHash=t})}),A.set(this,(e,t)=>{const s=Object.keys(this.state.txHistory).filter(s=>{const n=this.state.txHistory[s],r=(0,B.numberToHex)(n.quote.srcChainId);return n.account===e&&r===t});s.forEach(e=>{N(this,r,"f")[e]&&this.stopPollingByPollingToken(N(this,r,"f")[e])}),this.update(e=>{e.txHistory=s.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),v.set(this,async(e,t,s)=>{if(!s.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const n=(0,q.getClientRequest)(e,t.quote.srcChainId,s),r=await this.messenger.call("SnapController:handleRequest",n),a={...t,trade:e};return(0,q.handleNonEvmTxResponse)(r,a,s)}),E.set(this,async e=>{const t=await e,s=this.messenger.call("TransactionController:getState").transactions.find(e=>e.hash===t);if(!s)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return s}),S.set(this,async(e,t,s,n,r)=>{if(s){const a=async()=>{await N(this,T,"f").call(this,n);const a=await N(this,x,"f").call(this,{transactionType:e?R.TransactionType.bridgeApproval:R.TransactionType.swapApproval,trade:s,requireApproval:r});return await(0,q.handleApprovalDelay)(t),a};return await N(this,m,"f").call(this,{name:e?L.TraceName.BridgeTransactionApprovalCompleted:L.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t),stxEnabled:!1}},a)}return undefined}),x.set(this,async({transactionType:e,trade:t,requireApproval:s=!1,txFee:n})=>{const r=(0,q.generateActionId)().toString();if(!this.messenger.call("AccountsController:getAccountByAddress",t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const a=(0,D.formatChainIdToHex)(t.chainId),i=this.messenger.call("NetworkController:findNetworkClientIdByChainId",a),o={actionId:r,networkClientId:i,requireApproval:s,type:e,origin:"metamask"},d={...t,chainId:a,gasLimit:t.gasLimit?.toString(),gas:t.gasLimit?.toString()},l={...d,...await N(this,I,"f").call(this,d,i,a,n)},{result:u}=await N(this,c,"f").call(this,l,o);return await N(this,E,"f").call(this,u)}),T.set(this,async e=>{e&&await N(this,x,"f").call(this,{transactionType:R.TransactionType.bridgeApproval,trade:e})}),I.set(this,async(e,t,s,n)=>{const r=(0,O.toHex)(e.gas??0);if(n)return{maxFeePerGas:(0,O.toHex)(n.maxFeePerGas??0),maxPriorityFeePerGas:(0,O.toHex)(n.maxPriorityFeePerGas??0),gas:r};const{gasFeeEstimates:a}=this.messenger.call("GasFeeController:getState"),{estimates:i}=await N(this,u,"f").call(this,{transactionParams:e,chainId:s,networkClientId:t}),{maxFeePerGas:o,maxPriorityFeePerGas:c}=(0,G.getTxGasEstimates)({networkGasFeeEstimates:a,txGasFeeEstimates:i});return{maxFeePerGas:o,maxPriorityFeePerGas:c,gas:r}}),C.set(this,async e=>{const t=await(0,q.getAddTransactionBatchParams)({messenger:this.messenger,estimateGasFeeFn:N(this,u,"f"),...e}),s={[R.TransactionType.bridgeApproval]:t.transactions.find(({type:e})=>e===R.TransactionType.bridgeApproval)?.params.data,[R.TransactionType.swapApproval]:t.transactions.find(({type:e})=>e===R.TransactionType.swapApproval)?.params.data,[R.TransactionType.bridge]:t.transactions.find(({type:e})=>e===R.TransactionType.bridge)?.params.data,[R.TransactionType.swap]:t.transactions.find(({type:e})=>e===R.TransactionType.swap)?.params.data},{batchId:n}=await N(this,d,"f").call(this,t),{approvalMeta:r,tradeMeta:a}=(0,q.findAndUpdateTransactionsInBatch)({messenger:this.messenger,updateTransactionFn:N(this,l,"f"),batchId:n,txDataByType:s});if(!a)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:r,tradeMeta:a}}),this.submitTx=async(e,t,s,r)=>{this.messenger.call("BridgeController:stopPollingForQuotes",D.AbortReason.TransactionSubmitted,t.featureId?undefined:r);const i=N(this,n,"m",k).call(this,e);if(!i)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const o=(0,D.isHardwareWallet)(i),c=(0,H.getPreConfirmationPropertiesFromQuote)(t,s,o);let d,l;!t.featureId&&N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Submitted,undefined,c);const u=Date.now(),h=(0,D.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);if((0,D.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,D.isTronTrade)(t.approval)){const e=await N(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionApprovalCompleted:L.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{return t.approval&&(0,D.isTronTrade)(t.approval)?await N(this,v,"f").call(this,t.approval,t,i):undefined}catch(e){throw!t.featureId&&N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...c}),e}});l=e?.id,await(0,q.handleApprovalDelay)(t.quote.srcChainId)}d=await N(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionCompleted:L.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{if(!(0,D.isTronTrade)(t.trade)&&!(0,D.isBitcoinTrade)(t.trade)&&"string"!=typeof t.trade)throw new Error("Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction");return await N(this,v,"f").call(this,t.trade,t,i)}catch(e){throw!t.featureId&&N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,d?.id,{error_message:e?.message,...c}),e}})}else{const e=N(this,a,"f")===F.BridgeClientId.MOBILE&&o;d=await N(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionCompleted:L.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:s}},async()=>{if(!(0,D.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");if(s||t.quote.gasIncluded7702){const{tradeMeta:s,approvalMeta:n}=await N(this,C,"f").call(this,{isBridgeTx:h,resetApproval:t.resetApproval,approval:t.approval&&(0,D.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e});return l=n?.id,s}const n=await N(this,S,"f").call(this,h,t.quote.srcChainId,t.approval&&(0,D.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);return l=n?.id,await(0,q.handleMobileHardwareWalletDelay)(e),await N(this,x,"f").call(this,{transactionType:h?R.TransactionType.bridge:R.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined})})}try{N(this,f,"f").call(this,{accountAddress:i.address,bridgeTxMeta:d,statusRequest:{...(0,q.getStatusRequestParams)(t),srcTxHash:d.hash},quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:u,approvalTxId:l}),(0,D.isNonEvmChainId)(t.quote.srcChainId)&&(N(this,g,"f").call(this,d.id),h||N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Completed,d.id))}catch{}return d},j.set(this,(e,t,s)=>{const n={action_type:D.MetricsActionType.SWAPBRIDGE_V1,...s??{}};if(!t)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,n);const r=this.state.txHistory[t];if(!r)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,s??{});const a=(0,H.getRequestParamFromHistory)(r);if(e===D.UnifiedSwapBridgeEventName.StatusValidationFailed){const{chain_id_source:t,chain_id_destination:s,token_address_source:i,token_address_destination:o}=a;return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,{...n,chain_id_source:t,chain_id_destination:s,token_address_source:i,token_address_destination:o,refresh_count:r.attempts?.counter??0})}if(r.featureId)return;const i=this.messenger.call("AccountsController:getAccountByAddress",r.account),{transactions:o}=this.messenger.call("TransactionController:getState"),c=o?.find(({id:e})=>e===t),d=o?.find(({id:e})=>e===r.approvalTxId),l={...n,...a,...(0,H.getRequestMetadataFromHistory)(r,i),...(0,H.getTradeDataFromHistory)(r),...(0,H.getTxStatusesFromHistory)(r),...(0,H.getFinalizedTxProperties)(r,c,d),...(0,H.getPriceImpactFromQuote)(r.quote)};this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,l)}),P(this,a,s,"f"),P(this,i,M,"f"),P(this,c,$,"f"),P(this,d,V,"f"),P(this,l,K,"f"),P(this,u,Y,"f"),P(this,o,{customBridgeApiBaseUrl:z?.customBridgeApiBaseUrl??L.BRIDGE_PROD_API_BASE_URL},"f"),P(this,m,Q??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength(L.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:s,id:n}=e;t&&[R.TransactionType.bridge,R.TransactionType.swap,R.TransactionType.bridgeApproval,R.TransactionType.swapApproval].includes(t)&&[R.TransactionStatus.failed,R.TransactionStatus.dropped,R.TransactionStatus.rejected].includes(s)&&(N(this,h,"f").call(this,e),s!==R.TransactionStatus.rejected&&N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,n,(0,H.getEVMTxPropertiesFromTransactionMeta)(e)))}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:s,chainId:n}=e;t===R.TransactionType.swap&&N(this,j,"f").call(this,D.UnifiedSwapBridgeEventName.Completed,s),t!==R.TransactionType.bridge||(0,D.isNonEvmChainId)(n)||N(this,g,"f").call(this,s)}),N(this,p,"f").call(this)}}s.BridgeStatusController=$,r=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,w=new WeakMap,_=new WeakMap,b=new WeakMap,y=new WeakMap,A=new WeakMap,v=new WeakMap,E=new WeakMap,S=new WeakMap,x=new WeakMap,T=new WeakMap,I=new WeakMap,C=new WeakMap,j=new WeakMap,n=new WeakSet,k=function(e){return this.messenger.call("AccountsController:getAccountByAddress",e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=s.APPROVAL_DELAY_MS=s.BRIDGE_PROD_API_BASE_URL=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.BRIDGE_STATUS_CONTROLLER_NAME=s.MAX_ATTEMPTS=s.REFRESH_INTERVAL_MS=void 0,s.REFRESH_INTERVAL_MS=1e4,s.MAX_ATTEMPTS=7,s.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",s.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(n||(s.TraceName=n={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/index.cjs",{"./bridge-status-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getTxMetaFields=s.BridgeStatusController=s.BridgeStatusAction=s.BridgeId=s.MAX_ATTEMPTS=s.BRIDGE_STATUS_CONTROLLER_NAME=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.REFRESH_INTERVAL_MS=void 0;var n=e("./constants.cjs");Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return n.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(s,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return n.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(s,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return n.MAX_ATTEMPTS}});var r=e("./types.cjs");Object.defineProperty(s,"BridgeId",{enumerable:!0,get:function(){return r.BridgeId}}),Object.defineProperty(s,"BridgeStatusAction",{enumerable:!0,get:function(){return r.BridgeStatusAction}});var a=e("./bridge-status-controller.cjs");Object.defineProperty(s,"BridgeStatusController",{enumerable:!0,get:function(){return a.BridgeStatusController}});var i=e("./utils/transaction.cjs");Object.defineProperty(s,"getTxMetaFields",{enumerable:!0,get:function(){return i.getTxMetaFields}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a;Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusAction=s.BridgeId=s.BridgeClientId=void 0,function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(n||(s.BridgeClientId=n={})),function(e){e.HOP="hop",e.CELER="celer",e.CELERCIRCLE="celercircle",e.CONNEXT="connext",e.POLYGON="polygon",e.AVALANCHE="avalanche",e.MULTICHAIN="multichain",e.AXELAR="axelar",e.ACROSS="across",e.STARGATE="stargate",e.RELAY="relay",e.MAYAN="mayan"}(r||(s.BridgeId=r={})),function(e){e.START_POLLING_FOR_BRIDGE_TX_STATUS="startPollingForBridgeTxStatus",e.WIPE_BRIDGE_STATUS="wipeBridgeStatus",e.GET_STATE="getState",e.RESET_STATE="resetState",e.SUBMIT_TX="submitTx",e.RESTART_POLLING_FOR_FAILED_ATTEMPTS="restartPollingForFailedAttempts",e.GET_BRIDGE_HISTORY_ITEM_BY_TX_META_ID="getBridgeHistoryItemByTxMetaId"}(a||(s.BridgeStatusAction=a={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.shouldSkipFetchDueToFetchFailures=s.getStatusRequestWithSrcTxHash=s.fetchBridgeTxStatus=s.getStatusRequestDto=s.getBridgeStatusUrl=s.getClientIdHeader=void 0;const n=e("@metamask/superstruct"),r=e("./validators.cjs"),a=e("../constants.cjs");s.getClientIdHeader=e=>({"X-Client-Id":e});s.getBridgeStatusUrl=e=>`${e}/getTxStatus`;s.getStatusRequestDto=e=>{const{quote:t,...s}=e;return{...Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};s.fetchBridgeTxStatus=async(e,t,a,i)=>{const o=(0,s.getStatusRequestDto)(e),c=new URLSearchParams(o),d=`${(0,s.getBridgeStatusUrl)(i)}?${c.toString()}`,l=await a(d,{headers:(0,s.getClientIdHeader)(t)}),u=[];try{(0,r.validateBridgeStatusResponse)(l)}catch(t){t instanceof n.StructError&&t.failures().forEach(({branch:t,path:s})=>{const n=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||l?.bridge||e.bridge||e.bridgeId||"unknown",r=s?.join(".")||"unknown";u.push([n,r].join("|"))})}return{status:l,validationFailures:u}};s.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:s,bridges:n,srcChainId:r,destChainId:a,refuel:i}=e;return{bridgeId:s,srcTxHash:t,bridge:n[0],srcChainId:r,destChainId:a,quote:e,refuel:Boolean(i)}};s.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=a.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.calcActualGasUsed=s.calculateGasFees=s.getTxGasEstimates=void 0;const n=e("@metamask/controller-utils"),r=e("bignumber.js");s.getTxGasEstimates=({txGasFeeEstimates:e,networkGasFeeEstimates:t})=>{const{estimatedBaseFee:s="0"}=t;return((e,t)=>{const{maxFeePerGas:s,maxPriorityFeePerGas:n}=e?.high??{};return{baseAndPriorityFeePerGas:n?new r.BigNumber(t,10).times(10**9).plus(n,16):undefined,maxFeePerGas:s,maxPriorityFeePerGas:n}})(e,s)};s.calculateGasFees=async(e,t,r,{chainId:a,gasLimit:i,...o},c,d,l)=>{if(!e)return{};if(l)return{...l,gas:i?.toString()};const u={...o,gas:i?.toString(),data:o.data,to:o.to,value:o.value},{gasFeeEstimates:m}=t.call("GasFeeController:getState"),{estimates:h}=await r({transactionParams:u,chainId:d,networkClientId:c}),{maxFeePerGas:p,maxPriorityFeePerGas:f}=(0,s.getTxGasEstimates)({networkGasFeeEstimates:m,txGasFeeEstimates:h});return{maxFeePerGas:p,maxPriorityFeePerGas:f,gas:(0,n.toHex)(u.gas??0)}};const a=(e,t)=>e&&t?new r.BigNumber(e,16).times(new r.BigNumber(t,16)):null;s.calcActualGasUsed=({pricingData:e},t,s)=>{const n=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,i=a(t?.gasUsed,t?.effectiveGasPrice)?.plus(a(s?.gasUsed,s?.effectiveGasPrice)??0),o=i?.div(new r.BigNumber(10).pow(18)).toString(10);return i&&o?{amount:i.toString(10),usd:n?.multipliedBy(o).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs",{"./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./swap-received-amount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getEVMTxPropertiesFromTransactionMeta=s.getRequestMetadataFromHistory=s.getTradeDataFromHistory=s.getPreConfirmationPropertiesFromQuote=s.getPriceImpactFromQuote=s.getTradeDataFromQuote=s.getRequestParamFromHistory=s.getFinalizedTxProperties=s.getTxStatusesFromHistory=void 0;const n=e("@metamask/bridge-controller"),r=e("@metamask/transaction-controller"),a=e("bignumber.js"),i=e("./gas.cjs"),o=e("./swap-received-amount.cjs");s.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:s,quote:r})=>{const a=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING,i=e.destChain?.txHash?e.status:n.StatusTypes.PENDING,o=(0,n.formatChainIdToHex)(r.srcChainId),c=(0,n.isEthUsdt)(o,r.srcAsset.address),d=e.srcChain.txHash?n.StatusTypes.COMPLETE:undefined,l=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING;return{allowance_reset_transaction:c?d:undefined,approval_transaction:t||s?l:undefined,source_transaction:a,destination_transaction:e.status===n.StatusTypes.FAILED?n.StatusTypes.FAILED:i}};s.getFinalizedTxProperties=(e,t,s)=>{const n=s?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===r.TransactionType.swap?t?.time:e.completionTime,d=(0,i.calcActualGasUsed)(e,t?.txReceipt,s?.txReceipt),l=t?.type===r.TransactionType.swap?(0,o.getActualSwapReceivedAmount)(e,d,t):(0,o.getActualBridgeReceivedAmount)(e),u=e.pricingData?.quotedGasAmount&&d?.amount?new a.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new a.BigNumber(10).pow(18)).div(d.amount).toNumber():0,m=e.pricingData?.quotedReturnInUsd&&l?.usd?new a.BigNumber(e.pricingData.quotedReturnInUsd).div(l.usd).toNumber():0;return{actual_time_minutes:c&&n?(c-n)/6e4:0,usd_actual_return:Number(l?.usd??0),usd_actual_gas:d?.usd??0,quote_vs_execution_ratio:m,quoted_vs_used_gas_ratio:u}};s.getRequestParamFromHistory=e=>({chain_id_source:(0,n.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,n.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});s.getTradeDataFromQuote=e=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});s.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});s.getPreConfirmationPropertiesFromQuote=(e,t,r)=>{const{quote:a}=e;return{...(0,s.getPriceImpactFromQuote)(a),...(0,s.getTradeDataFromQuote)(e),chain_id_source:(0,n.formatChainIdToCaip)(a.srcChainId),token_symbol_source:a.srcAsset.symbol,chain_id_destination:(0,n.formatChainIdToCaip)(a.destChainId),token_symbol_destination:a.destAsset.symbol,is_hardware_wallet:r,swap_type:(0,n.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:n.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1}};s.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});s.getRequestMetadataFromHistory=(e,t)=>{const{quote:s,slippagePercentage:r,isStxEnabled:a}=e;return{slippage_limit:r,custom_slippage:(0,n.isCustomSlippage)(r),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,n.getSwapType)(s.srcChainId,s.destChainId),is_hardware_wallet:(0,n.isHardwareWallet)(t),stx_enabled:a??!1,security_warnings:[]}};s.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[r.TransactionStatus.failed,r.TransactionStatus.dropped,r.TransactionStatus.rejected].includes(e.status)?n.StatusTypes.FAILED:n.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,n.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,n.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:100,stx_enabled:!1,token_address_source:(0,n.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,n.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[r.TransactionType.swap,r.TransactionType.swapApproval].includes(e.type)?n.MetricsSwapType.SINGLE:n.MetricsSwapType.CROSSCHAIN,security_warnings:[],price_impact:0,usd_quoted_gas:0,gas_included:!1,gas_included_7702:!1,quoted_time_minutes:0,usd_quoted_return:0,provider:"",actual_time_minutes:0,quote_vs_execution_ratio:0,quoted_vs_used_gas_ratio:0,usd_actual_return:0,usd_actual_gas:0,action_type:n.MetricsActionType.SWAPBRIDGE_V1})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs",{uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createClientTransactionRequest=void 0;const n=e("uuid");s.createClientTransactionRequest=(e,t,s,r,a)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,n.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:s,accountId:r,...a&&{options:a}}}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getActualBridgeReceivedAmount=s.getActualSwapReceivedAmount=void 0;const n=e("@metamask/bridge-controller"),r=e("bignumber.js");s.getActualSwapReceivedAmount=(e,t,s)=>{const{pricingData:a}=e,i=e.quote.destTokenAmount;if(!s?.txReceipt)return null;const o=(0,n.isNativeAddress)(e.quote.destAsset.address)?((e,t,s)=>{const{preTxBalance:n,postTxBalance:a}=s;return n&&a&&n!==a?t&&a&&n?new r.BigNumber(a,16).minus(n,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new r.BigNumber(e.quote.destTokenAmount).div(new r.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,s):((e,t)=>{const{txReceipt:s}=t;if(!s?.logs||"0x0"===s.status)return null;const{account:n,quote:a}=e,i=s.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),s=e.address?.toLowerCase()===a.destAsset.address?.toLowerCase(),r=e.topics?.[2]&&(e.topics[2]===n||e.topics[2].match(n?.slice(2)));return t&&s&&r});return i?.data?new r.BigNumber(i.data,16).div(new r.BigNumber(10).pow(a.destAsset.decimals)):null})(e,s),c=a?.quotedReturnInUsd&&i?new r.BigNumber(a.quotedReturnInUsd).div(i).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:o,usd:o&&c?c.multipliedBy(o):null}};s.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:s,status:n}=e,a=s?.quotedReturnInUsd?new r.BigNumber(s.quotedReturnInUsd).div(t.destTokenAmount):null,i=n.destChain?.amount;return i&&a?{amount:i,usd:a.multipliedBy(i).toString(10)}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.findAndUpdateTransactionsInBatch=s.getAddTransactionBatchParams=s.toBatchTxParams=s.getClientRequest=s.handleMobileHardwareWalletDelay=s.handleApprovalDelay=s.handleNonEvmTxResponse=s.getTxMetaFields=s.getStatusRequestParams=s.generateActionId=void 0;const n=e("@metamask/bridge-controller"),r=e("@metamask/controller-utils"),a=e("@metamask/transaction-controller"),i=e("@metamask/utils"),o=e("uuid"),c=e("./gas.cjs"),d=e("./snaps.cjs"),l=e("../constants.cjs");s.generateActionId=()=>(Date.now()+Math.random()).toString();s.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)});s.getTxMetaFields=(e,t)=>{let s;try{s=(0,n.formatChainIdToHex)(e.quote.destChainId)}catch{s="0x1"}return{destinationChainId:s,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};s.handleNonEvmTxResponse=(e,t,r)=>{const i=r.address,c=r.metadata.snap?.id;let d;"string"==typeof e?d=e:e&&"object"==typeof e&&("transactionId"in e&&e.transactionId?d=e.transactionId:"result"in e&&e.result&&"object"==typeof e.result?d=e.result.signature||e.result.txid||e.result.hash||e.result.txHash:"signature"in e&&e.signature&&"string"==typeof e.signature&&(d=e.signature));const l=(0,n.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);let u;try{u=(0,n.formatChainIdToHex)(t.quote.srcChainId)}catch{u="0x1"}const m=(0,n.extractTradeData)(t.trade);return{...(0,s.getTxMetaFields)(t),time:Date.now(),id:d??(0,o.v4)(),chainId:u,networkClientId:c??u,txParams:{from:i,data:m},type:l?a.TransactionType.bridge:a.TransactionType.swap,status:a.TransactionStatus.submitted,hash:d,origin:c,isSolana:!0,isBridgeTx:l}};s.handleApprovalDelay=async e=>{if([n.ChainId.LINEA,n.ChainId.BASE].includes(e)){(0,i.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,l.APPROVAL_DELAY_MS));await e}};s.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};s.getClientRequest=(e,t,s)=>{const r=(0,n.formatChainIdToCaip)(t),a=(0,n.extractTradeData)(e),i=(0,n.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,d.createClientTransactionRequest)(s.metadata.snap?.id,a,r,s.id,i)};s.toBatchTxParams=(e,{chainId:t,gasLimit:s,...n},{maxFeePerGas:a,maxPriorityFeePerGas:i,gas:o})=>{const c={...n,data:n.data,to:n.to,value:n.value};return e?{...c,gas:(0,r.toHex)(o??0),maxFeePerGas:(0,r.toHex)(a??0),maxPriorityFeePerGas:(0,r.toHex)(i??0)}:c};s.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:r,resetApproval:i,trade:o,quoteResponse:{quote:{feeData:{txFee:d},gasIncluded:l,gasIncluded7702:u,gasSponsored:m},sentAmount:h,toTokenAmount:p},requireApproval:f=!1,estimateGasFeeFn:g})=>{const k=l||u;if(!e.call("AccountsController:getAccountByAddress",o.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,n.formatChainIdToHex)(o.chainId),_=e.call("NetworkController:findNetworkClientIdByChainId",w),b=!0!==u,y=[];if(i){const n=await(0,c.calculateGasFees)(b,e,g,i,_,w,k?d:undefined);y.push({type:t?a.TransactionType.bridgeApproval:a.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(b,i,n)})}if(r){const n=await(0,c.calculateGasFees)(b,e,g,r,_,w,k?d:undefined);y.push({type:t?a.TransactionType.bridgeApproval:a.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(b,r,n)})}const A=await(0,c.calculateGasFees)(b,e,g,o,_,w,k?d:undefined);y.push({type:t?a.TransactionType.bridge:a.TransactionType.swap,params:(0,s.toBatchTxParams)(b,o,A),assetsFiatValues:{sending:h?.valueInCurrency?.toString(),receiving:p?.valueInCurrency?.toString()}});return{disable7702:b,isGasFeeIncluded:Boolean(u),isGasFeeSponsored:Boolean(m),networkClientId:_,requireApproval:f,origin:"metamask",from:o.from,transactions:y}};s.findAndUpdateTransactionsInBatch=({messenger:e,updateTransactionFn:t,batchId:s,txDataByType:n})=>{const r=e.call("TransactionController:getState").transactions,i={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(n).forEach(([e,n])=>{const o=r.find(t=>{if(t.batchId!==s)return!1;if(Array.isArray(t.txParams.authorizationList)&&t.txParams.authorizationList.length>0||Boolean(t.delegationAddress)){if(e===a.TransactionType.swap&&t.type===a.TransactionType.batch)return!0;if(e===a.TransactionType.swapApproval&&t.txParams.data===n)return!0}return t.txParams.data===n});if(o){const s={...o,type:e};t(s,`Update tx type to ${e}`),i[[a.TransactionType.bridgeApproval,a.TransactionType.swapApproval].includes(e)?"approvalMeta":"tradeMeta"]=s}}),i}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateBridgeStatusResponse=s.StatusResponseSchema=void 0;const n=e("@metamask/bridge-controller"),r=e("@metamask/superstruct"),a=(0,r.number)(),i=(0,r.type)({}),o=(0,r.type)({chainId:a,txHash:(0,r.optional)((0,r.string)()),amount:(0,r.optional)((0,r.string)()),token:(0,r.optional)((0,r.union)([i,n.BridgeAssetSchema]))}),c=(0,r.type)({chainId:a,txHash:(0,r.optional)((0,r.string)()),amount:(0,r.optional)((0,r.string)()),token:(0,r.optional)((0,r.union)([i,n.BridgeAssetSchema]))}),d=(0,r.type)({});s.StatusResponseSchema=(0,r.type)({status:(0,r.enums)(Object.values(n.StatusTypes)),srcChain:o,destChain:(0,r.optional)(c),bridge:(0,r.optional)((0,r.string)()),isExpectedToken:(0,r.optional)((0,r.boolean)()),isUnrecognizedRouterAddress:(0,r.optional)((0,r.boolean)()),refuel:(0,r.optional)(d)});s.validateBridgeStatusResponse=e=>((0,r.assert)(e,s.StatusResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/assets.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","@ethersproject/bignumber":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/bignumber/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m,h,p,f,g,k,w,_,b,y,A,v,E,S,x,T,I=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.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.BridgeController=void 0;const j=e("@ethersproject/bignumber"),P=e("@ethersproject/contracts"),N=e("@ethersproject/providers"),D=e("@metamask/metamask-eth-abis"),O=e("@metamask/polling-controller"),M=e("./constants/bridge.cjs"),R=e("./constants/chains.cjs"),B=e("./constants/swaps.cjs"),L=e("./constants/traces.cjs"),F=e("./selectors.cjs"),U=e("./types.cjs"),G=e("./utils/assets.cjs"),H=e("./utils/balance.cjs"),q=e("./utils/bridge.cjs"),W=e("./utils/caip-formatters.cjs"),$=e("./utils/feature-flags.cjs"),V=e("./utils/fetch.cjs"),K=e("./utils/metrics/constants.cjs"),Y=e("./utils/metrics/properties.cjs"),z=e("./utils/quote.cjs"),Q=e("./utils/quote-fees.cjs"),J=e("./utils/snaps.cjs"),X={quoteRequest:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotes:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesInitialLoadTime:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLastFetched:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLoadingStatus:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quoteFetchError:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesRefreshCount:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetExchangeRates:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},minimumBalanceForRentExemptionInLamports:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0}};class Z extends((0,O.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,clientVersion:O,getLayer1GasFee:Z,fetchFn:ee,config:te,trackMetaMetricsFn:se,traceFn:ne}){super({name:M.BRIDGE_CONTROLLER_NAME,metadata:X,messenger:e,state:{...(0,q.getDefaultBridgeControllerState)(),...t}}),n.add(this),r.set(this,void 0),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),m.set(this,void 0),this._executePoll=async e=>{await C(this,w,"f").call(this,e)},this.updateBridgeQuoteRequestParams=async(e,t)=>{C(this,x,"f").call(this,e),this.resetState(K.AbortReason.QuoteRequestUpdated);const s={...M.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,...e};if(this.update(e=>{e.quoteRequest=s}),await C(this,f,"f").call(this,s).catch(e=>console.warn("Failed to fetch asset exchange rates",e)),(0,z.isValidQuoteRequest)(s)){I(this,a,Date.now(),"f");const r=(0,q.isNonEvmChainId)(s.srcChainId),i=r?undefined:C(this,n,"m",A).call(this,(0,W.formatChainIdToHex)(s.srcChainId))?.configuration;let o,c=Boolean(e.resetApproval);r?o=e.insufficientBal:i?.rpcUrl?.includes("tenderly")?o=!0:(this.update(e=>{e.quotesLoadingStatus=U.RequestStatus.LOADING}),c=await C(this,k,"f").call(this,s),o=e.insufficientBal??await C(this,g,"f").call(this,s)),this.setChainIntervalLength(),this.startPolling({updatedQuoteRequest:{...s,insufficientBal:o,resetApproval:c},context:t})}},this.fetchQuotes=async(e,t=null,s=null)=>{const r=(0,$.getBridgeFeatureFlags)(this.messenger),a=s?r.quoteRequestOverrides?.[s]:undefined,l=await C(this,k,"f").call(this,e),{quotes:u,validationFailures:p}=await(0,V.fetchBridgeQuotes)(a?{...e,...a,resetApproval:l}:{...e,resetApproval:l},t,C(this,i,"f"),C(this,d,"f"),C(this,m,"f").customBridgeApiBaseUrl??M.BRIDGE_PROD_API_BASE_URL,s,C(this,o,"f"));C(this,h,"f").call(this,p);const f=await(0,Q.appendFeesToQuotes)(u,this.messenger,C(this,c,"f"),C(this,n,"m",y).call(this,e.walletAddress));return(0,z.sortQuotes)(f,s)},h.set(this,e=>{0!==e.length&&this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesValidationFailed,{failures:e})}),p.set(this,()=>({...this.messenger.call("MultichainAssetsRatesController:getState"),...this.messenger.call("CurrencyRateController:getState"),...this.messenger.call("TokenRatesController:getState"),...this.state})),f.set(this,async({srcChainId:e,srcTokenAddress:t,destChainId:s,destTokenAddress:n})=>{const a=new Set([]),c=C(this,p,"f").call(this);t&&e&&!(0,F.selectIsAssetExchangeRateInState)(c,e,t)&&(0,G.getAssetIdsForToken)(t,e).forEach(e=>a.add(e)),n&&s&&!(0,F.selectIsAssetExchangeRateInState)(c,s,n)&&(0,G.getAssetIdsForToken)(n,s).forEach(e=>a.add(e));const l=this.messenger.call("CurrencyRateController:getState").currentCurrency;if(0===a.size)return;const u=await(0,V.fetchAssetPrices)({assetIds:a,currencies:new Set([l]),clientId:C(this,i,"f"),clientVersion:C(this,o,"f"),fetchFn:C(this,d,"f"),signal:C(this,r,"f")?.signal}),m=(0,G.toExchangeRates)(l,u);this.update(e=>{e.assetExchangeRates={...e.assetExchangeRates,...m}})}),g.set(this,async e=>{try{const t=(0,W.formatChainIdToHex)(e.srcChainId),s=C(this,n,"m",A).call(this,t)?.provider,r=(0,W.formatAddressToCaipReference)(e.srcTokenAddress);return!(s&&r&&e.srcTokenAmount&&t&&await(0,H.hasSufficientBalance)(s,e.walletAddress,r,e.srcTokenAmount,t))}catch(e){return console.warn("Failed to set insufficientBal",e),!0}}),k.set(this,async e=>{if((0,q.isNonEvmChainId)(e.srcChainId))return!1;try{const t=(0,W.formatAddressToCaipReference)(e.srcTokenAddress);if((0,q.isEthUsdt)(e.srcChainId,t)){const s=j.BigNumber.from(await C(this,T,"f").call(this,e.walletAddress,t,e.destChainId));return s.lt(e.srcTokenAmount)&&s.gt(0)}return!1}catch(e){return console.warn("Failed to set resetApproval",e),!0}}),this.stopPollingForQuotes=(e,t)=>{this.stopAllPolling(),this.state.quotesLoadingStatus===U.RequestStatus.LOADING&&t&&this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesReceived,t),C(this,r,"f")?.abort(e)},this.resetState=(e=K.AbortReason.ResetState)=>{this.stopPollingForQuotes(e),this.update(e=>{e.quoteRequest=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,e.quotesInitialLoadTime=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesInitialLoadTime,e.quotes=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,e.quotesLastFetched=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLastFetched,e.quotesLoadingStatus=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLoadingStatus,e.quoteFetchError=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,e.quotesRefreshCount=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount,e.assetExchangeRates=M.DEFAULT_BRIDGE_CONTROLLER_STATE.assetExchangeRates,e.minimumBalanceForRentExemptionInLamports=M.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports})},this.setChainIntervalLength=()=>{const{state:e}=this,{srcChainId:t}=e.quoteRequest,s=(0,$.getBridgeFeatureFlags)(this.messenger),n=t?s.chains[(0,W.formatChainIdToCaip)(t)]?.refreshRate:undefined,r=s.refreshRate;this.setIntervalLength(n??r)},w.set(this,async({updatedQuoteRequest:e,context:t})=>{C(this,r,"f")?.abort("New quote request"),I(this,r,new AbortController,"f"),this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesRequested,t);const{sse:s,maxRefreshCount:i}=(0,$.getBridgeFeatureFlags)(this.messenger),c=s?.enabled&&(0,$.hasMinimumRequiredVersion)(C(this,o,"f"),s.minimumVersion);this.update(t=>{t.quoteRequest=e,t.quoteFetchError=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,t.quotesLastFetched=Date.now(),t.quotesLoadingStatus=U.RequestStatus.LOADING});try{await C(this,u,"f").call(this,{name:(0,q.isCrossChain)(e.srcChainId,e.destChainId)?L.TraceName.BridgeQuotesFetched:L.TraceName.SwapQuotesFetched,data:{srcChainId:(0,W.formatChainIdToCaip)(e.srcChainId),destChainId:(0,W.formatChainIdToCaip)(e.destChainId)}},async()=>{const t=C(this,n,"m",y).call(this,e.walletAddress);if(C(this,b,"f").call(this,e.srcChainId,t?.metadata?.snap?.id),c)return void await C(this,_,"f").call(this,e,t);const s=await this.fetchQuotes(e,C(this,r,"f")?.signal);this.update(e=>{e.quotesRefreshCount===M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount&&C(this,a,"f")&&(e.quotesInitialLoadTime=Date.now()-C(this,a,"f")),e.quotes=s,e.quotesLoadingStatus=U.RequestStatus.FETCHED})})}catch(e){if(this.update(e=>{e.quotes=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes}),e.toString().includes("AbortError")||e.toString().includes("FetchRequestCanceledException")||[K.AbortReason.ResetState,K.AbortReason.NewQuoteRequest,K.AbortReason.QuoteRequestUpdated,K.AbortReason.TransactionSubmitted].includes(e))return;this.update(t=>{let s;try{s=e?.message??e.toString()}catch{}finally{t.quoteFetchError=s??"Unknown error"}t.quotesLoadingStatus=U.RequestStatus.ERROR}),this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesError,t),console.log(`Failed to ${c?"stream":"fetch"} bridge quotes`,e)}this.update(e=>{e.quotesRefreshCount+=1}),(e.insufficientBal||!e.insufficientBal&&this.state.quotesRefreshCount>=i)&&this.stopAllPolling()}),_.set(this,async(e,t)=>{let s=0;const n=new Set;await(0,V.fetchBridgeQuoteStream)(C(this,d,"f"),e,C(this,r,"f")?.signal,C(this,i,"f"),C(this,m,"f").customBridgeApiBaseUrl??M.BRIDGE_PROD_API_BASE_URL,{onValidationFailure:C(this,h,"f"),onValidQuoteReceived:async e=>{const r=(async()=>{const n=await(0,Q.appendFeesToQuotes)([e],this.messenger,C(this,c,"f"),t);n.length>0&&(s+=1),this.update(e=>{1===s&&(e.quotes=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,!e.quotesInitialLoadTime&&C(this,a,"f")&&(e.quotesInitialLoadTime=Date.now()-C(this,a,"f"))),e.quotes=[...e.quotes,...n]})})();n.add(r),r.catch(e=>{console.error("Error appending fees to quote",e)}).finally(()=>{n.delete(r)}),await r},onClose:async()=>{await Promise.allSettled(Array.from(n)),this.update(e=>{0===s&&(e.quotes=M.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes),e.quotesLoadingStatus=U.RequestStatus.FETCHED})}},C(this,o,"f"))}),b.set(this,async(e,t)=>{if(!(0,q.isSolanaChainId)(e)||!t)return;const s=await(0,J.getMinimumBalanceForRentExemptionInLamports)(t,this.messenger);this.update(e=>{e.minimumBalanceForRentExemptionInLamports=s})}),v.set(this,()=>({slippage_limit:this.state.quoteRequest.slippage,swap_type:(0,Y.getSwapTypeFromQuote)(this.state.quoteRequest),custom_slippage:(0,Y.isCustomSlippage)(this.state.quoteRequest.slippage)})),E.set(this,()=>({quotes_count:this.state.quotes.length,quotes_list:this.state.quotes.map(({quote:e})=>(0,Y.formatProviderLabel)(e)),initial_load_time_all_quotes:this.state.quotesInitialLoadTime??0})),S.set(this,(e,t)=>{const s={...t,action_type:K.MetricsActionType.SWAPBRIDGE_V1};switch(e){case K.UnifiedSwapBridgeEventName.ButtonClicked:case K.UnifiedSwapBridgeEventName.PageViewed:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...s};case K.UnifiedSwapBridgeEventName.QuotesValidationFailed:return{...(0,Y.getRequestParams)(this.state.quoteRequest),refresh_count:this.state.quotesRefreshCount,...s};case K.UnifiedSwapBridgeEventName.QuotesReceived:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...C(this,v,"f").call(this),...C(this,E,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(C(this,n,"m",y).call(this)),refresh_count:this.state.quotesRefreshCount,...s};case K.UnifiedSwapBridgeEventName.QuotesRequested:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...C(this,v,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(C(this,n,"m",y).call(this)),has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...s};case K.UnifiedSwapBridgeEventName.QuotesError:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...C(this,v,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(C(this,n,"m",y).call(this)),error_message:this.state.quoteFetchError,has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...s};case K.UnifiedSwapBridgeEventName.AllQuotesOpened:case K.UnifiedSwapBridgeEventName.AllQuotesSorted:case K.UnifiedSwapBridgeEventName.QuoteSelected:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...C(this,v,"f").call(this),...C(this,E,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(C(this,n,"m",y).call(this)),...s};case K.UnifiedSwapBridgeEventName.Failed:return{...s,...(0,Y.getRequestParams)(this.state.quoteRequest),...C(this,v,"f").call(this),...C(this,E,"f").call(this),...t};case K.UnifiedSwapBridgeEventName.AssetDetailTooltipClicked:return s;case K.UnifiedSwapBridgeEventName.Submitted:case K.UnifiedSwapBridgeEventName.Completed:return t;case K.UnifiedSwapBridgeEventName.InputChanged:default:return s}}),x.set(this,e=>{Object.entries(e).forEach(([t,s])=>{const n=Y.toInputChangedPropertyKey[t],r=Y.toInputChangedPropertyValue[t]?.(e);n&&r!==undefined&&s!==this.state.quoteRequest[t]&&this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.InputChanged,{input:n,input_value:r})})}),this.trackUnifiedSwapBridgeEvent=(e,t)=>{try{const s=C(this,S,"f").call(this,e,t);C(this,l,"f").call(this,e,s)}catch(t){console.error(`Error tracking cross-chain swaps MetaMetrics event ${e}`,t)}},T.set(this,async(e,t,s)=>{const r=C(this,n,"m",A).call(this,R.CHAIN_IDS.MAINNET),a=r?.provider;if(!a)throw new Error("No provider found");const i=new N.Web3Provider(a),o=new P.Contract(t,D.abiERC20,i),c=(0,q.isCrossChain)(R.CHAIN_IDS.MAINNET,s)?M.METABRIDGE_ETHEREUM_ADDRESS:B.SWAPS_CONTRACT_ADDRESSES[R.CHAIN_IDS.MAINNET];return(await o.allowance(e,c)).toString()}),this.setIntervalLength(M.REFRESH_INTERVAL_MS),I(this,r,new AbortController,"f"),I(this,c,Z,"f"),I(this,i,s,"f"),I(this,o,O,"f"),I(this,d,ee,"f"),I(this,l,se,"f"),I(this,m,te??{},"f"),I(this,u,ne??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${M.BRIDGE_CONTROLLER_NAME}:setChainIntervalLength`,this.setChainIntervalLength.bind(this)),this.messenger.registerActionHandler(`${M.BRIDGE_CONTROLLER_NAME}:updateBridgeQuoteRequestParams`,this.updateBridgeQuoteRequestParams.bind(this)),this.messenger.registerActionHandler(`${M.BRIDGE_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${M.BRIDGE_CONTROLLER_NAME}:trackUnifiedSwapBridgeEvent`,this.trackUnifiedSwapBridgeEvent.bind(this)),this.messenger.registerActionHandler(`${M.BRIDGE_CONTROLLER_NAME}:stopPollingForQuotes`,this.stopPollingForQuotes.bind(this)),this.messenger.registerActionHandler(`${M.BRIDGE_CONTROLLER_NAME}:fetchQuotes`,this.fetchQuotes.bind(this))}}s.BridgeController=Z,r=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,k=new WeakMap,w=new WeakMap,_=new WeakMap,b=new WeakMap,v=new WeakMap,E=new WeakMap,S=new WeakMap,x=new WeakMap,T=new WeakMap,n=new WeakSet,y=function(e){const t=e??this.state.quoteRequest.walletAddress;if(!t)throw new Error("Account address is required");return this.messenger.call("AccountsController:getAccountByAddress",t)},A=function(e){const t=this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);if(!t)throw new Error(`No network client found for chainId: ${e}`);return this.messenger.call("NetworkController:getNetworkClientById",t)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.METABRIDGE_CHAIN_TO_ADDRESS_MAP=s.DEFAULT_BRIDGE_CONTROLLER_STATE=s.DEFAULT_FEATURE_FLAG_CONFIG=s.BRIDGE_CONTROLLER_NAME=s.DEFAULT_MAX_REFRESH_COUNT=s.REFRESH_INTERVAL_MS=s.BRIDGE_MM_FEE_RATE=s.BRIDGE_PREFERRED_GAS_ESTIMATE=s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=s.BRIDGE_QUOTE_MAX_ETA_SECONDS=s.METABRIDGE_ETHEREUM_ADDRESS=s.ETH_USDT_ADDRESS=s.BridgeClientId=s.BRIDGE_PROD_API_BASE_URL=s.BRIDGE_DEV_API_BASE_URL=s.ALLOWED_BRIDGE_CHAIN_IDS=void 0;const n=e("@ethersproject/constants"),r=e("@metamask/keyring-api"),a=e("./chains.cjs");var i;s.ALLOWED_BRIDGE_CHAIN_IDS=[a.CHAIN_IDS.MAINNET,a.CHAIN_IDS.BSC,a.CHAIN_IDS.POLYGON,a.CHAIN_IDS.ZKSYNC_ERA,a.CHAIN_IDS.AVALANCHE,a.CHAIN_IDS.OPTIMISM,a.CHAIN_IDS.ARBITRUM,a.CHAIN_IDS.LINEA_MAINNET,a.CHAIN_IDS.BASE,a.CHAIN_IDS.SEI,a.CHAIN_IDS.MONAD,r.SolScope.Mainnet,r.BtcScope.Mainnet,r.TrxScope.Mainnet],s.BRIDGE_DEV_API_BASE_URL="https://bridge.dev-api.cx.metamask.io",s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(i||(s.BridgeClientId=i={})),s.ETH_USDT_ADDRESS="0xdac17f958d2ee523a2206206994597c13d831ec7",s.METABRIDGE_ETHEREUM_ADDRESS="0x0439e60F02a8900a951603950d8D4527f400C3f1",s.BRIDGE_QUOTE_MAX_ETA_SECONDS=3600,s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=.5,s.BRIDGE_PREFERRED_GAS_ESTIMATE="medium",s.BRIDGE_MM_FEE_RATE=.875,s.REFRESH_INTERVAL_MS=3e4,s.DEFAULT_MAX_REFRESH_COUNT=5,s.BRIDGE_CONTROLLER_NAME="BridgeController",s.DEFAULT_FEATURE_FLAG_CONFIG={minimumVersion:"0.0.0",refreshRate:s.REFRESH_INTERVAL_MS,maxRefreshCount:s.DEFAULT_MAX_REFRESH_COUNT,support:!1,chains:{}},s.DEFAULT_BRIDGE_CONTROLLER_STATE={quoteRequest:{srcTokenAddress:n.AddressZero},quotesInitialLoadTime:null,quotes:[],quotesLastFetched:null,quotesLoadingStatus:null,quoteFetchError:null,quotesRefreshCount:0,assetExchangeRates:{},minimumBalanceForRentExemptionInLamports:"0"},s.METABRIDGE_CHAIN_TO_ADDRESS_MAP={[a.CHAIN_IDS.MAINNET]:s.METABRIDGE_ETHEREUM_ADDRESS}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.NETWORK_TO_NAME_MAP=s.MONAD_DISPLAY_NAME=s.SEI_DISPLAY_NAME=s.MODE_DISPLAY_NAME=s.MODE_SEPOLIA_DISPLAY_NAME=s.SONEIUM_DISPLAY_NAME=s.INK_DISPLAY_NAME=s.INK_SEPOLIA_DISPLAY_NAME=s.LISK_SEPOLIA_DISPLAY_NAME=s.LISK_DISPLAY_NAME=s.METACHAIN_ONE_DISPLAY_NAME=s.BERACHAIN_DISPLAY_NAME=s.OP_BNB_DISPLAY_NAME=s.SCROLL_SEPOLIA_DISPLAY_NAME=s.SCROLL_DISPLAY_NAME=s.MOONRIVER_DISPLAY_NAME=s.MOONBEAM_DISPLAY_NAME=s.POLYGON_ZKEVM_DISPLAY_NAME=s.CRONOS_DISPLAY_NAME=s.AURORA_DISPLAY_NAME=s.BASE_DISPLAY_NAME=s.ZK_SYNC_ERA_DISPLAY_NAME=s.GNOSIS_DISPLAY_NAME=s.CELO_DISPLAY_NAME=s.PALM_DISPLAY_NAME=s.HARMONY_DISPLAY_NAME=s.FANTOM_DISPLAY_NAME=s.OPTIMISM_DISPLAY_NAME=s.BNB_DISPLAY_NAME=s.ARBITRUM_DISPLAY_NAME=s.AVALANCHE_DISPLAY_NAME=s.POLYGON_DISPLAY_NAME=s.BSC_DISPLAY_NAME=s.LOCALHOST_DISPLAY_NAME=s.LINEA_MAINNET_DISPLAY_NAME=s.LINEA_SEPOLIA_DISPLAY_NAME=s.LINEA_GOERLI_DISPLAY_NAME=s.SEPOLIA_DISPLAY_NAME=s.GOERLI_DISPLAY_NAME=s.MAINNET_DISPLAY_NAME=s.NETWORK_TYPES=s.CHAIN_IDS=void 0,s.CHAIN_IDS={MAINNET:"0x1",GOERLI:"0x5",LOCALHOST:"0x539",BSC:"0x38",BSC_TESTNET:"0x61",OPTIMISM:"0xa",OPTIMISM_TESTNET:"0xaa37dc",OPTIMISM_GOERLI:"0x1a4",BASE:"0x2105",BASE_TESTNET:"0x14a33",OPBNB:"0xcc",OPBNB_TESTNET:"0x15eb",POLYGON:"0x89",POLYGON_TESTNET:"0x13881",AVALANCHE:"0xa86a",AVALANCHE_TESTNET:"0xa869",FANTOM:"0xfa",FANTOM_TESTNET:"0xfa2",CELO:"0xa4ec",ARBITRUM:"0xa4b1",HARMONY:"0x63564c40",PALM:"0x2a15c308d",SEPOLIA:"0xaa36a7",HOLESKY:"0x4268",LINEA_GOERLI:"0xe704",LINEA_SEPOLIA:"0xe705",AMOY:"0x13882",BASE_SEPOLIA:"0x14a34",BLAST_SEPOLIA:"0xa0c71fd",OPTIMISM_SEPOLIA:"0xaa37dc",PALM_TESTNET:"0x2a15c3083",CELO_TESTNET:"0xaef3",ZK_SYNC_ERA_TESTNET:"0x12c",MANTA_SEPOLIA:"0x138b",UNICHAIN_SEPOLIA:"0x515",LINEA_MAINNET:"0xe708",AURORA:"0x4e454152",MOONBEAM:"0x504",MOONBEAM_TESTNET:"0x507",MOONRIVER:"0x505",CRONOS:"0x19",GNOSIS:"0x64",ZKSYNC_ERA:"0x144",TEST_ETH:"0x539",ARBITRUM_GOERLI:"0x66eed",BLAST:"0x13e31",FILECOIN:"0x13a",POLYGON_ZKEVM:"0x44d",SCROLL:"0x82750",SCROLL_SEPOLIA:"0x8274f",WETHIO:"0x4e",CHZ:"0x15b38",NUMBERS:"0x290b",SEI:"0x531",APE_TESTNET:"0x8157",APE_MAINNET:"0x8173",BERACHAIN:"0x138d5",METACHAIN_ONE:"0x1b6e6",ARBITRUM_SEPOLIA:"0x66eee",NEAR:"0x18d",NEAR_TESTNET:"0x18e",B3:"0x208d",B3_TESTNET:"0x7c9",GRAVITY_ALPHA_MAINNET:"0x659",GRAVITY_ALPHA_TESTNET_SEPOLIA:"0x34c1",LISK:"0x46f",LISK_SEPOLIA:"0x106a",INK_SEPOLIA:"0xba5eD",INK:"0xdef1",MODE_SEPOLIA:"0x397",MODE:"0x868b",MONAD:"0x8f"},s.NETWORK_TYPES={GOERLI:"goerli",LOCALHOST:"localhost",MAINNET:"mainnet",SEPOLIA:"sepolia",LINEA_GOERLI:"linea-goerli",LINEA_SEPOLIA:"linea-sepolia",LINEA_MAINNET:"linea-mainnet"},s.MAINNET_DISPLAY_NAME="Ethereum Mainnet",s.GOERLI_DISPLAY_NAME="Goerli",s.SEPOLIA_DISPLAY_NAME="Sepolia",s.LINEA_GOERLI_DISPLAY_NAME="Linea Goerli",s.LINEA_SEPOLIA_DISPLAY_NAME="Linea Sepolia",s.LINEA_MAINNET_DISPLAY_NAME="Linea Mainnet",s.LOCALHOST_DISPLAY_NAME="Localhost 8545",s.BSC_DISPLAY_NAME="Binance Smart Chain",s.POLYGON_DISPLAY_NAME="Polygon",s.AVALANCHE_DISPLAY_NAME="Avalanche Network C-Chain",s.ARBITRUM_DISPLAY_NAME="Arbitrum One",s.BNB_DISPLAY_NAME="BNB Chain",s.OPTIMISM_DISPLAY_NAME="OP Mainnet",s.FANTOM_DISPLAY_NAME="Fantom Opera",s.HARMONY_DISPLAY_NAME="Harmony Mainnet Shard 0",s.PALM_DISPLAY_NAME="Palm",s.CELO_DISPLAY_NAME="Celo Mainnet",s.GNOSIS_DISPLAY_NAME="Gnosis",s.ZK_SYNC_ERA_DISPLAY_NAME="zkSync Era Mainnet",s.BASE_DISPLAY_NAME="Base Mainnet",s.AURORA_DISPLAY_NAME="Aurora Mainnet",s.CRONOS_DISPLAY_NAME="Cronos",s.POLYGON_ZKEVM_DISPLAY_NAME="Polygon zkEVM",s.MOONBEAM_DISPLAY_NAME="Moonbeam",s.MOONRIVER_DISPLAY_NAME="Moonriver",s.SCROLL_DISPLAY_NAME="Scroll",s.SCROLL_SEPOLIA_DISPLAY_NAME="Scroll Sepolia",s.OP_BNB_DISPLAY_NAME="opBNB",s.BERACHAIN_DISPLAY_NAME="Berachain Artio",s.METACHAIN_ONE_DISPLAY_NAME="Metachain One Mainnet",s.LISK_DISPLAY_NAME="Lisk",s.LISK_SEPOLIA_DISPLAY_NAME="Lisk Sepolia",s.INK_SEPOLIA_DISPLAY_NAME="Ink Sepolia",s.INK_DISPLAY_NAME="Ink Mainnet",s.SONEIUM_DISPLAY_NAME="Soneium Mainnet",s.MODE_SEPOLIA_DISPLAY_NAME="Mode Sepolia",s.MODE_DISPLAY_NAME="Mode Mainnet",s.SEI_DISPLAY_NAME="Sei Network",s.MONAD_DISPLAY_NAME="Monad",s.NETWORK_TO_NAME_MAP={[s.NETWORK_TYPES.GOERLI]:s.GOERLI_DISPLAY_NAME,[s.NETWORK_TYPES.MAINNET]:s.MAINNET_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_GOERLI]:s.LINEA_GOERLI_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_SEPOLIA]:s.LINEA_SEPOLIA_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_MAINNET]:s.LINEA_MAINNET_DISPLAY_NAME,[s.NETWORK_TYPES.LOCALHOST]:s.LOCALHOST_DISPLAY_NAME,[s.NETWORK_TYPES.SEPOLIA]:s.SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.ARBITRUM]:s.ARBITRUM_DISPLAY_NAME,[s.CHAIN_IDS.AVALANCHE]:s.AVALANCHE_DISPLAY_NAME,[s.CHAIN_IDS.BSC]:s.BSC_DISPLAY_NAME,[s.CHAIN_IDS.BASE]:s.BASE_DISPLAY_NAME,[s.CHAIN_IDS.GOERLI]:s.GOERLI_DISPLAY_NAME,[s.CHAIN_IDS.MAINNET]:s.MAINNET_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_GOERLI]:s.LINEA_GOERLI_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_MAINNET]:s.LINEA_MAINNET_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_SEPOLIA]:s.LINEA_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.LOCALHOST]:s.LOCALHOST_DISPLAY_NAME,[s.CHAIN_IDS.OPTIMISM]:s.OPTIMISM_DISPLAY_NAME,[s.CHAIN_IDS.POLYGON]:s.POLYGON_DISPLAY_NAME,[s.CHAIN_IDS.SCROLL]:s.SCROLL_DISPLAY_NAME,[s.CHAIN_IDS.SCROLL_SEPOLIA]:s.SCROLL_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.SEPOLIA]:s.SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.OPBNB]:s.OP_BNB_DISPLAY_NAME,[s.CHAIN_IDS.ZKSYNC_ERA]:s.ZK_SYNC_ERA_DISPLAY_NAME,[s.CHAIN_IDS.BERACHAIN]:s.BERACHAIN_DISPLAY_NAME,[s.CHAIN_IDS.METACHAIN_ONE]:s.METACHAIN_ONE_DISPLAY_NAME,[s.CHAIN_IDS.LISK]:s.LISK_DISPLAY_NAME,[s.CHAIN_IDS.LISK_SEPOLIA]:s.LISK_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.SEI]:s.SEI_DISPLAY_NAME,[s.CHAIN_IDS.MONAD]:s.MONAD_DISPLAY_NAME}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ALLOWED_CONTRACT_ADDRESSES=s.SWAPS_WRAPPED_TOKENS_ADDRESSES=s.SWAPS_CONTRACT_ADDRESSES=s.SWAPS_API_V2_BASE_URL=void 0;const n=e("./chains.cjs");s.SWAPS_API_V2_BASE_URL="https://swap.api.cx.metamask.io";const r="0x881d40237659c251811cec9c364ef91dc08d300c";s.SWAPS_CONTRACT_ADDRESSES={[n.CHAIN_IDS.MAINNET]:r,[n.CHAIN_IDS.LOCALHOST]:r,[n.CHAIN_IDS.BSC]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.POLYGON]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.AVALANCHE]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.ARBITRUM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.OPTIMISM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.ZKSYNC_ERA]:"0xf504c1fe13d14df615e66dcd0abf39e60c697f34",[n.CHAIN_IDS.LINEA_MAINNET]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.BASE]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.SEI]:"0x962287c9d5B8a682389E61edAE90ec882325d08b"};const a="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";s.SWAPS_WRAPPED_TOKENS_ADDRESSES={[n.CHAIN_IDS.MAINNET]:a,[n.CHAIN_IDS.LOCALHOST]:a,[n.CHAIN_IDS.BSC]:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",[n.CHAIN_IDS.POLYGON]:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",[n.CHAIN_IDS.AVALANCHE]:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",[n.CHAIN_IDS.ARBITRUM]:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",[n.CHAIN_IDS.OPTIMISM]:"0x4200000000000000000000000000000000000006",[n.CHAIN_IDS.ZKSYNC_ERA]:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",[n.CHAIN_IDS.LINEA_MAINNET]:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",[n.CHAIN_IDS.BASE]:"0x4200000000000000000000000000000000000006",[n.CHAIN_IDS.SEI]:"0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7"},s.ALLOWED_CONTRACT_ADDRESSES={[n.CHAIN_IDS.MAINNET]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.MAINNET],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.MAINNET]],[n.CHAIN_IDS.LOCALHOST]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.LOCALHOST],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.LOCALHOST]],[n.CHAIN_IDS.BSC]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.BSC],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.BSC]],[n.CHAIN_IDS.POLYGON]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.POLYGON],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.POLYGON]],[n.CHAIN_IDS.AVALANCHE]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.AVALANCHE],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.AVALANCHE]],[n.CHAIN_IDS.ARBITRUM]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.ARBITRUM],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.ARBITRUM]],[n.CHAIN_IDS.OPTIMISM]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.OPTIMISM],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.OPTIMISM]],[n.CHAIN_IDS.ZKSYNC_ERA]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.ZKSYNC_ERA],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.ZKSYNC_ERA]],[n.CHAIN_IDS.LINEA_MAINNET]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.LINEA_MAINNET],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.LINEA_MAINNET]],[n.CHAIN_IDS.BASE]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.BASE],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.BASE]],[n.CHAIN_IDS.SEI]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.SEI],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.SEI]]}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SYMBOL_TO_SLIP44_MAP=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.DEFAULT_TOKEN_ADDRESS=void 0;const n=e("@metamask/keyring-api"),r=e("./chains.cjs");s.DEFAULT_TOKEN_ADDRESS="0x0000000000000000000000000000000000000000";const a="AVAX",i="BNB",o="ETH",c="POL",d="TESTETH",l="SOL",u="SEI",m="BTC",h="TRX",p="MON",f={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},g={symbol:i,name:"Binance Coin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},k={symbol:c,name:"Polygon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},w={symbol:a,name:"Avalanche",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},_={symbol:d,name:"Test Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},b={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},y={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},A={...f},v={...f},E={...f},S={...f},x={...f},T={symbol:l,name:"Solana",address:s.DEFAULT_TOKEN_ADDRESS,decimals:9,iconUrl:""},I={symbol:m,name:"Bitcoin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:8,iconUrl:""},C={symbol:u,name:"Sei",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},j={symbol:h,name:"Tron",address:s.DEFAULT_TOKEN_ADDRESS,decimals:6,iconUrl:""},P={symbol:p,name:"Mon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""};s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP={[r.CHAIN_IDS.MAINNET]:f,[r.CHAIN_IDS.LOCALHOST]:_,[r.CHAIN_IDS.BSC]:g,[r.CHAIN_IDS.POLYGON]:k,[r.CHAIN_IDS.GOERLI]:b,[r.CHAIN_IDS.SEPOLIA]:y,[r.CHAIN_IDS.AVALANCHE]:w,[r.CHAIN_IDS.OPTIMISM]:v,[r.CHAIN_IDS.ARBITRUM]:A,[r.CHAIN_IDS.ZKSYNC_ERA]:E,[r.CHAIN_IDS.LINEA_MAINNET]:S,[r.CHAIN_IDS.BASE]:x,[r.CHAIN_IDS.SEI]:C,[r.CHAIN_IDS.MONAD]:P,[n.SolScope.Mainnet]:T,[n.SolScope.Devnet]:T,[n.BtcScope.Mainnet]:I,[n.TrxScope.Mainnet]:j},s.SYMBOL_TO_SLIP44_MAP={SOL:"slip44:501",BTC:"slip44:0",ETH:"slip44:60",POL:"slip44:966",BNB:"slip44:714",AVAX:"slip44:9000",TESTETH:"slip44:60",SEI:"slip44:19000118",TRX:"slip44:195",MON:"slip44:268435779"}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=void 0,function(e){e.BridgeQuotesFetched="Bridge Quotes Fetched",e.SwapQuotesFetched="Swap Quotes Fetched"}(n||(s.TraceName=n={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs",{"./bridge-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs","./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs","./utils/trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./utils/validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isValidQuoteRequest=s.isCrossChain=s.getDefaultBridgeControllerState=s.getNativeAssetForChainId=s.isNonEvmChainId=s.isBitcoinChainId=s.isSolanaChainId=s.isNativeAddress=s.isEthUsdt=s.MetricsSwapType=s.MetricsActionType=s.ALLOWED_CONTRACT_ADDRESSES=s.SWAPS_WRAPPED_TOKENS_ADDRESSES=s.SWAPS_CONTRACT_ADDRESSES=s.SWAPS_API_V2_BASE_URL=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.BRIDGE_PROD_API_BASE_URL=s.BRIDGE_DEV_API_BASE_URL=s.METABRIDGE_CHAIN_TO_ADDRESS_MAP=s.DEFAULT_BRIDGE_CONTROLLER_STATE=s.DEFAULT_MAX_REFRESH_COUNT=s.REFRESH_INTERVAL_MS=s.BRIDGE_MM_FEE_RATE=s.BRIDGE_PREFERRED_GAS_ESTIMATE=s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=s.BRIDGE_QUOTE_MAX_ETA_SECONDS=s.BRIDGE_CONTROLLER_NAME=s.BridgeClientId=s.ALLOWED_BRIDGE_CHAIN_IDS=s.FeatureId=s.BridgeAssetSchema=s.ActionTypes=s.FeeType=s.BridgeBackgroundAction=s.BridgeUserAction=s.RequestStatus=s.ChainId=s.SortOrder=s.AssetType=s.StatusTypes=s.AbortReason=s.getQuotesReceivedProperties=s.isCustomSlippage=s.isHardwareWallet=s.getSwapType=s.getRequestParams=s.formatProviderLabel=s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=s.UnifiedSwapBridgeEventName=s.BridgeController=void 0,s.fetchTokens=s.getSwapsContractAddress=s.isValidSwapsContractAddress=s.BRIDGE_DEFAULT_SLIPPAGE=s.getBridgeFeatureFlags=s.DEFAULT_FEATURE_FLAG_CONFIG=s.selectMinimumBalanceForRentExemptionInSOL=s.selectBridgeFeatureFlags=s.selectIsQuoteExpired=s.selectExchangeRateByChainIdAndAddress=s.selectDefaultSlippagePercentage=s.selectBridgeQuotes=s.isEvmTxData=s.isTronTrade=s.isBitcoinTrade=s.extractTradeData=s.formatAddressToAssetId=s.formatAddressToCaipReference=s.formatChainIdToHex=s.formatChainIdToCaip=s.getClientHeaders=s.fetchBridgeTokens=s.calcLatestSrcBalance=s.calcSlippagePercentage=s.formatEtaInMinutes=void 0;var n=e("./bridge-controller.cjs");Object.defineProperty(s,"BridgeController",{enumerable:!0,get:function(){return n.BridgeController}});var r=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"UnifiedSwapBridgeEventName",{enumerable:!0,get:function(){return r.UnifiedSwapBridgeEventName}}),Object.defineProperty(s,"UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY",{enumerable:!0,get:function(){return r.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY}});var a=e("./utils/metrics/properties.cjs");Object.defineProperty(s,"formatProviderLabel",{enumerable:!0,get:function(){return a.formatProviderLabel}}),Object.defineProperty(s,"getRequestParams",{enumerable:!0,get:function(){return a.getRequestParams}}),Object.defineProperty(s,"getSwapType",{enumerable:!0,get:function(){return a.getSwapType}}),Object.defineProperty(s,"isHardwareWallet",{enumerable:!0,get:function(){return a.isHardwareWallet}}),Object.defineProperty(s,"isCustomSlippage",{enumerable:!0,get:function(){return a.isCustomSlippage}}),Object.defineProperty(s,"getQuotesReceivedProperties",{enumerable:!0,get:function(){return a.getQuotesReceivedProperties}});var i=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"AbortReason",{enumerable:!0,get:function(){return i.AbortReason}});var o=e("./types.cjs");Object.defineProperty(s,"StatusTypes",{enumerable:!0,get:function(){return o.StatusTypes}});var c=e("./types.cjs");Object.defineProperty(s,"AssetType",{enumerable:!0,get:function(){return c.AssetType}}),Object.defineProperty(s,"SortOrder",{enumerable:!0,get:function(){return c.SortOrder}}),Object.defineProperty(s,"ChainId",{enumerable:!0,get:function(){return c.ChainId}}),Object.defineProperty(s,"RequestStatus",{enumerable:!0,get:function(){return c.RequestStatus}}),Object.defineProperty(s,"BridgeUserAction",{enumerable:!0,get:function(){return c.BridgeUserAction}}),Object.defineProperty(s,"BridgeBackgroundAction",{enumerable:!0,get:function(){return c.BridgeBackgroundAction}});var d=e("./utils/validators.cjs");Object.defineProperty(s,"FeeType",{enumerable:!0,get:function(){return d.FeeType}}),Object.defineProperty(s,"ActionTypes",{enumerable:!0,get:function(){return d.ActionTypes}}),Object.defineProperty(s,"BridgeAssetSchema",{enumerable:!0,get:function(){return d.BridgeAssetSchema}}),Object.defineProperty(s,"FeatureId",{enumerable:!0,get:function(){return d.FeatureId}});var l=e("./constants/bridge.cjs");Object.defineProperty(s,"ALLOWED_BRIDGE_CHAIN_IDS",{enumerable:!0,get:function(){return l.ALLOWED_BRIDGE_CHAIN_IDS}}),Object.defineProperty(s,"BridgeClientId",{enumerable:!0,get:function(){return l.BridgeClientId}}),Object.defineProperty(s,"BRIDGE_CONTROLLER_NAME",{enumerable:!0,get:function(){return l.BRIDGE_CONTROLLER_NAME}}),Object.defineProperty(s,"BRIDGE_QUOTE_MAX_ETA_SECONDS",{enumerable:!0,get:function(){return l.BRIDGE_QUOTE_MAX_ETA_SECONDS}}),Object.defineProperty(s,"BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE",{enumerable:!0,get:function(){return l.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE}}),Object.defineProperty(s,"BRIDGE_PREFERRED_GAS_ESTIMATE",{enumerable:!0,get:function(){return l.BRIDGE_PREFERRED_GAS_ESTIMATE}}),Object.defineProperty(s,"BRIDGE_MM_FEE_RATE",{enumerable:!0,get:function(){return l.BRIDGE_MM_FEE_RATE}}),Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return l.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_MAX_REFRESH_COUNT",{enumerable:!0,get:function(){return l.DEFAULT_MAX_REFRESH_COUNT}}),Object.defineProperty(s,"DEFAULT_BRIDGE_CONTROLLER_STATE",{enumerable:!0,get:function(){return l.DEFAULT_BRIDGE_CONTROLLER_STATE}}),Object.defineProperty(s,"METABRIDGE_CHAIN_TO_ADDRESS_MAP",{enumerable:!0,get:function(){return l.METABRIDGE_CHAIN_TO_ADDRESS_MAP}}),Object.defineProperty(s,"BRIDGE_DEV_API_BASE_URL",{enumerable:!0,get:function(){return l.BRIDGE_DEV_API_BASE_URL}}),Object.defineProperty(s,"BRIDGE_PROD_API_BASE_URL",{enumerable:!0,get:function(){return l.BRIDGE_PROD_API_BASE_URL}});var u=e("./constants/tokens.cjs");Object.defineProperty(s,"SWAPS_CHAINID_DEFAULT_TOKEN_MAP",{enumerable:!0,get:function(){return u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP}});var m=e("./constants/swaps.cjs");Object.defineProperty(s,"SWAPS_API_V2_BASE_URL",{enumerable:!0,get:function(){return m.SWAPS_API_V2_BASE_URL}}),Object.defineProperty(s,"SWAPS_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return m.SWAPS_CONTRACT_ADDRESSES}}),Object.defineProperty(s,"SWAPS_WRAPPED_TOKENS_ADDRESSES",{enumerable:!0,get:function(){return m.SWAPS_WRAPPED_TOKENS_ADDRESSES}}),Object.defineProperty(s,"ALLOWED_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return m.ALLOWED_CONTRACT_ADDRESSES}});var h=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"MetricsActionType",{enumerable:!0,get:function(){return h.MetricsActionType}}),Object.defineProperty(s,"MetricsSwapType",{enumerable:!0,get:function(){return h.MetricsSwapType}});var p=e("./utils/bridge.cjs");Object.defineProperty(s,"isEthUsdt",{enumerable:!0,get:function(){return p.isEthUsdt}}),Object.defineProperty(s,"isNativeAddress",{enumerable:!0,get:function(){return p.isNativeAddress}}),Object.defineProperty(s,"isSolanaChainId",{enumerable:!0,get:function(){return p.isSolanaChainId}}),Object.defineProperty(s,"isBitcoinChainId",{enumerable:!0,get:function(){return p.isBitcoinChainId}}),Object.defineProperty(s,"isNonEvmChainId",{enumerable:!0,get:function(){return p.isNonEvmChainId}}),Object.defineProperty(s,"getNativeAssetForChainId",{enumerable:!0,get:function(){return p.getNativeAssetForChainId}}),Object.defineProperty(s,"getDefaultBridgeControllerState",{enumerable:!0,get:function(){return p.getDefaultBridgeControllerState}}),Object.defineProperty(s,"isCrossChain",{enumerable:!0,get:function(){return p.isCrossChain}});var f=e("./utils/quote.cjs");Object.defineProperty(s,"isValidQuoteRequest",{enumerable:!0,get:function(){return f.isValidQuoteRequest}}),Object.defineProperty(s,"formatEtaInMinutes",{enumerable:!0,get:function(){return f.formatEtaInMinutes}}),Object.defineProperty(s,"calcSlippagePercentage",{enumerable:!0,get:function(){return f.calcSlippagePercentage}});var g=e("./utils/balance.cjs");Object.defineProperty(s,"calcLatestSrcBalance",{enumerable:!0,get:function(){return g.calcLatestSrcBalance}});var k=e("./utils/fetch.cjs");Object.defineProperty(s,"fetchBridgeTokens",{enumerable:!0,get:function(){return k.fetchBridgeTokens}}),Object.defineProperty(s,"getClientHeaders",{enumerable:!0,get:function(){return k.getClientHeaders}});var w=e("./utils/caip-formatters.cjs");Object.defineProperty(s,"formatChainIdToCaip",{enumerable:!0,get:function(){return w.formatChainIdToCaip}}),Object.defineProperty(s,"formatChainIdToHex",{enumerable:!0,get:function(){return w.formatChainIdToHex}}),Object.defineProperty(s,"formatAddressToCaipReference",{enumerable:!0,get:function(){return w.formatAddressToCaipReference}}),Object.defineProperty(s,"formatAddressToAssetId",{enumerable:!0,get:function(){return w.formatAddressToAssetId}});var _=e("./utils/trade-utils.cjs");Object.defineProperty(s,"extractTradeData",{enumerable:!0,get:function(){return _.extractTradeData}}),Object.defineProperty(s,"isBitcoinTrade",{enumerable:!0,get:function(){return _.isBitcoinTrade}}),Object.defineProperty(s,"isTronTrade",{enumerable:!0,get:function(){return _.isTronTrade}}),Object.defineProperty(s,"isEvmTxData",{enumerable:!0,get:function(){return _.isEvmTxData}});var b=e("./selectors.cjs");Object.defineProperty(s,"selectBridgeQuotes",{enumerable:!0,get:function(){return b.selectBridgeQuotes}}),Object.defineProperty(s,"selectDefaultSlippagePercentage",{enumerable:!0,get:function(){return b.selectDefaultSlippagePercentage}}),Object.defineProperty(s,"selectExchangeRateByChainIdAndAddress",{enumerable:!0,get:function(){return b.selectExchangeRateByChainIdAndAddress}}),Object.defineProperty(s,"selectIsQuoteExpired",{enumerable:!0,get:function(){return b.selectIsQuoteExpired}}),Object.defineProperty(s,"selectBridgeFeatureFlags",{enumerable:!0,get:function(){return b.selectBridgeFeatureFlags}}),Object.defineProperty(s,"selectMinimumBalanceForRentExemptionInSOL",{enumerable:!0,get:function(){return b.selectMinimumBalanceForRentExemptionInSOL}});var y=e("./constants/bridge.cjs");Object.defineProperty(s,"DEFAULT_FEATURE_FLAG_CONFIG",{enumerable:!0,get:function(){return y.DEFAULT_FEATURE_FLAG_CONFIG}});var A=e("./utils/feature-flags.cjs");Object.defineProperty(s,"getBridgeFeatureFlags",{enumerable:!0,get:function(){return A.getBridgeFeatureFlags}});var v=e("./utils/slippage.cjs");Object.defineProperty(s,"BRIDGE_DEFAULT_SLIPPAGE",{enumerable:!0,get:function(){return v.BRIDGE_DEFAULT_SLIPPAGE}});var E=e("./utils/swaps.cjs");Object.defineProperty(s,"isValidSwapsContractAddress",{enumerable:!0,get:function(){return E.isValidSwapsContractAddress}}),Object.defineProperty(s,"getSwapsContractAddress",{enumerable:!0,get:function(){return E.getSwapsContractAddress}}),Object.defineProperty(s,"fetchTokens",{enumerable:!0,get:function(){return E.fetchTokens}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",reselect:"/home/runner/work/metamask-extension/metamask-extension/node_modules/reselect/dist/cjs/reselect.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.selectDefaultSlippagePercentage=s.selectMinimumBalanceForRentExemptionInSOL=s.selectBridgeQuotes=s.selectIsQuoteExpired=s.selectIsAssetExchangeRateInState=s.selectExchangeRateByChainIdAndAddress=s.selectBridgeFeatureFlags=void 0;const n=e("@ethersproject/constants"),r=e("@metamask/utils"),a=e("bignumber.js"),i=e("lodash"),o=e("reselect"),c=e("./constants/bridge.cjs"),d=e("./types.cjs"),l=e("./utils/bridge.cjs"),u=e("./utils/caip-formatters.cjs"),m=e("./utils/feature-flags.cjs"),h=e("./utils/quote.cjs"),p=e("./utils/slippage.cjs"),f=o.createStructuredSelector.withTypes(),g=o.createSelector.withTypes(),k=o.createSelector.withTypes();s.selectBridgeFeatureFlags=k([e=>e.remoteFeatureFlags.bridgeConfig],e=>(0,m.processFeatureFlags)(e));const w=(e,t,s)=>{if(!t||!s)return{};const n=(0,u.formatAddressToAssetId)(s,t);if(!n)return{};const{assetExchangeRates:i,currencyRates:o,marketData:c,conversionRates:d}=e,m=i?.[n]??i?.[n.toLowerCase()];if(m?.exchangeRate)return m;if((0,l.isNonEvmChainId)(t)){const e=d?.[n];return e?{exchangeRate:e.rate,usdExchangeRate:undefined}:{}}if((0,l.isNativeAddress)(s)){const{symbol:e}=(0,l.getNativeAssetForChainId)(t),s=o?.[e];return s?{exchangeRate:s?.conversionRate?.toString(),usdExchangeRate:s?.usdConversionRate?.toString()}:{}}if(!(0,l.isNonEvmChainId)(t)){const e=c?.[(0,u.formatChainIdToHex)(t)],n=(0,r.isStrictHexString)(s)?e?.[s]:null,i=n?o[n?.currency]:undefined;if(n&&i)return{exchangeRate:new a.BigNumber(n.price).multipliedBy(i.conversionRate??0).toString(),usdExchangeRate:new a.BigNumber(n.price).multipliedBy(i.usdConversionRate??0).toString()}}return{}};s.selectExchangeRateByChainIdAndAddress=(e,t,s)=>w(e,t,s);s.selectIsAssetExchangeRateInState=(...e)=>Boolean(w(...e)?.exchangeRate)&&Boolean(w(...e)?.usdExchangeRate);const _=g([({quotes:e})=>e,f({estimatedBaseFeeInDecGwei:({gasFeeEstimates:e})=>e?.estimatedBaseFee,feePerGasInDecGwei:({gasFeeEstimates:e})=>e?.[c.BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,maxFeePerGasInDecGwei:({gasFeeEstimates:e})=>e?.high?.suggestedMaxFeePerGas}),g([e=>e,({quoteRequest:{srcChainId:e}})=>e,({quoteRequest:{srcTokenAddress:e}})=>e],s.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{destChainId:e}})=>e,({quoteRequest:{destTokenAddress:e}})=>e],s.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{srcChainId:e}})=>e],(e,t)=>(0,s.selectExchangeRateByChainIdAndAddress)(e,t,n.AddressZero))],(e,t,s,n,r)=>e.map(e=>{const a=(0,h.calcSentAmount)(e.quote,s),i=(0,h.calcToAmount)(e.quote.destTokenAmount,e.quote.destAsset,n),o=(0,h.calcToAmount)(e.quote.minDestTokenAmount,e.quote.destAsset,n),c=(0,h.calcIncludedTxFees)(e.quote,s,n);let d,u,m,p;(0,l.isEvmQuoteResponse)(e)?(m=(0,h.calcRelayerFee)(e,r),p=(0,h.calcEstimatedAndMaxTotalGasFee)({bridgeQuote:e,...t,...r}),d=(0,h.calcTotalEstimatedNetworkFee)(p,m),u=(0,h.calcTotalMaxNetworkFee)(p,m)):(d=(0,h.calcNonEvmTotalNetworkFee)(e,r),p={effective:d,total:d,max:d},u=d);const f=(0,h.calcAdjustedReturn)(i,d,e.quote),g=(0,h.calcCost)(f,a);return{...e,sentAmount:a,toTokenAmount:i,minToTokenAmount:o,swapRate:(0,h.calcSwapRate)(a.amount,i.amount),totalNetworkFee:d,totalMaxNetworkFee:u,gasFee:p,adjustedReturn:f,cost:g,includedTxFees:c}})),b=g([_,(e,{sortOrder:t})=>t],(e,t)=>t===d.SortOrder.ETA_ASC?(0,i.orderBy)(e,e=>e.estimatedProcessingTimeInSeconds,"asc"):(0,i.orderBy)(e,({cost:e})=>e.valueInCurrency?Number(e.valueInCurrency):0,"asc")),y=g([b],e=>e.length>0?e[0]:null),A=g([y,(e,{selectedQuote:t})=>t],(e,t)=>t??e),v=g([s.selectBridgeFeatureFlags,e=>e.quoteRequest.insufficientBal,e=>e.quotesRefreshCount],(e,t,s)=>!t&&e.maxRefreshCount>s),E=g([s.selectBridgeFeatureFlags,e=>e.quoteRequest.srcChainId],(e,t)=>(t?e.chains[(0,u.formatChainIdToCaip)(t)]?.refreshRate:e.refreshRate)??e.refreshRate);s.selectIsQuoteExpired=g([v,({quotesLastFetched:e})=>e,E,(e,t,s)=>s],(e,t,s,n)=>Boolean(!e&&t&&n-t>s)),s.selectBridgeQuotes=f({sortedQuotes:b,recommendedQuote:y,activeQuote:A,quotesLastFetchedMs:e=>e.quotesLastFetched,isLoading:e=>e.quotesLoadingStatus===d.RequestStatus.LOADING,quoteFetchError:e=>e.quoteFetchError,quotesRefreshCount:e=>e.quotesRefreshCount,quotesInitialLoadTimeMs:e=>e.quotesInitialLoadTime,isQuoteGoingToRefresh:v});s.selectMinimumBalanceForRentExemptionInSOL=e=>new a.BigNumber(e.minimumBalanceForRentExemptionInLamports??0).div(10**9).toString(),s.selectDefaultSlippagePercentage=g([e=>(0,s.selectBridgeFeatureFlags)(e).chains,(e,t)=>t.srcTokenAddress,(e,t)=>t.destTokenAddress,(e,t)=>t.srcChainId?(0,u.formatChainIdToCaip)(t.srcChainId):undefined,(e,t)=>t.destChainId?(0,u.formatChainIdToCaip)(t.destChainId):undefined],(e,t,s,n,r)=>(0,p.getDefaultSlippagePercentage)({srcTokenAddress:t,destTokenAddress:s,srcChainId:n,destChainId:r},n?e[n]?.stablecoins:undefined,r?e[r]?.stablecoins:undefined))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d;Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeBackgroundAction=s.BridgeUserAction=s.RequestStatus=s.ChainId=s.StatusTypes=s.SortOrder=s.AssetType=void 0,function(e){e.native="NATIVE",e.token="TOKEN",e.NFT="NFT",e.unknown="UNKNOWN"}(n||(s.AssetType=n={})),function(e){e.COST_ASC="cost_ascending",e.ETA_ASC="time_descending"}(r||(s.SortOrder=r={})),function(e){e.UNKNOWN="UNKNOWN",e.FAILED="FAILED",e.PENDING="PENDING",e.COMPLETE="COMPLETE"}(a||(s.StatusTypes=a={})),function(e){e[e.ETH=1]="ETH",e[e.OPTIMISM=10]="OPTIMISM",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ZKSYNC=324]="ZKSYNC",e[e.BASE=8453]="BASE",e[e.ARBITRUM=42161]="ARBITRUM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.LINEA=59144]="LINEA",e[e.SOLANA=0x416edef1601be]="SOLANA",e[e.BTC=20000000000001]="BTC",e[e.TRON=728126428]="TRON",e[e.SEI=1329]="SEI",e[e.MONAD=143]="MONAD"}(i||(s.ChainId=i={})),function(e){e[e.LOADING=0]="LOADING",e[e.FETCHED=1]="FETCHED",e[e.ERROR=2]="ERROR"}(o||(s.RequestStatus=o={})),function(e){e.SELECT_DEST_NETWORK="selectDestNetwork",e.UPDATE_QUOTE_PARAMS="updateBridgeQuoteRequestParams"}(c||(s.BridgeUserAction=c={})),function(e){e.SET_CHAIN_INTERVAL_LENGTH="setChainIntervalLength",e.RESET_STATE="resetState",e.TRACK_METAMETRICS_EVENT="trackUnifiedSwapBridgeEvent",e.STOP_POLLING_FOR_QUOTES="stopPollingForQuotes",e.FETCH_QUOTES="fetchQuotes"}(d||(s.BridgeBackgroundAction=d={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.toExchangeRates=s.getAssetIdsForToken=void 0;const n=e("./bridge.cjs"),r=e("./caip-formatters.cjs");s.getAssetIdsForToken=(e,t)=>{const s=[],a=(0,r.formatAddressToAssetId)(e,t);return a&&(s.push(a),(0,n.getNativeAssetForChainId)(t)?.assetId&&s.push((0,n.getNativeAssetForChainId)(t).assetId)),s};s.toExchangeRates=(e,t)=>Object.entries(t).reduce((t,[s,n])=>(n&&(t[s]={exchangeRate:n[e],usdExchangeRate:n.usd}),t),{})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hasSufficientBalance=s.calcLatestSrcBalance=s.fetchTokenBalance=void 0;const n=e("@ethersproject/address"),r=e("@ethersproject/contracts"),a=e("@ethersproject/providers"),i=e("@metamask/metamask-eth-abis"),o=e("./bridge.cjs");s.fetchTokenBalance=async(e,t,s)=>{const n=new a.Web3Provider(s),o=new r.Contract(e,i.abiERC20,n),c="function"==typeof o?.balanceOf?o.balanceOf(t):Promise.resolve(undefined);return await c};s.calcLatestSrcBalance=async(e,t,r,i)=>{if(r&&i){if((0,o.isNativeAddress)(r)){const s=new a.Web3Provider(e);return await s.getBalance((0,n.getAddress)(t))}return await(0,s.fetchTokenBalance)(r,t,e)}return undefined};s.hasSufficientBalance=async(e,t,n,r,a)=>{const i=await(0,s.calcLatestSrcBalance)(e,t,n,a);return!!i&&i.gte(r)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isEvmQuoteResponse=s.isNonEvmChainId=s.isTronChainId=s.isBitcoinChainId=s.isSolanaChainId=s.isNativeAddress=s.isSwapsDefaultTokenSymbol=s.isSwapsDefaultTokenAddress=s.sumHexes=s.isEthUsdt=s.getEthUsdtResetData=s.getNativeAssetForChainId=s.getDefaultBridgeControllerState=s.isCrossChain=void 0;const n=e("@ethersproject/constants"),r=e("@ethersproject/contracts"),a=e("@metamask/keyring-api"),i=e("@metamask/metamask-eth-abis"),o=e("@metamask/utils"),c=e("./caip-formatters.cjs"),d=e("../constants/bridge.cjs"),l=e("../constants/chains.cjs"),u=e("../constants/swaps.cjs"),m=e("../constants/tokens.cjs"),h=e("../types.cjs");s.isCrossChain=(e,t)=>{try{return!!t&&(0,c.formatChainIdToCaip)(e)!==(0,c.formatChainIdToCaip)(t)}catch{return!1}};s.getDefaultBridgeControllerState=()=>d.DEFAULT_BRIDGE_CONTROLLER_STATE;const p=(e,t)=>`${(0,c.formatChainIdToCaip)(e)}/${m.SYMBOL_TO_SLIP44_MAP[t]}`;s.getNativeAssetForChainId=e=>{const t=(0,c.formatChainIdToCaip)(e),s=m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToCaip)(e)]??m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToHex)(e)];if(!s)throw new Error(`No XChain Swaps native asset found for chainId: ${e}`);return{...s,chainId:(0,c.formatChainIdToDec)(e),assetId:p(t,s.symbol)}};s.getEthUsdtResetData=e=>{const t=(0,s.isCrossChain)(l.CHAIN_IDS.MAINNET,e)?d.METABRIDGE_ETHEREUM_ADDRESS:u.SWAPS_CONTRACT_ADDRESSES[l.CHAIN_IDS.MAINNET];return new r.Contract(d.ETH_USDT_ADDRESS,i.abiERC20).interface.encodeFunctionData("approve",[t,"0"])};s.isEthUsdt=(e,t)=>(0,c.formatChainIdToDec)(e)===h.ChainId.ETH&&t.toLowerCase()===d.ETH_USDT_ADDRESS.toLowerCase();s.sumHexes=(...e)=>{if(0===e.length)return"0x0";return`0x${e.reduce((e,t)=>e+BigInt(t),BigInt(0)).toString(16)}`};s.isSwapsDefaultTokenAddress=(e,t)=>!(!e||!t)&&e===(0,s.getNativeAssetForChainId)(t)?.address;s.isSwapsDefaultTokenSymbol=(e,t)=>!(!e||!t)&&e===(0,s.getNativeAssetForChainId)(t)?.symbol;s.isNativeAddress=e=>e===n.AddressZero||""===e||!e||!(0,o.isStrictHexString)(e)&&Object.values(m.SYMBOL_TO_SLIP44_MAP).some(t=>e.includes(t)||t.endsWith(e));s.isSolanaChainId=e=>(0,o.isCaipChainId)(e)?e===a.SolScope.Mainnet.toString():e.toString()===h.ChainId.SOLANA.toString();s.isBitcoinChainId=e=>(0,o.isCaipChainId)(e)?e===a.BtcScope.Mainnet.toString():e.toString()===h.ChainId.BTC.toString();s.isTronChainId=e=>(0,o.isCaipChainId)(e)?e===a.TrxScope.Mainnet.toString():e.toString()===h.ChainId.TRON.toString();s.isNonEvmChainId=e=>(0,s.isSolanaChainId)(e)||(0,s.isBitcoinChainId)(e)||(0,s.isTronChainId)(e);s.isEvmQuoteResponse=e=>!(0,s.isNonEvmChainId)(e.quote.srcChainId)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/multichain-network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-network-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.formatAddressToAssetId=s.formatAddressToCaipReference=s.formatChainIdToHex=s.formatChainIdToDec=s.formatChainIdToCaip=void 0;const n=e("@ethersproject/address"),r=e("@ethersproject/constants"),a=e("@metamask/controller-utils"),i=e("@metamask/keyring-api"),o=e("@metamask/multichain-network-controller"),c=e("@metamask/utils"),d=e("./bridge.cjs"),l=e("../types.cjs");s.formatChainIdToCaip=e=>(0,c.isCaipChainId)(e)?e:(0,c.isStrictHexString)(e)?(0,o.toEvmCaipChainId)(e):(0,d.isSolanaChainId)(e)?i.SolScope.Mainnet:(0,d.isBitcoinChainId)(e)?i.BtcScope.Mainnet:(0,d.isTronChainId)(e)?i.TrxScope.Mainnet:(0,o.toEvmCaipChainId)((0,c.numberToHex)(Number(e)));s.formatChainIdToDec=e=>(0,c.isStrictHexString)(e)?(0,a.convertHexToDecimal)(e):e===i.SolScope.Mainnet?l.ChainId.SOLANA:e===i.BtcScope.Mainnet?l.ChainId.BTC:e===i.TrxScope.Mainnet?l.ChainId.TRON:(0,c.isCaipChainId)(e)?Number(e.split(":").at(-1)):"string"==typeof e?parseInt(e,10):e;s.formatChainIdToHex=e=>{if((0,c.isStrictHexString)(e))return e;if("number"==typeof e||parseInt(e,10))return(0,c.numberToHex)(Number(e));if((0,c.isCaipChainId)(e)){const{reference:t}=(0,c.parseCaipChainId)(e);if((0,c.isCaipReference)(t)&&!isNaN(Number(t)))return(0,c.numberToHex)(Number(t))}throw new Error(`Invalid cross-chain swaps chainId: ${e}`)};s.formatAddressToCaipReference=e=>{if((0,c.isStrictHexString)(e))return(0,n.getAddress)(e);if((0,d.isNativeAddress)(e))return r.AddressZero;const t=e.split(":").at(-1);if(!t)throw new Error("Invalid address");return t};s.formatAddressToAssetId=(e,t)=>(0,c.isCaipAssetType)(e)?e:(0,d.isNativeAddress)(e)?(0,d.getNativeAssetForChainId)(t).assetId:t===i.SolScope.Mainnet?c.CaipAssetTypeStruct.create(`${t}/token:${e}`):(0,c.isStrictHexString)(e)?c.CaipAssetTypeStruct.create(`${(0,s.formatChainIdToCaip)(t)}/erc20:${e}`):undefined}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hasMinimumRequiredVersion=s.getBridgeFeatureFlags=s.processFeatureFlags=s.formatFeatureFlags=void 0;const n=e("./caip-formatters.cjs"),r=e("./validators.cjs"),a=e("../constants/bridge.cjs");s.formatFeatureFlags=e=>{return{...e,chains:(t=e.chains,Object.entries(t).reduce((e,[t,s])=>({...e,[(0,n.formatChainIdToCaip)(t)]:s}),{}))};var t};s.processFeatureFlags=e=>(0,r.validateFeatureFlagsResponse)(e)?(0,s.formatFeatureFlags)(e):a.DEFAULT_FEATURE_FLAG_CONFIG,s.getBridgeFeatureFlags=function(e){const t=e.call("RemoteFeatureFlagController:getState"),n=t?.remoteFeatureFlags?.bridgeConfigV2,r=t?.remoteFeatureFlags?.bridgeConfig;return(0,s.processFeatureFlags)(n||r)};s.hasMinimumRequiredVersion=(e,t)=>{const[s,n,r]=e.split(".").map(Number),[a,i,o]=t.split(".").map(Number);return s>a||(s===a&&n>i||s===a&&n===i&&r>=o)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchServerEvents=void 0;s.fetchServerEvents=async(e,{onMessage:t,onError:s,onClose:n,fetchFn:r,...a})=>{let i;try{const s=await r(e,a);if(!s.ok||!s.body)throw new Error(`${s.status}`);i=s.body.getReader();const o=new TextDecoder("utf-8");let c="";for(;;){const{done:e,value:s}=await i.read();if(e)break;c+=o.decode(s,{stream:!0});const n=c.split("\n\n");c=n.pop()||"";for(const e of n){const s=e.split("\n");let n;const r=[];for(const e of s)e.startsWith("event:")?n=e.slice(6).trim():e.startsWith("data:")&&r.push(e.slice(5).trim());if("error"===n)throw new Error(`Bridge-api error: ${r.join("\n")}`);if(r.length>0){const e=JSON.parse(r.join("\n"));await t(e,n)}}}await(n?.())}catch(e){s?.(e)}finally{try{await(i?.cancel())}catch(e){console.error("Error cleaning up stream reader",e)}}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./fetch-server-events.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchBridgeQuoteStream=s.fetchAssetPrices=s.fetchBridgeQuotes=s.fetchBridgeTokens=s.getClientHeaders=void 0;const n=e("@metamask/superstruct"),r=e("./bridge.cjs"),a=e("./caip-formatters.cjs"),i=e("./fetch-server-events.cjs"),o=e("./trade-utils.cjs"),c=e("./validators.cjs");s.getClientHeaders=(e,t)=>({"X-Client-Id":e,...t?{"Client-Version":t}:{}}),s.fetchBridgeTokens=async function(e,t,n,r,i){const o=`${r}/getTokens?chainId=${(0,a.formatChainIdToDec)(e)}`,d=await n(o,{headers:(0,s.getClientHeaders)(t,i)}),l={};return d.forEach(e=>{(0,c.validateSwapsTokenObject)(e)&&(l[e.address]=e)}),l};const d=e=>{const t=e.destWalletAddress??e.walletAddress,s={walletAddress:(0,a.formatAddressToCaipReference)(e.walletAddress),destWalletAddress:(0,a.formatAddressToCaipReference)(t),srcChainId:(0,a.formatChainIdToDec)(e.srcChainId),destChainId:(0,a.formatChainIdToDec)(e.destChainId),srcTokenAddress:(0,a.formatAddressToCaipReference)(e.srcTokenAddress),destTokenAddress:(0,a.formatAddressToCaipReference)(e.destTokenAddress),srcTokenAmount:e.srcTokenAmount,insufficientBal:Boolean(e.insufficientBal),resetApproval:Boolean(e.resetApproval),gasIncluded:Boolean(e.gasIncluded),gasIncluded7702:Boolean(e.gasIncluded7702)};e.slippage!==undefined&&(s.slippage=e.slippage),e.fee!==undefined&&(s.fee=e.fee),e.aggIds&&e.aggIds.length>0&&(s.aggIds=e.aggIds),e.bridgeIds&&e.bridgeIds.length>0&&(s.bridgeIds=e.bridgeIds);const n=new URLSearchParams;return Object.entries(s).forEach(([e,t])=>{n.append(e,t.toString())}),n};s.fetchBridgeQuotes=async function(e,t,a,i,l,u,m){const h=`${l}/getQuote?${d(e)}`,p=await i(h,{headers:(0,s.getClientHeaders)(a,m),signal:t}),f=new Set([]),g=p.filter(e=>{try{return(0,c.validateQuoteResponse)(e)}catch(t){return t instanceof n.StructError&&t.failures().forEach(({branch:t,path:s})=>{const n=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||e?.quote?.bridgeId||e?.quote?.bridges?.[0]||"unknown",r=s?.join(".")||"unknown";f.add([n,r].join("|"))}),!1}}).map(t=>({...t,featureId:u??undefined,resetApproval:e.resetApproval&&t.approval&&(0,o.isEvmTxData)(t.approval)?{...t.approval,data:(0,r.getEthUsdtResetData)(e.destChainId)}:undefined})),k=Array.from(f);return f.size>0&&console.warn("Quote validation failed",k),{quotes:g,validationFailures:k}};s.fetchAssetPrices=async e=>{const{currencies:t,...n}=e,r=await Promise.allSettled(Array.from(t).map(async e=>await(async e=>{const{currency:t,assetIds:n,clientId:r,clientVersion:a,fetchFn:i,signal:o}=e,c=Array.from(n).filter(Boolean);if(0===c.length)return{};const d=`https://price.api.cx.metamask.io/v3/spot-prices?${new URLSearchParams({assetIds:c.filter(Boolean).join(","),vsCurrency:t})}`,l=await i(d,{headers:(0,s.getClientHeaders)(r,a),signal:o});return l&&"object"==typeof l?Object.entries(l).reduce((e,[s,n])=>n?(e[s]||(e[s]={}),n[t]&&(e[s][t]=n[t].toString()),e):e,{}):{}})({...n,currency:e}))).then(e=>e.reduce((e,t)=>("fulfilled"===t.status&&Object.entries(t.value).forEach(([t,s])=>{e[t]||(e[t]={}),Object.entries(s).forEach(([s,n])=>{e[t][s]=n})}),e),{}));return r},s.fetchBridgeQuoteStream=async function(e,t,a,l,u,m,h){const p=`${u}/getQuoteStream?${d(t)}`;await(0,i.fetchServerEvents)(p,{headers:{...(0,s.getClientHeaders)(l,h),"Content-Type":"text/event-stream"},signal:a,onMessage:async e=>{const s=new Set([]);try{if((0,c.validateQuoteResponse)(e))return await m.onValidQuoteReceived({...e,resetApproval:t.resetApproval&&e.approval&&(0,o.isEvmTxData)(e.approval)?{...e.approval,data:(0,r.getEthUsdtResetData)(t.destChainId)}:undefined})}catch(t){t instanceof n.StructError&&t.failures().forEach(({branch:t,path:n})=>{const r=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||e?.quote?.bridgeId||e?.quote?.bridges?.[0]||"unknown",a=n?.join(".")||"unknown";s.add([r,a].join("|"))});const r=Array.from(s);if(s.size>0)return console.warn("Quote validation failed",r),m.onValidationFailure(r);throw t}return undefined},onError:e=>{throw e},onClose:async()=>{await m.onClose()},fetchFn:e})}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o;Object.defineProperty(s,"__esModule",{value:!0}),s.MetricsSwapType=s.MetricsActionType=s.MetaMetricsSwapsEventSource=s.AbortReason=s.UnifiedSwapBridgeEventName=s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=void 0,s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY="Unified SwapBridge",function(e){e.ButtonClicked="Unified SwapBridge Button Clicked",e.PageViewed="Unified SwapBridge Page Viewed",e.InputChanged="Unified SwapBridge Input Changed",e.InputSourceDestinationSwitched="Unified SwapBridge Source Destination Switched",e.QuotesRequested="Unified SwapBridge Quotes Requested",e.QuotesReceived="Unified SwapBridge Quotes Received",e.QuotesError="Unified SwapBridge Quotes Error",e.Submitted="Unified SwapBridge Submitted",e.Completed="Unified SwapBridge Completed",e.Failed="Unified SwapBridge Failed",e.AllQuotesOpened="Unified SwapBridge All Quotes Opened",e.AllQuotesSorted="Unified SwapBridge All Quotes Sorted",e.QuoteSelected="Unified SwapBridge Quote Selected",e.AssetDetailTooltipClicked="Unified SwapBridge Asset Detail Tooltip Clicked",e.QuotesValidationFailed="Unified SwapBridge Quotes Failed Validation",e.StatusValidationFailed="Unified SwapBridge Status Failed Validation"}(n||(s.UnifiedSwapBridgeEventName=n={})),function(e){e.NewQuoteRequest="New Quote Request",e.QuoteRequestUpdated="Quote Request Updated",e.ResetState="Reset controller state",e.TransactionSubmitted="Transaction submitted"}(r||(s.AbortReason=r={})),function(e){e.MainView="Main View",e.TokenView="Token View"}(a||(s.MetaMetricsSwapsEventSource=a={})),function(e){e.CROSSCHAIN_V1="crosschain-v1",e.SWAPBRIDGE_V1="swapbridge-v1"}(i||(s.MetricsActionType=i={})),function(e){e.SINGLE="single_chain",e.CROSSCHAIN="crosschain"}(o||(s.MetricsSwapType=o={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs",{"../../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","../bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","../caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getQuotesReceivedProperties=s.isCustomSlippage=s.isHardwareWallet=s.getRequestParams=s.formatProviderLabel=s.getSwapTypeFromQuote=s.getSwapType=s.toInputChangedPropertyValue=s.toInputChangedPropertyKey=void 0;const n=e("./constants.cjs"),r=e("../../constants/bridge.cjs"),a=e("../../types.cjs"),i=e("../bridge.cjs"),o=e("../caip-formatters.cjs");s.toInputChangedPropertyKey={srcTokenAddress:"token_source",destTokenAddress:"token_destination",srcChainId:"chain_source",destChainId:"chain_destination",slippage:"slippage"},s.toInputChangedPropertyValue={srcTokenAddress:({srcTokenAddress:e,srcChainId:t})=>t?(0,o.formatAddressToAssetId)(e??"",t):undefined,destTokenAddress:({destTokenAddress:e,destChainId:t})=>t?(0,o.formatAddressToAssetId)(e??"",t):undefined,srcChainId:({srcChainId:e})=>e?(0,o.formatChainIdToCaip)(e):undefined,destChainId:({destChainId:e})=>e?(0,o.formatChainIdToCaip)(e):undefined,slippage:({slippage:e})=>e?Number(e):e};s.getSwapType=(e,t)=>e&&!(0,i.isCrossChain)(e,t??e)?n.MetricsSwapType.SINGLE:n.MetricsSwapType.CROSSCHAIN;s.getSwapTypeFromQuote=e=>(0,s.getSwapType)(e.srcChainId,e.destChainId);s.formatProviderLabel=({bridgeId:e,bridges:t})=>`${e}_${t[0]}`;s.getRequestParams=({srcChainId:e,destChainId:t,srcTokenAddress:s,destTokenAddress:n})=>{const r=(0,o.formatChainIdToCaip)(e??a.ChainId.ETH);return{chain_id_source:r,chain_id_destination:t?(0,o.formatChainIdToCaip)(t):null,token_address_source:s?(0,o.formatAddressToAssetId)(s,r)??(0,i.getNativeAssetForChainId)(r)?.assetId??null:(0,i.getNativeAssetForChainId)(r)?.assetId??null,token_address_destination:n?(0,o.formatAddressToAssetId)(n,t??r)??null:null}};s.isHardwareWallet=e=>e?.metadata?.keyring.type?.includes("Hardware")??!1;s.isCustomSlippage=e=>e!==r.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;s.getQuotesReceivedProperties=(e,t=[],n=!0,r)=>{const a=e?(0,s.formatProviderLabel)(e.quote):"_";return{can_submit:n,gas_included:Boolean(e?.quote?.gasIncluded),gas_included_7702:Boolean(e?.quote?.gasIncluded7702),quoted_time_minutes:e?.estimatedProcessingTimeInSeconds?e.estimatedProcessingTimeInSeconds/60:0,usd_quoted_gas:Number(e?.gasFee?.effective?.usd??0),usd_quoted_return:Number(e?.toTokenAmount?.usd??0),best_quote_provider:r?(0,s.formatProviderLabel)(r.quote):a,provider:a,warnings:t,price_impact:Number(e?.quote.priceData?.priceImpact??0)}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.appendFeesToQuotes=void 0;const n=e("@metamask/utils"),r=e("./bridge.cjs"),a=e("./caip-formatters.cjs"),i=e("./snaps.cjs"),o=e("./trade-utils.cjs"),c=e("../constants/chains.cjs");s.appendFeesToQuotes=async(e,t,s,d)=>{const l=await(async(e,t)=>{if(e.some(({quote:e})=>{const t=(0,a.formatChainIdToCaip)(e.srcChainId);return![c.CHAIN_IDS.OPTIMISM,c.CHAIN_IDS.BASE].map(a.formatChainIdToCaip).includes(t)}))return undefined;const s=Promise.allSettled(e.map(async e=>{const{quote:s,trade:a,approval:i}=e,o=(0,n.numberToHex)(s.srcChainId),c=e=>({from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit?.toString()}),d=i?await t({transactionParams:c(i),chainId:o}):"0x0",l=await t({transactionParams:c(a),chainId:o});return d===undefined||l===undefined?undefined:{...e,l1GasFeesInHexWei:(0,r.sumHexes)(d,l)}}));return(await s).reduce((e,t)=>("fulfilled"===t.status&&t.value?e.push(t.value):"rejected"===t.status&&console.error("Error calculating L1 gas fees for quote",t.reason),e),[])})(e,s),u=await(async(e,t,s)=>{if(e.some(({quote:{srcChainId:e}})=>!(0,r.isNonEvmChainId)(e)))return undefined;const n=Promise.allSettled(e.map(async e=>{const{trade:n,quote:r}=e;if(!s?.metadata?.snap?.id||!n)return e;try{const c=(0,a.formatChainIdToCaip)(r.srcChainId),d=(0,o.extractTradeData)(n),l=(0,o.isTronTrade)(n)?{visible:n.visible,type:n.raw_data?.contract?.[0]?.type,feeLimit:n.raw_data?.fee_limit}:undefined,u=await t.call("SnapController:handleRequest",(0,i.computeFeeRequest)(s?.metadata?.snap?.id,d,s?.id,c,l)),m=u?.find(e=>"base"===e.type)||u?.find(e=>"priority"===e.type)||u?.[0],h=m?.asset?.amount||"0";return{...e,nonEvmFeesInNative:h}}catch(t){return console.error(`Failed to compute non-EVM fees for quote ${r.requestId}:`,t),{...e,nonEvmFeesInNative:undefined}}}));return(await n).reduce((e,t)=>("fulfilled"===t.status&&t.value&&e.push(t.value),e),[])})(e,t,d);return l??u??e}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sortQuotes=s.formatEtaInMinutes=s.calcSlippagePercentage=s.calcCost=s.calcSwapRate=s.calcAdjustedReturn=s.calcIncludedTxFees=s.calcTotalMaxNetworkFee=s.calcTotalEstimatedNetworkFee=s.calcEstimatedAndMaxTotalGasFee=s.calcRelayerFee=s.calcSentAmount=s.calcToAmount=s.calcNonEvmTotalNetworkFee=s.getQuoteIdentifier=s.isValidQuoteRequest=void 0;const n=e("@metamask/controller-utils"),r=e("bignumber.js"),a=e("./bridge.cjs"),i=e("./validators.cjs");s.isValidQuoteRequest=(e,t=!0)=>{const s=["srcTokenAddress","destTokenAddress","srcChainId","destChainId","walletAddress"];if(t&&s.push("srcTokenAmount"),e.destChainId&&e.srcChainId&&e.destChainId!==e.srcChainId&&((0,a.isNonEvmChainId)(e.destChainId)||(0,a.isNonEvmChainId)(e.srcChainId))&&(s.push("destWalletAddress"),!e.destWalletAddress))return!1;const n=[];return e.slippage!==undefined&&n.push("slippage"),s.every(t=>t in e&&"string"==typeof e[t]&&e[t]!==undefined&&""!==e[t]&&null!==e[t])&&n.every(t=>t in e&&"number"==typeof e[t]&&e[t]!==undefined&&!isNaN(Number(e[t]))&&null!==e[t])&&(!t||Boolean((e.srcTokenAmount??"").match(/^[1-9]\d*$/u)))};s.getQuoteIdentifier=e=>`${e.bridgeId}-${e.bridges[0]}-${e.steps.length}`;const o=(e,t)=>{const s=new r.BigNumber(10).pow(t??0);return new r.BigNumber(e).div(s)};s.calcNonEvmTotalNetworkFee=(e,{exchangeRate:t,usdExchangeRate:s})=>{const{nonEvmFeesInNative:n}=e,a=new r.BigNumber(n??"0");return{amount:a.toString(),valueInCurrency:t?a.times(t).toString():null,usd:s?a.times(s).toString():null}};s.calcToAmount=(e,t,{exchangeRate:s,usdExchangeRate:n})=>{const r=o(e,t.decimals);return{amount:r.toString(),valueInCurrency:s?r.times(s).toString():null,usd:n?r.times(n).toString():null}};s.calcSentAmount=({srcTokenAmount:e,srcAsset:t,feeData:s},{exchangeRate:n,usdExchangeRate:a})=>{const i=Object.values(s).filter(e=>e&&e.amount&&e.asset?.assetId===t.assetId).reduce((e,{amount:t})=>e.plus(t),new r.BigNumber(e)),c=o(i,t.decimals);return{amount:c.toString(),valueInCurrency:n?c.times(n).toString():null,usd:a?c.times(a).toString():null}};s.calcRelayerFee=(e,{exchangeRate:t,usdExchangeRate:i})=>{const{quote:c,trade:d}=e,l=new r.BigNumber((0,n.convertHexToDecimal)(d.value||"0x0"));let u=o(l,18);if((0,a.isNativeAddress)(c.srcAsset.address)){const e=(0,s.calcSentAmount)(c,{exchangeRate:t,usdExchangeRate:i}).amount;u=u.minus(e)}return{amount:u,valueInCurrency:t?u.times(t):null,usd:i?u.times(i):null}};const c=({approvalGasLimit:e,resetApprovalGasLimit:t,tradeGasLimit:s,l1GasFeesInHexWei:a,feePerGasInDecGwei:i,nativeToDisplayCurrencyExchangeRate:o,nativeToUsdExchangeRate:c})=>{const d=new r.BigNumber(s?.toString()??"0").plus(e?.toString()??"0").plus(t?.toString()??"0"),l=(0,n.weiHexToGweiDec)((0,n.toHex)(a??"0")),u=d.times(i).plus(l).times(new r.BigNumber(10).pow(-9)),m=o?u.times(o.toString()):null,h=c?u.times(c.toString()):null;return{amount:u.toString(),valueInCurrency:m?.toString()??null,usd:h?.toString()??null}};s.calcEstimatedAndMaxTotalGasFee=({bridgeQuote:{approval:e,trade:t,l1GasFeesInHexWei:s,resetApproval:n},estimatedBaseFeeInDecGwei:r,maxFeePerGasInDecGwei:a,feePerGasInDecGwei:i,exchangeRate:o,usdExchangeRate:d})=>{const{amount:l,valueInCurrency:u,usd:m}=c({approvalGasLimit:e?.effectiveGas??e?.gasLimit,resetApprovalGasLimit:n?.effectiveGas??n?.gasLimit,tradeGasLimit:t?.effectiveGas??t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:i,nativeToDisplayCurrencyExchangeRate:o,nativeToUsdExchangeRate:d}),{amount:h,valueInCurrency:p,usd:f}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:n?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:i,nativeToDisplayCurrencyExchangeRate:o,nativeToUsdExchangeRate:d}),{amount:g,valueInCurrency:k,usd:w}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:n?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:o,nativeToUsdExchangeRate:d});return{effective:{amount:l,valueInCurrency:u,usd:m},total:{amount:h,valueInCurrency:p,usd:f},max:{amount:g,valueInCurrency:k,usd:w}}};s.calcTotalEstimatedNetworkFee=({total:e},t)=>({amount:new r.BigNumber(e?.amount??"0").plus(t.amount).toString(),valueInCurrency:e?.valueInCurrency?new r.BigNumber(e.valueInCurrency).plus(t.valueInCurrency||"0").toString():null,usd:e?.usd?new r.BigNumber(e.usd).plus(t.usd||"0").toString():null});s.calcTotalMaxNetworkFee=(e,t)=>({amount:new r.BigNumber(e.max.amount).plus(t.amount).toString(),valueInCurrency:e.max.valueInCurrency?new r.BigNumber(e.max.valueInCurrency).plus(t.valueInCurrency||"0").toString():null,usd:e.max.usd?new r.BigNumber(e.max.usd).plus(t.usd||"0").toString():null});s.calcIncludedTxFees=({gasIncluded:e,gasIncluded7702:t,srcAsset:s,feeData:{txFee:n}},r,a)=>{if(!n||!e&&!t)return null;const{exchangeRate:i,usdExchangeRate:c}=n.asset.assetId===s.assetId?r:a,d=o(n.amount,n.asset.decimals);return{amount:d.toString(),valueInCurrency:i?d.times(i).toString():null,usd:c?d.times(c).toString():null}};s.calcAdjustedReturn=(e,t,{feeData:{txFee:s},destAsset:{assetId:n}})=>s?.asset?.assetId===n?{valueInCurrency:e.valueInCurrency,usd:e.usd}:{valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new r.BigNumber(e.valueInCurrency).minus(t.valueInCurrency).toString():null,usd:e.usd&&t.usd?new r.BigNumber(e.usd).minus(t.usd).toString():null};s.calcSwapRate=(e,t)=>new r.BigNumber(t).div(e).toString();s.calcCost=(e,t)=>({valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new r.BigNumber(t.valueInCurrency).minus(e.valueInCurrency).toString():null,usd:e.usd&&t.usd?new r.BigNumber(t.usd).minus(e.usd).toString():null});s.calcSlippagePercentage=(e,t)=>{const n=(0,s.calcCost)(e,t);return n.valueInCurrency&&t.valueInCurrency?new r.BigNumber(n.valueInCurrency).div(t.valueInCurrency).times(100).abs().toString():n.usd&&t.usd?new r.BigNumber(n.usd).div(t.usd).times(100).abs().toString():null};s.formatEtaInMinutes=e=>e<60?"< 1":(e/60).toFixed();s.sortQuotes=(e,t)=>t===i.FeatureId.PERPS?e.sort((e,t)=>e.estimatedProcessingTimeInSeconds-t.estimatedProcessingTimeInSeconds):e}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getDefaultSlippagePercentage=s.BRIDGE_DEFAULT_SLIPPAGE=void 0;const n=e("./bridge.cjs");s.BRIDGE_DEFAULT_SLIPPAGE=.5;const r=undefined;s.getDefaultSlippagePercentage=({srcTokenAddress:e,destTokenAddress:t,srcChainId:a,destChainId:i},o,c)=>!a||(0,n.isCrossChain)(a,i)?s.BRIDGE_DEFAULT_SLIPPAGE:(0,n.isSolanaChainId)(a)?r:e&&t&&o?.map(e=>e.toLowerCase()).includes(e.toLowerCase())&&(c??o)?.map(e=>e.toLowerCase()).includes(t.toLowerCase())?.5:2}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.computeFeeRequest=s.getMinimumBalanceForRentExemptionInLamports=s.getMinimumBalanceForRentExemptionRequest=void 0;const n=e("@metamask/keyring-api"),r=e("uuid"),a=e("../constants/bridge.cjs");s.getMinimumBalanceForRentExemptionRequest=e=>({snapId:e,origin:"metamask",handler:"onProtocolRequest",request:{method:" ",jsonrpc:"2.0",params:{scope:n.SolScope.Mainnet,request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"getMinimumBalanceForRentExemption",params:[0,{commitment:"confirmed"}]}}}});s.getMinimumBalanceForRentExemptionInLamports=async(e,t)=>String(await t.call("SnapController:handleRequest",(0,s.getMinimumBalanceForRentExemptionRequest)(e)).catch(e=>(console.error("Error setting minimum balance for rent exemption",e),a.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports)));s.computeFeeRequest=(e,t,s,n,a)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"computeFee",params:{transaction:t,accountId:s,scope:n,...a&&{options:a}}}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchTokens=s.DEV_BASE_URL=s.API_BASE_URL=s.getSwapsContractAddress=s.isValidSwapsContractAddress=void 0;const n=e("./caip-formatters.cjs"),r=e("../constants/chains.cjs"),a=e("../constants/swaps.cjs"),i=e("../constants/tokens.cjs");function o(e){return e?{"X-Client-Id":e}:undefined}s.isValidSwapsContractAddress=function(e,t){return!(!t||!a.ALLOWED_CONTRACT_ADDRESSES[e])&&a.ALLOWED_CONTRACT_ADDRESSES[e].some(e=>t.toLowerCase()===e.toLowerCase())},s.getSwapsContractAddress=function(e){return a.SWAPS_CONTRACT_ADDRESSES[e]},s.API_BASE_URL="https://swap.api.cx.metamask.io",s.DEV_BASE_URL="https://swap.dev-api.cx.metamask.io",s.fetchTokens=async function(e,t,a){const[c,d]=e===r.CHAIN_IDS.LOCALHOST?[r.CHAIN_IDS.MAINNET,s.DEV_BASE_URL]:[e,s.API_BASE_URL],l=`${d}/networks/${(0,n.formatChainIdToDec)(c)}/tokens`,u=(await t(l,{headers:o(a)})).filter(e=>e.address!==i.DEFAULT_TOKEN_ADDRESS),m=i.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[e];return u.push(m),u}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs",{buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(e){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.extractTradeData=s.isTronTrade=s.isBitcoinTrade=s.isEvmTxData=void 0;s.isEvmTxData=e=>"object"==typeof e&&null!==e&&"data"in e&&"chainId"in e&&"to"in e;s.isBitcoinTrade=e=>"object"==typeof e&&null!==e&&"unsignedPsbtBase64"in e;s.isTronTrade=e=>"object"==typeof e&&null!==e&&"raw_data_hex"in e;s.extractTradeData=t=>(0,s.isBitcoinTrade)(t)?t.unsignedPsbtBase64:(0,s.isTronTrade)(t)?e.from(t.raw_data_hex,"hex").toString("base64"):"string"==typeof t?t:(0,s.isEvmTxData)(t)?t.data:""}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateQuoteResponse=s.QuoteResponseSchema=s.TronTradeDataSchema=s.BitcoinTradeDataSchema=s.TxDataSchema=s.QuoteSchema=s.StepSchema=s.ProtocolSchema=s.FeeDataSchema=s.validateSwapsTokenObject=s.validateFeatureFlagsResponse=s.PlatformConfigSchema=s.PriceImpactThresholdSchema=s.ChainConfigurationSchema=s.BridgeAssetSchema=s.truthyString=s.ActionTypes=s.FeatureId=s.FeeType=void 0;const n=e("@metamask/controller-utils"),r=e("@metamask/superstruct"),a=e("@metamask/utils");var i,o,c;!function(e){e.METABRIDGE="metabridge",e.REFUEL="refuel",e.TX_FEE="txFee"}(i||(s.FeeType=i={})),function(e){e.PERPS="perps"}(o||(s.FeatureId=o={})),function(e){e.BRIDGE="bridge",e.SWAP="swap",e.REFUEL="refuel"}(c||(s.ActionTypes=c={}));const d=(0,r.define)("HexAddress",e=>(0,n.isValidHexAddress)(e,{allowNonPrefixed:!1})),l=(0,r.define)("HexString",e=>(0,a.isStrictHexString)(e)),u=(0,r.define)("VersionString",e=>"string"==typeof e&&/^(\d+\.*){2}\d+$/u.test(e)&&3===e.split(".").length);s.truthyString=e=>Boolean(e?.length);const m=(0,r.pattern)((0,r.string)(),/^\d+$/u),h=(0,r.number)();s.BridgeAssetSchema=(0,r.type)({chainId:h,address:(0,r.string)(),assetId:a.CaipAssetTypeStruct,symbol:(0,r.string)(),name:(0,r.string)(),decimals:(0,r.number)(),icon:(0,r.optional)((0,r.nullable)((0,r.string)())),iconUrl:(0,r.optional)((0,r.nullable)((0,r.string)()))});const p=(0,r.type)({standard:(0,r.record)((0,r.string)(),(0,r.string)()),other:(0,r.record)((0,r.string)(),(0,r.string)())});s.ChainConfigurationSchema=(0,r.type)({isActiveSrc:(0,r.boolean)(),isActiveDest:(0,r.boolean)(),refreshRate:(0,r.optional)((0,r.number)()),topAssets:(0,r.optional)((0,r.array)((0,r.string)())),stablecoins:(0,r.optional)((0,r.array)((0,r.string)())),isUnifiedUIEnabled:(0,r.optional)((0,r.boolean)()),isSingleSwapBridgeButtonEnabled:(0,r.optional)((0,r.boolean)()),isGaslessSwapEnabled:(0,r.optional)((0,r.boolean)()),noFeeAssets:(0,r.optional)((0,r.array)((0,r.string)())),defaultPairs:(0,r.optional)(p)}),s.PriceImpactThresholdSchema=(0,r.type)({gasless:(0,r.number)(),normal:(0,r.number)()});const f=(0,r.type)({aggIds:(0,r.optional)((0,r.array)((0,r.string)())),bridgeIds:(0,r.optional)((0,r.array)((0,r.string)())),fee:(0,r.optional)((0,r.number)())}),g=(0,r.enums)(Object.values(o));s.PlatformConfigSchema=(0,r.type)({priceImpactThreshold:(0,r.optional)(s.PriceImpactThresholdSchema),quoteRequestOverrides:(0,r.optional)((0,r.record)(g,(0,r.optional)(f))),minimumVersion:(0,r.string)(),refreshRate:(0,r.number)(),maxRefreshCount:(0,r.number)(),support:(0,r.boolean)(),chains:(0,r.record)((0,r.string)(),s.ChainConfigurationSchema),bip44DefaultPairs:(0,r.optional)((0,r.record)((0,r.string)(),(0,r.optional)(p))),sse:(0,r.optional)((0,r.type)({enabled:(0,r.boolean)(),minimumVersion:u}))});s.validateFeatureFlagsResponse=e=>(0,r.is)(e,s.PlatformConfigSchema);s.validateSwapsTokenObject=e=>(0,r.is)(e,s.BridgeAssetSchema),s.FeeDataSchema=(0,r.type)({amount:m,asset:s.BridgeAssetSchema}),s.ProtocolSchema=(0,r.type)({name:(0,r.string)(),displayName:(0,r.optional)((0,r.string)()),icon:(0,r.optional)((0,r.string)())}),s.StepSchema=(0,r.type)({action:(0,r.enums)(Object.values(c)),srcChainId:h,destChainId:(0,r.optional)(h),srcAsset:s.BridgeAssetSchema,destAsset:s.BridgeAssetSchema,srcAmount:(0,r.string)(),destAmount:(0,r.string)(),protocol:s.ProtocolSchema});const k=s.StepSchema;s.QuoteSchema=(0,r.type)({requestId:(0,r.string)(),srcChainId:h,srcAsset:s.BridgeAssetSchema,srcTokenAmount:(0,r.string)(),destChainId:h,destAsset:s.BridgeAssetSchema,destTokenAmount:(0,r.string)(),minDestTokenAmount:(0,r.string)(),feeData:(0,r.type)({[i.METABRIDGE]:s.FeeDataSchema,[i.TX_FEE]:(0,r.optional)((0,r.intersection)([s.FeeDataSchema,(0,r.type)({maxFeePerGas:(0,r.string)(),maxPriorityFeePerGas:(0,r.string)()})]))}),gasIncluded:(0,r.optional)((0,r.boolean)()),gasIncluded7702:(0,r.optional)((0,r.boolean)()),bridgeId:(0,r.string)(),bridges:(0,r.array)((0,r.string)()),steps:(0,r.array)(s.StepSchema),refuel:(0,r.optional)(k),priceData:(0,r.optional)((0,r.type)({totalFromAmountUsd:(0,r.optional)((0,r.string)()),totalToAmountUsd:(0,r.optional)((0,r.string)()),priceImpact:(0,r.optional)((0,r.string)()),totalFeeAmountUsd:(0,r.optional)((0,r.string)())})),gasSponsored:(0,r.optional)((0,r.boolean)())}),s.TxDataSchema=(0,r.type)({chainId:(0,r.number)(),to:d,from:d,value:l,data:l,gasLimit:(0,r.nullable)((0,r.number)()),effectiveGas:(0,r.optional)((0,r.number)())}),s.BitcoinTradeDataSchema=(0,r.type)({unsignedPsbtBase64:(0,r.string)(),inputsToSign:(0,r.nullable)((0,r.array)((0,r.type)({})))}),s.TronTradeDataSchema=(0,r.type)({raw_data_hex:(0,r.string)(),visible:(0,r.optional)((0,r.boolean)()),raw_data:(0,r.optional)((0,r.nullable)((0,r.type)({contract:(0,r.optional)((0,r.array)((0,r.type)({type:(0,r.optional)((0,r.string)())})))})))}),s.QuoteResponseSchema=(0,r.type)({quote:s.QuoteSchema,estimatedProcessingTimeInSeconds:(0,r.number)(),approval:(0,r.optional)((0,r.union)([s.TxDataSchema,s.TronTradeDataSchema])),trade:(0,r.union)([s.TxDataSchema,s.BitcoinTradeDataSchema,s.TronTradeDataSchema,(0,r.string)()])});s.validateQuoteResponse=e=>((0,r.assert)(e,s.QuoteResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/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,r=Math.ceil,a=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",c=1e14,d=14,l=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function f(e){for(var t,s,n=1,r=e.length,a=e[0]+"";n<r;){for(t=e[n++]+"",s=d-t.length;s--;t="0"+t);a+=t}for(r=a.length;48===a.charCodeAt(--r););return a.slice(0,r+1||1)}function g(e,t){var s,n,r=e.c,a=t.c,i=e.s,o=t.s,c=e.e,d=t.e;if(!i||!o)return null;if(s=r&&!r[0],n=a&&!a[0],s||n)return s?n?0:-o:i;if(i!=o)return i;if(s=i<0,n=c==d,!r||!a)return n?0:!r^s?1:-1;if(!n)return c>d^s?1:-1;for(o=(c=r.length)<(d=a.length)?c:d,i=0;i<o;i++)if(r[i]!=a[i])return r[i]>a[i]^s?1:-1;return c==d?0:c>d^s?1:-1}function k(e,t,s,n){if(e<t||e>s||e!==a(e))throw Error(i+(n||"Argument")+("number"==typeof e?e<t||e>s?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return p(e.e/d)==t&&e.c[t]%2!=0}function _(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function b(e,t,s){var n,r;if(t<0){for(r=s+".";++t;r+=s);e=r+e}else if(++t>(n=e.length)){for(r=s,t-=n;--t;r+=s);e+=r}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var s,y,A,v,E,S,x,T,I,C,j=W.prototype={constructor:W,toString:null,valueOf:null},P=new W(1),N=20,D=4,O=-7,M=21,R=-1e7,B=1e7,L=!1,F=1,U=0,G={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},H="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function W(e,t){var s,r,i,c,u,m,h,p,f=this;if(!(f instanceof W))return new W(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>B?f.c=f.e=null:e.e<R?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((m="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,u=e;u>=10;u/=10,c++);return void(c>B?f.c=f.e=null:(f.e=c,f.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return A(f,p,m);f.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(u=p.search(/e/i))>0?(c<0&&(c=u),c+=+p.slice(u+1),p=p.substring(0,u)):c<0&&(c=p.length)}else{if(k(t,2,H.length,"Base"),10==t&&q)return Y(f=new W(e),N+f.e+1,D);if(p=String(e),m="number"==typeof e){if(0*e!=0)return A(f,p,m,t);if(f.s=1/e<0?(p=p.slice(1),-1):1,W.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else f.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(s=H.slice(0,t),c=u=0,h=p.length;u<h;u++)if(s.indexOf(r=p.charAt(u))<0){if("."==r){if(u>c){c=h;continue}}else if(!i&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){i=!0,u=-1,c=0;continue}return A(f,String(e),m,t)}m=!1,(c=(p=y(p,t,10,f.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(u=0;48===p.charCodeAt(u);u++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(u,++h)){if(h-=u,m&&W.DEBUG&&h>15&&(e>l||e!==a(e)))throw Error(o+f.s*e);if((c=c-u-1)>B)f.c=f.e=null;else if(c<R)f.c=[f.e=0];else{if(f.e=c,f.c=[],u=(c+1)%d,c<0&&(u+=d),u<h){for(u&&f.c.push(+p.slice(0,u)),h-=d;u<h;)f.c.push(+p.slice(u,u+=d));u=d-(p=p.slice(u)).length}else u-=h;for(;u--;p+="0");f.c.push(+p)}}else f.c=[f.e=0]}function $(e,t,s,n){var r,a,i,o,c;if(null==s?s=D:k(s,0,8),!e.c)return e.toString();if(r=e.c[0],i=e.e,null==t)c=f(e.c),c=1==n||2==n&&(i<=O||i>=M)?_(c,i):b(c,i,"0");else if(a=(e=Y(new W(e),t,s)).e,o=(c=f(e.c)).length,1==n||2==n&&(t<=a||a<=O)){for(;o<t;c+="0",o++);c=_(c,a)}else if(t-=i,c=b(c,a,"0"),a+1>o){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=a-o)>0)for(a+1==o&&(c+=".");t--;c+="0");return e.s<0&&r?"-"+c:c}function V(e,t){for(var s,n,r=1,a=new W(e[0]);r<e.length;r++)(!(n=new W(e[r])).s||(s=g(a,n))===t||0===s&&a.s===t)&&(a=n);return a}function K(e,t,s){for(var n=1,r=t.length;!t[--r];t.pop());for(r=t[0];r>=10;r/=10,n++);return(s=n+s*d-1)>B?e.c=e.e=null:s<R?e.c=[e.e=0]:(e.e=s,e.c=t),e}function Y(e,t,s,n){var i,o,l,m,h,p,f,g=e.c,k=u;if(g){e:{for(i=1,m=g[0];m>=10;m/=10,i++);if((o=t-i)<0)o+=d,l=t,h=g[p=0],f=a(h/k[i-l-1]%10);else if((p=r((o+1)/d))>=g.length){if(!n)break e;for(;g.length<=p;g.push(0));h=f=0,i=1,l=(o%=d)-d+1}else{for(h=m=g[p],i=1;m>=10;m/=10,i++);f=(l=(o%=d)-d+i)<0?0:a(h/k[i-l-1]%10)}if(n=n||t<0||null!=g[p+1]||(l<0?h:h%k[i-l-1]),n=s<4?(f||n)&&(0==s||s==(e.s<0?3:2)):f>5||5==f&&(4==s||n||6==s&&(o>0?l>0?h/k[i-l]:0:g[p-1])%10&1||s==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=k[(d-t%d)%d],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=p,m=1,p--):(g.length=p+1,m=k[d-o],g[p]=l>0?a(h/k[i-l]%k[l])*m:0),n)for(;;){if(0==p){for(o=1,l=g[0];l>=10;l/=10,o++);for(l=g[0]+=m,m=1;l>=10;l/=10,m++);o!=m&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[p]+=m,g[p]!=c)break;g[p--]=0,m=1}for(o=g.length;0===g[--o];g.pop());}e.e>B?e.c=e.e=null:e.e<R&&(e.c=[e.e=0])}return e}function z(e){var t,s=e.e;return null===s?e.toString():(t=f(e.c),t=s<=O||s>=M?_(t,s):b(t,s,"0"),e.s<0?"-"+t:t)}return W.clone=e,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(e){var t,s;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(s=e[t],0,h,t),N=s),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(s=e[t],0,8,t),D=s),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((s=e[t])&&s.pop?(k(s[0],-h,0,t),k(s[1],0,h,t),O=s[0],M=s[1]):(k(s,-h,h,t),O=-(M=s<0?-s:s))),e.hasOwnProperty(t="RANGE"))if((s=e[t])&&s.pop)k(s[0],-h,-1,t),k(s[1],1,h,t),R=s[0],B=s[1];else{if(k(s,-h,h,t),!s)throw Error(i+t+" cannot be zero: "+s);R=-(B=s<0?-s:s)}if(e.hasOwnProperty(t="CRYPTO")){if((s=e[t])!==!!s)throw Error(i+t+" not true or false: "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!s,Error(i+"crypto unavailable");L=s}else L=s}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(s=e[t],0,9,t),F=s),e.hasOwnProperty(t="POW_PRECISION")&&(k(s=e[t],0,h,t),U=s),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(s=e[t]))throw Error(i+t+" not an object: "+s);G=s}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(s=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(s))throw Error(i+t+" invalid: "+s);q="0123456789"==s.slice(0,10),H=s}}return{DECIMAL_PLACES:N,ROUNDING_MODE:D,EXPONENTIAL_AT:[O,M],RANGE:[R,B],CRYPTO:L,MODULO_MODE:F,POW_PRECISION:U,FORMAT:G,ALPHABET:H}},W.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!W.DEBUG)return!0;var t,s,n=e.c,r=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&r>=-h&&r<=h&&r===a(r)){if(0===n[0]){if(0===r&&1===n.length)return!0;break e}if((t=(r+1)%d)<1&&(t+=d),String(n[0]).length==t){for(t=0;t<n.length;t++)if((s=n[t])<0||s>=c||s!==a(s))break e;if(0!==s)return!0}}}else if(null===n&&null===r&&(null===o||1===o||-1===o))return!0;throw Error(i+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return V(arguments,-1)},W.minimum=W.min=function(){return V(arguments,1)},W.random=(v=9007199254740992,E=Math.random()*v&2097151?function(){return a(Math.random()*v)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,s,n,o,c,l=0,m=[],p=new W(P);if(null==e?e=N:k(e,0,h),o=r(e/d),L)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));l<o;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),t[l]=s[0],t[l+1]=s[1]):(m.push(c%1e14),l+=2);l=o/2}else{if(!crypto.randomBytes)throw L=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(o*=7);l<o;)(c=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(m.push(c%1e14),l+=7);l=o/7}if(!L)for(;l<o;)(c=E())<9e15&&(m[l++]=c%1e14);for(o=m[--l],e%=d,o&&e&&(c=u[d-e],m[l]=a(o/c)*c);0===m[l];m.pop(),l--);if(l<0)m=[n=0];else{for(n=-1;0===m[0];m.splice(0,1),n-=d);for(l=1,c=m[0];c>=10;c/=10,l++);l<d&&(n-=d-l)}return p.e=n,p.c=m,p}),W.sum=function(){for(var e=1,t=arguments,s=new W(t[0]);e<t.length;)s=s.plus(t[e++]);return s},y=function(){var e="0123456789";function t(e,t,s,n){for(var r,a,i=[0],o=0,c=e.length;o<c;){for(a=i.length;a--;i[a]*=t);for(i[0]+=n.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>s-1&&(null==i[r+1]&&(i[r+1]=0),i[r+1]+=i[r]/s|0,i[r]%=s)}return i.reverse()}return function(n,r,a,i,o){var c,d,l,u,m,h,p,g,k=n.indexOf("."),w=N,_=D;for(k>=0&&(u=U,U=0,n=n.replace(".",""),h=(g=new W(r)).pow(n.length-k),U=u,g.c=t(b(f(h.c),h.e,"0"),10,a,e),g.e=g.c.length),l=u=(p=t(n,r,a,o?(c=H,e):(c=e,H))).length;0==p[--u];p.pop());if(!p[0])return c.charAt(0);if(k<0?--l:(h.c=p,h.e=l,h.s=i,p=(h=s(h,g,w,_,a)).c,m=h.r,l=h.e),k=p[d=l+w+1],u=a/2,m=m||d<0||null!=p[d+1],m=_<4?(null!=k||m)&&(0==_||_==(h.s<0?3:2)):k>u||k==u&&(4==_||m||6==_&&1&p[d-1]||_==(h.s<0?8:7)),d<1||!p[0])n=m?b(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(p.length=d,m)for(--a;++p[--d]>a;)p[d]=0,d||(++l,p=[1].concat(p));for(u=p.length;!p[--u];);for(k=0,n="";k<=u;n+=c.charAt(p[k++]));n=b(n,l,c.charAt(0))}return n}}(),s=function(){function e(e,t,s){var n,r,a,i,o=0,c=e.length,d=t%m,l=t/m|0;for(e=e.slice();c--;)o=((r=d*(a=e[c]%m)+(n=l*a+(i=e[c]/m|0)*d)%m*m+o)/s|0)+(n/m|0)+l*i,e[c]=r%s;return o&&(e=[o].concat(e)),e}function t(e,t,s,n){var r,a;if(s!=n)a=s>n?1:-1;else for(r=a=0;r<s;r++)if(e[r]!=t[r]){a=e[r]>t[r]?1:-1;break}return a}function s(e,t,s,n){for(var r=0;s--;)e[s]-=r,r=e[s]<t[s]?1:0,e[s]=r*n+e[s]-t[s];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,r,i,o,l){var u,m,h,f,g,k,w,_,b,y,A,v,E,S,x,T,I,C=n.s==r.s?1:-1,j=n.c,P=r.c;if(!(j&&j[0]&&P&&P[0]))return new W(n.s&&r.s&&(j?!P||j[0]!=P[0]:P)?j&&0==j[0]||!P?0*C:C/0:NaN);for(b=(_=new W(C)).c=[],C=i+(m=n.e-r.e)+1,l||(l=c,m=p(n.e/d)-p(r.e/d),C=C/d|0),h=0;P[h]==(j[h]||0);h++);if(P[h]>(j[h]||0)&&m--,C<0)b.push(1),f=!0;else{for(S=j.length,T=P.length,h=0,C+=2,(g=a(l/(P[0]+1)))>1&&(P=e(P,g,l),j=e(j,g,l),T=P.length,S=j.length),E=T,A=(y=j.slice(0,T)).length;A<T;y[A++]=0);I=P.slice(),I=[0].concat(I),x=P[0],P[1]>=l/2&&x++;do{if(g=0,(u=t(P,y,T,A))<0){if(v=y[0],T!=A&&(v=v*l+(y[1]||0)),(g=a(v/x))>1)for(g>=l&&(g=l-1),w=(k=e(P,g,l)).length,A=y.length;1==t(k,y,w,A);)g--,s(k,T<w?I:P,w,l),w=k.length,u=1;else 0==g&&(u=g=1),w=(k=P.slice()).length;if(w<A&&(k=[0].concat(k)),s(y,k,A,l),A=y.length,-1==u)for(;t(P,y,T,A)<1;)g++,s(y,T<A?I:P,A,l),A=y.length}else 0===u&&(g++,y=[0]);b[h++]=g,y[0]?y[A++]=j[E]||0:(y=[j[E]],A=1)}while((E++<S||null!=y[0])&&C--);f=null!=y[0],b[0]||b.splice(0,1)}if(l==c){for(h=1,C=b[0];C>=10;C/=10,h++);Y(_,i+(_.e=h+m*d-1)+1,o,f)}else _.e=m,_.r=+f;return _}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,A=function(e,t,s,n){var r,a=s?t:t.replace(C,"");if(I.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!s&&(a=a.replace(S,function(e,t,s){return r="x"==(s=s.toLowerCase())?16:"b"==s?2:8,n&&n!=r?e:t}),n&&(r=n,a=a.replace(x,"$1").replace(T,"0.$1")),t!=a))return new W(a,r);if(W.DEBUG)throw Error(i+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},j.absoluteValue=j.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},j.comparedTo=function(e,t){return g(this,new W(e,t))},j.decimalPlaces=j.dp=function(e,t){var s,n,r,a=this;if(null!=e)return k(e,0,h),null==t?t=D:k(t,0,8),Y(new W(a),e+a.e+1,t);if(!(s=a.c))return null;if(n=((r=s.length-1)-p(this.e/d))*d,r=s[r])for(;r%10==0;r/=10,n--);return n<0&&(n=0),n},j.dividedBy=j.div=function(e,t){return s(this,new W(e,t),N,D)},j.dividedToIntegerBy=j.idiv=function(e,t){return s(this,new W(e,t),0,1)},j.exponentiatedBy=j.pow=function(e,t){var s,n,o,c,l,u,m,h,p=this;if((e=new W(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+z(e));if(null!=t&&(t=new W(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new W(Math.pow(+z(p),l?e.s*(2-w(e)):+z(e))),t?h.mod(t):h;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new W(NaN);(n=!u&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&w(e)?-0:0,p.e>-1&&(c=1/c),new W(u?1/c:c);U&&(c=r(U/d+2))}for(l?(s=new W(.5),u&&(e.s=1),m=w(e)):m=(o=Math.abs(+z(e)))%2,h=new W(P);;){if(m){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(o){if(0===(o=a(o/2)))break;m=o%2}else if(Y(e=e.times(s),e.e+1,1),e.e>14)m=w(e);else{if(0===(o=+z(e)))break;m=o%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):n&&(p=p.mod(t))}return n?h:(u&&(h=P.div(h)),t?h.mod(t):c?Y(h,U,D,undefined):h)},j.integerValue=function(e){var t=new W(this);return null==e?e=D:k(e,0,8),Y(t,t.e+1,e)},j.isEqualTo=j.eq=function(e,t){return 0===g(this,new W(e,t))},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(e,t){return g(this,new W(e,t))>0},j.isGreaterThanOrEqualTo=j.gte=function(e,t){return 1===(t=g(this,new W(e,t)))||0===t},j.isInteger=function(){return!!this.c&&p(this.e/d)>this.c.length-2},j.isLessThan=j.lt=function(e,t){return g(this,new W(e,t))<0},j.isLessThanOrEqualTo=j.lte=function(e,t){return-1===(t=g(this,new W(e,t)))||0===t},j.isNaN=function(){return!this.s},j.isNegative=function(){return this.s<0},j.isPositive=function(){return this.s>0},j.isZero=function(){return!!this.c&&0==this.c[0]},j.minus=function(e,t){var s,n,r,a,i=this,o=i.s;if(t=(e=new W(e,t)).s,!o||!t)return new W(NaN);if(o!=t)return e.s=-t,i.plus(e);var l=i.e/d,u=e.e/d,m=i.c,h=e.c;if(!l||!u){if(!m||!h)return m?(e.s=-t,e):new W(h?i:NaN);if(!m[0]||!h[0])return h[0]?(e.s=-t,e):new W(m[0]?i:3==D?-0:0)}if(l=p(l),u=p(u),m=m.slice(),o=l-u){for((a=o<0)?(o=-o,r=m):(u=l,r=h),r.reverse(),t=o;t--;r.push(0));r.reverse()}else for(n=(a=(o=m.length)<(t=h.length))?o:t,o=t=0;t<n;t++)if(m[t]!=h[t]){a=m[t]<h[t];break}if(a&&(r=m,m=h,h=r,e.s=-e.s),(t=(n=h.length)-(s=m.length))>0)for(;t--;m[s++]=0);for(t=c-1;n>o;){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),--u);return m[0]?K(e,m,u):(e.s=3==D?-1:1,e.c=[e.e=0],e)},j.modulo=j.mod=function(e,t){var n,r,a=this;return e=new W(e,t),!a.c||!e.s||e.c&&!e.c[0]?new W(NaN):!e.c||a.c&&!a.c[0]?new W(a):(9==F?(r=e.s,e.s=1,n=s(a,e,0,3),e.s=r,n.s*=r):n=s(a,e,0,F),(e=a.minus(n.times(e))).c[0]||1!=F||(e.s=a.s),e)},j.multipliedBy=j.times=function(e,t){var s,n,r,a,i,o,l,u,h,f,g,k,w,_,b,y=this,A=y.c,v=(e=new W(e,t)).c;if(!(A&&v&&A[0]&&v[0]))return!y.s||!e.s||A&&!A[0]&&!v||v&&!v[0]&&!A?e.c=e.e=e.s=null:(e.s*=y.s,A&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(y.e/d)+p(e.e/d),e.s*=y.s,(l=A.length)<(f=v.length)&&(w=A,A=v,v=w,r=l,l=f,f=r),r=l+f,w=[];r--;w.push(0));for(_=c,b=m,r=f;--r>=0;){for(s=0,g=v[r]%b,k=v[r]/b|0,a=r+(i=l);a>r;)s=((u=g*(u=A[--i]%b)+(o=k*u+(h=A[i]/b|0)*g)%b*b+w[a]+s)/_|0)+(o/b|0)+k*h,w[a--]=u%_;w[a]=s}return s?++n:w.splice(0,1),K(e,w,n)},j.negated=function(){var e=new W(this);return e.s=-e.s||null,e},j.plus=function(e,t){var s,n=this,r=n.s;if(t=(e=new W(e,t)).s,!r||!t)return new W(NaN);if(r!=t)return e.s=-t,n.minus(e);var a=n.e/d,i=e.e/d,o=n.c,l=e.c;if(!a||!i){if(!o||!l)return new W(r/0);if(!o[0]||!l[0])return l[0]?e:new W(o[0]?n:0*r)}if(a=p(a),i=p(i),o=o.slice(),r=a-i){for(r>0?(i=a,s=l):(r=-r,s=o),s.reverse();r--;s.push(0));s.reverse()}for((r=o.length)-(t=l.length)<0&&(s=l,l=o,o=s,t=r),r=0;t;)r=(o[--t]=o[t]+l[t]+r)/c|0,o[t]=c===o[t]?0:o[t]%c;return r&&(o=[r].concat(o),++i),K(e,o,i)},j.precision=j.sd=function(e,t){var s,n,r,a=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=D:k(t,0,8),Y(new W(a),e,t);if(!(s=a.c))return null;if(n=(r=s.length-1)*d+1,r=s[r]){for(;r%10==0;r/=10,n--);for(r=s[0];r>=10;r/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},j.shiftedBy=function(e){return k(e,-9007199254740991,l),this.times("1e"+e)},j.squareRoot=j.sqrt=function(){var e,t,n,r,a,i=this,o=i.c,c=i.s,d=i.e,l=N+4,u=new W("0.5");if(1!==c||!o||!o[0])return new W(!c||c<0&&(!o||o[0])?NaN:o?i:1/0);if(0==(c=Math.sqrt(+z(i)))||c==1/0?(((t=f(o)).length+d)%2==0&&(t+="0"),c=Math.sqrt(+t),d=p((d+1)/2)-(d<0||d%2),n=new W(t=c==1/0?"5e"+d:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+d)):n=new W(c+""),n.c[0])for((c=(d=n.e)+l)<3&&(c=0);;)if(a=n,n=u.times(a.plus(s(i,a,l,1))),f(a.c).slice(0,c)===(t=f(n.c)).slice(0,c)){if(n.e<d&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(r||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Y(n,n.e+N+2,1),e=!n.times(n).eq(i));break}if(!r&&(Y(a,a.e+N+2,0),a.times(a).eq(i))){n=a;break}l+=4,c+=4,r=1}return Y(n,n.e+N+1,D,e)},j.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),$(this,e,t,1)},j.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),$(this,e,t)},j.toFormat=function(e,t,s){var n,r=this;if(null==s)null!=e&&t&&"object"==typeof t?(s=t,t=null):e&&"object"==typeof e?(s=e,e=t=null):s=G;else if("object"!=typeof s)throw Error(i+"Argument not an object: "+s);if(n=r.toFixed(e,t),r.c){var a,o=n.split("."),c=+s.groupSize,d=+s.secondaryGroupSize,l=s.groupSeparator||"",u=o[0],m=o[1],h=r.s<0,p=h?u.slice(1):u,f=p.length;if(d&&(a=c,c=d,d=a,f-=a),c>0&&f>0){for(a=f%c||c,u=p.substr(0,a);a<f;a+=c)u+=l+p.substr(a,c);d>0&&(u+=l+p.slice(a)),h&&(u="-"+u)}n=m?u+(s.decimalSeparator||"")+((d=+s.fractionGroupSize)?m.replace(new RegExp("\\d{"+d+"}\\B","g"),"$&"+(s.fractionGroupSeparator||"")):m):u}return(s.prefix||"")+n+(s.suffix||"")},j.toFraction=function(e){var t,n,r,a,o,c,l,m,h,p,g,k,w=this,_=w.c;if(null!=e&&(!(l=new W(e)).isInteger()&&(l.c||1!==l.s)||l.lt(P)))throw Error(i+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+z(l));if(!_)return new W(w);for(t=new W(P),h=n=new W(P),r=m=new W(P),k=f(_),o=t.e=k.length-w.e-1,t.c[0]=u[(c=o%d)<0?d+c:c],e=!e||l.comparedTo(t)>0?o>0?t:h:l,c=B,B=1/0,l=new W(k),m.c[0]=0;p=s(l,t,0,1),1!=(a=n.plus(p.times(r))).comparedTo(e);)n=r,r=a,h=m.plus(p.times(a=h)),m=a,t=l.minus(p.times(a=t)),l=a;return a=s(e.minus(n),r,0,1),m=m.plus(a.times(h)),n=n.plus(a.times(r)),m.s=h.s=w.s,g=s(h,r,o*=2,D).minus(w).abs().comparedTo(s(m,n,o,D).minus(w).abs())<1?[h,r]:[m,n],B=c,g},j.toNumber=function(){return+z(this)},j.toPrecision=function(e,t){return null!=e&&k(e,1,h),$(this,e,t,2)},j.toString=function(e){var t,s=this,n=s.s,r=s.e;return null===r?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=r<=O||r>=M?_(f(s.c),r):b(f(s.c),r,"0"):10===e&&q?t=b(f((s=Y(new W(s),N+r+1,D)).c),s.e,"0"):(k(e,2,H.length,"Base"),t=y(b(f(s.c),r,"0"),10,e,n,!0)),n<0&&s.c[0]&&(t="-"+t)),t},j.valueOf=j.toJSON=function(){return z(this)},j._isBigNumber=!0,null!=t&&W.set(t),W}(),s.default=s.BigNumber=s,"function"==typeof define&&define.amd?define(function(){return s}):void 0!==t&&t.exports?t.exports=s:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=s)}(this)}}},{package:"@metamask/bridge-status-controller>bignumber.js",file:"node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/browser-passworder/dist/index.js",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(t){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.isVaultUpdated=s.updateVaultWithDetail=s.updateVault=s.generateSalt=s.serializeBufferForStorage=s.serializeBufferFromStorage=s.keyFromPassword=s.exportKey=s.importKey=s.decryptWithKey=s.decryptWithDetail=s.decrypt=s.encryptWithKey=s.encryptWithDetail=s.encrypt=void 0;const n=e("@metamask/utils"),r="jwk",a="AES-GCM",i="utf-8",o={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function d(e,t,s,n=g(),r=c){const a=s||await f(e,n,!1,r),i=await u(a,t);return i.salt=n,JSON.stringify(i)}async function l(e,t,s=g(),n=c){const r=await f(e,s,!0,n),a=await p(r);return{vault:await d(e,t,r,s),exportedKeyString:a}}async function u(e,s){const n=JSON.stringify(s),r=t.from(n,i),o=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=_(e),d=await globalThis.crypto.subtle.encrypt({name:a,iv:o},c,r),l=new Uint8Array(d),u=t.from(o).toString("base64"),m={data:t.from(l).toString("base64"),iv:u};return k(e)&&(m.keyMetadata=e.derivationOptions),m}async function m(e,t,s){const n=JSON.parse(t),{salt:r,keyMetadata:a}=n,i=_(s||await f(e,r,!1,a));return await h(i,n)}async function h(e,s){const n=t.from(s.data,"base64"),r=t.from(s.iv,"base64"),o=_(e);let c;try{const e=await crypto.subtle.decrypt({name:a,iv:r},o,n),s=new Uint8Array(e),d=t.from(s).toString(i);c=JSON.parse(d)}catch(e){throw new Error("Incorrect password")}return c}async function p(e){return k(e)?JSON.stringify({key:await globalThis.crypto.subtle.exportKey(r,e.key),derivationOptions:e.derivationOptions}):JSON.stringify(await globalThis.crypto.subtle.exportKey(r,e))}async function f(e,s,n=!1,r=o){const c=t.from(e,i),d=t.from(s,"base64"),l=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),u=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:d,iterations:r.params.iterations,hash:"SHA-256"},l,{name:a,length:256},n,["encrypt","decrypt"]);return r?{key:u,derivationOptions:r}:u}function g(e=32){const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);return btoa(String.fromCharCode.apply(null,t))}function k(e){return(0,n.isPlainObject)(e)&&(0,n.hasProperty)(e,"key")&&(0,n.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&w(e.derivationOptions)}function w(e){return(0,n.isPlainObject)(e)&&(0,n.hasProperty)(e,"algorithm")&&(0,n.hasProperty)(e,"params")}function _(e){return k(e)?e.key:e}function b(e,t=c){const{keyMetadata:s}=JSON.parse(e);return w(s)&&s.algorithm===t.algorithm&&s.params.iterations===t.params.iterations}s.encrypt=d,s.encryptWithDetail=l,s.encryptWithKey=u,s.decrypt=m,s.decryptWithDetail=async function(e,t){const s=JSON.parse(t),{salt:n,keyMetadata:r}=s,a=await f(e,n,!0,r);return{exportedKeyString:await p(a),vault:await m(e,t,a),salt:n}},s.decryptWithKey=h,s.importKey=async function(e){const t=JSON.parse(e);return s=t,(0,n.isPlainObject)(s)&&(0,n.hasProperty)(s,"key")&&(0,n.hasProperty)(s,"derivationOptions")&&w(s.derivationOptions)?{key:await globalThis.crypto.subtle.importKey(r,t.key,a,!0,["encrypt","decrypt"]),derivationOptions:t.derivationOptions}:await globalThis.crypto.subtle.importKey(r,t,a,!0,["encrypt","decrypt"]);var s},s.exportKey=p,s.keyFromPassword=f,s.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,s=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const n=t.substr(e,2);s[e/2]=parseInt(n,16)}return s},s.serializeBufferForStorage=function(e){let t="0x";return e.forEach(e=>{t+=function(e){let t=e.toString(16);for(;t.length<2;)t=`0${t}`;return t}(e)}),t},s.generateSalt=g,s.updateVault=async function(e,t,s=c){return b(e,s)?e:d(t,await m(t,e),undefined,undefined,s)},s.updateVaultWithDetail=async function(e,t,s=c){return b(e.vault,s)?e:l(t,await m(t,e.vault),undefined,s)},s.isVaultUpdated=b}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/browser-passworder",file:"node_modules/@metamask/browser-passworder/dist/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},i=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.DelegationController=s.controllerName=void 0;const o=e("@metamask/base-controller"),c=e("@metamask/keyring-controller"),d=e("@metamask/utils"),l=e("./constants.cjs"),u=e("./utils.cjs");s.controllerName="DelegationController";const m={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends o.BaseController{constructor({messenger:e,state:t,hashDelegation:i,getDelegationEnvironment:o}){super({messenger:e,metadata:m,name:s.controllerName,state:{delegations:{},...t}}),n.set(this,void 0),r.set(this,void 0),a(this,n,i,"f"),a(this,r,o,"f")}async signDelegation(e){const{delegation:t,chainId:s}=e,{DelegationManager:n}=i(this,r,"f").call(this,s),a=(0,u.createTypedMessageParams)({chainId:(0,d.hexToNumber)(s),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:n});return await this.messenger.call("KeyringController:signTypedMessage",a,c.SignTypedDataVersion.V4)}store(e){const{entry:t}=e,s=i(this,n,"f").call(this,t.delegation);if(!(0,u.isHexEqual)(t.delegation.authority,l.ROOT_AUTHORITY)&&!this.state.delegations[t.delegation.authority])throw new Error("Invalid authority");this.update(e=>{e.delegations[s]=t})}list(e){const t=this.messenger.call("AccountsController:getSelectedAccount").address;let s=Object.values(this.state.delegations);e?.from&&(s=s.filter(t=>(0,u.isHexEqual)(t.delegation.delegator,e.from))),(!e?.from||e?.from&&!(0,u.isHexEqual)(e.from,t))&&(s=s.filter(e=>(0,u.isHexEqual)(e.delegation.delegate,t)));const n=e?.chainId;n&&(s=s.filter(e=>(0,u.isHexEqual)(e.chainId,n)));const r=e?.tags;return r&&r.length>0&&(s=s.filter(e=>r.every(t=>e.tags.includes(t)))),s}retrieve(e){return this.state.delegations[e]??null}chain(e){const t=[],s=this.retrieve(e);if(!s)return null;t.push(s);for(let e=s.delegation.authority;e!==l.ROOT_AUTHORITY;){const s=this.retrieve(e);if(!s)throw new Error("Invalid delegation chain");t.push(s),e=s.delegation.authority}return t}delete(e){if(!this.retrieve(e))return 0;const t=Object.entries(this.state.delegations),s=[e],n=[];for(;s.length>0;){const e=s.pop();t.filter(([t,s])=>s.delegation.authority===e).forEach(([e])=>{s.push(e)}),n.push(e)}return this.update(e=>{n.forEach(t=>{delete e.delegations[t]})}),n.length}}s.DelegationController=h,n=new WeakMap,r=new WeakMap}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SIGNABLE_DELEGATION_TYPED_DATA=s.ROOT_AUTHORITY=void 0,s.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";s.SIGNABLE_DELEGATION_TYPED_DATA={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Caveat:[{name:"enforcer",type:"address"},{name:"terms",type:"bytes"}],Delegation:[{name:"delegate",type:"address"},{name:"delegator",type:"address"},{name:"authority",type:"bytes32"},{name:"caveats",type:"Caveat[]"},{name:"salt",type:"uint256"}]}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/index.cjs",{"./DelegationController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DelegationController=void 0;var n=e("./DelegationController.cjs");Object.defineProperty(s,"DelegationController",{enumerable:!0,get:function(){return n.DelegationController}})}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createTypedMessageParams=s.toDelegationStruct=s.isHexEqual=void 0;const n=e("@metamask/utils"),r=e("./constants.cjs");s.isHexEqual=function(e,t){return e.toLowerCase()===t.toLowerCase()};s.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,n.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),s="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,n.getChecksumAddress)(e.delegate),delegator:(0,n.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:s,signature:e.signature}},s.createTypedMessageParams=function(e){const{chainId:t,from:n,delegation:a,verifyingContract:i}=e;return{data:{types:r.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:i},message:(0,s.toDelegationStruct)(a)},from:n}}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-deployments/dist/index.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0});var n={DelegationManager:"0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c",MultiSigDeleGatorImpl:"0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7",HybridDeleGatorImpl:"0x48dBe696A4D990079e039489bA2053B36E8FFEC4",EIP7702StatelessDeleGatorImpl:"0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B",AllowedCalldataEnforcer:"0xc2b0d624c1c4319760C96503BA27C347F3260f55",AllowedMethodsEnforcer:"0x2c21fD0Cb9DC8445CB3fb0DC5E7Bb0Aca01842B5",AllowedTargetsEnforcer:"0x7F20f61b1f09b08D970938F6fa563634d65c4EeB",BlockNumberEnforcer:"0x5d9818dF0AE3f66e9c3D0c5029DAF99d1823ca6c",DeployedEnforcer:"0x24ff2AA430D53a8CD6788018E902E098083dcCd2",ERC20BalanceChangeEnforcer:"0xcdF6aB796408598Cea671d79506d7D48E97a5437",ERC20TransferAmountEnforcer:"0xf100b0819427117EcF76Ed94B358B1A5b5C6D2Fc",ERC20PeriodTransferEnforcer:"0x474e3Ae7E169e940607cC624Da8A15Eb120139aB",ERC20StreamingEnforcer:"0x56c97aE02f233B29fa03502Ecc0457266d9be00e",ERC721BalanceChangeEnforcer:"0x8aFdf96eDBbe7e1eD3f5Cd89C7E084841e12A09e",ERC721TransferEnforcer:"0x3790e6B7233f779b09DA74C72b6e94813925b9aF",ERC1155BalanceChangeEnforcer:"0x63c322732695cAFbbD488Fc6937A0A7B66fC001A",ExactCalldataBatchEnforcer:"0x982FD5C86BBF425d7d1451f974192d4525113DfD",ExactCalldataEnforcer:"0x99F2e9bF15ce5eC84685604836F71aB835DBBdED",ExactExecutionBatchEnforcer:"0x1e141e455d08721Dd5BCDA1BaA6Ea5633Afd5017",ExactExecutionEnforcer:"0x146713078D39eCC1F5338309c28405ccf85Abfbb",IdEnforcer:"0xC8B5D93463c893401094cc70e66A206fb5987997",LimitedCallsEnforcer:"0x04658B29F6b82ed55274221a06Fc97D318E25416",NativeBalanceChangeEnforcer:"0xbD7B277507723490Cd50b12EaaFe87C616be6880",ArgsEqualityCheckEnforcer:"0x44B8C6ae3C304213c3e298495e12497Ed3E56E41",NativeTokenPaymentEnforcer:"0x4803a326ddED6dDBc60e659e5ed12d85c7582811",NativeTokenTransferAmountEnforcer:"0xF71af580b9c3078fbc2BBF16FbB8EEd82b330320",NativeTokenStreamingEnforcer:"0xD10b97905a320b13a0608f7E9cC506b56747df19",NativeTokenPeriodTransferEnforcer:"0x9BC0FAf4Aca5AE429F4c06aEEaC517520CB16BD9",NonceEnforcer:"0xDE4f2FAC4B3D87A1d9953Ca5FC09FCa7F366254f",OwnershipTransferEnforcer:"0x7EEf9734E7092032B5C56310Eb9BbD1f4A524681",RedeemerEnforcer:"0xE144b0b2618071B4E56f746313528a669c7E65c5",SpecificActionERC20TransferBatchEnforcer:"0x6649b61c873F6F9686A1E1ae9ee98aC380c7bA13",TimestampEnforcer:"0x1046bb45C8d673d4ea75321280DB34899413c069",ValueLteEnforcer:"0x92Bf12322527cAA612fd31a0e810472BBB106A8F",MultiTokenPeriodEnforcer:"0xFB2f1a9BD76d3701B730E5d69C3219D42D80eBb7"},r={DelegationManager:"0x56D56e07e3d6Ee5a24e30203A37a0a460f42D7A3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0xd1f421EDbA5e3FA9efe3874827114b20C5BEC40C",HybridDeleGatorImpl:"0x941f3a016F8726d5643Ce62452d0D78492D42b42",AllowedCalldataEnforcer:"0xff71d60f3208469cBCE0859717B5198042DCB3F3",AllowedMethodsEnforcer:"0xe32C2561792e8446Abe73B9f557B881C13906186",AllowedTargetsEnforcer:"0x06aaE4c67EEA95277c46Bf79b1583d4a01772D22",BlockNumberEnforcer:"0x8E470D2Ae278457b42d2405E0B8Cd4BE21Ed9045",DeployedEnforcer:"0xf9088f013dBD9ebb7Cebd66fEB48253c6Ac5a820",ERC20BalanceGteEnforcer:"0xB7B6f32ec6343261D814e55Ed8C5925d91Cab861",ERC20TransferAmountEnforcer:"0x9A069b18032B31429A363AeCFb1B6A0564b44471",IdEnforcer:"0x91015c3b9D9523966eD2399885e5Df7A567f916c",LimitedCallsEnforcer:"0xe694bFfffEA3E85923b1210b37e6a0175e910863",NonceEnforcer:"0xE83BCFD8bBE672A96747e831050a91cf44F4F87A",TimestampEnforcer:"0x550FdD13eEBC1f22ea2a2480024BacBF0Ad7e5CE",ValueLteEnforcer:"0xBE32a6DB7471F63BB168C088c57Db01AfAe87967",NativeTokenTransferAmountEnforcer:"0x5eD3833d7B957A8DB8A461c3AF2d668Ec25382E0",NativeBalanceGteEnforcer:"0x376a98860E210DdEda3689fb39565592c563cB0A",ArgsEqualityCheckEnforcer:"0x7378dE585998d3E18Ce147867C335C25B3dB8Ee5",NativeTokenPaymentEnforcer:"0x87Fe18EbF99e42fcE8A03a25F1d20E119407f8e7",RedeemerEnforcer:"0x926672b130D1EF60A9d6b11D2048d121b30f40C1"},a={DelegationManager:"0xbe4138886cb096bdc1b930f2f0ca7892aa234d78",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0x11f555af5844d85bfcf5d61d2a22866527eb585a",HybridDeleGatorImpl:"0xd6edd1256deccb2b06bdecef92dc16bcf26e531b",AllowedCalldataEnforcer:"0x48db3835a873d64a4af2c09f014052407c003bd7",AllowedMethodsEnforcer:"0xfd731951bf1c52afccee3e6f14ab656475b76dd4",AllowedTargetsEnforcer:"0xbc8673c0afa52d86d991c06881e55b2966920564",BlockNumberEnforcer:"0xc15faffa0d879b9263c15a46ce31eacfa2e0e8ae",DeployedEnforcer:"0x5accb9559b56a6c1e3f90e342c85c42d93720d43",ERC20BalanceGteEnforcer:"0xb5d6b1ec6d868a3bae5b7f48178eaa2686a7a087",ERC20TransferAmountEnforcer:"0x92ac423b9c111962179a6242e1adb58d02c103be",IdEnforcer:"0x34152d9f3f8f74338d50703e780389e829b4abac",LimitedCallsEnforcer:"0x4b3adad4a328bee8ba17b86074d92fe7372180cd",NonceEnforcer:"0x2f32ff3fc3086d7f63f16fe8d0065390d460b40d",TimestampEnforcer:"0x78e05f779490c24bf3bfa135b4112e7003b321cd",ValueLteEnforcer:"0xfc20ede0a1132e839fbda9d7ed3904ff3c89540f"},i={arbitrum:42161,arbitrumNova:42170,base:8453,berachain:80094,bsc:56,gnosis:100,ink:57073,linea:59144,mainnet:1,monad:143,optimism:10,polygon:137,sei:1329,sonic:146,unichain:130,bscTestnet:97,arbitrumSepolia:421614,baseSepolia:84532,berachainBepolia:80069,chiado:10200,citreaTestnet:5115,hoodiTestnet:560048,inkSepolia:763373,lineaSepolia:59141,megaEthTestnet:6342,monadTestnet:10143,optimismSepolia:11155420,polygonAmoy:80002,seiTestnet:1328,sepolia:11155111,sonicTestnet:14601,unichainSepolia:1301,lineaGoerli:59140},o={"1.0.0":{[i.optimism]:a,[i.polygon]:a,[i.base]:a,[i.arbitrum]:a,[i.linea]:a,[i.sepolia]:{...a,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"},[i.lineaSepolia]:{...a,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"}},"1.1.0":{[i.arbitrum]:r,[i.base]:r,[i.linea]:r,[i.optimism]:r,[i.polygon]:r,[i.sepolia]:r,[i.lineaSepolia]:r,[i.baseSepolia]:{...r,SimpleFactory:"0xE8eA1DE8D6AfE400B7C8C1A81B7C29B7876b4d02"}},"1.3.0":{[i.mainnet]:n,[i.polygon]:n,[i.bsc]:n,[i.optimism]:n,[i.arbitrum]:n,[i.ink]:n,[i.linea]:n,[i.base]:n,[i.gnosis]:n,[i.berachain]:n,[i.unichain]:n,[i.arbitrumNova]:n,[i.sei]:n,[i.sonic]:n,[i.monad]:n,[i.bscTestnet]:n,[i.citreaTestnet]:n,[i.megaEthTestnet]:n,[i.chiado]:n,[i.lineaSepolia]:n,[i.berachainBepolia]:n,[i.baseSepolia]:n,[i.arbitrumSepolia]:n,[i.sepolia]:n,[i.optimismSepolia]:n,[i.unichainSepolia]:n,[i.polygonAmoy]:n,[i.inkSepolia]:n,[i.monadTestnet]:n,[i.seiTestnet]:n,[i.sonicTestnet]:n,[i.hoodiTestnet]:n}};s.CHAIN_ID=i,s.DELEGATOR_CONTRACTS=o}}},{package:"@metamask/delegation-deployments",file:"node_modules/@metamask/delegation-deployments/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.GetCallsStatusCode=s.EIP7682ErrorCode=s.EIP5792ErrorCode=s.SupportedCapabilities=s.MessageType=s.KEYRING_TYPES_SUPPORTING_7702=s.VERSION=void 0;const n=e("@metamask/keyring-controller");var r,a,i,o,c;s.VERSION="2.0.0",s.KEYRING_TYPES_SUPPORTING_7702=[n.KeyringTypes.hd,n.KeyringTypes.simple],function(e){e.SendTransaction="eth_sendTransaction"}(r||(s.MessageType=r={})),function(e){e.AuxiliaryFunds="auxiliaryFunds"}(a||(s.SupportedCapabilities=a={})),function(e){e[e.UnsupportedNonOptionalCapability=5700]="UnsupportedNonOptionalCapability",e[e.UnsupportedChainId=5710]="UnsupportedChainId",e[e.UnknownBundleId=5730]="UnknownBundleId",e[e.RejectedUpgrade=5750]="RejectedUpgrade"}(i||(s.EIP5792ErrorCode=i={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(o||(s.EIP7682ErrorCode=o={})),function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(c||(s.GetCallsStatusCode=c={}))}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getCallsStatus=void 0;const n=e("@metamask/rpc-errors"),r=e("@metamask/transaction-controller"),a=e("../constants.cjs");s.getCallsStatus=function(e,t){const s=e.call("TransactionController:getState").transactions.filter(e=>e.batchId===t);if(!s?.length)throw new n.JsonRpcError(a.EIP5792ErrorCode.UnknownBundleId,"No matching bundle found");const i=s[0],{chainId:o,txReceipt:c}=i,d=function(e){const{hash:t,status:s}=e;if(s===r.TransactionStatus.confirmed)return a.GetCallsStatusCode.CONFIRMED;if(s===r.TransactionStatus.failed)return t?a.GetCallsStatusCode.REVERTED:a.GetCallsStatusCode.FAILED_OFFCHAIN;if(s===r.TransactionStatus.dropped)return a.GetCallsStatusCode.REVERTED;return a.GetCallsStatusCode.PENDING}(i),l=c,u=l?.logs??[],m=l&&[{blockHash:l.blockHash,blockNumber:l.blockNumber,gasUsed:l.gasUsed,logs:u.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:l.status,transactionHash:l.transactionHash}];return{version:a.VERSION,id:t,chainId:o,atomic:!0,status:d,receipts:m}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getCapabilities=void 0;const n=e("../constants.cjs"),r=e("../utils.cjs");s.getCapabilities=async function(e,t,s,a){const{getDismissSmartAccountSuggestionEnabled:i,getIsSmartTransaction:o,isAtomicBatchSupported:c,isRelaySupported:d,getSendBundleSupportedChains:l,isAuxiliaryFundsSupported:u}=e;let m=a?.map(e=>e.toLowerCase());if(!m?.length){const e=t.call("NetworkController:getState").networkConfigurationsByChainId;m=Object.keys(e)}const h=await c({address:s,chainIds:m}),p=await async function(e,t,s,n,r,a){const i=a.call("PreferencesController:getState").useTransactionSimulations,o=await Promise.all(t.map(({chainId:e})=>e).map(e=>n(e))),c=await r(e),d=t.map((e,t)=>({...e,relaySupportedForChain:o[t]}));return e.reduce((e,t)=>{const n=d.find(({chainId:e})=>e===t)??{},{isSupported:r=!1,relaySupportedForChain:a}=n,o=s(t),l=c[t]??!1;return i&&(o&&l||r&&a)&&(e[t]={alternateGasFees:{supported:!0}}),e},{})}(m,h,o,d,l,t);return m.reduce((e,a)=>{const o=h.find(({chainId:e})=>e===a)??{},{delegationAddress:c,isSupported:d,upgradeContractAddress:l}=o,m=i();let p=!1;try{const e=(0,r.getAccountKeyringType)(s,t);p=n.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!d&&!(!m&&l&&!c&&p))return e;const f=d?"supported":"ready",g=a;return e[g]===undefined&&(e[g]={}),e[g].atomic={status:f},p&&u(a)&&(e[g].auxiliaryFunds={supported:!0}),e},p)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.processSendCalls=void 0;const n=e("@metamask/rpc-errors"),r=e("@metamask/transaction-controller"),a=e("@metamask/utils"),i=e("lodash"),o=e("uuid"),c=e("../constants.cjs"),d=e("../utils.cjs");function l(e){const{version:t}=e;if(t!==c.VERSION)throw n.rpcErrors.invalidInput(`Version not supported: Got ${t}, expected ${c.VERSION}`)}function u(e,t){const{chainId:s}=e;if(s&&s.toLowerCase()!==t.toLowerCase())throw n.rpcErrors.invalidParams(`Chain ID must match the dApp selected network: Got ${s}, expected ${t}`)}function m(e,t,s){const{calls:r,capabilities:a,chainId:i}=e,o=[...Object.keys(a??{}).filter(e=>e!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==a?.[e].optional),...r.flatMap(e=>Object.keys(e.capabilities??{}).filter(t=>t!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==e.capabilities?.[t].optional))];if(o?.length)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${o.join(", ")}`);a?.auxiliaryFunds&&function({auxiliaryFunds:e,chainId:t,keyringType:s,isAuxiliaryFundsSupported:r}){if(e.optional)return;const a=c.KEYRING_TYPES_SUPPORTING_7702.includes(s);if(!a)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capability: ${c.SupportedCapabilities.AuxiliaryFunds}`);if(!r(t))throw new n.JsonRpcError(c.EIP7682ErrorCode.UnsupportedChain,`The wallet no longer supports auxiliary funds on the requested chain: ${t}`);if(!e?.requiredAssets)return;for(const t of e.requiredAssets)if("erc20"!==t.standard)throw new n.JsonRpcError(c.EIP7682ErrorCode.UnsupportedAsset,`The requested asset ${t.address} is not available through the wallet’s auxiliary fund system: unsupported token standard ${t.standard}`)}({auxiliaryFunds:a.auxiliaryFunds,chainId:i,keyringType:t,isAuxiliaryFundsSupported:s})}function h(e){if(e.capabilities?.auxiliaryFunds?.requiredAssets){const{requiredAssets:t}=e.capabilities.auxiliaryFunds,s=(0,i.groupBy)(t,e=>`${e.address.toLowerCase()}-${e.standard}`),n=Object.values(s).map(e=>{if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+BigInt(t.amount),0n);return{...e[0],amount:(0,a.add0x)(t.toString(16))}});e.capabilities.auxiliaryFunds.requiredAssets=n}}s.processSendCalls=async function(e,t,s,i){const{addTransactionBatch:p,addTransaction:f,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:k,validateSecurity:w,isAuxiliaryFundsSupported:_}=e,{calls:b,from:y}=s,{networkClientId:A,origin:v}=i,E=b.map(e=>({params:e})),{chainId:S}=t.call("NetworkController:getNetworkClientById",A).configuration,x=y??t.call("AccountsController:getSelectedAccount").address,T=(0,o.v4)(),I=w.bind(null,T),C=i.id?String(i.id):"";let j;return j=1===Object.keys(E).length?await async function({addTransaction:e,chainId:t,from:s,messenger:n,networkClientId:i,origin:p,requestId:f,securityAlertId:g,sendCalls:k,transactions:w,validateSecurity:_,isAuxiliaryFundsSupported:b}){const y=(0,d.getAccountKeyringType)(s,n);!function(e,t,s,n){l(e),m(e,s,n),u(e,t)}(k,t,y,b);const A={from:s,...w[0].params,type:r.TransactionEnvelopeType.feeMarket},v={method:c.MessageType.SendTransaction,params:[A],origin:p};_(v,t),h(k);const E=function(){const e=(0,o.v4)(),t=new Uint8Array((0,o.parse)(e));return(0,a.bytesToHex)(t)}();return await e(A,{requestId:f,networkClientId:i,origin:p,securityAlertResponse:{securityAlertId:g},batchId:E}),E}({addTransaction:f,chainId:S,from:x,messenger:t,networkClientId:A,origin:v,requestId:C,securityAlertId:T,sendCalls:s,transactions:E,validateSecurity:I,isAuxiliaryFundsSupported:_}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:s,from:r,getDismissSmartAccountSuggestionEnabled:a,networkClientId:i,messenger:o,origin:p,requestId:f,sendCalls:g,securityAlertId:k,transactions:w,validateSecurity:_,isAuxiliaryFundsSupported:b}){const y=await t({address:r,chainIds:[s]}),A=y?.[0],v=(0,d.getAccountKeyringType)(r,o),E=a();(function(e,t,s,r,a,i){l(e),function(e,t,s){if(u(e,t),!s)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedChainId,`EIP-7702 not supported on chain: ${t}`)}(e,t,r),m(e,a,i),function(e,t,s){if(t?.delegationAddress)return;if(e)throw new n.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade disabled by the user");if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(s))throw new n.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported on account")}(s,r,a)})(g,s,E,A,v,b),h(g);const S=await e({from:r,networkClientId:i,origin:p,requestId:f,securityAlertId:k,transactions:w,validateSecurity:_});return S.batchId}({addTransactionBatch:p,isAtomicBatchSupported:k,chainId:S,from:x,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:A,origin:v,requestId:C,sendCalls:s,securityAlertId:T,transactions:E,validateSecurity:I,isAuxiliaryFundsSupported:_}),{id:j}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/index.cjs",{"./hooks/getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs","./hooks/getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs","./hooks/processSendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs","./methods/wallet_getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs","./methods/wallet_getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs","./methods/wallet_sendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCapabilities=s.walletGetCallsStatus=s.walletSendCalls=s.getCapabilities=s.getCallsStatus=s.processSendCalls=void 0;var n=e("./hooks/processSendCalls.cjs");Object.defineProperty(s,"processSendCalls",{enumerable:!0,get:function(){return n.processSendCalls}});var r=e("./hooks/getCallsStatus.cjs");Object.defineProperty(s,"getCallsStatus",{enumerable:!0,get:function(){return r.getCallsStatus}});var a=e("./hooks/getCapabilities.cjs");Object.defineProperty(s,"getCapabilities",{enumerable:!0,get:function(){return a.getCapabilities}});var i=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(s,"walletSendCalls",{enumerable:!0,get:function(){return i.walletSendCalls}});var o=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(s,"walletGetCallsStatus",{enumerable:!0,get:function(){return o.walletGetCallsStatus}});var c=e("./methods/wallet_getCapabilities.cjs");Object.defineProperty(s,"walletGetCapabilities",{enumerable:!0,get:function(){return c.walletGetCapabilities}})}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCallsStatus=void 0;const n=e("@metamask/rpc-errors"),r=e("../types.cjs"),a=e("../utils.cjs");s.walletGetCallsStatus=async function(e,t,{getCallsStatus:s}){if(!s)throw n.rpcErrors.methodNotSupported();(0,a.validateParams)(e.params,r.GetCallsStatusStruct);const i=e.params[0];t.result=await s(i,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCapabilities=void 0;const n=e("@metamask/rpc-errors"),r=e("../types.cjs"),a=e("../utils.cjs");s.walletGetCapabilities=async function(e,t,{getAccounts:s,getCapabilities:i}){if(!i)throw n.rpcErrors.methodNotSupported();(0,a.validateParams)(e.params,r.GetCapabilitiesStruct);const o=e.params[0],c=e.params[1];await(0,a.validateAndNormalizeKeyholder)(o,e,{getAccounts:s});const d=await i(o,c,e);t.result=d}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletSendCalls=void 0;const n=e("@metamask/rpc-errors"),r=e("../types.cjs"),a=e("../utils.cjs");s.walletSendCalls=async function(e,t,{getAccounts:s,processSendCalls:i}){if(!i)throw n.rpcErrors.methodNotSupported();(0,a.validateParams)(e.params,r.SendCallsStruct);const o=e.params[0],c=o.from?await(0,a.validateAndNormalizeKeyholder)(o.from,e,{getAccounts:s}):undefined,d={...o,from:c};t.result=await i(d,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SendCallsStruct=s.CapabilitiesStruct=s.GetCapabilitiesStruct=s.GetCallsStatusStruct=void 0;const n=e("@metamask/superstruct"),r=e("@metamask/utils");s.GetCallsStatusStruct=(0,n.tuple)([r.StrictHexStruct]),s.GetCapabilitiesStruct=(0,n.tuple)([r.HexChecksumAddressStruct,(0,n.optional)((0,n.array)(r.StrictHexStruct))]);const a=(0,n.type)({address:(0,n.nonempty)(r.HexChecksumAddressStruct),amount:(0,n.nonempty)(r.StrictHexStruct),standard:(0,n.nonempty)((0,n.string)())});s.CapabilitiesStruct=(0,n.record)((0,n.string)(),(0,n.type)({optional:(0,n.optional)((0,n.boolean)()),requiredAssets:(0,n.optional)((0,n.array)(a))})),s.SendCallsStruct=(0,n.tuple)([(0,n.object)({version:(0,n.nonempty)((0,n.string)()),id:(0,n.optional)(r.StrictHexStruct),from:(0,n.optional)(r.HexChecksumAddressStruct),chainId:r.StrictHexStruct,atomicRequired:(0,n.boolean)(),calls:(0,n.array)((0,n.object)({to:(0,n.optional)(r.HexChecksumAddressStruct),data:(0,n.optional)(r.StrictHexStruct),value:(0,n.optional)(r.StrictHexStruct),capabilities:(0,n.optional)(s.CapabilitiesStruct)})),capabilities:(0,n.optional)(s.CapabilitiesStruct)})])}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.resemblesAddress=s.validateParams=s.validateAndNormalizeKeyholder=s.getAccountKeyringType=void 0;const n=e("@metamask/rpc-errors"),r=e("@metamask/superstruct"),a=e("./constants.cjs");function i(e){return 42===e.length}s.getAccountKeyringType=function(e,t){const{accounts:s}=t.call("AccountsController:getState").internalAccounts,r=Object.values(s).find(t=>t.address.toLowerCase()===e.toLowerCase()),i=r?.metadata?.keyring?.type;if(!i)throw new n.JsonRpcError(a.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return i},s.validateAndNormalizeKeyholder=async function(e,t,{getAccounts:s}){if("string"==typeof e&&e.length>0&&i(e)){const r=(await s(t)).map(e=>e.toLowerCase()),a=e.toLowerCase();if(r.includes(a))return a;throw n.providerErrors.unauthorized()}throw n.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},s.validateParams=function(e,t){const[s]=(0,r.validate)(e,t);if(s)throw n.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(s,"Invalid params"))},s.resemblesAddress=i}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DELEGATION_INDICATOR_PREFIX=s.METHOD_NAMES=void 0,s.METHOD_NAMES={UPGRADE_ACCOUNT:"wallet_upgradeAccount",GET_ACCOUNT_UPGRADE_STATUS:"wallet_getAccountUpgradeStatus"},s.DELEGATION_INDICATOR_PREFIX="0xef0100"}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","./wallet_getAccountUpgradeStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs","./wallet_upgradeAccount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.METHOD_NAMES=s.validateAndNormalizeAddress=s.validateParams=s.walletGetAccountUpgradeStatus=s.walletUpgradeAccount=void 0;var n=e("./wallet_upgradeAccount.cjs");Object.defineProperty(s,"walletUpgradeAccount",{enumerable:!0,get:function(){return n.walletUpgradeAccount}});var r=e("./wallet_getAccountUpgradeStatus.cjs");Object.defineProperty(s,"walletGetAccountUpgradeStatus",{enumerable:!0,get:function(){return r.walletGetAccountUpgradeStatus}});var a=e("./utils.cjs");Object.defineProperty(s,"validateParams",{enumerable:!0,get:function(){return a.validateParams}}),Object.defineProperty(s,"validateAndNormalizeAddress",{enumerable:!0,get:function(){return a.validateAndNormalizeAddress}});var i=e("./constants.cjs");Object.defineProperty(s,"METHOD_NAMES",{enumerable:!0,get:function(){return i.METHOD_NAMES}})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.GetAccountUpgradeStatusParamsStruct=s.UpgradeAccountParamsStruct=void 0;const n=e("@metamask/superstruct"),r=e("@metamask/utils");s.UpgradeAccountParamsStruct=(0,n.object)({account:r.HexChecksumAddressStruct,chainId:(0,n.optional)(r.StrictHexStruct)}),s.GetAccountUpgradeStatusParamsStruct=(0,n.object)({account:r.HexChecksumAddressStruct,chainId:(0,n.optional)(r.StrictHexStruct)})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs",{"@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateParams=s.validateAndNormalizeAddress=void 0;const n=e("@metamask/rpc-errors"),r=e("@metamask/superstruct"),a=e("@metamask/utils");s.validateAndNormalizeAddress=async function(e,t,s){if("string"!=typeof e||0===e.length||!(0,a.isHexAddress)(e))throw n.rpcErrors.invalidParams({message:"Invalid parameters: must provide an EVM address."});if(!(await s(t)).map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw n.providerErrors.unauthorized();return e},s.validateParams=function(e,t){const[s]=(0,r.validate)(e,t);if(s)throw n.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(s,"Invalid parameters"))}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetAccountUpgradeStatus=void 0;const n=e("@metamask/rpc-errors"),r=e("@metamask/utils"),a=e("./constants.cjs"),i=e("./types.cjs"),o=e("./utils.cjs");s.walletGetAccountUpgradeStatus=async function(e,t,s){const{params:c,origin:d}=e;(0,o.validateParams)(c,i.GetAccountUpgradeStatusParamsStruct);const{account:l,chainId:u}=c,m=await(0,o.validateAndNormalizeAddress)(l,d,s.getPermittedAccountsForOrigin);let h;if(u!==undefined)h=u;else{const e=s.getCurrentChainIdForDomain(d);if(!e)throw n.rpcErrors.invalidParams({message:`Could not determine current chain ID for origin: ${d}`});h=e}const{isSupported:p}=await s.isEip7702Supported({address:m,chainId:h});if(p)try{const e=h,r=s.getSelectedNetworkClientIdForChain(e);if(!r)throw n.rpcErrors.invalidParams({message:`Network client ID not found for chain ID ${h}`});const{isUpgraded:i,upgradedAddress:o}=await(async(e,t,s)=>{const n=await s(e,t);if(!n||"0x"===n||n.length<=2)return{isUpgraded:!1,upgradedAddress:null};if(!n.startsWith(a.DELEGATION_INDICATOR_PREFIX))return{isUpgraded:!1,upgradedAddress:null};const r=a.DELEGATION_INDICATOR_PREFIX.length+40;return n.length!==r?{isUpgraded:!1,upgradedAddress:null}:{isUpgraded:!0,upgradedAddress:`0x${n.slice(8,48)}`}})(m,r,s.getCode);t.result={isSupported:p,account:m,isUpgraded:i,upgradedAddress:o,chainId:h}}catch(e){if(e instanceof n.JsonRpcError)throw e;throw n.rpcErrors.internal({message:`Failed to get account upgrade status: ${(0,r.getErrorMessage)(e)}`})}else t.result={isSupported:p,account:m,isUpgraded:!1,upgradedAddress:null,chainId:h}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletUpgradeAccount=void 0;const n=e("@metamask/rpc-errors"),r=e("./types.cjs"),a=e("./utils.cjs");s.walletUpgradeAccount=async function(e,t,s){const{params:i,origin:o}=e;(0,a.validateParams)(i,r.UpgradeAccountParamsStruct);const{account:c,chainId:d}=i,l=await(0,a.validateAndNormalizeAddress)(c,o,s.getPermittedAccountsForOrigin);let u;if(d!==undefined)u=d;else{const e=s.getCurrentChainIdForDomain(o);if(!e)throw n.rpcErrors.invalidParams({message:`No network configuration found for origin: ${o}`});u=e}try{const e=u,{isSupported:r,upgradeContractAddress:a}=await s.isEip7702Supported({address:l,chainId:e});if(!r)throw n.rpcErrors.invalidParams({message:`Account upgrade not supported on chain ID ${u}`});if(!a)throw n.rpcErrors.invalidParams({message:`No upgrade contract address available for chain ID ${u}`});const i=await s.upgradeAccount(l,a,u);t.result={transactionHash:i.transactionHash,upgradedAccount:l,delegatedTo:i.delegatedTo}}catch(e){if(e instanceof n.JsonRpcError)throw e;throw n.rpcErrors.internal({message:`Failed to upgrade account: ${e instanceof Error?e.message:String(e)}`})}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs",{"@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","punycode/punycode.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/punycode/punycode.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,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)},d=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s};Object.defineProperty(s,"__esModule",{value:!0}),s.EnsController=s.DEFAULT_ENS_NETWORK_MAP=void 0;const l=e("@ethersproject/providers"),u=e("@metamask/base-controller"),m=e("@metamask/controller-utils"),h=e("@metamask/utils"),p=e("punycode/punycode.js"),f=(0,h.createProjectLogger)("ens-controller");s.DEFAULT_ENS_NETWORK_MAP={1:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",4:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",5:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",17e3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",11155111:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"};const g={ensEntries:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},ensResolutionsByAddress:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},k={ensEntries:{},ensResolutionsByAddress:{}};class w extends u.BaseController{constructor({registriesByChainId:e=s.DEFAULT_ENS_NETWORK_MAP,messenger:t,state:o={},onNetworkDidChange:d}){super({name:"EnsController",metadata:g,messenger:t,state:{...k,ensEntries:Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,m.toHex)(e),{".":{address:t,chainId:(0,m.toHex)(e),ensName:"."}}])),...o}}),n.add(this),r.set(this,null),c(this,n,"m",a).call(this,e),d&&d(({selectedNetworkClientId:t})=>{this.resetState(),c(this,n,"m",i).call(this,t,e)})}resetState(){this.update(e=>{e.ensResolutionsByAddress={}})}clear(){this.update(e=>{e.ensEntries={}})}delete(e,t){const s=(0,m.normalizeEnsName)(t);return!!((0,m.isSafeDynamicKey)(e)&&s&&this.state.ensEntries[e]&&this.state.ensEntries[e][s])&&(this.update(t=>{delete t.ensEntries[e][s],0===Object.keys(t.ensEntries[e]).length&&delete t.ensEntries[e]}),!0)}get(e,t){const s=(0,m.normalizeEnsName)(t);return s&&this.state.ensEntries[e]&&this.state.ensEntries[e][s]||null}set(e,t,s){if(!Number.isInteger(Number.parseInt(e,10))||!t||"string"!=typeof t||s&&!(0,m.isValidHexAddress)(s))throw new Error(`Invalid ENS entry: { chainId:${e}, ensName:${t}, address:${s}}`);const n=(0,m.normalizeEnsName)(t);if(!n)throw new Error(`Invalid ENS name: ${t}`);const r=s?(0,m.toChecksumHexAddress)(s):null,a=this.state.ensEntries[e];return(!a?.[n]||a[n].address!==r)&&(this.update(t=>{t.ensEntries={...this.state.ensEntries,[e]:{...this.state.ensEntries[e],[n]:{address:r,chainId:e,ensName:n}}}}),!0)}async reverseResolveAddress(e){if(!c(this,r,"f"))return undefined;const t=(0,m.toChecksumHexAddress)(e);if(this.state.ensResolutionsByAddress[t])return this.state.ensResolutionsByAddress[t];let s,n;try{s=await c(this,r,"f").lookupAddress(t)}catch(e){return f(e),undefined}if(!s)return undefined;try{n=await c(this,r,"f").resolveName(s)}catch(e){return f(e),undefined}return n?"0x0000000000000000000000000000000000000000"===n||"0x"===n||(0,m.toChecksumHexAddress)(n)!==t?undefined:(this.update(e=>{e.ensResolutionsByAddress[t]=(0,p.toASCII)(s)}),s):undefined}}s.EnsController=w,r=new WeakMap,n=new WeakSet,a=function(e){const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState");c(this,n,"m",i).call(this,t,e)},i=function(e,t){const{configuration:{chainId:s},provider:a}=this.messenger.call("NetworkController:getNetworkClientById",e);t&&t[parseInt(s,16)]&&c(this,n,"m",o).call(this,s)?d(this,r,new l.Web3Provider(a,{chainId:(0,m.convertHexToDecimal)(s),name:m.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP[s],ensAddress:t[parseInt(s,16)]}),"f"):d(this,r,null,"f")},o=function(e){return Boolean(this.state.ensEntries[e])},s.default=w}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/EnsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/index.cjs",{"./EnsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./EnsController.cjs"),s)}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},i=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.ErrorReportingService=void 0;s.ErrorReportingService=class{constructor({messenger:e,captureException:t}){this.name="ErrorReportingService",this.state=null,n.set(this,void 0),r.set(this,void 0),a(this,r,e,"f"),a(this,n,t,"f"),i(this,r,"f").registerActionHandler("ErrorReportingService:captureException",i(this,n,"f").bind(this))}captureException(e){i(this,n,"f").call(this,e)}},n=new WeakMap,r=new WeakMap}}},{package:"@metamask/error-reporting-service",file:"node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/index.cjs",{"./error-reporting-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ErrorReportingService=void 0;var n=e("./error-reporting-service.cjs");Object.defineProperty(s,"ErrorReportingService",{enumerable:!0,get:function(){return n.ErrorReportingService}})}}},{package:"@metamask/error-reporting-service",file:"node_modules/@metamask/error-reporting-service/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("./base-filter");t.exports=class extends n{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js",{"@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("@metamask/safe-event-emitter").default;t.exports=class extends n{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach(e=>this.emit("update",e))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("./base-filter"),r=e("./getBlocksForRange"),{incrementHexInt:a}=e("./hexUtils");t.exports=class extends n{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const s=t,n=a(e),i=(await r({provider:this.provider,fromBlock:n,toBlock:s})).map(e=>e.hash);this.addResults(i)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/block-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function r(e){if(e===undefined||null===e)return e;return"0x"+e.toString(16)}t.exports=async function({provider:e,fromBlock:t,toBlock:s}){t||(t=s);const a=n(t),i=n(s),o=Array(i-a+1).fill().map((e,t)=>a+t).map(r);let c=await Promise.all(o.map(t=>async function(e,t,s){for(let n=0;n<3;n++)try{return e.request({id:1,jsonrpc:"2.0",method:t,params:s})}catch(e){console.error(`provider.request failed: ${e.stack||e.message||e}`)}return null}(e,"eth_getBlockByNumber",[t,!1])));return c=c.filter(e=>null!==e),c}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){function n(e){return e.sort((e,t)=>"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:r(e)-r(t))}function r(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function a(e){if(e===undefined||null===e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function i(){return Math.floor(16*Math.random()).toString(16)}t.exports={minBlockRef:function(...e){return n(e)[0]},maxBlockRef:function(...e){const t=n(e);return t[t.length-1]},sortBlockRefs:n,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:r,incrementHexInt:function(e){if(e===undefined||null===e)return e;return a(r(e)+1)},intToHex:a,unsafeRandomBytes:function(e){let t="0x";for(let s=0;s<e;s++)t+=i(),t+=i();return t}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js",{"./block-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./log-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js","./tx-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("async-mutex").Mutex,{createAsyncMiddleware:r,createScaffoldMiddleware:a}=e("@metamask/json-rpc-engine"),i=e("./log-filter.js"),o=e("./block-filter.js"),c=e("./tx-filter.js"),{intToHex:d,hexToInt:l}=e("./hexUtils");function u(e){return m(async(...t)=>{const s=await e(...t);return d(s.id)})}function m(e){return r(async(t,s)=>{const n=await e.apply(null,t.params);s.result=n})}function h(e,t){const s=[];for(let t in e)s.push(e[t]);return s}t.exports=function({blockTracker:e,provider:t}){let s=0,r={};const p=new n,f=function({mutex:e}){return t=>async(s,n,r,a)=>{(await e.acquire())(),t(s,n,r,a)}}({mutex:p}),g=a({eth_newFilter:f(u(w)),eth_newBlockFilter:f(u(_)),eth_newPendingTransactionFilter:f(u(b)),eth_uninstallFilter:f(m(v)),eth_getFilterChanges:f(m(y)),eth_getFilterLogs:f(m(A))}),k=async({oldBlock:e,newBlock:t})=>{if(0===r.length)return;const s=await p.acquire();try{await Promise.all(h(r).map(async s=>{try{await s.update({oldBlock:e,newBlock:t})}catch(e){console.error(e)}}))}catch(e){console.error(e)}s()};return g.newLogFilter=w,g.newBlockFilter=_,g.newPendingTransactionFilter=b,g.uninstallFilter=v,g.getFilterChanges=y,g.getFilterLogs=A,g.destroy=()=>{!async function(){const e=h(r).length;r={},S({prevFilterCount:e,newFilterCount:0})}()},g;async function w(e){const s=new i({provider:t,params:e});await E(s);return s}async function _(){const e=new o({provider:t});await E(e);return e}async function b(){const e=new c({provider:t});await E(e);return e}async function y(e){const t=l(e),s=r[t];if(!s)throw new Error(`No filter for index "${t}"`);return s.getChangesAndClear()}async function A(e){const t=l(e),s=r[t];if(!s)throw new Error(`No filter for index "${t}"`);let n=[];return"log"===s.type&&(n=s.getAllResults()),n}async function v(e){const t=l(e),s=r[t],n=Boolean(s);return n&&await async function(e){const t=h(r).length;delete r[e];const s=h(r).length;S({prevFilterCount:t,newFilterCount:s})}(t),n}async function E(t){const n=h(r).length,a=await e.getLatestBlock();await t.initialize({currentBlock:a}),s++,r[s]=t,t.id=s,t.idHex=d(s);return S({prevFilterCount:n,newFilterCount:h(r).length}),s}function S({prevFilterCount:t,newFilterCount:s}){0===t&&s>0?e.on("sync",k):t>0&&0===s&&e.removeListener("sync",k)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js",{"./base-filter-history":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js",pify:"/home/runner/work/metamask-extension/metamask-extension/node_modules/pify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("@metamask/eth-query"),r=e("pify"),a=e("./base-filter-history"),{bnToHex:i,hexToInt:o,incrementHexInt:c,minBlockRef:d,blockRefIsNumber:l}=e("./hexUtils");t.exports=class extends a{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new n(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:undefined,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(e=>e.toLowerCase()))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const s=d(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:s}),r=await this._fetchLogs(n);this.addInitialResults(r)}async update({oldBlock:e,newBlock:t}){const s=t;let n;n=e?c(e):t;const r=Object.assign({},this.params,{fromBlock:n,toBlock:s}),a=(await this._fetchLogs(r)).filter(e=>this.matchLog(e));this.addResults(a)}async _fetchLogs(e){return await r(t=>this.ethQuery.getLogs(e,t))()}matchLog(e){if(o(this.params.fromBlock)>=o(e.blockNumber))return!1;if(l(this.params.toBlock)&&o(this.params.toBlock)<=o(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every((t,s)=>{let n=e.topics[s];if(!n)return!1;n=n.toLowerCase();let r=Array.isArray(t)?t:[t];if(r.includes(null))return!0;r=r.map(e=>e.toLowerCase());return r.includes(n)})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/log-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js",{"./getBlocksForRange.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./index.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("@metamask/safe-event-emitter").default,{createAsyncMiddleware:r,createScaffoldMiddleware:a}=e("@metamask/json-rpc-engine"),i=e("./index.js"),{unsafeRandomBytes:o,incrementHexInt:c}=e("./hexUtils.js"),d=e("./getBlocksForRange.js");function l(e){return null===e||e===undefined?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}t.exports=function({blockTracker:e,provider:t}){const s={},u=i({blockTracker:e,provider:t});let m=!1;const h=new n,p=a({eth_subscribe:r(async function(n,r){if(m)throw new Error("SubscriptionManager - attempting to use after destroying");const a=n.params[0],i=o(16);let h;switch(a){case"newHeads":h=p({subId:i});break;case"logs":const e=n.params[1];h=g({subId:i,filter:await u.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${a}"`)}return s[i]=h,void(r.result=i);function p({subId:s}){const n={type:a,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const r=n,a=c(e);(await d({provider:t,fromBlock:a,toBlock:r})).map(l).filter(e=>null!==e).forEach(e=>{f(s,e)})}};return e.on("sync",n.update),n}function g({subId:e,filter:t}){t.on("update",t=>f(e,t));return{type:a,destroy:async()=>await u.uninstallFilter(t.idHex)}}}),eth_unsubscribe:r(async function(e,t){if(m)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],r=s[n];if(!r)return void(t.result=!1);delete s[n],await r.destroy(),t.result=!0})});return p.destroy=function(){h.removeAllListeners();for(const e in s)s[e].destroy(),delete s[e];m=!0},{events:h,middleware:p};function f(e,t){h.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){const n=e("./base-filter"),r=e("./getBlocksForRange"),{incrementHexInt:a}=e("./hexUtils");t.exports=class extends n{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,s=a(e),n=await r({provider:this.provider,fromBlock:s,toBlock:t}),i=[];for(const e of n)i.push(...e.transactions);this.addResults(i)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/tx-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs",{"@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createLedgerError=function(e,t){const s=r(e);if(s){const e=t?`${s.message} (${t})`:s.message;return new n.HardwareWalletError(e,{code:s.code,severity:s.severity,category:s.category,userMessage:s.userMessage??e})}const a=t?`Unknown Ledger error: ${e} (${t})`:`Unknown Ledger error: ${e}`;return new n.HardwareWalletError(a,{code:n.ErrorCode.Unknown,severity:n.Severity.Err,category:n.Category.Unknown,userMessage:a})},s.isKnownLedgerError=function(e){return e in n.LEDGER_ERROR_MAPPINGS},s.getLedgerErrorMapping=r;const n=e("@metamask/hw-wallet-sdk");function r(e){return n.LEDGER_ERROR_MAPPINGS[e]}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs","./ledger-iframe-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs","./ledger-keyring-v2.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs","./ledger-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs","./ledger-mobile-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs","./ledger-transport-middleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./ledger-keyring.cjs"),s),r(e("./ledger-keyring-v2.cjs"),s),r(e("./ledger-iframe-bridge.cjs"),s),r(e("./ledger-mobile-bridge.cjs"),s),r(e("./ledger-transport-middleware.cjs"),s),r(e("./ledger-hw-app.cjs"),s),r(e("./errors.cjs"),s),r(e("./ledger-error-handler.cjs"),s)}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","@ledgerhq/hw-transport":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-transport/lib/Transport.js","@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.handleLedgerTransportError=function(e,t){if(e instanceof n.TransportStatusError){const t=`0x${e.statusCode.toString(16)}`;if((0,a.isKnownLedgerError)(t)){const e=(0,a.createLedgerError)(t);throw o.has(t)&&(e.message=(s=e.message).startsWith(i)?s:`${i}${s}`),e}throw new r.HardwareWalletError(e.message,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:e.message,cause:e})}var s;if(e instanceof r.HardwareWalletError)throw e;if(e instanceof Error)throw new r.HardwareWalletError(e.message,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:e.message,cause:e});throw new r.HardwareWalletError(t,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:t})};const n=e("@ledgerhq/hw-transport"),r=e("@metamask/hw-wallet-sdk"),a=e("./errors.cjs"),i="Ledger: ",o=new Set(["0x6985","0x6a80","0x5515","0x650f"])}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs",{"@ledgerhq/hw-app-eth":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.MetaMaskLedgerHwAppEth=void 0;const r=n(e("@ledgerhq/hw-app-eth")),a=e("buffer");class i extends r.default{constructor(){super(...arguments),this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii"}async openEthApp(){await this.transport.send(224,216,0,0,a.Buffer.from(this.ethAppName,this.transportEncoding))}async closeApps(){await this.transport.send(176,167,0,0)}async getAppNameAndVersion(){const e=await this.transport.send(176,1,0,0);if(1!==e[0])throw new Error("Incorrect format return from getAppNameAndVersion.");let t=1;const s=e[t]??0;t+=1;const n=e.slice(t,t+=s).toString(this.transportEncoding),r=e[t]??0;t+=1;return{appName:n,version:e.slice(t,t+=r).toString(this.transportEncoding)}}}s.MetaMaskLedgerHwAppEth=i}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m=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)},h=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s};Object.defineProperty(s,"__esModule",{value:!0}),s.LedgerIframeBridge=s.IFrameMessageAction=void 0;const p=e("@metamask/utils");var f;!function(e){e.LedgerIsIframeReady="ledger-is-iframe-ready",e.LedgerConnectionChange="ledger-connection-change",e.LedgerUnlock="ledger-unlock",e.LedgerMakeApp="ledger-make-app",e.LedgerUpdateTransport="ledger-update-transport",e.LedgerSignTransaction="ledger-sign-transaction",e.LedgerSignPersonalMessage="ledger-sign-personal-message",e.LedgerSignTypedData="ledger-sign-typed-data",e.LedgerGetAppNameAndVersion="ledger-get-app-name-and-version",e.LedgerGetAppConfiguration="ledger-get-app-configuration"}(f||(s.IFrameMessageAction=f={}));s.LedgerIframeBridge=class{constructor(e={bridgeUrl:"https://metamask.github.io/eth-ledger-bridge-keyring"}){n.add(this),this.iframeLoaded=!1,r.set(this,void 0),this.isDeviceConnected=!1,this.currentMessageId=0,a.set(this,new Map),m(this,n,"m",u).call(this,e),h(this,r,{bridgeUrl:e?.bridgeUrl},"f")}async init(){await m(this,n,"m",o).call(this,m(this,r,"f").bridgeUrl),this.eventListener=m(this,n,"m",d).bind(this,m(this,r,"f").bridgeUrl),window.addEventListener("message",this.eventListener)}async destroy(){this.eventListener&&window.removeEventListener("message",this.eventListener)}async getOptions(){return m(this,r,"f")}async setOptions(e){m(this,n,"m",u).call(this,e),m(this,r,"f")?.bridgeUrl!==e.bridgeUrl&&(m(this,r,"f").bridgeUrl=e.bridgeUrl,await this.destroy(),await this.init())}async attemptMakeApp(){const e=await m(this,n,"m",l).call(this,{action:f.LedgerMakeApp},{timeout:8e3});if("success"in e&&e.success)return!0;throw"error"in e?e.error:new Error("Unknown error occurred")}async updateTransportMethod(e){if(!this.iframeLoaded)throw new Error("The iframe is not loaded yet");const t=await m(this,n,"m",l).call(this,{action:f.LedgerUpdateTransport,params:{transportType:e}},{timeout:8e3});if("success"in t&&t.success)return!0;throw new Error("Ledger transport could not be updated")}async getPublicKey(e){return m(this,n,"m",i).call(this,f.LedgerUnlock,e)}async deviceSignTransaction(e){return m(this,n,"m",i).call(this,f.LedgerSignTransaction,e)}async deviceSignMessage(e){return m(this,n,"m",i).call(this,f.LedgerSignPersonalMessage,e)}async deviceSignTypedData(e){return m(this,n,"m",i).call(this,f.LedgerSignTypedData,e)}async getAppNameAndVersion(){return m(this,n,"m",i).call(this,f.LedgerGetAppNameAndVersion,{})}async getAppConfiguration(){return m(this,n,"m",i).call(this,f.LedgerGetAppConfiguration,{})}},r=new WeakMap,a=new WeakMap,n=new WeakSet,i=async function(...[e,t]){const s=await m(this,n,"m",l).call(this,{action:e,params:t});if("payload"in s&&s.payload){if("success"in s&&s.success)return s.payload;if("error"in s.payload)throw s.payload.error}throw new Error("Unknown error occurred")},o=async function(e){return new Promise(t=>{this.iframe=document.createElement("iframe"),this.iframe.src=e,this.iframe.allow="hid 'src'",this.iframe.onload=async()=>{this.iframeLoaded=!0,t()},document.head.appendChild(this.iframe)})},c=function(e){const t=e.split("/");return t.splice(-1,1),t.join("/")},d=function(e,t){const{origin:s,data:r}=t;if(s===m(this,n,"m",c).call(this,e)&&r){const e=m(this,a,"f").get(r.messageId);e?(e.resolve(r),m(this,a,"f").delete(r.messageId)):r.action===f.LedgerConnectionChange&&(this.isDeviceConnected=r.payload.connected)}},l=async function(e,{timeout:t}={}){this.currentMessageId+=1;const s={...e,messageId:this.currentMessageId,target:"LEDGER-IFRAME"},n=(0,p.createDeferredPromise)();if(m(this,a,"f").set(this.currentMessageId,n),!this.iframeLoaded||!this.iframe?.contentWindow)throw new Error("The iframe is not loaded yet");return t&&setTimeout(()=>{m(this,a,"f").has(s.messageId)&&(m(this,a,"f").delete(s.messageId),n.reject(new Error("Ledger iframe message timeout")))},t),this.iframe.contentWindow.postMessage(s,"*"),n.promise},u=function(e){if("string"!=typeof e.bridgeUrl||0===e.bridgeUrl.length)throw new Error("bridgeURL is not a valid URL")}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,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.LedgerKeyringV2=void 0;const d=e("@metamask/keyring-api"),l=e("@metamask/utils"),u=[d.EthMethod.SignTransaction,d.EthMethod.PersonalSign,d.EthMethod.SignTypedDataV4],m={scopes:[d.EthScope.Eoa],bip44:{deriveIndex:!0,derivePath:!0}},h=/^m\/44'\/60'\/(\d+)'\/0\/0$/u,p=/^(m\/44'\/60'(?:\/\d+'?)*)\/(\d+)$/u;class f extends d.EthKeyringWrapper{constructor(e){super({type:d.KeyringType.Ledger,inner:e.legacyKeyring,capabilities:m}),n.add(this),this.entropySource=e.entropySource}async getAccounts(){const e=await this.inner.getAccounts();return 0===e.length?[]:e.map(e=>{const t=this.registry.getAccountId(e);if(t){const e=this.registry.get(t);if(e)return e}const s=c(this,n,"m",i).call(this,e);return c(this,n,"m",o).call(this,e,s)})}async createAccounts(e){return this.withLock(async()=>{if("bip44:derive-path"!==e.type&&"bip44:derive-index"!==e.type)throw new Error(`Unsupported account creation type for LedgerKeyring: ${String(e.type)}`);if(e.entropySource!==this.entropySource)throw new Error(`Entropy source mismatch: expected '${this.entropySource}', got '${e.entropySource}'`);const t=await this.getAccounts();let s,r,i;if("bip44:derive-path"===e.type){const t=c(this,n,"m",a).call(this,e.derivationPath);s=t.index,r=t.basePath,i=e.derivationPath}else s=e.groupIndex,r="m/44'/60'/0'/0",i=`${r}/${s}`;const d=t.find(e=>e.options.entropy.groupIndex===s&&e.options.entropy.derivationPath===i);if(d)return[d];this.inner.setHdPath(r),this.inner.setAccountToUnlock(s);const[l]=await this.inner.addAccounts(1);if(!l)throw new Error("Failed to create new account");return[c(this,n,"m",o).call(this,l,s)]})}async deleteAccount(e){await this.withLock(async()=>{const{address:t}=await this.getAccount(e),s=this.toHexAddress(t);this.inner.removeAccount(s),this.registry.delete(e)})}}s.LedgerKeyringV2=f,n=new WeakSet,r=function(e){return(0,l.getChecksumAddress)((0,l.add0x)(e))},a=function(e){const t=e.match(h);if(t?.[1])return{basePath:"m/44'/60'/0'/0/0",index:parseInt(t[1],10)};const s=e.match(p);if(s)return{basePath:s[1],index:parseInt(s[2],10)};throw new Error(`Invalid derivation path format: ${e}. Expected Ledger Live (m/44'/60'/{index}'/0/0) or index-at-end (m/44'/60'/.../{index}) format.`)},i=function(e){const t=c(this,n,"m",r).call(this,e),s=this.inner.accountDetails[t];if(!s)throw new Error(`Address ${t} not found in account details`);const{hdPath:a}=s;if(!a)throw new Error(`No HD path found for address ${t}`);if(s.bip44){const e=a.match(h);if(e?.[1])return parseInt(e[1],10)}else{const e=a.match(p);if(e?.[2])return parseInt(e[2],10)}throw new Error(`Could not extract index from HD path: ${a}`)},o=function(e,t){const s=this.registry.register(e),a=c(this,n,"m",r).call(this,e),i=this.inner.accountDetails[a];if(!i?.hdPath)throw new Error(`No HD path found for address ${a}. Cannot create account.`);const o={id:s,type:d.EthAccountType.Eoa,address:e,scopes:[...this.capabilities.scopes],methods:[...u],options:{entropy:{type:d.KeyringAccountEntropyTypeOption.Mnemonic,id:this.entropySource,groupIndex:t,derivationPath:i.hdPath}}};return this.registry.set(o),o}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs",{"./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","@ethereumjs/rlp":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/rlp/dist/cjs/index.js","@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@metamask/eth-sig-util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-sig-util/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",hdkey:"/home/runner/work/metamask-extension/metamask-extension/node_modules/hdkey/lib/hdkey.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m,h,p,f,g,k,w=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)},_=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.LedgerKeyring=void 0;const b=e("@ethereumjs/rlp"),y=e("@ethereumjs/tx"),A=e("@ethereumjs/util"),v=e("@metamask/eth-sig-util"),E=e("@metamask/utils"),S=e("buffer"),x=_(e("hdkey")),T=e("./ledger-error-handler.cjs"),I="m",C=`${I}/44'/60'/0'`,j="Ledger Hardware";var P;!function(e){e.Ropsten="https://api-ropsten.etherscan.io",e.Kovan="https://api-kovan.etherscan.io",e.Rinkeby="https://api-rinkeby.etherscan.io",e.Mainnet="https://api.etherscan.io"}(P||(P={}));class N{constructor({bridge:e}){if(n.add(this),this.deviceId="",this.type=j,this.page=0,this.perPage=5,this.unlockedAccount=0,this.accounts=[],this.accountDetails={},this.hdk=new x.default,this.hdPath=C,this.paths={},this.network=P.Mainnet,this.implementFullBIP44=!1,!e)throw new Error("Bridge is a required dependency for the keyring");this.bridge=e}async init(){return this.bridge.init()}async destroy(){return this.bridge.destroy()}async serialize(){return{hdPath:this.hdPath,accounts:this.accounts.slice(),deviceId:this.deviceId,accountDetails:this.accountDetails,implementFullBIP44:!1}}async deserialize(e){this.hdPath=e.hdPath??C,this.accounts=e.accounts??[],this.deviceId=e.deviceId??"",this.accountDetails=e.accountDetails??{},e.accountDetails||w(this,n,"m",r).call(this,e),this.implementFullBIP44=e.implementFullBIP44??!1;const t=new Set(Object.keys(this.accountDetails));return this.accounts=this.accounts.filter(e=>t.has(w(this,n,"m",g).call(this,e))),Promise.resolve()}setDeviceId(e){this.deviceId=e}getDeviceId(){return this.deviceId}isUnlocked(){return Boolean(this.hdk.publicKey)}isConnected(){return this.bridge.isDeviceConnected}setAccountToUnlock(e){this.unlockedAccount=e}setHdPath(e){this.hdPath!==e&&(this.hdk=new x.default),this.hdPath=e}async unlock(e,t=!0){if(this.isUnlocked()&&!e)return w(this,n,"m",g).call(this,(0,E.bytesToHex)((0,A.publicToAddress)(this.hdk.publicKey,!0)));const s=e?w(this,n,"m",h).call(this,e):this.hdPath;let r;try{r=await this.bridge.getPublicKey({hdPath:s})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while unlocking account")}return t&&r.chainCode&&(this.hdk.publicKey=S.Buffer.from(r.publicKey,"hex"),this.hdk.chainCode=S.Buffer.from(r.chainCode,"hex")),(0,E.add0x)(r.address)}async addAccounts(e){return new Promise((t,s)=>{this.unlock().then(async s=>{const r=this.unlockedAccount,a=r+e,i=[];for(let e=r;e<a;e++){const t=w(this,n,"m",u).call(this,e);let s;s=w(this,n,"m",m).call(this)?await this.unlock(t):w(this,n,"m",d).call(this,I,e),this.accountDetails[w(this,n,"m",g).call(this,s)]={bip44:w(this,n,"m",m).call(this),hdPath:t},this.accounts.includes(s)||(this.accounts=[...this.accounts,s],i.push(s)),this.page=0}t(i)}).catch(s)})}getName(){return j}async getFirstPage(){return this.page=0,w(this,n,"m",i).call(this,1)}async getNextPage(){return w(this,n,"m",i).call(this,1)}async getPreviousPage(){return w(this,n,"m",i).call(this,-1)}async getAccounts(){return Promise.resolve(this.accounts.slice())}removeAccount(e){const t=this.accounts.filter(t=>t.toLowerCase()!==e.toLowerCase());if(t.length===this.accounts.length)throw new Error(`Address ${e} not found in this keyring`);this.accounts=t,delete this.accountDetails[w(this,n,"m",g).call(this,e)]}async attemptMakeApp(){return this.bridge.attemptMakeApp()}async updateTransportMethod(e){return this.bridge.updateTransportMethod(e)}async getAppNameAndVersion(){try{return await this.bridge.getAppNameAndVersion()}catch(e){return(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while getting app name and version")}}async getAppConfiguration(){try{return await this.bridge.getAppConfiguration()}catch(e){return(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while getting app configuration")}}async signTransaction(e,t){let s;if(function(e){return"getChainId"in e&&"function"==typeof e.getChainId}(t))return t.v=t.getChainId(),t.r="0x00",t.s="0x00",s=t.serialize().toString("hex"),w(this,n,"m",a).call(this,e,s,e=>(t.v=S.Buffer.from(e.v,"hex"),t.r=S.Buffer.from(e.r,"hex"),t.s=S.Buffer.from(e.s,"hex"),t));const r=t.getMessageToSign();return s=Array.isArray(r)?S.Buffer.from(b.RLP.encode(r)).toString("hex"):(0,E.bytesToHex)(r),w(this,n,"m",a).call(this,e,s,e=>{const s=t.toJSON();return s.type=t.type,s.v=(0,E.add0x)(e.v),s.r=(0,E.add0x)(e.r),s.s=(0,E.add0x)(e.s),y.TransactionFactory.fromTxData(s,{common:t.common,freeze:Object.isFrozen(t)})})}async signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,t){const s=await this.unlockAccountByAddress(e);if(!s)throw new Error("Ledger: Unknown error while signing message");let r;try{r=await this.bridge.deviceSignMessage({hdPath:s,message:(0,E.remove0x)(t)})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while signing message")}const a=w(this,n,"m",k).call(this,parseInt(String(r.v),10)),i=`0x${r.r}${r.s}${a}`,o=(0,v.recoverPersonalSignature)({data:t,signature:i});if(w(this,n,"m",g).call(this,o)!==w(this,n,"m",g).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return i}async unlockAccountByAddress(e){const t=w(this,n,"m",g).call(this,e),s=this.accountDetails[t];if(!s)throw new Error(`Ledger: Account for address '${t}' not found`);const{hdPath:r}=s;if((await this.unlock(r,!1)).toLowerCase()!==e.toLowerCase())throw new Error(`Ledger: Account ${e} does not belong to the connected device`);return r}async signTypedData(e,t,s){const{version:r}=s??{};if(!("V4"===r))throw new Error("Ledger: Only version 4 of typed data signing is supported");const{domain:a,types:i,primaryType:o,message:c}=v.TypedDataUtils.sanitizeData(t),d=await this.unlockAccountByAddress(e);if(!d)throw new Error("Ledger: Unknown error while signing message");let l;try{l=await this.bridge.deviceSignTypedData({hdPath:d,message:{domain:{name:a.name,chainId:a.chainId,version:a.version,verifyingContract:a.verifyingContract,salt:a.salt instanceof ArrayBuffer?S.Buffer.from(a.salt).toString("hex"):a.salt},types:i,primaryType:o.toString(),message:c}})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while signing message")}const u=w(this,n,"m",k).call(this,parseInt(String(l.v),10)),m=`0x${l.r}${l.s}${u}`,h=(0,v.recoverTypedSignature)({data:t,signature:m,version:v.SignTypedDataVersion.V4});if(w(this,n,"m",g).call(this,h)!==w(this,n,"m",g).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return m}forgetDevice(){this.deviceId="",this.accounts=[],this.page=0,this.unlockedAccount=0,this.paths={},this.accountDetails={},this.hdk=new x.default}}s.LedgerKeyring=N,n=new WeakSet,r=function(e){if(w(this,n,"m",m).call(this)&&e.accountIndexes)for(const[t,s]of Object.entries(e.accountIndexes))this.accountDetails[t]={bip44:!0,hdPath:w(this,n,"m",u).call(this,s)};const t=new Set(Object.keys(this.accountDetails));w(this,n,"m",m).call(this)||this.accounts.forEach(e=>{const s=w(this,n,"m",g).call(this,e);t.has(s)||(this.accountDetails[s]={bip44:!1,hdPath:w(this,n,"m",l).call(this,e)})})},a=async function(e,t,s){const n=await this.unlockAccountByAddress(e);if(!n)throw new Error("Ledger: hdPath is empty while signing transaction");let r;try{r=await this.bridge.deviceSignTransaction({tx:(0,E.remove0x)(t),hdPath:n})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while signing transaction")}const a=s(r);if(a.verifySignature())return a;throw new Error("Ledger: The transaction signature is not valid")},i=async function(e){this.page+=e,this.page<=0&&(this.page=1);const t=(this.page-1)*this.perPage,s=t+this.perPage;let r;return await this.unlock(),r=w(this,n,"m",m).call(this)?await w(this,n,"m",o).call(this,t,s):w(this,n,"m",c).call(this,t,s),r},o=async function(e,t){const s=[];for(let r=e;r<t;r++){const e=w(this,n,"m",u).call(this,r),t=await this.unlock(e),a=!this.implementFullBIP44||await w(this,n,"m",p).call(this,t);if(s.push({address:t,balance:null,index:r}),!a)break}return s},c=function(e,t){const s=[];for(let r=e;r<t;r++){const e=w(this,n,"m",d).call(this,I,r);s.push({address:e,balance:null,index:r}),this.paths[w(this,n,"m",g).call(this,e)]=r}return s},d=function(e,t){const s=this.hdk.derive(`${e}/${t}`),r=(0,E.bytesToHex)((0,A.publicToAddress)(s.publicKey,!0));return w(this,n,"m",g).call(this,r)},l=function(e){const t=w(this,n,"m",g).call(this,e);let s=this.paths[t];if(void 0===s)for(let e=0;e<1e3;e++)if(t===w(this,n,"m",d).call(this,I,e)){s=e;break}if(void 0===s)throw new Error("Unknown address");return w(this,n,"m",u).call(this,s)},u=function(e){return w(this,n,"m",m).call(this)?`m/44'/60'/${e}'/0/0`:`${this.hdPath}/${e}`},m=function(){return"m/44'/60'/0'/0/0"===this.hdPath},h=function(e){return e.toString().replace("m/","")},p=async function(e){const t=w(this,n,"m",f).call(this),s=await window.fetch(`${t}/api?module=account&action=txlist&address=${e}&tag=latest&page=1&offset=1`),r=await s.json();return"0"!==r.status&&r.result.length>0},f=function(){return this.network},g=function(e){return(0,E.getChecksumAddress)((0,E.add0x)(e))},k=function(e){return 0===e||1===e?(e+27).toString(16):e.toString(16)},N.type=j}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs",{"./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.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.LedgerMobileBridge=void 0;e("./ledger-hw-app.cjs");s.LedgerMobileBridge=class{constructor(e,t={}){n.add(this),r.set(this,void 0),a.set(this,void 0),this.isDeviceConnected=!1,c(this,a,t,"f"),c(this,r,e,"f")}async init(){return Promise.resolve()}async destroy(){try{await d(this,n,"m",i).call(this).dispose()}catch(e){console.error(e)}this.isDeviceConnected=!1}async deviceSignMessage({hdPath:e,message:t}){return d(this,n,"m",o).call(this).signPersonalMessage(e,t)}async deviceSignTypedData({hdPath:e,message:t}){return d(this,n,"m",o).call(this).signEIP712Message(e,t)}async deviceSignTransaction({tx:e,hdPath:t}){return d(this,n,"m",o).call(this).clearSignTransaction(t,e,{externalPlugins:!0,erc20:!0,nft:!0})}async getPublicKey({hdPath:e}){return await d(this,n,"m",o).call(this).getAddress(e,!1,!0)}async getOptions(){return d(this,a,"f")}async setOptions(e){c(this,a,e,"f")}async updateTransportMethod(e){if(!e.deviceModel)throw new Error("Property `deviceModel` is not defined in `transport`.");if(!e.deviceModel.id)throw new Error("Property `deviceModel.id` is not defined in `transport`.");return d(this,n,"m",i).call(this).setTransport(e),this.isDeviceConnected=!0,Promise.resolve(!0)}async attemptMakeApp(){throw new Error("Method not supported.")}async openEthApp(){await d(this,n,"m",o).call(this).openEthApp()}async closeApps(){await d(this,n,"m",o).call(this).closeApps()}async getAppNameAndVersion(){return d(this,n,"m",o).call(this).getAppNameAndVersion()}async getAppConfiguration(){return d(this,n,"m",o).call(this).getAppConfiguration()}},r=new WeakMap,a=new WeakMap,n=new WeakSet,i=function(){if(d(this,r,"f"))return d(this,r,"f");throw new Error("Instance `transportMiddleware` is not initialized.")},o=function(){return d(this,n,"m",i).call(this).getEthApp()}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs",{"./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},a=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.LedgerTransportMiddleware=void 0;const i=e("./ledger-hw-app.cjs");s.LedgerTransportMiddleware=class{constructor(){this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii",n.set(this,void 0)}async dispose(){const e=this.getTransport();await e.close()}setTransport(e){r(this,n,e,"f")}getTransport(){if(!a(this,n,"f"))throw new Error("Instance `transport` is not initialized.");return a(this,n,"f")}getEthApp(){return new i.MetaMaskLedgerHwAppEth(this.getTransport())}},n=new WeakMap}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs",{"./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.MOBILE_ERROR_MAPPINGS=s.BLE_ERROR_MAPPINGS=s.LEDGER_ERROR_MAPPINGS=void 0;const n=e("./hardware-errors-enums.cjs");s.LEDGER_ERROR_MAPPINGS={"0x9000":{code:n.ErrorCode.Success,message:"Operation successful",severity:n.Severity.Info,category:n.Category.Success},"0x6300":{code:n.ErrorCode.AuthenticationFailed,message:"Authentication failed",severity:n.Severity.Err,category:n.Category.Authentication,userMessage:"Authentication failed. Please verify your credentials."},"0x63c0":{code:n.ErrorCode.AuthenticationPinAttemptsRemaining,message:"PIN attempts remaining",severity:n.Severity.Warning,category:n.Category.Authentication,userMessage:"Incorrect PIN. Please try again."},"0x6982":{code:n.ErrorCode.AuthenticationSecurityCondition,message:"Security conditions not satisfied",severity:n.Severity.Err,category:n.Category.Authentication,userMessage:"Device is locked or access rights are insufficient. Please unlock your device."},"0x6985":{code:n.ErrorCode.UserRejected,message:"User rejected action on device",severity:n.Severity.Warning,category:n.Category.UserAction,userMessage:"Transaction was rejected. Please approve on your device to continue."},"0x9804":{code:n.ErrorCode.AuthenticationSecurityCondition,message:"App update required",severity:n.Severity.Err,category:n.Category.Authentication,userMessage:"Please update your Ledger app to continue."},"0x9808":{code:n.ErrorCode.AuthenticationFailed,message:"Contradiction in secret code status",severity:n.Severity.Err,category:n.Category.Authentication},"0x9840":{code:n.ErrorCode.AuthenticationDeviceBlocked,message:"Code blocked",severity:n.Severity.Critical,category:n.Category.Authentication,userMessage:"Your device is blocked due to too many failed attempts. Please follow device recovery procedures."},"0x650f":{code:n.ErrorCode.ConnectionClosed,message:"App closed or connection issue",severity:n.Severity.Err,category:n.Category.Connection,userMessage:"Connection lost or app closed. Please open the corresponding app on your Ledger device."},"0x5515":{code:n.ErrorCode.AuthenticationDeviceLocked,message:"Device is locked",severity:n.Severity.Err,category:n.Category.Authentication,userMessage:"Please unlock your Ledger device to continue."},"0x5501":{code:n.ErrorCode.UserRejected,message:"User refused on device",severity:n.Severity.Warning,category:n.Category.UserAction,userMessage:"Operation was rejected. Please approve on your device to continue."},"0x6a80":{code:n.ErrorCode.DeviceStateBlindSignNotSupported,message:"Blind signing not supported",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Blind signing is not supported on this device."},"0x6d00":{code:n.ErrorCode.DeviceStateOnlyV4Supported,message:"Ledger Only V4 supported",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Only V4 is supported on this device."},"0x6e00":{code:n.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."},"0x6501":{code:n.ErrorCode.DeviceStateEthAppOutOfDate,message:"Ethereum app out of date",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Ethereum app is out of date. Please update it to continue."},"0x6f00":{code:n.ErrorCode.DeviceUnresponsive,message:"Device unresponsive",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Your device is not responding. Please disconnect and reconnect your device."},"0x6b0c":{code:n.ErrorCode.AuthenticationDeviceLocked,message:"Device locked",severity:n.Severity.Err,category:n.Category.Authentication,userMessage:"Please unlock your Ledger device to continue."},"0x6a15":{code:n.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."},"0x6511":{code:n.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."}},s.BLE_ERROR_MAPPINGS={BLUETOOTH_PERMISSION_DENIED:{code:n.ErrorCode.PermissionBluetoothDenied,message:"Bluetooth permission denied",severity:n.Severity.Err,category:n.Category.Configuration,userMessage:"Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings."},LOCATION_PERMISSION_DENIED:{code:n.ErrorCode.PermissionLocationDenied,message:"Location permission denied",severity:n.Severity.Err,category:n.Category.Configuration,userMessage:"Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings."},NEARBY_DEVICES_PERMISSION_DENIED:{code:n.ErrorCode.PermissionNearbyDevicesDenied,message:"Nearby devices permission denied",severity:n.Severity.Err,category:n.Category.Configuration,userMessage:"Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings."},BLUETOOTH_DISABLED:{code:n.ErrorCode.BluetoothDisabled,message:"Bluetooth is turned off",severity:n.Severity.Warning,category:n.Category.Connection,userMessage:"Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet."},BLUETOOTH_SCAN_FAILED:{code:n.ErrorCode.BluetoothScanFailed,message:"Bluetooth scanning failed",severity:n.Severity.Err,category:n.Category.Connection,userMessage:"Unable to scan for Bluetooth devices. Please try again."},BLUETOOTH_CONNECTION_FAILED:{code:n.ErrorCode.BluetoothConnectionFailed,message:"Bluetooth connection failed",severity:n.Severity.Err,category:n.Category.Connection,userMessage:"Failed to connect via Bluetooth. Please make sure your device is nearby and try again."}},s.MOBILE_ERROR_MAPPINGS={NOT_SUPPORTED:{code:n.ErrorCode.MobileNotSupported,message:"Operation not supported on mobile",severity:n.Severity.Err,category:n.Category.DeviceState,userMessage:"This operation is not supported on mobile devices."}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs",{"./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=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.HardwareWalletError=void 0;const i=e("./hardware-errors-enums.cjs");class o extends Error{constructor(e,t){super(e),n.add(this),this.name="HardwareWalletError",this.id=`err_${Date.now().toString(36)}_${Math.random().toString(36).substring(2,9)}`,this.code=t.code,this.severity=t.severity,this.category=t.category,this.userMessage=t.userMessage,this.timestamp=new Date,this.metadata=t.metadata,this.cause=t.cause}isCritical(){return this.severity===i.Severity.Critical}isWarning(){return this.severity===i.Severity.Warning}withMetadata(e){const t={code:this.code,severity:this.severity,category:this.category,userMessage:this.userMessage,metadata:{...this.metadata??{},...e}};return this.cause!==undefined&&(t.cause=this.cause),new o(this.message,t)}toJSON(){const e={id:this.id,name:this.name,message:this.message,code:this.code,severity:this.severity,category:this.category,userMessage:this.userMessage,timestamp:this.timestamp.toISOString(),metadata:this.metadata};return this.cause!==undefined&&(e.cause={name:this.cause.name,message:this.cause.message}),e}toString(){return`${a(this,n,"m",r).call(this)}: ${this.message}`}toDetailedString(){const e=[this.toString(),`User Message: ${this.userMessage}`,`Severity: ${this.severity}`,`Category: ${this.category}`,`Timestamp: ${this.timestamp.toISOString()}`];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`Metadata: ${JSON.stringify(this.metadata,null,2)}`),this.cause!==undefined&&e.push(`Caused by: ${this.cause.message}`),e.join("\n")}static isHardwareWalletError(e){return e instanceof o}}s.HardwareWalletError=o,n=new WeakSet,r=function(){const e=(t=this.code,i.ErrorCode[t]??i.ErrorCode[i.ErrorCode.Unknown]);var t;return`${this.name} [${e}:${this.code}]`}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a;Object.defineProperty(s,"__esModule",{value:!0}),s.Category=s.Severity=s.ErrorCode=void 0,function(e){e[e.Success=0]="Success",e[e.AuthenticationFailed=1e3]="AuthenticationFailed",e[e.AuthenticationIncorrectPin=1001]="AuthenticationIncorrectPin",e[e.AuthenticationPinAttemptsRemaining=1002]="AuthenticationPinAttemptsRemaining",e[e.AuthenticationPinCancelled=1003]="AuthenticationPinCancelled",e[e.AuthenticationDeviceLocked=1100]="AuthenticationDeviceLocked",e[e.AuthenticationDeviceBlocked=1101]="AuthenticationDeviceBlocked",e[e.AuthenticationSecurityCondition=1200]="AuthenticationSecurityCondition",e[e.AuthenticationWipeCodeMismatch=1300]="AuthenticationWipeCodeMismatch",e[e.UserRejected=2e3]="UserRejected",e[e.UserCancelled=2001]="UserCancelled",e[e.UserConfirmationRequired=2002]="UserConfirmationRequired",e[e.UserInputRequired=2003]="UserInputRequired",e[e.DeviceNotReady=3e3]="DeviceNotReady",e[e.DeviceInvalidSession=3001]="DeviceInvalidSession",e[e.DeviceDisconnected=3003]="DeviceDisconnected",e[e.DeviceUsedElsewhere=3004]="DeviceUsedElsewhere",e[e.DeviceCallInProgress=3005]="DeviceCallInProgress",e[e.DeviceUnresponsive=3006]="DeviceUnresponsive",e[e.DeviceNotFound=3010]="DeviceNotFound",e[e.DeviceMultipleConnected=3011]="DeviceMultipleConnected",e[e.DeviceMissingCapability=3020]="DeviceMissingCapability",e[e.DeviceBtcOnlyFirmware=3021]="DeviceBtcOnlyFirmware",e[e.DeviceIncompatibleMode=3030]="DeviceIncompatibleMode",e[e.ConnectionTransportMissing=4e3]="ConnectionTransportMissing",e[e.ConnectionClosed=4001]="ConnectionClosed",e[e.ConnectionTimeout=4002]="ConnectionTimeout",e[e.ConnectionBlocked=4003]="ConnectionBlocked",e[e.ProtocolUnexpectedMessage=5e3]="ProtocolUnexpectedMessage",e[e.ProtocolCommandError=5001]="ProtocolCommandError",e[e.ProtocolMessageError=5002]="ProtocolMessageError",e[e.DeviceStateBlindSignNotSupported=6001]="DeviceStateBlindSignNotSupported",e[e.DeviceStateOnlyV4Supported=6002]="DeviceStateOnlyV4Supported",e[e.DeviceStateEthAppClosed=6003]="DeviceStateEthAppClosed",e[e.DeviceStateEthAppOutOfDate=6004]="DeviceStateEthAppOutOfDate",e[e.PermissionBluetoothDenied=7e3]="PermissionBluetoothDenied",e[e.PermissionLocationDenied=7001]="PermissionLocationDenied",e[e.PermissionNearbyDevicesDenied=7002]="PermissionNearbyDevicesDenied",e[e.BluetoothDisabled=7100]="BluetoothDisabled",e[e.BluetoothScanFailed=7101]="BluetoothScanFailed",e[e.BluetoothConnectionFailed=7102]="BluetoothConnectionFailed",e[e.MobileNotSupported=7300]="MobileNotSupported",e[e.TxInsufficientFunds=1e4]="TxInsufficientFunds",e[e.Unknown=99999]="Unknown"}(n||(s.ErrorCode=n={})),function(e){e.Info="Info",e.Err="Error",e.Warning="Warning",e.Critical="Critical"}(r||(s.Severity=r={})),function(e){e.Success="Success",e.Authentication="Authentication",e.Protocol="Protocol",e.Connection="Connection",e.UserAction="UserAction",e.DeviceState="DeviceState",e.Unknown="Unknown",e.Configuration="Configuration"}(a||(s.Category=a={}))}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs",{"./hardware-error-mappings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs","./hardware-error.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs","./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./hardware-errors-enums.cjs"),s),r(e("./hardware-error-mappings.cjs"),s),r(e("./hardware-error.cjs"),s),r(e("./types.cjs"),s)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a;Object.defineProperty(s,"__esModule",{value:!0}),s.DeviceEvent=s.ConnectionStatus=s.HardwareWalletType=void 0,function(e){e.Ledger="ledger",e.Trezor="trezor",e.OneKey="onekey",e.Lattice="lattice",e.Qr="qr",e.Unknown="unknown"}(n||(s.HardwareWalletType=n={})),function(e){e.Disconnected="disconnected",e.Scanning="scanning",e.Connecting="connecting",e.Connected="connected",e.Ready="ready",e.AwaitingApp="awaiting_app",e.AwaitingConfirmation="awaiting_confirmation",e.ErrorState="error"}(r||(s.ConnectionStatus=r={})),function(e){e.Connected="connected",e.Disconnected="disconnected",e.ConnectionFailed="connection_failed",e.DeviceLocked="device_locked",e.AppOpened="app_opened",e.AppNotOpen="app_not_open",e.AppChanged="app_changed",e.ConfirmationRequired="confirmation_required",e.ConfirmationReceived="confirmation_received",e.ConfirmationRejected="confirmation_rejected",e.OperationTimeout="operation_timeout",e.PermissionChanged="permission_changed"}(a||(s.DeviceEvent=a={}))}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/index.cjs",{"./onekey-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/onekey-keyring.cjs","./trezor-connect-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-connect-bridge.cjs","./trezor-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./trezor-keyring.cjs"),s),r(e("./onekey-keyring.cjs"),s),r(e("./trezor-connect-bridge.cjs"),s)}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/onekey-keyring.cjs",{"./trezor-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.OneKeyKeyring=void 0;const n=e("./trezor-keyring.cjs"),r="OneKey Hardware";class a extends n.TrezorKeyring{constructor(){super(...arguments),this.type=r}}s.OneKeyKeyring=a,a.type=r}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/onekey-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-connect-bridge.cjs",{"@trezor/connect-web":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@trezor/connect-web/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&n(t,e,s);return r(t,e),t};Object.defineProperty(s,"__esModule",{value:!0}),s.TrezorConnectBridge=void 0;const i=a(e("@trezor/connect-web"));s.TrezorConnectBridge=class{constructor(){this.trezorConnectInitiated=!1}async init(e){i.default.on(i.DEVICE_EVENT,e=>{var t;e.type===i.DEVICE.CONNECT&&(this.model=null===(t=e.payload.features)||void 0===t?void 0:t.model)}),this.trezorConnectInitiated||(await i.default.init(e),this.trezorConnectInitiated=!0)}async dispose(){return i.default.dispose(),Promise.resolve()}getPublicKey(e){return i.default.getPublicKey(e)}ethereumSignTransaction(e){return i.default.ethereumSignTransaction(e)}ethereumSignMessage(e){return i.default.ethereumSignMessage(e)}ethereumSignTypedData(e){return i.default.ethereumSignTypedData(e)}}}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/trezor-connect-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs",{"@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@metamask/eth-sig-util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-sig-util/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","@trezor/connect-plugin-ethereum":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@trezor/connect-plugin-ethereum/lib/index.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",hdkey:"/home/runner/work/metamask-extension/metamask-extension/node_modules/hdkey/lib/hdkey.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(t){(function(){var n,r,a,i,o,c,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)},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.TrezorKeyring=s.TREZOR_CONNECT_MANIFEST=void 0;const u=e("@ethereumjs/tx"),m=e("@ethereumjs/util"),h=e("@metamask/eth-sig-util"),p=e("@metamask/utils"),f=e("@trezor/connect-plugin-ethereum"),g=l(e("hdkey")),k="m/44'/60'/0'/0",w="m/44'/1'/0'/0",_="m/44'/60'/0'",b={[k]:!0,[_]:!0,[w]:!0},y="Trezor Hardware",A=1e3;async function v(e){return new Promise(t=>setTimeout(t,e))}function E(e){return"function"==typeof e.getChainId}s.TREZOR_CONNECT_MANIFEST={appName:"MetaMask",email:"support@metamask.io",appUrl:"https://metamask.io"};class S{constructor({bridge:e}){if(n.add(this),this.type=y,this.accounts=[],this.hdk=new g.default,this.hdPath=k,this.page=0,this.perPage=5,this.unlockedAccount=0,this.paths={},!e)throw new Error("Bridge is a required dependency for the keyring");this.bridge=e}getModel(){return this.bridge.model}async init(){return this.bridge.init({manifest:s.TREZOR_CONNECT_MANIFEST,lazyLoad:!0})}async destroy(){return this.bridge.dispose()}async serialize(){return Promise.resolve({hdPath:this.hdPath,accounts:this.accounts.slice(),page:this.page,paths:this.paths,perPage:this.perPage,unlockedAccount:this.unlockedAccount})}async deserialize(e){var t,s,n,r;return this.hdPath=null!==(t=e.hdPath)&&void 0!==t?t:k,this.accounts=null!==(s=e.accounts)&&void 0!==s?s:[],this.page=null!==(n=e.page)&&void 0!==n?n:0,this.perPage=null!==(r=e.perPage)&&void 0!==r?r:5,Promise.resolve()}isUnlocked(){var e;return Boolean(null===(e=this.hdk)||void 0===e?void 0:e.publicKey)}async unlock(){return this.isUnlocked()?Promise.resolve("already unlocked"):new Promise((e,s)=>{this.bridge.getPublicKey({path:this.hdPath,coin:"ETH"}).then(n=>{var r;n.success?(this.hdk.publicKey=t.from(n.payload.publicKey,"hex"),this.hdk.chainCode=t.from(n.payload.chainCode,"hex"),e("just unlocked")):s(new Error((null===(r=n.payload)||void 0===r?void 0:r.error)||"Unknown error"))}).catch(e=>{s(new Error((null==e?void 0:e.toString())||"Unknown error"))})})}setAccountToUnlock(e){this.unlockedAccount=parseInt(String(e),10)}async addAccounts(e){return new Promise((t,s)=>{this.unlock().then(s=>{const r=this.unlockedAccount,a=r+e,i=[];for(let e=r;e<a;e++){const t=d(this,n,"m",o).call(this,"m",e);this.accounts.includes(t)||(this.accounts=[...this.accounts,t],i.push(t)),this.page=0}t(i)}).catch(e=>{s(e)})})}async getFirstPage(){return this.page=0,d(this,n,"m",r).call(this,1)}async getNextPage(){return d(this,n,"m",r).call(this,1)}async getPreviousPage(){return d(this,n,"m",r).call(this,-1)}async getAccounts(){return Promise.resolve(this.accounts.slice())}removeAccount(e){if(!this.accounts.map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter(t=>t.toLowerCase()!==e.toLowerCase())}async signTransaction(e,s){return E(s)?d(this,n,"m",a).call(this,e,s.getChainId(),s,e=>(s.v=t.from(e.v,"hex"),s.r=t.from(e.r,"hex"),s.s=t.from(e.s,"hex"),s)):d(this,n,"m",a).call(this,e,Number(s.common.chainId()),s,e=>{const t=s.toJSON();return t.type=s.type,t.v=(0,p.add0x)(e.v),t.r=(0,p.add0x)(e.r),t.s=(0,p.add0x)(e.s),u.TransactionFactory.fromTxData(t,{common:s.common,freeze:Object.isFrozen(s)})})}async signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,t){return new Promise((s,r)=>{this.unlock().then(a=>{setTimeout(()=>{this.bridge.ethereumSignMessage({path:d(this,n,"m",c).call(this,e),message:(0,p.remove0x)(t),hex:!0}).then(t=>{var n;if(t.success){t.payload.address!==(0,p.getChecksumAddress)(e)&&r(new Error("signature doesnt match the right address"));const n=`0x${t.payload.signature}`;s(n)}else r(new Error((null===(n=t.payload)||void 0===n?void 0:n.error)||"Unknown error"))}).catch(e=>{r(new Error((null==e?void 0:e.toString())||"Unknown error"))})},"just unlocked"===a?A:0)}).catch(e=>{r(new Error((null==e?void 0:e.toString())||"Unknown error"))})})}async signTypedData(e,t,s){var r,a;const{version:i}=null!=s?s:{version:h.SignTypedDataVersion.V4},o=(0,f.transformTypedData)(t,i===h.SignTypedDataVersion.V4),{types:l,message:u={},domain:m={},primaryType:g,domain_separator_hash:k,message_hash:w}=o,_=await this.unlock();await v("just unlocked"===_?A:0);const b=await this.bridge.ethereumSignTypedData({path:d(this,n,"m",c).call(this,e),data:{types:Object.assign(Object.assign({},l),{EIP712Domain:null!==(r=l.EIP712Domain)&&void 0!==r?r:[]}),message:u,domain:m,primaryType:g},metamask_v4_compat:!0,domain_separator_hash:k,message_hash:null!=w?w:""});if(b.success){if((0,p.getChecksumAddress)(e)!==b.payload.address)throw new Error("signature doesnt match the right address");return b.payload.signature}throw new Error((null===(a=b.payload)||void 0===a?void 0:a.error)||"Unknown error")}forgetDevice(){this.accounts=[],this.hdk=new g.default,this.page=0,this.unlockedAccount=0,this.paths={}}setHdPath(e){if(!b[e])throw new Error(`The setHdPath method does not support setting HD Path to ${e}`);this.hdPath!==e&&(this.hdk=new g.default,this.accounts=[],this.page=0,this.perPage=5,this.unlockedAccount=0,this.paths={}),this.hdPath=e}}s.TrezorKeyring=S,n=new WeakSet,r=async function(e){return this.page+=e,this.page<=0&&(this.page=1),new Promise((e,t)=>{this.unlock().then(t=>{const s=(this.page-1)*this.perPage,r=s+this.perPage,a=[];for(let e=s;e<r;e++){const t=d(this,n,"m",o).call(this,"m",e);a.push({address:t,balance:null,index:e}),this.paths[(0,p.getChecksumAddress)(t)]=e}e(a)}).catch(e=>{t(e)})})},a=async function(e,s,r,a){var o,l,u,m;let h;h=E(r)?{to:d(this,n,"m",i).call(this,r.to),value:d(this,n,"m",i).call(this,r.value),data:d(this,n,"m",i).call(this,r.data),chainId:s,nonce:d(this,n,"m",i).call(this,r.nonce),gasLimit:d(this,n,"m",i).call(this,r.gasLimit),gasPrice:d(this,n,"m",i).call(this,r.gasPrice)}:Object.assign(Object.assign({},r.toJSON()),{chainId:s,to:d(this,n,"m",i).call(this,t.from(null!==(l=null===(o=r.to)||void 0===o?void 0:o.bytes)&&void 0!==l?l:[]))});try{const t=await this.unlock();await v("just unlocked"===t?A:0);const s=await this.bridge.ethereumSignTransaction({path:d(this,n,"m",c).call(this,e),transaction:h});if(s.success){const t=a(s.payload),n=(0,p.getChecksumAddress)((0,p.add0x)(t.getSenderAddress().toString("hex")));if(n!==(0,p.getChecksumAddress)(e))throw new Error("signature doesn't match the right address");return t}throw new Error((null===(u=s.payload)||void 0===u?void 0:u.error)||"Unknown error")}catch(e){throw new Error(null!==(m=null==e?void 0:e.toString())&&void 0!==m?m:"Unknown error")}},i=function(e){return(0,p.bytesToHex)(e)},o=function(e,t){const s=this.hdk.derive(`${e}/${t}`),n=(0,p.bytesToHex)((0,m.publicToAddress)(s.publicKey,!0));return(0,m.toChecksumAddress)(n)},c=function(e){const t=(0,p.getChecksumAddress)(e);let s=this.paths[t];if(void 0===s)for(let e=0;e<1e3;e++)if(t===d(this,n,"m",o).call(this,"m",e)){s=e;break}if(void 0===s)throw new Error("Unknown address");return`${this.hdPath}/${s}`},S.type=y}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs",{"./determineGasFeeCalculations.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/determineGasFeeCalculations.cjs","./gas-util.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/gas-util.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},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)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.GasFeeController=s.GAS_ESTIMATE_TYPES=s.LEGACY_GAS_PRICES_API_URL=void 0;const d=e("@metamask/controller-utils"),l=c(e("@metamask/eth-query")),u=e("@metamask/polling-controller"),m=e("uuid"),h=c(e("./determineGasFeeCalculations.cjs")),p=e("./gas-util.cjs");s.LEGACY_GAS_PRICES_API_URL="https://api.metaswap.codefi.network/gasPrices",s.GAS_ESTIMATE_TYPES={FEE_MARKET:"fee-market",LEGACY:"legacy",ETH_GASPRICE:"eth_gasPrice",NONE:"none"};const f={gasFeeEstimatesByChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},gasFeeEstimates:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},estimatedGasFeeTimeBounds:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},gasEstimateType:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},nonRPCGasFeeApisDisabled:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}},g={gasFeeEstimatesByChainId:{},gasFeeEstimates:{},estimatedGasFeeTimeBounds:{},gasEstimateType:s.GAS_ESTIMATE_TYPES.NONE,nonRPCGasFeeApisDisabled:!1};class k extends((0,u.StaticIntervalPollingController)()){constructor({interval:e=15e3,messenger:t,state:c,getCurrentNetworkEIP1559Compatibility:d,getCurrentAccountEIP1559Compatibility:u,getChainId:m,getCurrentNetworkLegacyGasAPICompatibility:h,getProvider:p,onNetworkDidChange:k,legacyAPIEndpoint:w=s.LEGACY_GAS_PRICES_API_URL,EIP1559APIEndpoint:_,clientId:b}){if(super({name:"GasFeeController",metadata:f,messenger:t,state:{...g,...c}}),n.add(this),r.set(this,void 0),this.intervalDelay=e,this.setIntervalLength(e),this.pollTokens=new Set,this.getCurrentNetworkEIP1559Compatibility=d,this.getCurrentNetworkLegacyGasAPICompatibility=h,this.getCurrentAccountEIP1559Compatibility=u,i(this,r,p,"f"),this.EIP1559APIEndpoint=_,this.legacyAPIEndpoint=w,this.clientId=b,this.ethQuery=new l.default(o(this,r,"f").call(this)),k&&m)this.currentChainId=m(),k(async e=>{await o(this,n,"m",a).call(this,e)});else{const{selectedNetworkClientId:e}=this.messenger.call("NetworkController:getState");this.currentChainId=this.messenger.call("NetworkController:getNetworkClientById",e).configuration.chainId,this.messenger.subscribe("NetworkController:networkDidChange",async e=>{await o(this,n,"m",a).call(this,e)})}}async resetPolling(){if(0!==this.pollTokens.size){const e=Array.from(this.pollTokens);this.stopPolling(),await this.getGasFeeEstimatesAndStartPolling(e[0]),e.slice(1).forEach(e=>{this.pollTokens.add(e)})}}async fetchGasFeeEstimates(e){return await this._fetchGasFeeEstimateData(e)}async getGasFeeEstimatesAndStartPolling(e){const t=e||(0,m.v1)();return this.pollTokens.add(t),1===this.pollTokens.size&&(await this._fetchGasFeeEstimateData(),this._poll()),t}async _fetchGasFeeEstimateData(e={}){const{shouldUpdateState:t=!0,networkClientId:s}=e;let n,r,a,i;if(s!==undefined){const e=this.messenger.call("NetworkController:getNetworkClientById",s);a="0x38"===e.configuration.chainId,i=(0,d.convertHexToDecimal)(e.configuration.chainId);try{r=await this.messenger.call("NetworkController:getEIP1559Compatibility",s)||!1}catch{r=!1}n=new l.default(e.provider)}n??(n=this.ethQuery),a??(a=this.getCurrentNetworkLegacyGasAPICompatibility()),i??(i=(0,d.convertHexToDecimal)(this.currentChainId));try{r??(r=await this.getEIP1559Compatibility())}catch(e){console.error(e),r??(r=!1)}const o=await(0,h.default)({isEIP1559Compatible:r,isLegacyGasAPICompatible:a,fetchGasEstimates:p.fetchGasEstimates,fetchGasEstimatesUrl:this.EIP1559APIEndpoint.replace("<chain_id>",`${i}`),fetchLegacyGasPriceEstimates:p.fetchLegacyGasPriceEstimates,fetchLegacyGasPriceEstimatesUrl:this.legacyAPIEndpoint.replace("<chain_id>",`${i}`),fetchEthGasPriceEstimate:p.fetchEthGasPriceEstimate,calculateTimeEstimate:p.calculateTimeEstimate,clientId:this.clientId,ethQuery:n,nonRPCGasFeeApisDisabled:this.state.nonRPCGasFeeApisDisabled});if(t){const e=(0,d.toHex)(i);this.update(t=>{this.currentChainId===e&&(t.gasFeeEstimates=o.gasFeeEstimates,t.estimatedGasFeeTimeBounds=o.estimatedGasFeeTimeBounds,t.gasEstimateType=o.gasEstimateType),t.gasFeeEstimatesByChainId??(t.gasFeeEstimatesByChainId={}),t.gasFeeEstimatesByChainId[e]={gasFeeEstimates:o.gasFeeEstimates,estimatedGasFeeTimeBounds:o.estimatedGasFeeTimeBounds,gasEstimateType:o.gasEstimateType}})}return o}disconnectPoller(e){this.pollTokens.delete(e),0===this.pollTokens.size&&this.stopPolling()}stopPolling(){this.intervalId&&clearInterval(this.intervalId),this.pollTokens.clear(),this.resetState()}destroy(){super.destroy(),this.stopPolling()}_poll(){this.intervalId&&clearInterval(this.intervalId),this.intervalId=setInterval(async()=>{await(0,d.safelyExecute)(()=>this._fetchGasFeeEstimateData())},this.intervalDelay)}async _executePoll({networkClientId:e}){await this._fetchGasFeeEstimateData({networkClientId:e})}resetState(){this.update(()=>g)}async getEIP1559Compatibility(){const e=await this.getCurrentNetworkEIP1559Compatibility(),t=this.getCurrentAccountEIP1559Compatibility?.()??!0;return e&&t}getTimeEstimate(e,t){return this.state.gasFeeEstimates&&this.state.gasEstimateType===s.GAS_ESTIMATE_TYPES.FEE_MARKET?(0,p.calculateTimeEstimate)(e,t,this.state.gasFeeEstimates):{}}enableNonRPCGasFeeApis(){this.update(e=>{e.nonRPCGasFeeApisDisabled=!1})}disableNonRPCGasFeeApis(){this.update(e=>{e.nonRPCGasFeeApisDisabled=!0})}}s.GasFeeController=k,r=new WeakMap,n=new WeakSet,a=async function({selectedNetworkClientId:e}){const t=this.messenger.call("NetworkController:getNetworkClientById",e).configuration.chainId;t!==this.currentChainId&&(this.ethQuery=new l.default(o(this,r,"f").call(this)),await this.resetPolling(),this.currentChainId=t)},s.default=k}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/determineGasFeeCalculations.cjs",{"./GasFeeController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0});const n=e("./GasFeeController.cjs");s.default=async function(e){try{return await async function(e){const{isEIP1559Compatible:t,isLegacyGasAPICompatible:s,nonRPCGasFeeApisDisabled:r}=e;try{if(t&&!r)return await async function(e){const{fetchGasEstimates:t,fetchGasEstimatesUrl:s,clientId:r,calculateTimeEstimate:a}=e,i=await t(s,r),{suggestedMaxPriorityFeePerGas:o,suggestedMaxFeePerGas:c}=i.medium,d=a(o,c,i);return{gasFeeEstimates:i,estimatedGasFeeTimeBounds:d,gasEstimateType:n.GAS_ESTIMATE_TYPES.FEE_MARKET}}(e);if(s&&!r)return await async function(e){const{fetchLegacyGasPriceEstimates:t,fetchLegacyGasPriceEstimatesUrl:s,clientId:r}=e;return{gasFeeEstimates:await t(s,r),estimatedGasFeeTimeBounds:{},gasEstimateType:n.GAS_ESTIMATE_TYPES.LEGACY}}(e);throw new Error("Main gas fee/price estimation failed. Use fallback")}catch{return await async function(e){const{ethQuery:t,fetchEthGasPriceEstimate:s}=e;return{gasFeeEstimates:await s(t),estimatedGasFeeTimeBounds:{},gasEstimateType:n.GAS_ESTIMATE_TYPES.ETH_GASPRICE}}(e)}}(e)}catch(e){if(e instanceof Error)throw new Error(`Gas fee/price estimation failed. Message: ${e.message}`);throw e}}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/determineGasFeeCalculations.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/gas-util.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.calculateTimeEstimate=s.fetchEthGasPriceEstimate=s.fetchLegacyGasPriceEstimates=s.fetchGasEstimates=s.normalizeGWEIDecimalNumbers=void 0;const r=e("@metamask/controller-utils"),a=n(e("bn.js")),i=e=>({"X-Client-Id":e});function o(e){const t=(0,r.gweiDecToWEIBN)(e).toString(16);return(0,r.weiHexToGweiDec)(t)}s.normalizeGWEIDecimalNumbers=o,s.fetchGasEstimates=async function(e,t){const s=await(0,r.handleFetch)(e,t?{headers:i(t)}:undefined);return{low:{...s.low,suggestedMaxPriorityFeePerGas:o(s.low.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:o(s.low.suggestedMaxFeePerGas)},medium:{...s.medium,suggestedMaxPriorityFeePerGas:o(s.medium.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:o(s.medium.suggestedMaxFeePerGas)},high:{...s.high,suggestedMaxPriorityFeePerGas:o(s.high.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:o(s.high.suggestedMaxFeePerGas)},estimatedBaseFee:o(s.estimatedBaseFee),historicalBaseFeeRange:s.historicalBaseFeeRange,baseFeeTrend:s.baseFeeTrend,latestPriorityFeeRange:s.latestPriorityFeeRange,historicalPriorityFeeRange:s.historicalPriorityFeeRange,priorityFeeTrend:s.priorityFeeTrend,networkCongestion:s.networkCongestion}},s.fetchLegacyGasPriceEstimates=async function(e,t){const s=await(0,r.handleFetch)(e,{referrer:e,referrerPolicy:"no-referrer-when-downgrade",method:"GET",mode:"cors",headers:{"Content-Type":"application/json",...t&&i(t)}});return{low:s.SafeGasPrice,medium:s.ProposeGasPrice,high:s.FastGasPrice}},s.fetchEthGasPriceEstimate=async function(e){const t=await(0,r.query)(e,"gasPrice");return{gasPrice:(0,r.weiHexToGweiDec)(t).toString()}},s.calculateTimeEstimate=function(e,t,s){const{low:n,medium:i,high:o,estimatedBaseFee:c}=s,d=(0,r.gweiDecToWEIBN)(e),l=(0,r.gweiDecToWEIBN)(t),u=(0,r.gweiDecToWEIBN)(c),m=a.default.min(d,l.sub(u)),h=(0,r.gweiDecToWEIBN)(n.suggestedMaxPriorityFeePerGas),p=(0,r.gweiDecToWEIBN)(i.suggestedMaxPriorityFeePerGas),f=(0,r.gweiDecToWEIBN)(o.suggestedMaxPriorityFeePerGas);let g,k;return m.lt(h)?(g=null,k="unknown"):m.gte(h)&&m.lt(p)?(g=n.minWaitTimeEstimate,k=n.maxWaitTimeEstimate):m.gte(p)&&m.lt(f)?(g=i.minWaitTimeEstimate,k=i.maxWaitTimeEstimate):m.eq(f)?(g=o.minWaitTimeEstimate,k=o.maxWaitTimeEstimate):(g=0,k=o.maxWaitTimeEstimate),{lowerTimeBound:g,upperTimeBound:k}}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/gas-util.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/index.cjs",{"./GasFeeController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./GasFeeController.cjs"),s)}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs",{"fast-json-stable-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-json-stable-stringify/index.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=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.AbstractPollingControllerBaseMixin=s.getKey=void 0;const a=r(e("fast-json-stable-stringify")),i=e("uuid");s.getKey=e=>(0,a.default)(e),s.AbstractPollingControllerBaseMixin=function(e){var t,r;return t=new WeakMap,r=new WeakMap,class extends e{constructor(){super(...arguments),t.set(this,new Map),r.set(this,new Map)}startPolling(e){const r=(0,i.v4)(),a=(0,s.getKey)(e),o=n(this,t,"f").get(a)??new Set;return o.add(r),n(this,t,"f").set(a,o),1===o.size&&this._startPolling(e),r}stopAllPolling(){n(this,t,"f").forEach((e,t)=>{e.forEach(e=>{this.stopPollingByPollingToken(e)})})}stopPollingByPollingToken(e){if(!e)throw new Error("pollingToken required");let s=null;for(const[r,a]of n(this,t,"f"))if(a.delete(e)){0===a.size&&(s=r);break}if(s){this._stopPollingByPollingTokenSetId(s),n(this,t,"f").delete(s);const e=n(this,r,"f").get(s);if(e){for(const t of e)t(JSON.parse(s));e.clear()}}}onPollingComplete(e,t){const a=(0,s.getKey)(e),i=n(this,r,"f").get(a)??new Set;i.add(t),n(this,r,"f").set(a,i)}}}}}},{package:"@metamask/gas-fee-controller>@metamask/polling-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/BlockTrackerPollingController.cjs",{"./AbstractPollingController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=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.BlockTrackerPollingController=s.BlockTrackerPollingControllerOnly=void 0;const r=e("@metamask/base-controller"),a=e("./AbstractPollingController.cjs");function i(e){var t;class s extends((0,a.AbstractPollingControllerBaseMixin)(e)){constructor(){super(...arguments),t.set(this,{})}_startPolling(e){const s=(0,a.getKey)(e);if(n(this,t,"f")[s])return;const r=this._getNetworkClientById(e.networkClientId);if(!r)throw new Error(`Unable to retrieve blockTracker for networkClientId ${e.networkClientId}`);{const a=this._executePoll.bind(this,e);r.blockTracker.addListener("latest",a),n(this,t,"f")[s]=a}}_stopPollingByPollingTokenSetId(e){const{networkClientId:s}=JSON.parse(e),r=this._getNetworkClientById(s);if(r&&n(this,t,"f")[e]){const s=n(this,t,"f")[e];s&&(r.blockTracker.removeListener("latest",s),delete n(this,t,"f")[e])}}}return t=new WeakMap,s}class o{}s.BlockTrackerPollingControllerOnly=()=>i(o);s.BlockTrackerPollingController=()=>i(r.BaseController)}}},{package:"@metamask/gas-fee-controller>@metamask/polling-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/BlockTrackerPollingController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/StaticIntervalPollingController.cjs",{"./AbstractPollingController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.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.StaticIntervalPollingController=s.StaticIntervalPollingControllerOnly=void 0;const a=e("@metamask/base-controller"),i=e("./AbstractPollingController.cjs");function o(e){var t,s;class a extends((0,i.AbstractPollingControllerBaseMixin)(e)){constructor(){super(...arguments),t.set(this,{}),s.set(this,1e3)}setIntervalLength(e){n(this,s,e,"f")}getIntervalLength(){return r(this,s,"f")}_startPolling(e){if(!r(this,s,"f"))throw new Error("intervalLength must be defined and greater than 0");const n=(0,i.getKey)(e),a=r(this,t,"f")[n];this._stopPollingByPollingTokenSetId(n);const o=r(this,t,"f")[n]=setTimeout(async()=>{try{await this._executePoll(e)}catch(e){console.error(e)}o===r(this,t,"f")[n]&&this._startPolling(e)},a?r(this,s,"f"):0)}_stopPollingByPollingTokenSetId(e){const s=r(this,t,"f")[e];s&&(clearTimeout(s),delete r(this,t,"f")[e])}}return t=new WeakMap,s=new WeakMap,a}class c{}s.StaticIntervalPollingControllerOnly=()=>o(c);s.StaticIntervalPollingController=()=>o(a.BaseController)}}},{package:"@metamask/gas-fee-controller>@metamask/polling-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/StaticIntervalPollingController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/index.cjs",{"./BlockTrackerPollingController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/BlockTrackerPollingController.cjs","./StaticIntervalPollingController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/StaticIntervalPollingController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.StaticIntervalPollingController=s.StaticIntervalPollingControllerOnly=s.BlockTrackerPollingController=s.BlockTrackerPollingControllerOnly=void 0;var n=e("./BlockTrackerPollingController.cjs");Object.defineProperty(s,"BlockTrackerPollingControllerOnly",{enumerable:!0,get:function(){return n.BlockTrackerPollingControllerOnly}}),Object.defineProperty(s,"BlockTrackerPollingController",{enumerable:!0,get:function(){return n.BlockTrackerPollingController}});var r=e("./StaticIntervalPollingController.cjs");Object.defineProperty(s,"StaticIntervalPollingControllerOnly",{enumerable:!0,get:function(){return r.StaticIntervalPollingControllerOnly}}),Object.defineProperty(s,"StaticIntervalPollingController",{enumerable:!0,get:function(){return r.StaticIntervalPollingController}})}}},{package:"@metamask/gas-fee-controller>@metamask/polling-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/AbstractMessageManager.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.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.AbstractMessageManager=void 0;const n=e("@metamask/base-controller"),r=e("events"),a=e("uuid"),i={unapprovedMessages:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},unapprovedMessagesCount:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0}};class o extends n.BaseController{constructor({additionalFinishStatuses:e,messenger:t,name:s,securityProviderRequest:n,state:a={}}){super({messenger:t,metadata:i,name:s,state:{unapprovedMessages:{},unapprovedMessagesCount:0,...a}}),this.internalEvents=new r.EventEmitter,this.messages=[],this.securityProviderRequest=n,this.additionalFinishStatuses=e??[]}addRequestToMessageParams(e,t){const s={...e};return t&&(s.requestId=t.id,s.origin=t.origin),s}createUnapprovedMessage(e,t,s){return{id:(0,a.v1)(),messageParams:e,securityAlertResponse:s?.securityAlertResponse,status:"unapproved",time:Date.now(),type:t}}saveMessageList(e=!0){this.update(e=>{e.unapprovedMessages=this.getUnapprovedMessages(),e.unapprovedMessagesCount=this.getUnapprovedMessagesCount()}),e&&this.messenger.publish(`${this.name}:updateBadge`)}setMessageStatus(e,t){const s=this.getMessage(e);if(!s)throw new Error(`${this.name}: Message not found for id: ${e}.`);const n={...s,status:t};this.updateMessage(n),this.internalEvents.emit(`${e}:${t}`,n),("rejected"===t||"signed"===t||"errored"===t||this.additionalFinishStatuses.includes(t))&&this.internalEvents.emit(`${e}:finished`,n)}updateMessage(e,t=!0){const s=this.messages.findIndex(t=>e.id===t.id);-1!==s&&(this.messages[s]=e),this.saveMessageList(t)}async securityCheck(e){if(this.securityProviderRequest){const t=await this.securityProviderRequest(e,e.type);return{...e,securityProviderResponse:t}}return e}clearUnapprovedMessages(){this.update(e=>{e.unapprovedMessages={},e.unapprovedMessagesCount=0})}getUnapprovedMessagesCount(){return Object.keys(this.getUnapprovedMessages()).length}getUnapprovedMessages(){return this.messages.filter(e=>"unapproved"===e.status).reduce((e,t)=>(e[t.id]=t,e),{})}async addMessage(e){const t=await this.securityCheck(e);this.messages.push(t),this.saveMessageList()}getMessage(e){return this.messages.find(t=>t.id===e)}getAllMessages(){return this.messages}approveMessage(e){return this.setMessageStatusApproved(e.metamaskId),this.prepMessageForSigning(e)}setMessageStatusApproved(e){this.setMessageStatus(e,"approved")}setMessageStatusInProgress(e){this.setMessageStatus(e,"inProgress")}setMessageStatusSigned(e,t){this.setMessageStatusAndResult(e,t,"signed")}setMessageStatusAndResult(e,t,s){this.setResult(e,t),this.setMessageStatus(e,s)}setResult(e,t){const s=this.getMessage(e);s&&this.updateMessage({...s,rawSig:t},!1)}setMetadata(e,t){const s=this.getMessage(e);if(!s)throw new Error(`${this.name}: Message not found for id: ${e}.`);this.updateMessage({...s,metadata:t},!1)}rejectMessage(e){this.setMessageStatus(e,"rejected")}async waitForFinishStatus(e,t){const{metamaskId:s,...n}=e;return new Promise((e,r)=>{this.internalEvents.once(`${s}:finished`,s=>{switch(s.status){case"signed":return e(s.rawSig);case"rejected":return r(new Error(`MetaMask ${t} Signature: User denied message signature.`));case"errored":return r(new Error(`MetaMask ${t} Signature: ${s.error}`));default:return r(new Error(`MetaMask ${t} Signature: Unknown problem: ${JSON.stringify(n)}`))}})})}}s.AbstractMessageManager=o,s.default=o}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/AbstractMessageManager.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/DecryptMessageManager.cjs",{"./AbstractMessageManager.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/AbstractMessageManager.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/utils.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){Object.defineProperty(s,"__esModule",{value:!0}),s.DecryptMessageManager=void 0;const n=e("@metamask/controller-utils"),r=e("./AbstractMessageManager.cjs"),a=e("./utils.cjs"),i="DecryptMessageManager";class o extends r.AbstractMessageManager{constructor({additionalFinishStatuses:e,messenger:t,securityProviderRequest:s,state:n}){super({additionalFinishStatuses:e,messenger:t,name:i,securityProviderRequest:s,state:n})}async addUnapprovedMessageAsync(e,t){(0,a.validateDecryptedMessageData)(e);const s=await this.addUnapprovedMessage(e,t);return new Promise((t,n)=>{this.internalEvents.once(`${s}:finished`,s=>{switch(s.status){case"decrypted":return t(s.rawSig);case"rejected":return n(new Error("MetaMask DecryptMessage: User denied message decryption."));case"errored":return n(new Error("MetaMask DecryptMessage: This message cannot be decrypted."));default:return n(new Error(`MetaMask DecryptMessage: Unknown problem: ${JSON.stringify(e)}`))}})})}async addUnapprovedMessage(e,t){const s=this.addRequestToMessageParams(e,t);e.data=(0,a.normalizeMessageData)(e.data);const r=this.createUnapprovedMessage(s,n.ApprovalType.EthDecrypt,t),o=r.id;return await this.addMessage(r),this.messenger.publish(`${i}:unapprovedMessage`,{...s,metamaskId:o}),o}prepMessageForSigning(e){return delete e.metamaskId,Promise.resolve(e)}}s.DecryptMessageManager=o}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/DecryptMessageManager.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/EncryptionPublicKeyManager.cjs",{"./AbstractMessageManager.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/AbstractMessageManager.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/utils.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){Object.defineProperty(s,"__esModule",{value:!0}),s.EncryptionPublicKeyManager=void 0;const n=e("@metamask/controller-utils"),r=e("./AbstractMessageManager.cjs"),a=e("./utils.cjs");class i extends r.AbstractMessageManager{constructor({additionalFinishStatuses:e,messenger:t,securityProviderRequest:s,state:n}){super({additionalFinishStatuses:e,messenger:t,name:"EncryptionPublicKeyManager",securityProviderRequest:s,state:n})}async addUnapprovedMessageAsync(e,t){(0,a.validateEncryptionPublicKeyMessageData)(e);const s=await this.addUnapprovedMessage(e,t);return new Promise((t,n)=>{this.internalEvents.once(`${s}:finished`,s=>{switch(s.status){case"received":return t(s.rawSig);case"rejected":return n(new Error("MetaMask EncryptionPublicKey: User denied message EncryptionPublicKey."));default:return n(new Error(`MetaMask EncryptionPublicKey: Unknown problem: ${JSON.stringify(e)}`))}})})}async addUnapprovedMessage(e,t){const s=this.addRequestToMessageParams(e,t),r=this.createUnapprovedMessage(s,n.ApprovalType.EthGetEncryptionPublicKey,t),a=r.id;return await this.addMessage(r),this.messenger.publish(`${this.name}:unapprovedMessage`,{...s,metamaskId:a}),a}prepMessageForSigning(e){return delete e.metamaskId,Promise.resolve({from:e.data})}}s.EncryptionPublicKeyManager=i,s.default=i}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/EncryptionPublicKeyManager.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/index.cjs",{"./AbstractMessageManager.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/AbstractMessageManager.cjs","./DecryptMessageManager.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/DecryptMessageManager.cjs","./EncryptionPublicKeyManager.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/EncryptionPublicKeyManager.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./AbstractMessageManager.cjs"),s),r(e("./EncryptionPublicKeyManager.cjs"),s),r(e("./DecryptMessageManager.cjs"),s)}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/message-manager/dist/utils.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",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){(function(t){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.validateDecryptedMessageData=s.validateEncryptionPublicKeyMessageData=s.normalizeMessageData=void 0;const n=e("@metamask/controller-utils"),r=e("@metamask/utils"),a=/^[0-9A-Fa-f]+$/gu;function i(e,t){if(!e||"string"!=typeof e||!(0,n.isValidHexAddress)(e))throw new Error(`Invalid "${t}" address: ${e} must be a valid string.`)}s.normalizeMessageData=function(e){try{const t=(0,r.remove0x)(e);if(t.match(a))return(0,r.add0x)(t)}catch(e){}return(0,r.bytesToHex)(t.from(e,"utf8"))},s.validateEncryptionPublicKeyMessageData=function(e){const{from:t}=e;i(t,"from")},s.validateDecryptedMessageData=function(e){const{from:t}=e;i(t,"from")}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountGroup.cjs",{"./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/logger.cjs","./providers/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/index.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/utils.cjs","@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m,h,p,f=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},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.MultichainAccountGroup=void 0;const k=e("@metamask/account-api"),w=e("@metamask/account-api"),_=e("./logger.cjs"),b=e("./providers/index.cjs"),y=e("./utils.cjs");s.MultichainAccountGroup=class{constructor({groupIndex:e,wallet:t,providers:s,messenger:h}){n.add(this),r.set(this,void 0),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),m.set(this,!1),f(this,r,(0,w.toMultichainAccountGroupId)(t.id,e),"f"),f(this,i,e,"f"),f(this,a,t,"f"),f(this,o,s,"f"),f(this,l,h,"f"),f(this,c,new Map,"f"),f(this,d,new Map,"f"),f(this,u,(0,_.createModuleLogger)(_.projectLogger,`[${g(this,r,"f")}]`),"f")}init(e){g(this,u,"f").call(this,"Initializing group state..."),g(this,n,"m",p).call(this,e),g(this,u,"f").call(this,"Finished initializing group state...")}update(e){g(this,u,"f").call(this,"Updating group state..."),g(this,n,"m",p).call(this,e),g(this,u,"f").call(this,"Finished updating group state...")}get id(){return g(this,r,"f")}get type(){return k.AccountGroupType.MultichainAccount}get wallet(){return g(this,a,"f")}get groupIndex(){return g(this,i,"f")}hasAccounts(){return g(this,d,"f").size>0}getAccounts(){const e=[];for(const[t,s]of g(this,c,"f").entries())for(const n of s){const s=t.getAccount(n);s&&e.push(s)}return e}getAccountIds(){return[...g(this,d,"f").keys()]}getAccount(e){const t=g(this,d,"f").get(e);return t?t.getAccount(e):undefined}get(e){return(0,k.selectOne)(this.getAccounts(),e)}select(e){return(0,k.select)(this.getAccounts(),e)}async alignAccounts(){g(this,u,"f").call(this,"Aligning accounts..."),g(this,c,"f").clear(),g(this,d,"f").clear();const e=await Promise.allSettled(g(this,o,"f").map(async e=>{try{const t=await e.alignAccounts({entropySource:this.wallet.entropySource,groupIndex:this.groupIndex});if((0,b.isAccountProviderWrapper)(e)&&e.isDisabled())g(this,u,"f").call(this,`Account provider "${e.getName()}" is disabled, skipping alignment...`);else if(t.length>0){g(this,u,"f").call(this,`Found missing accounts for account provider "${e.getName()}", creating them now...`),g(this,c,"f").set(e,t);for(const s of t)g(this,d,"f").set(s,e)}return t}catch(t){g(this,u,"f").call(this,`${_.WARNING_PREFIX} ${t instanceof Error?t.message:String(t)}`);const s=(0,y.createSentryError)(`Unable to align accounts with provider "${e.getName()}"`,t,{groupIndex:this.groupIndex,provider:e.getName()});throw g(this,l,"f").captureException?.(s),t}}));let t="",s=0;const n=e.reduce((e,n,r)=>("fulfilled"===n.status&&n.value.length?e[g(this,o,"f")[r].getName()]=n.value:"rejected"===n.status&&(s+=1,t+=`\n- ${g(this,o,"f")[r].getName()}: ${n.reason.message}`),e),{});if(this.update(n),s>0){const e=s>1,n=`Failed to fully align multichain account group for entropy ID: ${this.wallet.entropySource} and group index: ${this.groupIndex}, some accounts might be missing. ${e?"Providers":"Provider"} threw the following ${e?"errors":"error"}:${t}`;g(this,u,"f").call(this,`${_.WARNING_PREFIX} ${n}`),console.warn(n)}g(this,u,"f").call(this,"Aligned")}},r=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(e){g(this,d,"f").forEach((t,s)=>{t===e&&g(this,d,"f").delete(s)})},p=function(e){for(const t of g(this,o,"f")){const s=e[t.getName()];if(s){g(this,n,"m",h).call(this,t),g(this,c,"f").set(t,s);for(const e of s)g(this,d,"f").set(e,t)}}g(this,m,"f")?g(this,l,"f").publish("MultichainAccountService:multichainAccountGroupUpdated",this):f(this,m,!0,"f")}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/MultichainAccountGroup.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountService.cjs",{"./MultichainAccountWallet.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountWallet.cjs","./analytics/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/logger.cjs","./providers/AccountProviderWrapper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/AccountProviderWrapper.cjs","./providers/EvmAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/EvmAccountProvider.cjs","./providers/SolAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SolAccountProvider.cjs","./providers/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/index.cjs","./snaps/SnapPlatformWatcher.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/snaps/SnapPlatformWatcher.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/utils.cjs","@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m,h,p,f=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},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.MultichainAccountService=s.serviceName=void 0;const k=e("@metamask/account-api"),w=e("@metamask/keyring-controller"),_=e("@metamask/utils"),b=e("./analytics/index.cjs"),y=e("./logger.cjs"),A=e("./MultichainAccountWallet.cjs"),v=e("./providers/index.cjs"),E=e("./providers/AccountProviderWrapper.cjs"),S=e("./providers/EvmAccountProvider.cjs"),x=e("./providers/SolAccountProvider.cjs"),T=e("./providers/SolAccountProvider.cjs"),I=e("./snaps/SnapPlatformWatcher.cjs"),C=e("./utils.cjs");s.serviceName="MultichainAccountService";s.MultichainAccountService=class{constructor({messenger:e,providers:t=[],providerConfigs:c,config:d}){n.add(this),r.set(this,void 0),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),this.name=s.serviceName,f(this,r,e,"f"),f(this,o,new Map,"f");const l=d?.trace??b.traceFallback;f(this,i,[new S.EvmAccountProvider(g(this,r,"f"),c?.[v.EVM_ACCOUNT_PROVIDER_NAME],l),new E.AccountProviderWrapper(g(this,r,"f"),new x.SolAccountProvider(g(this,r,"f"),c?.[T.SOL_ACCOUNT_PROVIDER_NAME],l)),...t],"f"),f(this,a,new I.SnapPlatformWatcher(e),"f"),g(this,r,"f").registerActionHandler("MultichainAccountService:getMultichainAccountGroup",(...e)=>this.getMultichainAccountGroup(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:getMultichainAccountGroups",(...e)=>this.getMultichainAccountGroups(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:getMultichainAccountWallet",(...e)=>this.getMultichainAccountWallet(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:getMultichainAccountWallets",(...e)=>this.getMultichainAccountWallets(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:createNextMultichainAccountGroup",(...e)=>this.createNextMultichainAccountGroup(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:createMultichainAccountGroup",(...e)=>this.createMultichainAccountGroup(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:setBasicFunctionality",(...e)=>this.setBasicFunctionality(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:alignWallets",(...e)=>this.alignWallets(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:alignWallet",(...e)=>this.alignWallet(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:createMultichainAccountWallet",(...e)=>this.createMultichainAccountWallet(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:resyncAccounts",(...e)=>this.resyncAccounts(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:removeMultichainAccountWallet",(...e)=>this.removeMultichainAccountWallet(...e)),g(this,r,"f").registerActionHandler("MultichainAccountService:ensureCanUseSnapPlatform",(...e)=>this.ensureCanUseSnapPlatform(...e))}async init(){(0,y.projectLogger)("Initializing..."),g(this,o,"f").clear();const{serviceState:e,providerState:t}=g(this,n,"m",d).call(this);for(const e of g(this,i,"f")){const s=t[e.getName()]??[];e.init(s)}for(const t of Object.keys(e)){const s=new A.MultichainAccountWallet({entropySource:t,providers:g(this,i,"f"),messenger:g(this,r,"f")});s.init(e[t]),g(this,o,"f").set(s.id,s)}(0,y.projectLogger)("Initialized")}async resyncAccounts(){(0,y.projectLogger)("Re-sync provider accounts if needed...");const e=g(this,r,"f").call("AccountsController:listMultichainAccounts").filter(k.isBip44Account);await Promise.all(g(this,i,"f").map(async t=>{try{await t.resyncAccounts(e)}catch(e){const s=`Unable to re-sync provider "${t.getName()}"`;(0,y.projectLogger)(s),console.error(s);const n=(0,C.createSentryError)(s,e,{provider:t.getName()});g(this,r,"f").captureException?.(n)}})),(0,y.projectLogger)("Providers got re-synced!")}ensureCanUseSnapPlatform(){return g(this,a,"f").ensureCanUseSnapPlatform()}getMultichainAccountWallet({entropySource:e}){return g(this,n,"m",l).call(this,e)}getMultichainAccountWallets(){return Array.from(g(this,o,"f").values())}async createMultichainAccountWallet(e){let t;return"import"===e.type?t=await g(this,n,"m",m).call(this,e.mnemonic):"create"===e.type?t=await g(this,n,"m",h).call(this,e.password):"restore"===e.type&&(t=await g(this,n,"m",p).call(this,e.password,e.mnemonic)),(0,_.assert)(t,"Failed to create wallet."),t.init({}),await t.createMultichainAccountGroup(0,{waitForAllProvidersToFinishCreatingAccounts:!1}),g(this,o,"f").set(t.id,t),(0,y.projectLogger)(`Wallet created: [${t.id}]`),t}async removeMultichainAccountWallet(e,t){const s=g(this,n,"m",l).call(this,e);await g(this,r,"f").call("KeyringController:removeAccount",t),g(this,o,"f").delete(s.id)}getMultichainAccountGroup({entropySource:e,groupIndex:t}){const s=g(this,n,"m",l).call(this,e).getMultichainAccountGroup(t);if(!s)throw new Error(`No multichain account for index: ${t}`);return s}getMultichainAccountGroups({entropySource:e}){return g(this,n,"m",l).call(this,e).getMultichainAccountGroups()}async createNextMultichainAccountGroup({entropySource:e}){return await g(this,n,"m",l).call(this,e).createNextMultichainAccountGroup()}async createMultichainAccountGroup({groupIndex:e,entropySource:t}){return await g(this,n,"m",l).call(this,t).createMultichainAccountGroup(e)}async setBasicFunctionality(e){(0,y.projectLogger)("Turning basic functionality: "+(e?"ON":"OFF"));for(const t of g(this,i,"f"))(0,E.isAccountProviderWrapper)(t)&&((0,y.projectLogger)(`${e?"Enabling":"Disabling"} account provider: "${t.getName()}"`),t.setEnabled(e));e&&await this.alignWallets()}async alignWallets(){(0,y.projectLogger)("Triggering alignment on all wallets...");const e=this.getMultichainAccountWallets();await Promise.all(e.map(e=>e.alignAccounts())),(0,y.projectLogger)("Wallets aligned")}async alignWallet(e){const t=this.getMultichainAccountWallet({entropySource:e});(0,y.projectLogger)(`Triggering alignment for wallet: [${t.id}]`),await t.alignAccounts(),(0,y.projectLogger)(`Wallet [${t.id}] aligned`)}},r=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakSet,c=function(e){for(const t of g(this,i,"f"))if((0,k.isBip44Account)(e)&&t.isAccountCompatible(e))return{entropySource:e.options.entropy.id,groupIndex:e.options.entropy.groupIndex,providerName:t.getName()};return null},d=function(){var e,t;const s=g(this,r,"f").call("AccountsController:listMultichainAccounts"),a={},i={};for(const r of s){const s=g(this,n,"m",c).call(this,r);if(s){const{entropySource:n,groupIndex:o,providerName:c}=s;a[n]??(a[n]={}),(e=a[n])[o]??(e[o]={}),(t=a[n][o])[c]??(t[c]=[]),a[n][o][c].push(r.id),i[c]??(i[c]=[]),i[c].push(r.id)}}return{serviceState:a,providerState:i}},l=function(e){const t=g(this,o,"f").get((0,k.toMultichainAccountWalletId)(e));if(!t)throw new Error("Unknown wallet, no wallet matching this entropy source");return t},u=function(){const{keyrings:e}=g(this,r,"f").call("KeyringController:getState"),t=e.find(e=>e.type===w.KeyringTypes.hd);return(0,_.assert)(t,"Primary keyring not found"),t.metadata.id},m=async function(e){(0,y.projectLogger)("Creating new wallet by importing an existing mnemonic...");if(g(this,r,"f").call("KeyringController:getKeyringsByType",w.KeyringTypes.hd).some(t=>!!t.mnemonic&&(0,_.areUint8ArraysEqual)(t.mnemonic,e)))throw new Error("This Secret Recovery Phrase has already been imported.");const t=await g(this,r,"f").call("KeyringController:addNewKeyring",w.KeyringTypes.hd,{mnemonic:e,numberOfAccounts:1});return new A.MultichainAccountWallet({providers:g(this,i,"f"),entropySource:t.id,messenger:g(this,r,"f")})},h=async function(e){(0,y.projectLogger)("Creating new wallet by creating a new vault and keychain..."),await g(this,r,"f").call("KeyringController:createNewVaultAndKeychain",e);const t=g(this,n,"m",u).call(this);return new A.MultichainAccountWallet({providers:g(this,i,"f"),entropySource:t,messenger:g(this,r,"f")})},p=async function(e,t){(0,y.projectLogger)("Creating new wallet by restoring vault and keyring..."),await g(this,r,"f").call("KeyringController:createNewVaultAndRestore",e,t);const s=g(this,n,"m",u).call(this);return new A.MultichainAccountWallet({providers:g(this,i,"f"),entropySource:s,messenger:g(this,r,"f")})}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/MultichainAccountService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountWallet.cjs",{"./MultichainAccountGroup.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountGroup.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/logger.cjs","./providers/EvmAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/EvmAccountProvider.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/utils.cjs","@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l,u,m,h,p,f,g=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s},k=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.MultichainAccountWallet=void 0;const w=e("@metamask/account-api"),_=e("@metamask/keyring-api"),b=e("@metamask/utils"),y=e("async-mutex"),A=e("./logger.cjs"),v=e("./MultichainAccountGroup.cjs"),E=e("./providers/EvmAccountProvider.cjs"),S=e("./utils.cjs");s.MultichainAccountWallet=class{constructor({providers:e,entropySource:t,messenger:s}){n.add(this),r.set(this,new y.Mutex),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,!1),m.set(this,void 0),g(this,a,(0,w.toMultichainAccountWalletId)(t),"f"),g(this,i,e,"f"),g(this,o,t,"f"),g(this,d,s,"f"),g(this,c,new Map,"f"),g(this,l,(0,A.createModuleLogger)(A.projectLogger,`[${k(this,a,"f")}]`),"f"),g(this,m,"uninitialized","f")}init(e){k(this,l,"f").call(this,"Initializing wallet state...");for(const[t,s]of Object.entries(e)){const e=Number(t),n=new v.MultichainAccountGroup({groupIndex:e,wallet:this,providers:k(this,i,"f"),messenger:k(this,d,"f")});k(this,l,"f").call(this,`Creating new group for index ${e}...`),n.init(s),k(this,c,"f").set(e,n)}k(this,u,"f")||(g(this,u,!0,"f"),g(this,m,"ready","f")),k(this,l,"f").call(this,"Finished initializing wallet state...")}get id(){return k(this,a,"f")}get type(){return w.AccountWalletType.Entropy}get entropySource(){return k(this,o,"f")}get status(){return k(this,m,"f")}getAccountGroup(e){if(e===(0,w.toDefaultAccountGroupId)(this.id))return k(this,c,"f").get(0);if(!(0,w.isMultichainAccountGroupId)(e))return undefined;const t=(0,w.getGroupIndexFromMultichainAccountGroupId)(e);return k(this,c,"f").get(t)}getAccountGroups(){return this.getMultichainAccountGroups()}getMultichainAccountGroup(e){return k(this,c,"f").get(e)}getMultichainAccountGroups(){return Array.from(k(this,c,"f").values())}getNextGroupIndex(){return Math.max(-1,...k(this,c,"f").keys())+1}async createMultichainAccountGroup(e,t={waitForAllProvidersToFinishCreatingAccounts:!1}){return await k(this,n,"m",h).call(this,"in-progress:create-accounts",async()=>{const s=this.getNextGroupIndex();if(e>s)throw new Error(`You cannot use a group index that is higher than the next available one: expected <=${s}, got ${e}`);let r=this.getMultichainAccountGroup(e);if(r)return k(this,l,"f").call(this,`Trying to re-create existing group: [${r.id}] (idempotent)`),r;k(this,l,"f").call(this,`Creating new group for index ${e}...`);const[a,...m]=k(this,i,"f");(0,b.assert)(a instanceof E.EvmAccountProvider,"EVM account provider must be first");const h=await a.createAccounts({type:_.AccountCreationType.Bip44DeriveIndex,entropySource:k(this,o,"f"),groupIndex:e}).then(e=>e.map(e=>e.id)).catch(t=>{const s=`Unable to create some accounts for group index: ${e} with provider "${a.getName()}". Error: ${t.message}`;console.warn(s),k(this,l,"f").call(this,`${A.ERROR_PREFIX} ${s}:`,t);const n=(0,S.createSentryError)(`Unable to create account with provider "${a.getName()}"`,t,{groupIndex:e,provider:a.getName()});throw k(this,d,"f").captureException?.(n),t});return r=new v.MultichainAccountGroup({wallet:this,providers:k(this,i,"f"),groupIndex:e,messenger:k(this,d,"f")}),r.init({[a.getName()]:h}),t?.waitForAllProvidersToFinishCreatingAccounts?await k(this,n,"m",p).call(this,{groupIndex:e,providers:m,awaitAll:!0,group:r}):k(this,n,"m",p).call(this,{groupIndex:e,providers:m,awaitAll:!1,group:r}),k(this,c,"f").set(e,r),k(this,l,"f").call(this,`New group created: [${r.id}]`),k(this,u,"f")&&k(this,d,"f").publish("MultichainAccountService:multichainAccountGroupCreated",r),r})}async createNextMultichainAccountGroup(){return this.createMultichainAccountGroup(this.getNextGroupIndex(),{waitForAllProvidersToFinishCreatingAccounts:!0})}async alignAccounts(){await k(this,n,"m",h).call(this,"in-progress:alignment",async()=>{await k(this,n,"m",f).call(this)})}async alignAccountsOf(e){await k(this,n,"m",h).call(this,"in-progress:alignment",async()=>{const t=this.getMultichainAccountGroup(e);t&&await t.alignAccounts()})}async discoverAccounts(){return k(this,n,"m",h).call(this,"in-progress:discovery",async()=>{let e=this.getNextGroupIndex();const t={},s=(e,s,n)=>{const r=e.map(e=>e.id);t[n]??(t[n]={}),t[n][s]=r},r=k(this,i,"f").map(t=>({provider:t,stopped:!1,groupIndex:e,accounts:[]}));await Promise.all(r.map(async t=>{const n=t.provider.getName(),r=(e,t)=>`[${n}] Discovery ${e} for group index: ${t}`;for(;!t.stopped;){const a=Math.max(t.groupIndex,e);(0,A.projectLogger)(r("started",a));let i=[];try{i=await t.provider.discoverAccounts({entropySource:k(this,o,"f"),groupIndex:a})}catch(e){t.stopped=!0,console.error(e),(0,A.projectLogger)(r(`failed (with: "${e.message}")`,a),e);const s=(0,S.createSentryError)("Unable to discover accounts",e,{provider:n,groupIndex:a});k(this,d,"f").captureException?.(s);break}if(!i.length){(0,A.projectLogger)(r("stopped (no accounts got discovered)",a)),t.stopped=!0;break}(0,A.projectLogger)(r("**succeeded**",a)),t.accounts=t.accounts.concat(i),s(i,n,a);const c=a+1;t.groupIndex=c,c>e&&(e=c)}}));for(const[e,s]of Object.entries(t)){const t=Number(e),n=new v.MultichainAccountGroup({wallet:this,providers:k(this,i,"f"),groupIndex:t,messenger:k(this,d,"f")});n.init(s),k(this,c,"f").set(t,n)}return await k(this,n,"m",f).call(this),r.flatMap(e=>e.accounts)})}},r=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,n=new WeakSet,h=async function(e,t){const s=await k(this,r,"f").acquire();try{return k(this,l,"f").call(this,`Locking wallet with status "${e}"...`),g(this,m,e,"f"),k(this,d,"f").publish("MultichainAccountService:walletStatusChange",this.id,k(this,m,"f")),await t()}finally{g(this,m,"ready","f"),k(this,d,"f").publish("MultichainAccountService:walletStatusChange",this.id,k(this,m,"f")),s(),k(this,l,"f").call(this,`Releasing wallet lock (was "${e}")`)}},p=async function({groupIndex:e,providers:t,awaitAll:s,group:n}){if(s){const s=t.map(t=>t.createAccounts({type:_.AccountCreationType.Bip44DeriveIndex,entropySource:k(this,o,"f"),groupIndex:e}).catch(s=>{const n=(0,S.createSentryError)(`Unable to create account with provider "${t.getName()}"`,s,{groupIndex:e,provider:t.getName()});throw k(this,d,"f").captureException?.(n),s})),r=await Promise.allSettled(s),a=r.reduce((e,s,n)=>{let r=e;return"rejected"===s.status&&(r+=`\n- ${t[n].getName()}: ${s.reason.message}`),r},"");if(a.length){const t=`Unable to create some accounts for group index: ${e}. Providers threw the following errors:${a}`;console.warn(t),k(this,l,"f").call(this,`${A.WARNING_PREFIX} ${t}`)}const i=r.reduce((e,s,n)=>("fulfilled"===s.status&&(e[t[n].getName()]=s.value.map(e=>e.id)),e),{});n.update(i)}else t.forEach(t=>{t.createAccounts({type:_.AccountCreationType.Bip44DeriveIndex,entropySource:k(this,o,"f"),groupIndex:e}).then(e=>{const s=e.map(e=>e.id);return n.update({[t.getName()]:s}),n}).catch(s=>{const n=`Unable to create some accounts for group index: ${e} with provider "${t.getName()}". Error: ${s.message}`;console.warn(n),k(this,l,"f").call(this,`${A.WARNING_PREFIX} ${n}:`,s);const r=(0,S.createSentryError)(`Unable to create account with provider "${t.getName()}"`,s,{groupIndex:e,provider:t.getName()});k(this,d,"f").captureException?.(r)})})},f=async function(){const e=this.getMultichainAccountGroups();await Promise.all(e.map(e=>e.alignAccounts()))}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/MultichainAccountWallet.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs",{"./traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/traces.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),r(e("./traces.cjs"),s)}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/traces.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.traceFallback=void 0;s.traceFallback=async(e,t)=>t?await Promise.resolve(t()):undefined}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/analytics/traces.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/constants/traces.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=void 0,function(e){e.SnapDiscoverAccounts="Snap Discover Accounts",e.EvmDiscoverAccounts="EVM Discover Accounts"}(n||(s.TraceName=n={}))}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/constants/traces.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/index.cjs",{"./MultichainAccountGroup.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountGroup.cjs","./MultichainAccountService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountService.cjs","./MultichainAccountWallet.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/MultichainAccountWallet.cjs","./providers/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/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.MultichainAccountService=s.MultichainAccountGroup=s.MultichainAccountWallet=s.TrxAccountProvider=s.TRX_ACCOUNT_PROVIDER_NAME=s.BtcAccountProvider=s.BTC_ACCOUNT_PROVIDER_NAME=s.SolAccountProvider=s.SOL_ACCOUNT_PROVIDER_NAME=s.EvmAccountProvider=s.EVM_ACCOUNT_PROVIDER_NAME=s.TimeoutError=s.SnapAccountProvider=s.BaseBip44AccountProvider=s.AccountProviderWrapper=void 0;var n=e("./providers/index.cjs");Object.defineProperty(s,"AccountProviderWrapper",{enumerable:!0,get:function(){return n.AccountProviderWrapper}}),Object.defineProperty(s,"BaseBip44AccountProvider",{enumerable:!0,get:function(){return n.BaseBip44AccountProvider}}),Object.defineProperty(s,"SnapAccountProvider",{enumerable:!0,get:function(){return n.SnapAccountProvider}}),Object.defineProperty(s,"TimeoutError",{enumerable:!0,get:function(){return n.TimeoutError}}),Object.defineProperty(s,"EVM_ACCOUNT_PROVIDER_NAME",{enumerable:!0,get:function(){return n.EVM_ACCOUNT_PROVIDER_NAME}}),Object.defineProperty(s,"EvmAccountProvider",{enumerable:!0,get:function(){return n.EvmAccountProvider}}),Object.defineProperty(s,"SOL_ACCOUNT_PROVIDER_NAME",{enumerable:!0,get:function(){return n.SOL_ACCOUNT_PROVIDER_NAME}}),Object.defineProperty(s,"SolAccountProvider",{enumerable:!0,get:function(){return n.SolAccountProvider}}),Object.defineProperty(s,"BTC_ACCOUNT_PROVIDER_NAME",{enumerable:!0,get:function(){return n.BTC_ACCOUNT_PROVIDER_NAME}}),Object.defineProperty(s,"BtcAccountProvider",{enumerable:!0,get:function(){return n.BtcAccountProvider}}),Object.defineProperty(s,"TRX_ACCOUNT_PROVIDER_NAME",{enumerable:!0,get:function(){return n.TRX_ACCOUNT_PROVIDER_NAME}}),Object.defineProperty(s,"TrxAccountProvider",{enumerable:!0,get:function(){return n.TrxAccountProvider}});var r=e("./MultichainAccountWallet.cjs");Object.defineProperty(s,"MultichainAccountWallet",{enumerable:!0,get:function(){return r.MultichainAccountWallet}});var a=e("./MultichainAccountGroup.cjs");Object.defineProperty(s,"MultichainAccountGroup",{enumerable:!0,get:function(){return a.MultichainAccountGroup}});var i=e("./MultichainAccountService.cjs");Object.defineProperty(s,"MultichainAccountService",{enumerable:!0,get:function(){return i.MultichainAccountService}})}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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.ERROR_PREFIX=s.WARNING_PREFIX=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)("multichain-account-service"),s.WARNING_PREFIX="WARNING --",s.ERROR_PREFIX="ERROR --"}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/AccountProviderWrapper.cjs",{"./BaseBip44AccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BaseBip44AccountProvider.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isAccountProviderWrapper=s.AccountProviderWrapper=void 0;const n=e("./BaseBip44AccountProvider.cjs");class r extends n.BaseBip44AccountProvider{constructor(e,t){super(e),this.isEnabled=!0,this.provider=t}getName(){return this.provider.getName()}get capabilities(){return this.provider.capabilities}init(e){this.provider.init(e)}setEnabled(e){this.isEnabled=e}isDisabled(){return!this.isEnabled}async resyncAccounts(e){this.isEnabled&&await this.provider.resyncAccounts(e)}getAccounts(){return this.isEnabled?this.provider.getAccounts():[]}async alignAccounts(e){return this.isDisabled()?[]:await this.provider.alignAccounts(e)}getAccount(e){if(!this.isEnabled)throw new Error("Provider is disabled");return this.provider.getAccount(e)}isAccountCompatible(e){return this.provider.isAccountCompatible(e)}async createAccounts(e){return this.isEnabled?this.provider.createAccounts(e):[]}async discoverAccounts(e){return this.isEnabled?this.provider.discoverAccounts(e):[]}}s.AccountProviderWrapper=r,s.isAccountProviderWrapper=function(e){return e instanceof r}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/AccountProviderWrapper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BaseBip44AccountProvider.cjs",{"@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=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.BaseBip44AccountProvider=s.assertAreBip44Accounts=s.assertIsBip44Account=void 0;const i=e("@metamask/account-api"),o=e("@metamask/keyring-api");function c(e){if(!(0,i.isBip44Account)(e))throw new Error("Created account is not BIP-44 compatible")}s.assertIsBip44Account=c,s.assertAreBip44Accounts=function(e){e.forEach(c)};s.BaseBip44AccountProvider=class{constructor(e){n.add(this),this.accounts=new Set,this.messenger=e}init(e){for(const t of e)this.accounts.add(t)}getAccounts(){const e=a(this,n,"m",r).call(this);return this.messenger.call("AccountsController:getAccounts",e)}getAccount(e){if(!this.accounts.has(e))throw new Error(`Unable to find account: ${e}`);return this.messenger.call("AccountsController:getAccount",e)}async withKeyring(e,t){return await this.messenger.call("KeyringController:withKeyring",e,({keyring:e,metadata:s})=>t({keyring:e,metadata:s}))}async alignAccounts({entropySource:e,groupIndex:t}){return(await this.createAccounts({type:o.AccountCreationType.Bip44DeriveIndex,entropySource:e,groupIndex:t})).map(e=>e.id)}},n=new WeakSet,r=function(){return[...this.accounts]}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/BaseBip44AccountProvider.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BtcAccountProvider.cjs",{"../analytics/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs","../constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/constants/traces.cjs","./SnapAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SnapAccountProvider.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/utils.cjs","@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=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.BtcAccountProvider=s.BTC_ACCOUNT_PROVIDER_DEFAULT_CONFIG=s.BTC_ACCOUNT_PROVIDER_NAME=void 0;const i=e("@metamask/account-api"),o=e("@metamask/keyring-api"),c=e("./SnapAccountProvider.cjs"),d=e("./utils.cjs"),l=e("../analytics/index.cjs"),u=e("../constants/traces.cjs");s.BTC_ACCOUNT_PROVIDER_NAME="Bitcoin",s.BTC_ACCOUNT_PROVIDER_DEFAULT_CONFIG={maxConcurrency:3,createAccounts:{timeoutMs:3e3},discovery:{enabled:!0,timeoutMs:2e3,maxAttempts:3,backOffMs:1e3}};class m extends c.SnapAccountProvider{constructor(e,t=s.BTC_ACCOUNT_PROVIDER_DEFAULT_CONFIG,r=l.traceFallback){super(m.BTC_SNAP_ID,e,t,r),n.add(this),this.capabilities={scopes:[o.BtcScope.Mainnet,o.BtcScope.Testnet],bip44:{deriveIndex:!0}}}getName(){return m.NAME}isAccountCompatible(e){return e.type===o.BtcAccountType.P2wpkh&&Object.values(o.BtcAccountType).includes(e.type)}async createAccounts(e){(0,o.assertCreateAccountOptionIsSupported)(e,[`${o.AccountCreationType.Bip44DeriveIndex}`]);const{entropySource:t,groupIndex:s}=e;return this.withSnap(async({keyring:e})=>a(this,n,"m",r).call(this,{keyring:e,entropySource:t,groupIndex:s}))}async discoverAccounts({entropySource:e,groupIndex:t}){return this.withSnap(async({client:s,keyring:i})=>await super.trace({name:u.TraceName.SnapDiscoverAccounts,data:{provider:this.getName()}},async()=>{if(!this.config.discovery.enabled)return[];const c=await(0,d.withRetry)(()=>(0,d.withTimeout)(s.discoverAccounts([o.BtcScope.Mainnet],e,t),this.config.discovery.timeoutMs),{maxAttempts:this.config.discovery.maxAttempts,backOffMs:this.config.discovery.backOffMs});if(!Array.isArray(c)||0===c.length)return[];return await a(this,n,"m",r).call(this,{keyring:i,entropySource:e,groupIndex:t})}))}}s.BtcAccountProvider=m,n=new WeakSet,r=async function({keyring:e,entropySource:t,groupIndex:s}){return this.withMaxConcurrency(async()=>{const n=await(0,d.withTimeout)(e.createAccount({entropySource:t,index:s,addressType:o.BtcAccountType.P2wpkh,scope:o.BtcScope.Mainnet}),this.config.createAccounts.timeoutMs);return(0,i.assertIsBip44Account)(n),this.accounts.add(n.id),[n]})},m.NAME=s.BTC_ACCOUNT_PROVIDER_NAME,m.BTC_SNAP_ID="npm:@metamask/bitcoin-wallet-snap"}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/BtcAccountProvider.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/EvmAccountProvider.cjs",{"../analytics/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs","../constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/constants/traces.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/logger.cjs","./BaseBip44AccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BaseBip44AccountProvider.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/utils.cjs","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@metamask/accounts-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/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/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,r,a,i,o,c,d,l=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.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.EvmAccountProvider=s.EVM_ACCOUNT_PROVIDER_DEFAULT_CONFIG=s.EVM_ACCOUNT_PROVIDER_NAME=void 0;const m=e("@ethereumjs/util"),h=e("@metamask/accounts-controller"),p=e("@metamask/keyring-api"),f=e("@metamask/keyring-controller"),g=e("@metamask/utils"),k=e("./BaseBip44AccountProvider.cjs"),w=e("./utils.cjs"),_=e("../analytics/index.cjs"),b=e("../constants/traces.cjs"),y=e("../logger.cjs");function A(e){if(!e)throw new Error("Internal account does not exist")}s.EVM_ACCOUNT_PROVIDER_NAME="EVM",s.EVM_ACCOUNT_PROVIDER_DEFAULT_CONFIG={discovery:{maxAttempts:3,timeoutMs:500,backOffMs:500}};class v extends k.BaseBip44AccountProvider{constructor(e,t=s.EVM_ACCOUNT_PROVIDER_DEFAULT_CONFIG,i){super(e),n.add(this),r.set(this,void 0),a.set(this,void 0),this.capabilities={scopes:[p.EthScope.Eoa],bip44:{deriveIndex:!0}},l(this,r,{...t,discovery:{...t.discovery,enabled:t.discovery.enabled??!0}},"f"),l(this,a,i??_.traceFallback,"f")}isAccountCompatible(e){return e.type===p.EthAccountType.Eoa&&e.metadata.keyring.type===f.KeyringTypes.hd}getName(){return v.NAME}getEvmProvider(){const e=this.messenger.call("NetworkController:findNetworkClientIdByChainId","0x1"),{provider:t}=this.messenger.call("NetworkController:getNetworkClientById",e);return t}async createAccounts(e){(0,p.assertCreateAccountOptionIsSupported)(e,[`${p.AccountCreationType.Bip44DeriveIndex}`]);const{entropySource:t,groupIndex:s}=e,[r]=await u(this,n,"m",o).call(this,{entropySource:t,groupIndex:s,throwOnGap:!0}),a=u(this,n,"m",i).call(this,r),c=this.messenger.call("AccountsController:getAccount",a);A(c);const d=[c];return(0,k.assertAreBip44Accounts)(d),this.accounts.add(c.id),d}async discoverAccounts(e){return u(this,a,"f").call(this,{name:b.TraceName.EvmDiscoverAccounts,data:{provider:this.getName()}},async()=>{if(!u(this,r,"f").discovery.enabled)return[];const t=this.getEvmProvider(),{entropySource:s,groupIndex:a}=e,l=await u(this,n,"m",d).call(this,{entropySource:s,groupIndex:a});if(0===await u(this,n,"m",c).call(this,t,l))return[];const[m]=await u(this,n,"m",o).call(this,{entropySource:s,groupIndex:a});(0,g.assert)(l===m,"Created account does not match address from group index.");const h=u(this,n,"m",i).call(this,m),p=this.messenger.call("AccountsController:getAccount",h);return A(p),(0,k.assertIsBip44Account)(p),this.accounts.add(p.id),[p]})}async resyncAccounts(){}}s.EvmAccountProvider=v,r=new WeakMap,a=new WeakMap,n=new WeakSet,i=function(e){return(0,h.getUUIDFromAddressOfNormalAccount)(e)},o=async function({entropySource:e,groupIndex:t,throwOnGap:s=!1}){return await this.withKeyring({id:e},async({keyring:e})=>{const n=await e.getAccounts();if(t<n.length)return[n[t],!1];if(s&&t!==n.length)throw new Error("Trying to create too many accounts");const[r]=await e.addAccounts(1);return[r,!0]})},c=async function(e,t){const s="eth_getTransactionCount",n=await(0,w.withRetry)(()=>(0,w.withTimeout)(e.request({method:s,params:[t,"latest"]}),u(this,r,"f").discovery.timeoutMs),{maxAttempts:u(this,r,"f").discovery.maxAttempts,backOffMs:u(this,r,"f").discovery.backOffMs});if(!(0,g.isStrictHexString)(n)){const e=`Received invalid hex response from "${s}" request: ${JSON.stringify(n)}`;return(0,y.projectLogger)(`${y.WARNING_PREFIX} ${e}`),console.warn(e),0}return parseInt(n,16)},d=async function({entropySource:e,groupIndex:t}){return await this.withKeyring({id:e},async({keyring:e})=>{const s=await e.getAccounts();if(t<s.length)return s[t];(0,g.assert)(e.root,"Expected HD keyring.root to be set");const n=e.root.deriveChild(t);return(0,g.assert)(n.publicKey,"Expected public key to be set"),(0,g.add0x)((0,g.bytesToHex)((0,m.publicToAddress)(n.publicKey,!0)).toLowerCase())})},v.NAME=s.EVM_ACCOUNT_PROVIDER_NAME}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/EvmAccountProvider.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SnapAccountProvider.cjs",{"../analytics/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/utils.cjs","./BaseBip44AccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BaseBip44AccountProvider.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-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/multichain-account-service/node_modules/@metamask/snaps-utils/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a,i,o,c,d,l=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)},u=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.value=s:t.set(e,s),s};Object.defineProperty(s,"__esModule",{value:!0}),s.isSnapAccountProvider=s.SnapAccountProvider=void 0;const m=e("@metamask/keyring-api"),h=e("@metamask/keyring-controller"),p=e("@metamask/keyring-snap-client"),f=e("@metamask/snaps-utils"),g=e("async-mutex"),k=e("./BaseBip44AccountProvider.cjs"),w=e("../analytics/index.cjs"),_=e("../utils.cjs");class b extends k.BaseBip44AccountProvider{constructor(e,t,s,o=w.traceFallback){super(t),n.add(this),r.set(this,void 0),a.set(this,void 0),i.set(this,void 0),this.snapId=e,u(this,r,l(this,n,"m",c).call(this,e),"f");const d=s.maxConcurrency??Infinity;this.config={...s,discovery:{...s.discovery,enabled:s.discovery.enabled??!0},maxConcurrency:d},isFinite(d)&&u(this,a,new g.Semaphore(d),"f"),u(this,i,o,"f")}async ensureCanUseSnapPlatform(){return this.messenger.call("MultichainAccountService:ensureCanUseSnapPlatform")}async withMaxConcurrency(e){return l(this,a,"f")?l(this,a,"f").runExclusive(e):e()}async trace(e,t){return l(this,i,"f").call(this,e,t)}async resyncAccounts(e){await this.withSnap(async({keyring:t})=>{const s=e.filter(e=>e.metadata.snap?.id===this.snapId),n=new Set((await l(this,r,"f").listAccounts()).map(e=>e.id));if(s.length<n.size){const e=new Set(s.map(e=>e.id));await Promise.all([...n].map(async t=>{try{e.has(t)||(await l(this,r,"f").deleteAccount(t),n.delete(t))}catch(e){const s=(0,_.createSentryError)(`Unable to delete de-synced Snap account: ${this.snapId}`,e,{provider:this.getName(),snapAccountId:t});this.messenger.captureException?.(s)}}))}s.length>n.size&&await Promise.all(s.map(async e=>{const{id:s,groupIndex:r}=e.options.entropy;try{n.has(e.id)||(await t.removeAccount(e.address),await this.createAccounts({type:m.AccountCreationType.Bip44DeriveIndex,entropySource:s,groupIndex:r}))}catch(e){const t=(0,_.createSentryError)(`Unable to re-sync account: ${r}`,e,{provider:this.getName(),groupIndex:r});this.messenger.captureException?.(t)}}))})}async withSnap(e){return await this.ensureCanUseSnapPlatform(),await e({client:l(this,r,"f"),keyring:await l(this,n,"m",o).call(this)})}}s.SnapAccountProvider=b,r=new WeakMap,a=new WeakMap,i=new WeakMap,n=new WeakSet,o=async function(){const e=await l(this,n,"m",d).call(this,async({keyring:e})=>e.createAccount.bind(e));return{createAccount:async t=>await e(this.snapId,t,{displayAccountNameSuggestion:!1,displayConfirmation:!1,setSelectedAccount:!1}),removeAccount:async e=>await l(this,n,"m",d).call(this,async({keyring:t})=>{await t.removeAccount(e)})}},c=function(e){return new p.KeyringClient({send:async t=>await this.messenger.call("SnapController:handleRequest",{snapId:e,origin:"metamask",handler:f.HandlerType.OnKeyringRequest,request:t})})},d=async function(e){return this.withKeyring({type:h.KeyringTypes.snap},t=>e(t))};s.isSnapAccountProvider=e=>e instanceof b}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/SnapAccountProvider.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SolAccountProvider.cjs",{"../analytics/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs","../constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/constants/traces.cjs","./SnapAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SnapAccountProvider.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/utils.cjs","@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=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.SolAccountProvider=s.SOL_ACCOUNT_PROVIDER_DEFAULT_CONFIG=s.SOL_ACCOUNT_PROVIDER_NAME=void 0;const i=e("@metamask/account-api"),o=e("@metamask/keyring-api"),c=e("@metamask/keyring-controller"),d=e("./SnapAccountProvider.cjs"),l=e("./utils.cjs"),u=e("../analytics/index.cjs"),m=e("../constants/traces.cjs");s.SOL_ACCOUNT_PROVIDER_NAME="Solana",s.SOL_ACCOUNT_PROVIDER_DEFAULT_CONFIG={maxConcurrency:3,discovery:{enabled:!0,timeoutMs:2e3,maxAttempts:3,backOffMs:1e3},createAccounts:{timeoutMs:3e3}};class h extends d.SnapAccountProvider{constructor(e,t=s.SOL_ACCOUNT_PROVIDER_DEFAULT_CONFIG,r=u.traceFallback){super(h.SOLANA_SNAP_ID,e,t,r),n.add(this),this.capabilities={scopes:[o.SolScope.Mainnet,o.SolScope.Devnet,o.SolScope.Testnet],bip44:{deriveIndex:!0}}}getName(){return h.NAME}isAccountCompatible(e){return e.type===o.SolAccountType.DataAccount&&e.metadata.keyring.type===c.KeyringTypes.snap}async createAccounts(e){(0,o.assertCreateAccountOptionIsSupported)(e,[`${o.AccountCreationType.Bip44DeriveIndex}`]);const{entropySource:t,groupIndex:s}=e;return this.withSnap(async({keyring:e})=>this.withMaxConcurrency(async()=>{const i=`m/44'/501'/${s}'/0'`,o=await a(this,n,"m",r).call(this,{keyring:e,entropySource:t,groupIndex:s,derivationPath:i});return this.accounts.add(o.id),[o]}))}async discoverAccounts({entropySource:e,groupIndex:t}){return this.withSnap(async({client:s,keyring:i})=>await super.trace({name:m.TraceName.SnapDiscoverAccounts,data:{provider:this.getName()}},async()=>{if(!this.config.discovery.enabled)return[];const c=await(0,l.withRetry)(()=>(0,l.withTimeout)(s.discoverAccounts([o.SolScope.Mainnet],e,t),this.config.discovery.timeoutMs),{maxAttempts:this.config.discovery.maxAttempts,backOffMs:this.config.discovery.backOffMs});if(!c.length)return[];const d=await Promise.all(c.map(s=>a(this,n,"m",r).call(this,{keyring:i,entropySource:e,groupIndex:t,derivationPath:s.derivationPath})));for(const e of d)this.accounts.add(e.id);return d}))}}s.SolAccountProvider=h,n=new WeakSet,r=async function({keyring:e,entropySource:t,groupIndex:s,derivationPath:n}){const r=await(0,l.withTimeout)(e.createAccount({entropySource:t,derivationPath:n}),this.config.createAccounts.timeoutMs);return r.options.entropy={type:o.KeyringAccountEntropyTypeOption.Mnemonic,id:t,groupIndex:s,derivationPath:n},(0,i.assertIsBip44Account)(r),r},h.NAME=s.SOL_ACCOUNT_PROVIDER_NAME,h.SOLANA_SNAP_ID="npm:@metamask/solana-wallet-snap"}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/SolAccountProvider.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/TrxAccountProvider.cjs",{"../analytics/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/analytics/index.cjs","../constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/constants/traces.cjs","./SnapAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SnapAccountProvider.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/utils.cjs","@metamask/account-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/account-api/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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,r,a=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.TrxAccountProvider=s.TRX_ACCOUNT_PROVIDER_DEFAULT_CONFIG=s.TRX_ACCOUNT_PROVIDER_NAME=void 0;const i=e("@metamask/account-api"),o=e("@metamask/keyring-api"),c=e("@metamask/keyring-controller"),d=e("./SnapAccountProvider.cjs"),l=e("./utils.cjs"),u=e("../analytics/index.cjs"),m=e("../constants/traces.cjs");s.TRX_ACCOUNT_PROVIDER_NAME="Tron",s.TRX_ACCOUNT_PROVIDER_DEFAULT_CONFIG={maxConcurrency:3,discovery:{enabled:!0,timeoutMs:2e3,maxAttempts:3,backOffMs:1e3},createAccounts:{timeoutMs:3e3}};class h extends d.SnapAccountProvider{constructor(e,t=s.TRX_ACCOUNT_PROVIDER_DEFAULT_CONFIG,r=u.traceFallback){super(h.TRX_SNAP_ID,e,t,r),n.add(this),this.capabilities={scopes:[o.TrxScope.Mainnet,o.TrxScope.Shasta],bip44:{deriveIndex:!0}}}getName(){return h.NAME}isAccountCompatible(e){return e.type===o.TrxAccountType.Eoa&&e.metadata.keyring.type===c.KeyringTypes.snap}async createAccounts(e){(0,o.assertCreateAccountOptionIsSupported)(e,[`${o.AccountCreationType.Bip44DeriveIndex}`]);const{entropySource:t,groupIndex:s}=e;return this.withSnap(async({keyring:e})=>a(this,n,"m",r).call(this,{keyring:e,entropySource:t,groupIndex:s}))}async discoverAccounts({entropySource:e,groupIndex:t}){return this.withSnap(async({client:s,keyring:i})=>await super.trace({name:m.TraceName.SnapDiscoverAccounts,data:{provider:this.getName()}},async()=>{if(!this.config.discovery.enabled)return[];if(!(await(0,l.withRetry)(()=>(0,l.withTimeout)(s.discoverAccounts([o.TrxScope.Mainnet],e,t),this.config.discovery.timeoutMs),{maxAttempts:this.config.discovery.maxAttempts,backOffMs:this.config.discovery.backOffMs})).length)return[];return await a(this,n,"m",r).call(this,{keyring:i,entropySource:e,groupIndex:t})}))}}s.TrxAccountProvider=h,n=new WeakSet,r=async function({keyring:e,entropySource:t,groupIndex:s}){return this.withMaxConcurrency(async()=>{const n=await(0,l.withTimeout)(e.createAccount({entropySource:t,index:s,addressType:o.TrxAccountType.Eoa,scope:o.TrxScope.Mainnet}),this.config.createAccounts.timeoutMs);return(0,i.assertIsBip44Account)(n),this.accounts.add(n.id),[n]})},h.NAME=s.TRX_ACCOUNT_PROVIDER_NAME,h.TRX_SNAP_ID="npm:@metamask/tron-wallet-snap"}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/TrxAccountProvider.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/index.cjs",{"./AccountProviderWrapper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/AccountProviderWrapper.cjs","./BaseBip44AccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BaseBip44AccountProvider.cjs","./BtcAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/BtcAccountProvider.cjs","./EvmAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/EvmAccountProvider.cjs","./SnapAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SnapAccountProvider.cjs","./SolAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/SolAccountProvider.cjs","./TrxAccountProvider.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/TrxAccountProvider.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){n===undefined&&(n=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,n,r)}:function(e,t,s,n){n===undefined&&(n=s),e[n]=t[s]}),r=this&&this.__exportStar||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}),s.TimeoutError=void 0,r(e("./BaseBip44AccountProvider.cjs"),s),r(e("./SnapAccountProvider.cjs"),s),r(e("./AccountProviderWrapper.cjs"),s);var a=e("./utils.cjs");Object.defineProperty(s,"TimeoutError",{enumerable:!0,get:function(){return a.TimeoutError}}),r(e("./SolAccountProvider.cjs"),s),r(e("./EvmAccountProvider.cjs"),s),r(e("./BtcAccountProvider.cjs"),s),r(e("./TrxAccountProvider.cjs"),s)}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/providers/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.withTimeout=s.withRetry=s.TimeoutError=void 0;class n extends Error{constructor(e){super(e),this.name="TimeoutError"}}s.TimeoutError=n,s.withRetry=async function(e,{maxAttempts:t=3,backOffMs:s=500}={}){let n,r=s;for(let s=1;s<=t;s++)try{return await e()}catch(e){if(n=e,s>=t)break;const a=r;await new Promise(e=>setTimeout(e,a)),r*=2}throw n},s.withTimeout=async function(e,t=500){let s;try{return await Promise.race([e,new Promise((e,r)=>{s=setTimeout(()=>r(new n("Timed out")),t)})])}finally{s&&clearTimeout(s)}}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/providers/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/snaps/SnapPlatformWatcher.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/dist/logger.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,r,a,i,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,s):r?r.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.SnapPlatformWatcher=void 0;const l=e("@metamask/utils"),u=e("lodash"),m=e("../logger.cjs");s.SnapPlatformWatcher=class{constructor(e){n.add(this),r.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c(this,r,e,"f"),c(this,i,!1,"f"),c(this,a,(0,l.createDeferredPromise)(),"f"),d(this,n,"m",o).call(this)}get isReady(){return d(this,i,"f")}async ensureCanUseSnapPlatform(){if(await d(this,a,"f").promise,!d(this,i,"f"))throw new Error("Snap platform cannot be used now.")}},r=new WeakMap,a=new WeakMap,i=new WeakMap,n=new WeakSet,o=function(){const e=(0,u.once)(()=>(0,m.projectLogger)("Snap platform is ready!"));d(this,r,"f").call("SnapController:getState").isReady&&(c(this,i,!0,"f"),d(this,a,"f").resolve()),d(this,r,"f").subscribe("SnapController:stateChange",t=>{c(this,i,t,"f"),t&&(e(),d(this,a,"f").resolve())},e=>e.isReady)}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/snaps/SnapPlatformWatcher.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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.createSentryError=void 0;s.createSentryError=(e,t,s)=>{const n=new Error(e);return n.cause=t,n.context=s,n}}}},{package:"@metamask/multichain-account-service",file:"node_modules/@metamask/multichain-account-service/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/account.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/array.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs",{"./base64.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/base64.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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"),r=e("@metamask/utils"),a=e("./base64.cjs"),i=e("./constants.cjs");s.encodeAuxiliaryFile=async function(e,t){if(t===n.AuxiliaryFileEncoding.Base64)return e;const s=await(0,a.decodeBase64)(e);return t===n.AuxiliaryFileEncoding.Utf8?(0,r.bytesToString)(s):(0,r.bytesToHex)(s)},s.validateAuxiliaryFiles=function(e){for(const t of e)(0,r.assert)(t.size<i.MAX_FILE_SIZE,"Static files required by the Snap must be smaller than 64 MB.")}}}},{package:"@metamask/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/auxiliary-files.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/base64.cjs",{"./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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"),r=e("./bytes.cjs");s.encodeBase64=async function(e){const t=(0,r.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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/base64.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/bytes.cjs",{"./virtual-file/VirtualFile.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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"),r=e("./virtual-file/VirtualFile.cjs");s.getBytes=function(e){const t=e instanceof r.VirtualFile?e.value:e;return"string"==typeof t?(0,n.stringToBytes)(t):t}}}},{package:"@metamask/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/bytes.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/caveats.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/checksum.cjs",{"./bytes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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"),r=e("./bytes.cjs");async function a(e){return await(0,n.sha256)((0,r.getBytes)(e))}s.checksum=a,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=>a(e)));return a((0,n.concatBytes)(t))}}}},{package:"@metamask/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/checksum.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/cronjob.cjs",{"./time.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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"),r=e("@metamask/superstruct"),a=e("@metamask/utils"),i=e("cron-parser"),o=e("./time.cjs");s.CronjobRpcRequestStruct=(0,r.object)({jsonrpc:(0,r.optional)(a.JsonRpcVersionStruct),id:(0,r.optional)(a.JsonRpcIdStruct),method:(0,r.string)(),params:(0,r.optional)(a.JsonRpcParamsStruct)}),s.CronExpressionStruct=(0,r.refine)((0,r.string)(),"cronjob expression",e=>{try{return(0,i.parseExpression)(e),!0}catch{return`Expected a cronjob expression, but received: "${e}"`}});const c=(0,r.object)({expression:s.CronExpressionStruct,request:s.CronjobRpcRequestStruct}),d=(0,r.object)({duration:o.ISO8601DurationStruct,request:s.CronjobRpcRequestStruct});s.CronjobSpecificationStruct=(0,n.selectiveUnion)(e=>(0,a.isObject)(e)&&(0,a.hasProperty)(e,"duration")?d:c),s.isCronjobSpecification=function(e){try{return(0,r.create)(e,s.CronjobSpecificationStruct),!0}catch{return!1}},s.CronjobSpecificationArrayStruct=(0,r.array)(s.CronjobSpecificationStruct),s.isCronjobSpecificationArray=function(e){try{return(0,r.create)(e,s.CronjobSpecificationArrayStruct),!0}catch{return!1}}}}},{package:"@metamask/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/cronjob.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/currency.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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 r=n(e("rfdc"));s.deepClone=(0,r.default)({proto:!1,circles:!1})}}},{package:"@metamask/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/deep-clone.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/default-endowments.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs",{"./array.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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 r=n(e("@metamask/slip44")),a=e("./array.cjs");function i(e){var t;return"1"===String(e)?"Test Networks":(null===(t=r.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,a.isEqual)(s.path,e));if(n)return n.name;if("secp256k1"===t&&"m"===e[0]&&"44'"===e[1]&&e[2].endsWith("'")){return i(e[2].slice(0,-1))??null}return null},s.getSlip44ProtocolName=i}}},{package:"@metamask/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/derivation-paths.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/multichain-account-service/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/multichain-account-service>@metamask/snaps-utils",file:"node_modules/@metamask/multichain-account-service/node_modules/@metamask/snaps-utils/dist/entropy.cjs"}]],[],{});