LavaPack.loadBundle([[100,{"../../../../shared/constants/defi-referrals":8536,"../../../../shared/constants/time":8573,"@metamask/json-rpc-engine":2691,loglevel:7215},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ReferralTriggerType=void 0,n.createDefiReferralMiddleware=function(e){return(0,s.createAsyncMiddleware)(async(t,n,r)=>{if(await r(),!function(e){return Boolean(e.origin)&&Boolean(e.tabId)}(t))return;const s=(0,o.getPartnerByOrigin)(t.origin);if(!s)return;const a=`${t.origin}:${t.tabId}`;if(l(t.method)||d(t.method)){let r=!1;if(Array.isArray(n.result)&&n.result.length>0)if(l(t.method)){r=n.result.some(e=>"eth_accounts"===e?.parentCapability)}else r=n.result.every(e=>"string"==typeof e);return void(r&&(h(s.connectionFlow)?(f??(f=function(){const e=new Map,t=setInterval(()=>{const n=Date.now()-c;for(const[t,r]of e.entries())r<=n&&e.delete(t);0===e.size&&(clearInterval(t),e.clear(),f=null)},c);return e}()),f).set(a,Date.now()):e(s,t.tabId,u.NewConnection).catch(e=>{i.default.error(`Failed to handle ${s.name} referral after permissions grant: `,e)})))}h(s.connectionFlow)&&p(t.method)&&"string"==typeof n.result&&f?.has(a)&&(f.delete(a),e(s,t.tabId,u.NewConnection).catch(e=>{i.default.error(`Failed to handle ${s.name} referral after signature grant: `,e)}))})};var r,s=e("@metamask/json-rpc-engine"),i=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../../shared/constants/time"),o=e("../../../../shared/constants/defi-referrals");const c=10*a.SECOND;let u=n.ReferralTriggerType=function(e){return e.NewConnection="new_connection",e.OnNavigateConnectedTab="on_navigate_connected_tab",e.PermittedAccountAdded="permitted_account_added",e}({});const l=e=>"wallet_requestPermissions"===e,d=e=>"eth_requestAccounts"===e,p=e=>"eth_signTypedData_v4"===e,h=e=>"permissions_then_signature"===e;let f=null}}},{package:"$root$",file:"app/scripts/lib/defi-referrals/createDefiReferralMiddleware.ts"}],[1008,{"@firebase/component":1009,"@firebase/logger":1011,"@firebase/util":1014,idb:6895},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"FirebaseError",{enumerable:!0,get:function(){return i.FirebaseError}}),n._DEFAULT_ENTRY_NAME=n.SDK_VERSION=void 0,n._addComponent=U,n._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},n._apps=void 0,n._clearComponents=function(){H.clear()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n._components=void 0,n._getProvider=W,n._isFirebaseApp=Q,n._isFirebaseServerApp=function(e){return e.settings!==undefined},n._registerComponent=$,n._removeServiceInstance=function(e,t,n=F){W(e,t).clearInstance(n)},n._serverApps=void 0,n.deleteApp=Y,n.getApp=function(e=F){const t=q.get(e);if(!t&&e===F&&(0,i.getDefaultAppConfig)())return J();if(!t)throw G.create("no-app",{appName:e});return t},n.getApps=function(){return Array.from(q.values())},n.initializeApp=J,n.initializeServerApp=function(e,t){if((0,i.isBrowser)()&&!(0,i.isWebWorker)())throw G.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let n;n=Q(e)?e.options:e;const s=Object.assign(Object.assign({},t),n);s.releaseOnDeref!==undefined&&delete s.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw G.create("finalization-registry-not-supported",{});const a=""+(c=JSON.stringify(s),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),o=L.get(a);var c;if(o)return o.incRefCount(t.releaseOnDeref),o;const u=new r.ComponentContainer(a);for(const e of H.values())u.addComponent(e);const l=new V(n,t,a,u);return L.set(a,l),l},n.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw G.create("invalid-log-argument");(0,s.setUserLogHandler)(e,t)},n.registerVersion=X,n.setLogLevel=function(e){(0,s.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 r=e("@firebase/component"),s=e("@firebase/logger"),i=e("@firebase/util"),a=e("idb");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class 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",u="0.10.18",l=new s.Logger("@firebase/app"),d="@firebase/app-compat",p="@firebase/analytics-compat",h="@firebase/analytics",f="@firebase/app-check-compat",m="@firebase/app-check",g="@firebase/auth",y="@firebase/auth-compat",b="@firebase/database",w="@firebase/data-connect",v="@firebase/database-compat",_="@firebase/functions",T="@firebase/functions-compat",S="@firebase/installations",I="@firebase/installations-compat",E="@firebase/messaging",k="@firebase/messaging-compat",A="@firebase/performance",C="@firebase/performance-compat",O="@firebase/remote-config",P="@firebase/remote-config-compat",M="@firebase/storage",j="@firebase/storage-compat",x="@firebase/firestore",N="@firebase/vertexai",R="@firebase/firestore-compat",D="firebase",F=n._DEFAULT_ENTRY_NAME="[DEFAULT]",B={[c]:"fire-core",[d]:"fire-core-compat",[h]:"fire-analytics",[p]:"fire-analytics-compat",[m]:"fire-app-check",[f]:"fire-app-check-compat",[g]:"fire-auth",[y]:"fire-auth-compat",[b]:"fire-rtdb",[w]:"fire-data-connect",[v]:"fire-rtdb-compat",[_]:"fire-fn",[T]:"fire-fn-compat",[S]:"fire-iid",[I]:"fire-iid-compat",[E]:"fire-fcm",[k]:"fire-fcm-compat",[A]:"fire-perf",[C]:"fire-perf-compat",[O]:"fire-rc",[P]:"fire-rc-compat",[M]:"fire-gcs",[j]:"fire-gcs-compat",[x]:"fire-fst",[R]:"fire-fst-compat",[N]:"fire-vertex","fire-js":"fire-js",[D]:"fire-js-all"},q=n._apps=new Map,L=n._serverApps=new Map,H=n._components=new Map;function U(e,t){try{e.container.addComponent(t)}catch(n){l.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function $(e){const t=e.name;if(H.has(t))return l.debug(`There were multiple attempts to register component ${t}.`),!1;H.set(t,e);for(const t of q.values())U(t,e);for(const t of L.values())U(t,e);return!0}function W(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Q(e){return e.options!==undefined}const K={"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."},G=new i.ErrorFactory("app","Firebase",K);
/**
 * @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 z{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new r.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 G.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 V extends z{constructor(e,t,n,r){const s=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,i={name:n,automaticDataCollectionEnabled:s};if(e.apiKey!==undefined)super(e,i,r);else{super(e.options,i,r)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:s},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,u,"serverapp")}toJSON(){return undefined}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==undefined&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){Y(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw G.create("server-app-deleted")}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.SDK_VERSION="11.2.0";function J(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const s=Object.assign({name:F,automaticDataCollectionEnabled:!1},t),a=s.name;if("string"!=typeof a||!a)throw G.create("bad-app-name",{appName:String(a)});if(n||(n=(0,i.getDefaultAppConfig)()),!n)throw G.create("no-options");const o=q.get(a);if(o){if((0,i.deepEqual)(n,o.options)&&(0,i.deepEqual)(s,o.config))return o;throw G.create("duplicate-app",{appName:a})}const c=new r.ComponentContainer(a);for(const e of H.values())c.addComponent(e);const u=new z(n,s,c);return q.set(a,u),u}async function Y(e){let t=!1;const n=e.name;if(q.has(n))t=!0,q.delete(n);else if(L.has(n)){e.decRefCount()<=0&&(L.delete(n),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function X(e,t,n){var s;let i=null!==(s=B[e])&&void 0!==s?s:e;n&&(i+=`-${n}`);const a=i.match(/\s|\//),o=t.match(/\s|\//);if(a||o){const e=[`Unable to register library "${i}" with version "${t}":`];return a&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),a&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void l.warn(e.join(" "))}$(new r.Component(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,a.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw G.create("idb-open",{originalErrorMessage:e.message})})),ee}async function ne(e,t){try{const n=(await te()).transaction(Z,"readwrite"),r=n.objectStore(Z);await r.put(t,re(e)),await n.done}catch(e){if(e instanceof i.FirebaseError)l.warn(e.message);else{const t=G.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});l.warn(t.message)}}}function re(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 se{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ae(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=ie();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===r||this._heartbeatsCache.heartbeats.some(e=>e.date===r))return;return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}catch(e){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=ie(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),oe(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),oe(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=(0,i.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return l.warn(e),""}}}function ie(){return(new Date).toISOString().substring(0,10)}class ae{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,i.isIndexedDBAvailable)()&&(0,i.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),n=await t.objectStore(Z).get(re(e));return await t.done,n}catch(e){if(e instanceof i.FirebaseError)l.warn(e.message);else{const t=G.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 n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function oe(e){return(0,i.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="",$(new r.Component("platform-logger",e=>new o(e),"PRIVATE")),$(new r.Component("heartbeat",e=>new se(e),"PRIVATE")),X(c,u,ce),X(c,u,"esm2017"),X("fire-js","")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app",file:"node_modules/@firebase/app/dist/esm/index.esm2017.js"}],[1009,{"@firebase/util":1014},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Provider=n.ComponentContainer=n.Component=void 0;var r=e("@firebase/util");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.Component=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};const s="[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 i{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 r.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)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:s})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=s){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=s){return this.instances.has(e)}getOptions(e=s){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(r)}return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===s?undefined:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e=s){return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}n.Provider=i;n.ComponentContainer=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new i(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"}],[101,{"../../../../shared/constants/defi-referrals":8536},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.checkHyperliquidHasReferralCode=async function(e){try{const t=await fetch(r.HYPERLIQUID_INFO_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"referral",user:e})});if(!t.ok)return!1;const n=await t.json();return Boolean(n?.referredBy)}catch{return!1}};var r=e("../../../../shared/constants/defi-referrals")}}},{package:"$root$",file:"app/scripts/lib/defi-referrals/referral-api-check.ts"}],[1010,{"@firebase/app":1008,"@firebase/component":1009,"@firebase/util":1014,idb:6895},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteInstallations=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function(e){const{appConfig:t}=e,n=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(n){if(1===n.registrationStatus)throw m.create("delete-pending-registration");if(2===n.registrationStatus){if(!navigator.onLine)throw m.create("app-offline");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
await async function(e,t){const n=function(e,{fid:t}){return`${y(e)}/${t}`}(e,t),r=_(e,t),s={method:"DELETE",headers:r},i=await T(()=>fetch(n,s));if(!i.ok)throw await w("Delete Installation",i)}(t,n),await L(t)}}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getId=J,n.getInstallations=
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,r.getApp)()){return(0,r._getProvider)(e,"installations").getImmediate()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getToken=Y,n.onIdChange=function(e,t){const{appConfig:n}=e;return function(e,t){j();const n=A(e);let r=C.get(n);r||(r=new Set,C.set(n,r));r.add(t)}(n,t),()=>{!function(e,t){const n=A(e),r=C.get(n);if(!r)return;r.delete(t),0===r.size&&C.delete(n);x()}(n,t)}};var r=e("@firebase/app"),s=e("@firebase/component"),i=e("@firebase/util"),a=e("idb");const o="@firebase/installations",c="0.6.12",u=1e4,l=`w:${c}`,d="FIS_v2",p="https://firebaseinstallations.googleapis.com/v1",h=36e5,f={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},m=new i.ErrorFactory("installations","Installations",f);function g(e){return e instanceof i.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 y({projectId:e}){return`${p}/projects/${e}/installations`}function b(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function w(e,t){const n=(await t.json()).error;return m.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function v({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function _(e,{refreshToken:t}){const n=v(e);return n.append("Authorization",function(e){return`${d} ${e}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t)),n}async function T(e){const t=await e();return t.status>=500&&t.status<600?e():t}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function S(e){return new Promise(t=>{setTimeout(t,e)})}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const I=/^[cdef][\w-]{21}$/,E="";function k(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e);return I.test(t)?t:E}catch(e){return E}}function A(e){return`${e.appName}!${e.appId}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const C=new Map;function O(e,t){const n=A(e);P(n,t),function(e,t){const n=j();n&&n.postMessage({key:e,fid:t});x()}(n,t)}function P(e,t){const n=C.get(e);if(n)for(const e of n)e(t)}let M=null;function j(){return!M&&"BroadcastChannel"in self&&(M=new BroadcastChannel("[Firebase] FID Change"),M.onmessage=e=>{P(e.data.key,e.data.fid)}),M}function x(){0===C.size&&M&&(M.close(),M=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 N="firebase-installations-database",R=1,D="firebase-installations-store";let F=null;function B(){return F||(F=(0,a.openDB)(N,R,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(D)}})),F}async function q(e,t){const n=A(e),r=(await B()).transaction(D,"readwrite"),s=r.objectStore(D),i=await s.get(n);return await s.put(t,n),await r.done,i&&i.fid===t.fid||O(e,t.fid),t}async function L(e){const t=A(e),n=(await B()).transaction(D,"readwrite");await n.objectStore(D).delete(t),await n.done}async function H(e,t){const n=A(e),r=(await B()).transaction(D,"readwrite"),s=r.objectStore(D),i=await s.get(n),a=t(i);return a===undefined?await s.delete(n):await s.put(a,n),await r.done,!a||i&&i.fid===a.fid||O(e,a.fid),a}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e){let t;const n=await H(e.appConfig,n=>{const r=function(e){const t=e||{fid:k(),registrationStatus:0};return Q(t)}(n),s=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(m.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=y(e),s=v(e),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const a={fid:n,authVersion:d,appId:e.appId,sdkVersion:l},o={method:"POST",headers:s,body:JSON.stringify(a)},c=await T(()=>fetch(r,o));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:b(e.authToken)}}throw await w("Create Installation",c)}(e,t);return q(e.appConfig,n)}catch(n){throw g(n)&&409===n.customData.serverCode?await L(e.appConfig):await q(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:$(e)}:{installationEntry:t}}(e,r);return t=s.registrationPromise,s.installationEntry});return n.fid===E?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function $(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await S(100),t=await W(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await U(e);return n||t}return t}function W(e){return H(e,e=>{if(!e)throw m.create("installation-not-found");return Q(e)})}function Q(e){return 1===(t=e).registrationStatus&&t.registrationTime+u<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 K({appConfig:e,heartbeatServiceProvider:t},n){const r=function(e,{fid:t}){return`${y(e)}/${t}/authTokens:generate`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e,n),s=_(e,n),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const a={installation:{sdkVersion:l,appId:e.appId}},o={method:"POST",headers:s,body:JSON.stringify(a)},c=await T(()=>fetch(r,o));if(c.ok){return b(await c.json())}throw await w("Generate Auth Token",c)}async function G(e,t=!1){let n;const r=await H(e.appConfig,r=>{if(!V(r))throw m.create("not-registered");const s=r.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)}(s))return r;if(1===s.requestStatus)return n=async function(e,t){let n=await z(e.appConfig);for(;1===n.authToken.requestStatus;)await S(100),n=await z(e.appConfig);const r=n.authToken;return 0===r.requestStatus?G(e,t):r}(e,t),r;{if(!navigator.onLine)throw m.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(r);return n=async function(e,t){try{const n=await K(e,t),r=Object.assign(Object.assign({},t),{authToken:n});return await q(e.appConfig,r),n}catch(n){if(!g(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await q(e.appConfig,n)}else await L(e.appConfig);throw n}}(e,t),t}});return n?await n:r.authToken}function z(e){return H(e,e=>{if(!V(e))throw m.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+u<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */})}function V(e){return e!==undefined&&2===e.registrationStatus}async function J(e){const t=e,{installationEntry:n,registrationPromise:r}=await U(t);return r?r.catch(console.error):G(t).catch(console.error),n.fid}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Y(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(n);return(await G(n,t)).token}function X(e){return m.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Z="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw X(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:(0,r._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),n=(0,r._getProvider)(t,Z).getImmediate();return{getId:()=>J(n),getToken:e=>Y(n,e)}};(0,r._registerComponent)(new s.Component(Z,ee,"PUBLIC")),(0,r._registerComponent)(new s.Component("installations-internal",te,"PRIVATE")),(0,r.registerVersion)(o,c),(0,r.registerVersion)(o,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],[1011,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const r=[];var s;n.LogLevel=void 0,(s=n.LogLevel||(n.LogLevel={}))[s.DEBUG=0]="DEBUG",s[s.VERBOSE=1]="VERBOSE",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.SILENT=5]="SILENT";const i={debug:n.LogLevel.DEBUG,verbose:n.LogLevel.VERBOSE,info:n.LogLevel.INFO,warn:n.LogLevel.WARN,error:n.LogLevel.ERROR,silent:n.LogLevel.SILENT},a=n.LogLevel.INFO,o={[n.LogLevel.DEBUG]:"log",[n.LogLevel.VERBOSE]:"log",[n.LogLevel.INFO]:"info",[n.LogLevel.WARN]:"warn",[n.LogLevel.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=o[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}]  ${e.name}:`,...n)};n.Logger=class{constructor(e){this.name=e,this._logLevel=a,this._logHandler=c,this._userLogHandler=null,r.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?i[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.DEBUG,...e),this._logHandler(this,n.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.VERBOSE,...e),this._logHandler(this,n.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.INFO,...e),this._logHandler(this,n.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.WARN,...e),this._logHandler(this,n.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.ERROR,...e),this._logHandler(this,n.LogLevel.ERROR,...e)}},n.setLogLevel=function(e){r.forEach(t=>{t.setLogLevel(e)})},n.setUserLogHandler=function(e,t){for(const s of r){let r=null;t&&t.level&&(r=i[t.level]),s.userLogHandler=null===e?null:(t,s,...i)=>{const a=i.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(" ");s>=(null!=r?r:t.logLevel)&&e({level:n.LogLevel[s].toLowerCase(),message:a,args:i,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],[1012,{"@firebase/app":1008,"@firebase/component":1009,"@firebase/installations":1010,"@firebase/util":1014,idb:6895},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteToken=function(e){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return async function(e){if(!navigator)throw O.create("only-available-in-window");e.swRegistration||await L(e);return async function(e){const t=await E(e.firebaseDependencies);t&&(await P(e.firebaseDependencies,t.token),await async function(e){const t=A(e),n=(await I()).transaction(T,"readwrite");await n.objectStore(T).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();if(n)return n.unsubscribe();return!0}(e)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=(0,i.getModularInstance)(e))},n.getMessaging=
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,a.getApp)()){return z().then(e=>{if(!e)throw O.create("unsupported-browser")},e=>{throw O.create("indexed-db-unsupported")}),(0,a._getProvider)((0,i.getModularInstance)(e),"messaging").getImmediate()},n.getToken=async function(e,t){return H(e=(0,i.getModularInstance)(e),t)},n.isSupported=z,n.onMessage=function(e,t){return function(e,t){if(!navigator)throw O.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,i.getModularInstance)(e),t)},e("@firebase/installations");var r=e("@firebase/component"),s=e("idb"),i=e("@firebase/util"),a=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",u="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",l="https://fcmregistrations.googleapis.com/v1",d="google.c.a.c_id",p=1e4;var h,f;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function m(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function g(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;++e)r[e]=n.charCodeAt(e);return 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.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(f||(f={}));const y="fcm_token_details_db",b=5,w="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const v="firebase-messaging-database",_=1,T="firebase-messaging-store";let S=null;function I(){return S||(S=(0,s.openDB)(v,_,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(T)}})),S}async function E(e){const t=A(e),n=await I(),r=await n.transaction(T).objectStore(T).get(t);if(r)return r;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(y))return null}let t=null;return(await(0,s.openDB)(y,b,{upgrade:async(n,r,s,i)=>{var a;if(r<2)return;if(!n.objectStoreNames.contains(w))return;const o=i.objectStore(w),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===r){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:m(e.vapidKey)}}}else if(3===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}else if(4===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}}})).close(),await(0,s.deleteDB)(y),await(0,s.deleteDB)("fcm_vapid_details_db"),await(0,s.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 k(e,t),t}}async function k(e,t){const n=A(e),r=(await I()).transaction(T,"readwrite");return await r.objectStore(T).put(t,n),await r.done,t}function A({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const C={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},O=new i.ErrorFactory("messaging","Messaging",C);async function P(e,t){const n={method:"DELETE",headers:await j(e)};try{const r=await fetch(`${M(e.appConfig)}/${t}`,n),s=await r.json();if(s.error){const e=s.error.message;throw O.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw O.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function M({projectId:e}){return`${l}/projects/${e}/registrations`}async function j({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function x({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const s={web:{endpoint:n,auth:t,p256dh:e}};return r!==u&&(s.web.applicationPubKey=r),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.
 */const N=6048e5;async function R(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:m(t.getKey("auth")),p256dh:m(t.getKey("p256dh"))},r=await E(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,s=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&r&&s&&i}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(r.subscriptionOptions,n))return Date.now()>=r.createTime+N?async function(e,t){try{const n=await async function(e,t){const n=await j(e),r=x(t.subscriptionOptions),s={method:"PATCH",headers:n,body:JSON.stringify(r)};let i;try{const n=await fetch(`${M(e.appConfig)}/${t.token}`,s);i=await n.json()}catch(e){throw O.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw O.create("token-update-failed",{errorInfo:e})}if(!i.token)throw O.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),r=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await k(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await P(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return D(e.firebaseDependencies,n)}return D(e.firebaseDependencies,n)}async function D(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await j(e),r=x(t),s={method:"POST",headers:n,body:JSON.stringify(r)};let i;try{const t=await fetch(M(e.appConfig),s);i=await t.json()}catch(e){throw O.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw O.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw O.create("token-subscribe-no-token");return i.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await k(e,r),r.token}function F(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const s=t.notification.image;s&&(e.notification.image=s);const i=t.notification.icon;i&&(e.notification.icon=i)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,r,s,i,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const o=null!==(s=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==s?s:null===(i=t.notification)||void 0===i?void 0:i.click_action;o&&(e.fcmOptions.link=o);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}function B(e){return O.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
!function(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e.charAt(r)),r<t.length&&n.push(t.charAt(r));n.join("")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class q{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const r=function(e){if(!e||!e.options)throw B("App Configuration Object");if(!e.name)throw B("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw B(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:r,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function L(e){try{e.swRegistration=await navigator.serviceWorker.register(o,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const r=setTimeout(()=>n(new Error(`Service worker not registered after ${p} ms`)),p),s=e.installing||e.waiting;e.active?(clearTimeout(r),t()):s?s.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(s.onstatechange=null,clearTimeout(r),t())}:(clearTimeout(r),n(new Error("No incoming service worker found.")))})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e.swRegistration)}catch(e){throw O.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function H(e,t){if(!navigator)throw O.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw O.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=u)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await L(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw O.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),R(e)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e,t,n){const r=function(e){switch(e){case f.NOTIFICATION_CLICKED:return"notification_open";case f.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n[d],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function $(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(F(n)):e.onMessageHandler.next(F(n)));const r=n.data;var s;"object"==typeof(s=r)&&s&&d in s&&"1"===r["google.c.a.e"]&&await U(e,n.messageType,r)}const W="@firebase/messaging",Q="0.12.16",K=e=>{const t=new q(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>$(t,e)),t},G=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>H(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function z(){try{await(0,i.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,i.isIndexedDBAvailable)()&&(0,i.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,a._registerComponent)(new r.Component("messaging",K,"PUBLIC")),(0,a._registerComponent)(new r.Component("messaging-internal",G,"PRIVATE")),(0,a.registerVersion)(W,Q),(0,a.registerVersion)(W,Q,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],[1013,{"@firebase/app":1008,"@firebase/component":1009,"@firebase/installations":1010,"@firebase/util":1014,idb:6895},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),e("@firebase/installations");var r=e("@firebase/component"),s=e("idb"),i=e("@firebase/util"),a=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var u,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 d(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;++e)r[e]=n.charCodeAt(e);return 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.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(u||(u={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(l||(l={}));const h="fcm_token_details_db",f="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const m="firebase-messaging-store";let g=null;function y(){return g||(g=s.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(m)}})),g}async function b(e){const t=v(e),n=await y(),r=await n.transaction(m).objectStore(m).get(t);if(r)return r;{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 s.openDB(h,5,{upgrade:async(n,r,s,i)=>{var a;if(r<2)return;if(!n.objectStoreNames.contains(f))return;const o=i.objectStore(f),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===r){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:d(e.vapidKey)}}}else if(3===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}else if(4===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:d(e.auth),p256dh:d(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:d(e.vapidKey)}}}}})).close(),await s.deleteDB(h),await s.deleteDB("fcm_vapid_details_db"),await s.deleteDB("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await w(e,t),t}}async function w(e,t){const n=v(e),r=(await y()).transaction(m,"readwrite");return await r.objectStore(m).put(t,n),await r.done,t}function v({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 _={"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."},T=new i.ErrorFactory("messaging","Messaging",_);async function S(e,t){const n={method:"DELETE",headers:await E(e)};try{const r=await fetch(`${I(e.appConfig)}/${t}`,n),s=await r.json();if(s.error){const e=s.error.message;throw T.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw T.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function I({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function E({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function k({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const s={web:{endpoint:n,auth:t,p256dh:e}};return r!==o&&(s.web.applicationPubKey=r),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.
 */async function A(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:p(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:d(t.getKey("auth")),p256dh:d(t.getKey("p256dh"))},r=await b(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,s=t.auth===e.auth,i=t.p256dh===e.p256dh;return n&&r&&s&&i}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(r.subscriptionOptions,n))return Date.now()>=r.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await E(e),r=k(t.subscriptionOptions),s={method:"PATCH",headers:n,body:JSON.stringify(r)};let i;try{const n=await fetch(`${I(e.appConfig)}/${t.token}`,s);i=await n.json()}catch(e){throw T.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw T.create("token-update-failed",{errorInfo:e})}if(!i.token)throw T.create("token-update-no-token");return i.token}(e.firebaseDependencies,t),r=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await w(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await S(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return O(e.firebaseDependencies,n)}return O(e.firebaseDependencies,n)}async function C(e){const t=await b(e.firebaseDependencies);t&&(await S(e.firebaseDependencies,t.token),await async function(e){const t=v(e),n=(await y()).transaction(m,"readwrite");await n.objectStore(m).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function O(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await E(e),r=k(t),s={method:"POST",headers:n,body:JSON.stringify(r)};let i;try{const t=await fetch(I(e.appConfig),s);i=await t.json()}catch(e){throw T.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(i.error){const e=i.error.message;throw T.create("token-subscribe-failed",{errorInfo:e})}if(!i.token)throw T.create("token-subscribe-no-token");return i.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await w(e,r),r.token}async function P(e,t){const n=function(e,t){var n,r;const s={};e.from&&(s.project_number=e.from);e.fcmMessageId&&(s.message_id=e.fcmMessageId);s.instance_id=t,e.notification?s.message_type=u.DISPLAY_NOTIFICATION.toString():s.message_type=u.DATA_MESSAGE.toString();s.sdk_platform=3..toString(),s.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(s.collapse_key=e.collapse_key);s.event=1..toString(),!(null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(s.analytics_label=null===(r=e.fcmOptions)||void 0===r?void 0:r.analytics_label);return s}(t,await e.firebaseDependencies.installations.getId());!function(e,t,n){const r={};r.event_time_ms=Math.floor(Date.now()).toString(),r.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!n||(r.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(n));e.logEvents.push(r)}(e,n,t.productId)}async function M(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await P(t,n);const r=await x();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(r))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=l.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(r,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:r}=Notification;n&&r&&n.length>r&&console.warn(`This browser only supports ${r} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[c]:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const s=t.notification.image;s&&(e.notification.image=s);const i=t.notification.icon;i&&(e.notification.icon=i)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,r,s,i,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const o=null!==(s=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==s?s:null===(i=t.notification)||void 0===i?void 0:i.click_action;o&&(e.fcmOptions.link=o);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function j(e){var t,n;const r=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n[c];if(!r)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const s=function(e){var t,n,r;const s=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(r=e.notification)||void 0===r?void 0:r.click_action;if(s)return s;return i=e.data,"object"==typeof i&&i&&"google.c.a.c_id"in i?self.location.origin:null;var 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.
 */}
/**
 * @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.
 */(r);if(!s)return;const i=new URL(s,self.location.href),a=new URL(self.location.origin);if(i.host!==a.host)return;let o=await async function(e){const t=await x();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(i);var u;
/**
 * @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(s),await(u=3e3,new Promise(e=>{setTimeout(e,u)}))),o?(r.messageType=l.NOTIFICATION_CLICKED,r.isFirebaseMessaging=!0,o.postMessage(r)):void 0}function x(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function N(e){return T.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e,t){const n=[];for(let r=0;r<e.length;r++)n.push(e.charAt(r)),r<t.length&&n.push(t.charAt(r));n.join("")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class R{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const r=function(e){if(!e||!e.options)throw N("App Configuration Object");if(!e.name)throw N("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw N(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:r,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D=e=>{const t=new R(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(M(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var n,r;const{newSubscription:s}=e;if(!s)return void await C(t);const i=await b(t.firebaseDependencies);await C(t),t.vapidKey=null!==(r=null===(n=null==i?void 0:i.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==r?r:o,await A(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(j(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 F(){return i.isIndexedDBAvailable()&&await i.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */a._registerComponent(new r.Component("messaging-sw",D,"PUBLIC")),n.experimentalSetDeliveryMetricsExportedToBigQueryEnabled=function(e,t){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=i.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getMessaging=function(e=a.getApp()){return F().then(e=>{if(!e)throw T.create("unsupported-browser")},e=>{throw T.create("indexed-db-unsupported")}),a._getProvider(i.getModularInstance(e),"messaging-sw").getImmediate()},n.isSupported=F,n.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw T.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=i.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],[1014,{_process:7499},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.Sha1=n.RANDOM_FACTOR=n.MAX_VALUE_MILLIS=n.FirebaseError=n.ErrorFactory=n.Deferred=n.DecodeBase64StringError=n.CONSTANTS=void 0,n.areCookiesEnabled=function(){if("undefined"==typeof navigator||!navigator.cookieEnabled)return!1;return!0}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.assertionError=n.assert=void 0,n.async=function(e,t){return(...n)=>{Promise.resolve(!0).then(()=>{e(...n)}).catch(e=>{t&&t(e)})}},n.base64urlEncodeWithoutPadding=n.base64Encode=n.base64Decode=n.base64=void 0,n.calculateBackoffMillis=function(e,t=O,n=P){const r=t*Math.pow(n,e),s=Math.round(j*r*(Math.random()-.5)*2);return Math.min(M,r+s)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.createMockUserToken=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e);return[u(JSON.stringify({alg:"none",type:"JWT"})),u(JSON.stringify(i)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.createSubscribe=function(e,t){const n=new k(e,t);return n.subscribe.bind(n)},n.decode=void 0,n.deepCopy=function(e){return d(undefined,e)},n.deepEqual=function e(t,n){if(t===n)return!0;const r=Object.keys(t),s=Object.keys(n);for(const i of r){if(!s.includes(i))return!1;const r=t[i],a=n[i];if(E(r)&&E(a)){if(!e(r,a))return!1}else if(r!==a)return!1}for(const e of s)if(!r.includes(e))return!1;return!0},n.deepExtend=d,n.errorPrefix=C,n.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:undefined)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getExperimentalSetting=n.getDefaults=n.getDefaultEmulatorHostnameAndPort=n.getDefaultEmulatorHost=n.getDefaultAppConfig=void 0,n.getGlobal=h,n.getModularInstance=
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e){return e&&e._delegate?e._delegate:e},n.getUA=y,n.isAdmin=void 0,n.isBrowser=function(){return"undefined"!=typeof window||w()},n.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},n.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},n.isElectron=function(){return y().indexOf("Electron/")>=0},n.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},n.isIE=function(){const e=y();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},n.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},n.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(y())},n.isNode=b,n.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},n.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},n.isSafari=function(){return!b()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},n.isUWP=function(){return y().indexOf("MSAppHost/")>=0},n.isValidTimestamp=n.isValidFormat=void 0,n.isWebWorker=w,n.issuedAtTime=void 0,n.jsonEval=S,n.map=function(e,t,n){const r={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=t.call(n,e[s],s,e));return r},n.ordinal=function(e){if(!Number.isFinite(e))return`${e}`;return e+function(e){e=Math.abs(e);const t=e%100;if(t>=10&&t<=20)return"th";const n=e%10;if(1===n)return"st";if(2===n)return"nd";if(3===n)return"rd";return"th"}(e)},n.promiseWithTimeout=
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e,t=2e3){const n=new g;return setTimeout(()=>n.reject("timeout!"),t),e.then(n.resolve,n.reject),n.promise}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.querystring=function(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""},n.querystringDecode=function(e){const t={},n=e.replace(/^\?/,"").split("&");return n.forEach(e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t},n.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},n.stringToByteArray=n.stringLength=void 0,n.stringify=function(e){return JSON.stringify(e)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateArgCount=void 0,n.validateCallback=function(e,t,n,r){if(r&&!n)return;if("function"!=typeof n)throw new Error(C(e,t)+"must be a valid function.")},n.validateContextObject=function(e,t,n,r){if(r&&!n)return;if("object"!=typeof n||null===n)throw new Error(C(e,t)+"must be a valid context object.")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},n.validateNamespace=function(e,t,n){if(n&&!t)return;if("string"!=typeof t)throw new Error(C(e,"namespace")+"must be a valid firebase namespace.")};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const t=n.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},r=function(e,t){if(!e)throw s(t)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.assert=r;const s=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.assertionError=s;const i=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},a=n.base64={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,a=i?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,u=s>>2,l=(3&s)<<4|a>>4;let d=(15&a)<<2|c>>6,p=63&c;o||(p=64,i||(d=64)),r.push(n[u],n[l],n[d],n[p])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const s=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==i||null==a||null==c)throw new o;const u=s<<2|i>>4;if(r.push(u),64!==a){const e=i<<4&240|a>>2;if(r.push(e),64!==c){const e=a<<6&192|c;r.push(e)}}}return r},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"}}n.DecodeBase64StringError=o;const c=function(e){const t=i(e);return a.encodeByteArray(t,!0)};n.base64Encode=c;const u=function(e){return c(e).replace(/\./g,"")};n.base64urlEncodeWithoutPadding=u;const l=function(e){try{return a.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function d(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===undefined&&(e={});break;case Array:e=[];break;default:return t}for(const n in t)t.hasOwnProperty(n)&&p(n)&&(e[n]=d(e[n],t[n]));return e}function p(e){return"__proto__"!==e}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function h(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.base64Decode=l;const f=()=>{try{return h().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&l(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};n.getDefaults=f;const m=e=>{var t,n;return null===(n=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]};n.getDefaultEmulatorHost=m;n.getDefaultEmulatorHostnameAndPort=e=>{const t=m(e);if(!t)return undefined;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]};n.getDefaultAppConfig=()=>{var e;return null===(e=f())||void 0===e?void 0:e.config};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.getExperimentalSetting=e=>{var t;return null===(t=f())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function y(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function b(){var e;const t=null===(e=f())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function w(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}n.Deferred=g;class v extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,v.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_.prototype.create)}}n.FirebaseError=v;class _{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],i=s?function(e,t){return e.replace(T,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(s,n):"Error",a=`${this.serviceName}: ${i} (${r}).`;return new v(r,a,n)}}n.ErrorFactory=_;const T=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function S(e){return JSON.parse(e)}const I=function(e){let t={},n={},r={},s="";try{const i=e.split(".");t=S(l(i[0])||""),n=S(l(i[1])||""),s=i[2],r=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:s}};n.decode=I;n.isValidTimestamp=function(e){const t=I(e).claims,n=Math.floor((new Date).getTime()/1e3);let r=0,s=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?r=t.nbf:t.hasOwnProperty("iat")&&(r=t.iat),s=t.hasOwnProperty("exp")?t.exp:r+86400),!!n&&!!r&&!!s&&n>=r&&n<=s};n.issuedAtTime=function(e){const t=I(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};n.isValidFormat=function(e){const t=I(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function E(e){return null!==e&&"object"==typeof e}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.isAdmin=function(e){const t=I(e).claims;return"object"==typeof t&&!0===t.admin};n.Sha1=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const n=this.W_;if("string"==typeof e)for(let r=0;r<16;r++)n[r]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let r=0;r<16;r++)n[r]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=n[e-3]^n[e-8]^n[e-14]^n[e-16];n[e]=4294967295&(t<<1|t>>>31)}let r,s,i=this.chain_[0],a=this.chain_[1],o=this.chain_[2],c=this.chain_[3],u=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(r=c^a&(o^c),s=1518500249):(r=a^o^c,s=1859775393):e<60?(r=a&o|c&(a|o),s=2400959708):(r=a^o^c,s=3395469782);const t=(i<<5|i>>>27)+r+u+s+n[e]&4294967295;u=c,c=o,o=4294967295&(a<<30|a>>>2),a=i,i=t}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+u&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const n=t-this.blockSize;let r=0;const s=this.buf_;let i=this.inbuf_;for(;r<t;){if(0===i)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(s[i]=e.charCodeAt(r),++i,++r,i===this.blockSize){this.compress_(s),i=0;break}}else for(;r<t;)if(s[i]=e[r],++i,++r,i===this.blockSize){this.compress_(s),i=0;break}}this.inbuf_=i,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let r=24;r>=0;r-=8)e[n]=this.chain_[t]>>r&255,++n;return e}};class k{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(e===undefined&&t===undefined&&n===undefined)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},r.next===undefined&&(r.next=A),r.error===undefined&&(r.error=A),r.complete===undefined&&(r.complete=A);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),s}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 A(){}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function C(e,t){return`${e} failed: ${t} argument `}n.validateArgCount=function(e,t,n,r){let s;if(r<t?s="at least "+t:r>n&&(s=0===n?"none":"no more than "+n),s){throw new Error(e+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+s+".")}};n.stringToByteArray=function(e){const t=[];let n=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);if(i>=55296&&i<=56319){const t=i-55296;s++,r(s<e.length,"Surrogate pair missing trail surrogate.");i=65536+(t<<10)+(e.charCodeAt(s)-56320)}i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):i<65536?(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.stringLength=function(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3}return t};const O=1e3,P=2,M=n.MAX_VALUE_MILLIS=144e5,j=n.RANDOM_FACTOR=.5}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/notification-services-controller>firebase>@firebase/util",file:"node_modules/@firebase/util/dist/index.esm2017.js"}],[102,{"../../../../shared/constants/defi-referrals":8536,"../../../../shared/constants/network":8552,"../../../../shared/lib/delegation/utils":8657},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.checkGmxHasReferralCode=async function(e,t){try{const n=e.findNetworkClientIdByChainId(r.CHAIN_IDS.ARBITRUM),{provider:a}=e.getNetworkClientById(n),o=(0,i.toFunctionSelector)("traderReferralCodes(address)"),c=`${o}${t.toLowerCase().replace("0x","").padStart(64,"0")}`,u=await a.request({method:"eth_call",params:[{to:s.GMX_REFERRAL_STORAGE_ADDRESS,data:c},"latest"]});return"string"==typeof u&&0n!==BigInt(u)}catch{return!1}};var r=e("../../../../shared/constants/network"),s=e("../../../../shared/constants/defi-referrals"),i=e("../../../../shared/lib/delegation/utils")}}},{package:"$root$",file:"app/scripts/lib/defi-referrals/referral-onchain-check.ts"}],[103,{"@metamask/browser-passworder":1571},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.encryptorFactory=void 0;var r=e("@metamask/browser-passworder");const s=e=>async(t,n,s,i)=>(0,r.encrypt)(t,n,s,i,{algorithm:"PBKDF2",params:{iterations:e}}),i=e=>async(t,n,s)=>(0,r.encryptWithDetail)(t,n,s,{algorithm:"PBKDF2",params:{iterations:e}}),a=e=>async(t,n,s,i)=>(0,r.keyFromPassword)(t,n,s,i??{algorithm:"PBKDF2",params:{iterations:e}}),o=e=>t=>(0,r.isVaultUpdated)(t,{algorithm:"PBKDF2",params:{iterations:e}});n.encryptorFactory=e=>({encrypt:s(e),encryptWithKey:r.encryptWithKey,encryptWithDetail:i(e),decrypt:r.decrypt,decryptWithKey:r.decryptWithKey,decryptWithDetail:r.decryptWithDetail,keyFromPassword:a(e),isVaultUpdated:o(e),importKey:r.importKey,exportKey:r.exportKey,generateSalt:r.generateSalt})}}},{package:"$root$",file:"app/scripts/lib/encryptor-factory.ts"}],[104,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports=[{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"resolver",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"ttl",outputs:[{name:"",type:"uint64"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"label",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"}]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/ens-registry.json"}],[1046,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});class r{static parse(e){if(""===e)return new r([]);if(!e.startsWith("/"))throw new s(e);const[,...t]=e.split("/");return new r(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 i(e,t);e=e[t]}return e}}n.default=r;class s extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}n.InvalidPtrError=s;class i extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}n.EvalError=i}}},{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"}],[1047,{"@json-schema-tools/reference-resolver":1052,"@json-schema-tools/traverse":1055,"fast-safe-stringify":6629},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=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(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var o=a(e("@json-schema-tools/traverse")),c=a(e("@json-schema-tools/reference-resolver")),u=a(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,u.default)(e))].join("\n")};n.NonStringRefError=l;var d=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var n=r(r({},t),e);return delete n.$ref,n}return t},p=function(){function e(e,t){var n;if(void 0===t&&(t={}),this.options=t,this.refCache={},n=!0===this.options.mutate||!0===e||!1===e?e:r({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=n),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=n),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var s=0,i=Object.keys(this.options.protocolHandlerMap);s<i.length;s++){var a=i[s];c.default.protocolHandlerMap[a]=this.options.protocolHandlerMap[a]}this.schema=n,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return s(this,void 0,void 0,function(){return i(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 s(this,void 0,void 0,function(){var t,n,s,a,u,l,p,h,f,m,g,y=this;return i(this,function(i){switch(i.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 y.refCache[e]===undefined}),n=[],s=0,a=t,i.label=1;case 1:return s<a.length?(u=a[s],l=void 0,this.refCache[u]===undefined?[3,2]:(l=this.refCache[u],[3,5])):[3,11];case 2:if("#"!==u)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 p=c.default.resolve(u,this.options.rootSchema),n.push(p),[4,p];case 4:l=i.sent(),i.label=5;case 5:return!0!==this.options.recursive||!0===l||!1===l||"#"===u?[3,9]:(h=r(r({},this.options),{refCache:this.refCache}),0===(f=new e(l,h)).refs.length?[3,7]:(m=f._resolve(),n.push(m),[4,m]));case 6:return g=i.sent(),this.refCache[u]=d(l,g),[3,8];case 7:this.refCache[u]=l,i.label=8;case 8:return[3,10];case 9:this.refCache[u]=l,i.label=10;case 10:return s++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=d(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=y.refCache[e.$ref];return d(e,t)}return e},{mutable:!0}),[4,Promise.all(n)];case 12:return i.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}();n.default=p}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],[1048,{"./dereferencer":1047},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var s=r(e("./dereferencer")),i=e("./dereferencer");Object.defineProperty(n,"NonStringRefError",{enumerable:!0,get:function(){return i.NonStringRefError}}),n.default=s.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],[1049,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.jsonSchema=void 0,n.jsonSchema={$schema:"https://meta.json-schema.tools/",$id:"https://meta.json-schema.tools/",title:"JSONSchema",default:{},oneOf:[{$ref:"#/definitions/JSONSchemaObject"},{$ref:"#/definitions/JSONSchemaBoolean"}],definitions:{JSONSchemaBoolean:{title:"JSONSchemaBoolean",description:"Always valid if true. Never valid if false. Is constant.",type:"boolean"},JSONSchemaObject:{title:"JSONSchemaObject",type:"object",properties:{$id:{title:"$id",type:"string",format:"uri-reference"},$schema:{title:"$schema",type:"string",format:"uri"},$ref:{title:"$ref",type:"string",format:"uri-reference"},$comment:{title:"$comment",type:"string"},title:{title:"title",type:"string"},description:{title:"description",type:"string"},default:!0,readOnly:{title:"readOnly",type:"boolean",default:!1},examples:{title:"examples",type:"array",items:!0},multipleOf:{title:"multipleOf",type:"number",exclusiveMinimum:0},maximum:{title:"maximum",type:"number"},exclusiveMaximum:{title:"exclusiveMaximum",type:"number"},minimum:{title:"minimum",type:"number"},exclusiveMinimum:{title:"exclusiveMinimum",type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{title:"pattern",type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{title:"items",anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{title:"uniqueItems",type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{title:"definitions",type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{title:"properties",type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{title:"patternProperties",type:"object",additionalProperties:{$ref:"#"},propertyNames:{title:"propertyNames",format:"regex"},default:{}},dependencies:{title:"dependencies",type:"object",additionalProperties:{title:"dependenciesSet",anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{title:"enum",type:"array",items:!0,minItems:1,uniqueItems:!0},type:{title:"type",anyOf:[{$ref:"#/definitions/simpleTypes"},{title:"arrayOfSimpleTypes",type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{title:"format",type:"string"},contentMediaType:{title:"contentMediaType",type:"string"},contentEncoding:{title:"contentEncoding",type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}}},schemaArray:{title:"schemaArray",type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{title:"nonNegativeInteger",type:"integer",minimum:0},nonNegativeIntegerDefault0:{title:"nonNegativeIntegerDefaultZero",type:"integer",minimum:0,default:0},simpleTypes:{title:"simpleTypes",type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{title:"stringArray",type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}},n.default=n.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],[105,{"./ens-registry.json":104},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,s=(r=e("./ens-registry.json"))&&r.__esModule?r:{default:r};n.default=s.default}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/registry.ts"}],[1050,{"./errors":1051,"isomorphic-fetch":6931},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=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(n,"__esModule",{value:!0});var a=e("./errors"),o=i(e("isomorphic-fetch")),c=function(e){return r(void 0,void 0,void 0,function(){var t,n;return s(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,o.default)(e)];case 1:return t=r.sent(),[3,3];case 2:throw r.sent(),new a.InvalidRemoteURLError(e);case 3:return r.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,r.sent()];case 5:throw n=r.sent(),new a.NonJsonRefError({$ref:e},n.message);case 6:return[2]}})})};n.default={https:c,http:c}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js"}],[1051,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidFileSystemPathError=n.InvalidRemoteURLError=n.NotResolvableError=n.NonJsonRefError=void 0;var r=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};n.NonJsonRefError=r;var s=function(e){this.name="NotResolvableError",this.message=["NotResolvableError","Could not resolve the reference: ".concat(e),"No protocol handler was found, and it was not found to be an internal reference"].join("\n")};n.NotResolvableError=s;var i=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};n.InvalidRemoteURLError=i;var a=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};n.InvalidFileSystemPathError=a}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],[1052,{"./default-protocol-handler-map":1050,"./reference-resolver":1053},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=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(n,"__esModule",{value:!0});var o=a(e("./default-protocol-handler-map")),c=a(e("./reference-resolver")),u=r(r({},o.default),{file:function(){return s(void 0,void 0,void 0,function(){return i(this,function(e){return[2,undefined]})})}});n.default=new c.default(u)}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/index-web.js"}],[1053,{"./errors":1051,"./resolve-pointer":1054},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(s,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function o(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=s=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(n,"__esModule",{value:!0});var a=e("./errors"),o=i(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return r(this,arguments,void 0,function(e,t){var n,r,i,c,u,l,d,p,h,f;return void 0===t&&(t={}),s(this,function(s){switch(s.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,o.default)(e,t))];(n=e.split("#")).length>1&&(r=n[n.length-1]),i=n[0],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(i,t)];case 2:return c=s.sent(),[3,4];case 3:throw u=s.sent(),new a.NonJsonRefError({$ref:e},u.message);case 4:if(c!==undefined)return f=c,r&&(f=(0,o.default)(r,f)),[2,f];if(!1===e.includes("://"))throw new a.InvalidFileSystemPathError(e);l=0,d=Object.keys(this.protocolHandlerMap),s.label=5;case 5:return l<d.length?(p=d[l],i.startsWith(p)?[4,this.protocolHandlerMap[p](i,t)]:[3,7]):[3,8];case 6:if((h=s.sent())!==undefined)return f=h,r&&(f=(0,o.default)(r,f)),[2,f];s.label=7;case 7:return l++,[3,5];case 8:throw new a.NotResolvableError(e)}})})},e}();n.default=c}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],[1054,{"@json-schema-spec/json-pointer":1046},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidJsonPointerRefError=void 0;var s=r(e("@json-schema-spec/json-pointer")),i=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};n.InvalidJsonPointerRefError=i,n.default=function(e,t){try{var n=e.replace("#","");return s.default.parse(n).shmeval(t)}catch(t){throw new i(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"}],[1055,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)},s=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,s=0,i=t.length;s<i;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(n,"__esModule",{value:!0}),n.defaultOptions=void 0,n.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var i=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},a=function(e,t){var n=t.find(function(t){return t===e});return n||!1},o=function(e,t){return void 0===t&&(t=1),e[e.length-t]};n.default=function e(t,c,u,l,d,p,h,f,m){void 0===u&&(u=n.defaultOptions),void 0===l&&(l=0),void 0===d&&(d=[]),void 0===p&&(p=[]),void 0===h&&(h=[]),void 0===f&&(f=[]),void 0===m&&(m=[]);var g=r(r({},n.defaultOptions),u);if(0===l&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===l?t:c(t,!1,i(h),o(p));var y=t;!1===g.mutable&&(y=r({},t)),p.push(y),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===l||(y=c(y,!1,i(h),o(p,2)))),d.push(t),f.push([t,y]);var b=function(t,n){var r=a(t,d);return r?(m.push(r),!0===g.skipFirstMutation&&r===d[0]?c(t,!0,i(n),o(p)):f.find(function(e){var t=e[0];return r===t})[1]):e(t,c,u,l+1,d,p,n,f,m)};if(t.anyOf)y.anyOf=t.anyOf.map(function(e,t){return b(e,s(s([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)y.allOf=t.allOf.map(function(e,t){return b(e,s(s([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)y.oneOf=t.oneOf.map(function(e,t){return b(e,s(s([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)y.items=t.items.map(function(e,t){return b(e,s(s([],h,!0),["items[".concat(t,"]")],!1))});else{var w=a(t.items,d);if(w)if(m.push(w),!0===g.skipFirstMutation&&w===d[0])y.items=c(t.items,!0,i(h),o(p));else{var v=f.find(function(e){var t=e[0];return w===t})[1];y.items=v}else y.items=e(t.items,c,u,l+1,d,p,s(s([],h,!0),["items"],!1),f,m)}if(t.additionalItems!==undefined&&(y.additionalItems=b(t.additionalItems,s(s([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var _=t.properties,T={};Object.keys(t.properties).forEach(function(e){T[e]=b(_[e],s(s([],h,!0),["properties",e.toString()],!1))}),y.properties=T}if(t.patternProperties!==undefined){var S=t.patternProperties,I={};Object.keys(t.patternProperties).forEach(function(e){I[e]=b(S[e],s(s([],h,!0),["patternProperties",e.toString()],!1))}),y.patternProperties=I}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(y.additionalProperties=b(t.additionalProperties,s(s([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===l)return y;if(!0===g.bfs)return p.pop(),y;var E=-1!==m.indexOf(t);return p.pop(),c(y,E,i(h),o(p))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],[106,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n,r){return{constant:"view"===r||"pure"===r,inputs:[...t],name:e,outputs:n.length?[...n]:[],payable:!1,stateMutability:r,type:"function"}}function s(e,t){return{anonymous:!1,inputs:[...t],name:e,type:"event"}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;const i=e=>({name:e,type:"bytes32"}),a=[r("setContent",[i("node"),i("hash")],[],"nonpayable"),r("content",[i("node")],[{name:"",type:"bytes32"}],"view"),r("supportsInterface",[{name:"interfaceID",type:"bytes4"}],[{name:"",type:"bool"}],"pure"),r("setText",[i("node"),{name:"key",type:"string"},{name:"value",type:"string"}],[],"nonpayable"),r("ABI",[i("node"),{name:"contentTypes",type:"uint256"}],[{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],"view"),r("setPubkey",[i("node"),i("x"),i("y")],[],"nonpayable"),r("setContenthash",[i("node"),{name:"hash",type:"bytes"}],[],"nonpayable"),r("addr",[i("node")],[{name:"",type:"address"}],"view"),r("text",[i("node"),{name:"key",type:"string"}],[{name:"",type:"string"}],"view"),r("setABI",[i("node"),{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],[],"nonpayable"),r("name",[i("node")],[{name:"",type:"string"}],"view"),r("setName",[i("node"),{name:"name",type:"string"}],[],"nonpayable"),r("contenthash",[i("node")],[{name:"",type:"bytes"}],"view"),r("pubkey",[i("node")],[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],"view"),r("setAddr",[i("node"),{name:"addr",type:"address"}],[],"nonpayable"),{inputs:[{name:"ensAddr",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},s("AddrChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"a",type:"address"}]),s("NameChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"name",type:"string"}]),s("ABIChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"contentType",type:"uint256"}]),s("PubkeyChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"x",type:"bytes32"},{indexed:!1,name:"y",type:"bytes32"}]),s("TextChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"indexedKey",type:"string"},{indexed:!1,name:"key",type:"string"}]),s("ContenthashChanged",[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"hash",type:"bytes"}])];n.default=a}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/resolver.ts"}],[107,{"./contracts/registry":105,"./contracts/resolver":106,"@ensdomains/content-hash":803,"@ethersproject/contracts":918,"@ethersproject/providers":956,"eth-ens-namehash":6516},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=async function({provider:e,name:t}){const n=r.default.hash(t),u=Number.parseInt(await e.request({method:"net_version"}),10),d=function(e){switch(e){case 1:case 3:case 4:case 5:case 6:return"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";default:return null}}(u);if(!d)throw new Error(`EnsIpfsResolver - no known ens-ipfs registry for chainId "${u}"`);const p=new i.Web3Provider(e),h=new a.Contract(d,o.default,p),f=await h.resolver(n);if(l(f))throw new Error(`EnsIpfsResolver - no resolver found for name "${t}"`);const m=new a.Contract(f,c.default,p),g=await m.supportsInterface("0xbc1c58d1"),y=await m.supportsInterface("0xd8389dc5");if(g){const e=await m.contenthash(n);let t=s.default.decode(e);const r=s.default.getCodec(e);return"ipfs-ns"!==r&&"ipns-ns"!==r||(t=s.default.helpers.cidV0ToV1Base32(t)),{type:r,hash:t}}if(y){const e=await m.content(n);if(l(e))throw new Error(`EnsIpfsResolver - no content ID found for name "${t}"`);return{type:"swarm-ns",hash:e.slice(2)}}throw new Error(`EnsIpfsResolver - the resolver for name "${t}" is not standard, it should either supports contenthash() or content()`)};var r=u(e("eth-ens-namehash")),s=u(e("@ensdomains/content-hash")),i=e("@ethersproject/providers"),a=e("@ethersproject/contracts"),o=u(e("./contracts/registry")),c=u(e("./contracts/resolver"));function u(e){return e&&e.__esModule?e:{default:e}}function l(e){return[undefined,null,"0x","0x0","0x0000000000000000000000000000000000000000000000000000000000000000"].includes(e)}}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/resolver.js"}],[108,{"../../../../shared/lib/fetch-with-timeout":8667,"./resolver":107,"base32-encode":6229,"base64-js":6230,"webextension-polyfill":8513},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function({provider:e,getCurrentChainId:t,getIpfsGateway:n,getUseAddressBarEnsResolution:a}){const c=l.map(e=>`*://*.${e}/*`);return i.default.webRequest.onErrorOccurred.addListener(d,{urls:c,types:["main_frame"]}),{remove(){i.default.webRequest.onErrorOccurred.removeListener(d)}};async function d(c){const{tabId:d,url:p}=c;if(-1===d||"0x1"!==t())return;const{hostname:h,pathname:f,search:m,hash:g}=new URL(p),y=h.split("."),b=y[y.length-1];l.includes(b)&&async function({tabId:t,name:c,pathname:l,search:d,fragment:p}){const h=n(),f=a(),m=`https://app.ens.domains/name/${c}`;f&&h&&await i.default.tabs.update(t,{url:"loading.html"});let g=m;0;try{const{type:t,hash:n}=await(0,o.default)({provider:e,name:c});if("ipfs-ns"===t||"ipns-ns"===t){if(""===h)return void(g=null);const e=`https://${n}.${t.slice(0,4)}.${h}${l}${d||""}${p||""}`;try{200===(await u(e,{method:"HEAD"})).status&&(g=e)}catch(e){console.warn(e)}}else if("swarm-ns"===t)g=`https://swarm-gateways.net/bzz:/${n}${l}${d||""}${p||""}`;else if("onion"===t||"onion3"===t)g=`http://${n}.onion${l}${d||""}${p||""}`;else if("zeronet"===t)g=`http://127.0.0.1:43110/${n}${l}${d||""}${p||""}`;else if("skynet-ns"===t){const e=n.padEnd(n.length+4-n.length%4,"="),t=s.default.toByteArray(e),i={padding:!1};g=`https://${(0,r.default)(t,"RFC4648-HEX",i).toLowerCase()}.siasky.net${l}${d||""}${p||""}`}}catch(e){console.warn(e)}finally{g&&(f||!f&&g!==m)&&await i.default.tabs.update(t,{url:g})}}({tabId:d,name:h,pathname:f,search:m,fragment:g})}};var r=c(e("base32-encode")),s=c(e("base64-js")),i=c(e("webextension-polyfill")),a=c(e("../../../../shared/lib/fetch-with-timeout")),o=c(e("./resolver"));function c(e){return e&&e.__esModule?e:{default:e}}const u=(0,a.default)(),l=["eth"]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/setup.js"}],[109,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t,n){s(e,t),t.set(e,n)}function s(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(e,t){return e.get(a(e,t))}function a(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}Object.defineProperty(n,"__esModule",{value:!0}),n.ExtensionLazyListener=void 0;var o=new WeakMap,c=new WeakMap,u=new WeakSet;function l(e){setTimeout(()=>{for(const[t,n]of i(c,this))for(const[r,{args:s}]of n){const n=`ExtensionLazyListener: Possible memory leak detected. The event "${t}.${r}" has been listened to, but no application code has added a listener after ${e}ms. There are currently ${s.length} buffered calls. If you are a developer of this extension, please ensure that you have added a listener for this event. If you are a user of this extension, please report this warning to the developers of the extension.`;console.warn(n)}},e)}function d(e,t){return i(o,this)[e][t]}n.ExtensionLazyListener=class{constructor(e,t={},n=2e4){var p,h;s(p=this,h=u),h.add(p),r(this,o,void 0),r(this,c,new Map),function(e,t,n){e.set(a(e,t),n)}(o,this,e);for(const[e,n]of Object.entries(t)){const t=new Map;for(const r of n){const n=[],s=(...e)=>{n.push(e)};a(u,this,d).call(this,e,r).addListener(s),t.set(r,{listener:s,args:n})}i(c,this).set(e,t)}a(u,this,l).call(this,n)}addListener(e,t,n){const r=a(u,this,d).call(this,e,t);r.addListener(n);const s=i(c,this).get(e);if(s){const a=s.get(t);if(a){r.removeListener(a.listener),s.delete(t),0===s.size&&i(c,this).delete(e);const{args:o}=a;for(let u=0,{length:l}=o;u<l;u++)try{if(n(...o[u]),!r.hasListener(n)){const n=u+1;n!==l&&(o.splice(0,n),s.set(t,a),i(c,this).set(e,s),r.addListener(a.listener));break}}catch(n){const d=u+1;throw d!==l&&(o.splice(0,d),s.set(t,a),i(c,this).set(e,s),r.addListener(a.listener)),n}}}}once(e,t){return new Promise(n=>{const r=a(u,this,d).call(this,e,t),s=i(c,this).get(e);if(s){const a=s.get(t),o=a?.args.length;if(o)return n(a.args.shift()),r.removeListener(a.listener),void(1===o&&(s.delete(t),0===s.size&&i(c,this).delete(e)))}const o=(...e)=>{r.removeListener(o),n(e)};r.addListener(o)})}}}}},{package:"$root$",file:"app/scripts/lib/extension-lazy-listener/extension-lazy-listener.ts"}],[110,{"@metamask/snaps-sdk":3729,"@metamask/snaps-utils":3846},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.forwardRequestToSnap=async function(e,t,n,i){const{method:a,params:o}=n,{handleRequest:c,snapId:u,onBeforeRequest:l,onAfterRequest:d}=e;if(!u)throw new s.InternalError(`No snapId configured for method ${a}`);const p=i.get("origin");if(!p)throw new s.InternalError(`No origin specified for method ${a}`);try{l?.()}catch(e){try{d?.()}catch(e){console.error("Error from onAfterRequest hook:",e)}throw e}let h;try{h=await c({snapId:u,origin:p,handler:r.HandlerType.OnRpcRequest,request:{jsonrpc:"2.0",method:a,params:o}})}catch(e){try{d?.()}catch(e){console.error("Error from onAfterRequest hook:",e)}throw e}return d?.(),h};var r=e("@metamask/snaps-utils"),s=e("@metamask/snaps-sdk")}}},{package:"$root$",file:"app/scripts/lib/forwardRequestToSnap.ts"}],[111,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getIframeProperties=function({frameId:e,origin:t,mainFrameOrigin:n}){const r="number"==typeof e&&0!==e,s=r&&"string"==typeof n&&t!==n;return{is_iframe:r,is_cross_origin_iframe:s,iframe_origin:s?t:null,top_level_origin:s?n:null}}}}},{package:"$root$",file:"app/scripts/lib/getIframeProperties.ts"}],[112,{lodash:7205},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){return s((0,r.cloneDeep)(e),e=>null===e?"null":typeof e)};var r=e("lodash");function s(e={},t){return Object.entries(e).forEach(([n,r])=>{e[n]="object"==typeof r&&null!==r?s(r,t):t(r)}),e}}}},{package:"$root$",file:"app/scripts/lib/getObjStructure.js"}],[113,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hardwareKeyringBuilderFactory=function(e,t){const n=()=>new e({bridge:new t});return n.type=e.type,n}}}},{package:"$root$",file:"app/scripts/lib/hardware-keyring-builder-factory.ts"}],[115,{"../../../shared/lib/messenger-tracing":8694,"../../../shared/lib/sentry":8734,"@metamask/messenger":2895},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ROOT_MESSENGER_NAMESPACE=void 0,n.getRootMessenger=function(){const e=new r.Messenger({namespace:a,captureException:s.captureException});return(0,i.wrapMessengerWithTracing)(e)};var r=e("@metamask/messenger"),s=e("../../../shared/lib/sentry"),i=e("../../../shared/lib/messenger-tracing");const a=n.ROOT_MESSENGER_NAMESPACE="Root"}}},{package:"$root$",file:"app/scripts/lib/messenger.ts"}],[117,{"../util":212},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createPendingNonceMiddleware=function({getPendingNonce:e}){return async({request:t,context:n,next:r})=>{const{method:s,params:i}=t;if("eth_getTransactionCount"!==s)return r();const[a,o]=i;return"pending"!==o?r():await e(a,n.get("networkClientId"))}},n.createPendingTxMiddleware=function({getPendingTransactionByHash:e}){return async({request:t,next:n})=>{const{method:s,params:i}=t;if("eth_getTransactionByHash"!==s)return n();const[a]=i,o=e(a);return o?(0,r.formatTxMetaForRpcResult)(o):n()}};var r=e("../util")}}},{package:"$root$",file:"app/scripts/lib/middleware/pending.ts"}],[118,{"../../../../shared/lib/stores/persistence-manager":8748,"@metamask/utils":4054,events:6609,loglevel:7215},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("events")),s=o(e("loglevel")),i=e("@metamask/utils"),a=e("../../../../shared/lib/stores/persistence-manager");function o(e){return e&&e.__esModule?e:{default:e}}class c extends r.default{constructor(e={}){super();const t=e.migrations||[];this.migrations=t.sort((e,t)=>e.version-t.version);const n=this.migrations.slice(-1)[0];this.defaultVersion=e.defaultVersion||n&&n.version||0}async migrateData(e=this.generateInitialState()){const t=(0,i.isObject)(e.data)&&e.meta.version<186?new Set(Object.keys(e.data)):new Set;let n=e;for(const e of this.migrations)if(a(e))try{let r;if(s.default.info(`Running migration ${e.version}...`),e.version<186)r=await e.migrate(n),o(r,e);else{r=structuredClone(n);const i=new Set,a=await e.migrate(r,i);if(o(r,e),void 0!==a)throw new Error("Migrator - migration returned value when none expected");if(0===i.size)s.default.debug(`Migrator - migration ${e.version} did not report any changes`);else for(const e of i)t.add(e)}n=r,s.default.info(`Migration ${e.version} complete`)}catch(t){const n=new AggregateError([t],`MetaMask Migration Error #${e.version}`);this.emit("error",n);break}const r=e.meta.version<186&&(0,i.isObject)(n.data)?new Set(Object.keys(n.data)):new Set;for(const e of t)r.add(e);return{state:n,changedKeys:r};function a(e){return e.version>n.meta.version}function o(e,t){if(!e.data)throw new Error("Migrator - migration returned empty data");if(e.version!==undefined&&e.meta.version!==t.version)throw new Error("Migrator - Migration did not update version number correctly")}}generateInitialState(e){return{data:e,meta:{storageKind:a.PersistenceManager.defaultStorageKind,version:this.defaultVersion}}}}n.default=c}}},{package:"$root$",file:"app/scripts/lib/migrator/index.js"}],[119,{"../../../../shared/constants/metametrics":8548,"../../../../shared/lib/only-keep-host":8709,"../../controllers/analytics":22,"../util":212,"./utils":120,"@metamask/utils":4054,loglevel:7215},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.onRpcEndpointDegraded=function({chainId:e,duration:t,endpointUrl:n,error:r,infuraProjectId:s,analyticsId:i,retryReason:o,rpcMethodName:c,traceId:u,type:l}){d(a.MetaMetricsEventName.RpcServiceDegraded,{chainId:e,duration:t,endpointUrl:n,error:r,infuraProjectId:s,analyticsId:i,retryReason:o,rpcMethodName:c,traceId:u,type:l})},n.onRpcEndpointUnavailable=function({chainId:e,endpointUrl:t,error:n,infuraProjectId:r,analyticsId:s}){d(a.MetaMetricsEventName.RpcServiceUnavailable,{chainId:e,endpointUrl:t,error:n,infuraProjectId:r,analyticsId:s})},n.trackRpcEndpointEvent=d;var r,s=(r=e("loglevel"))&&r.__esModule?r:{default:r},i=e("@metamask/utils"),a=e("../../../../shared/constants/metametrics"),o=e("../../../../shared/lib/only-keep-host"),c=e("../util"),u=e("../../controllers/analytics"),l=e("./utils");function d(e,{chainId:t,duration:n,endpointUrl:r,error:d,infuraProjectId:p,retryReason:h,rpcMethodName:f,traceId:m,type:g,analyticsId:y}){if(!(0,l.shouldCreateRpcServiceEvents)({error:d,analyticsId:y}))return;const b=(0,c.isPublicEndpointUrl)(r,p)?(0,o.onlyKeepHost)(r):"custom",w={chain_id_caip:`eip155:${(0,i.hexToNumber)(t)}`,rpc_domain:b,rpc_endpoint_url:b,...f?{rpc_method_name:f}:{},...g?{type:g}:{},...h?{retry_reason:h}:{},...n===undefined?{}:{duration_ms:n},...m===undefined?{}:{trace_id:m},...(0,i.isObject)(d)&&"httpStatus"in d&&(0,i.isValidJson)(d.httpStatus)?{http_status:d.httpStatus}:{}};s.default.debug(`Creating Segment event "${e}" with ${JSON.stringify(w)}`),(0,u.trackEvent)((0,u.createEventBuilder)(e).addCategory(a.MetaMetricsEventCategory.Network).addProperties(w).build())}}}},{package:"$root$",file:"app/scripts/lib/network-controller/messenger-action-handlers.ts"}],[120,{"../../../../shared/constants/build":8530,"@metamask/network-controller":3031,"@metamask/remote-feature-flag-controller":3479},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PRODUCTION_LIKE_ENVIRONMENTS=void 0,n.shouldCreateRpcServiceEvents=function({error:e,analyticsId:t}){return(!e||!(0,r.isConnectionError)(e))&&t!==undefined&&null!==t&&function(e){if("pull-request"===undefined)return!1;if(o.includes("pull-request"))return(0,s.generateDeterministicRandomNumber)(e)<a;return!0}(t)};var r=e("@metamask/network-controller"),s=e("@metamask/remote-feature-flag-controller"),i=e("../../../../shared/constants/build");const a=.01,o=n.PRODUCTION_LIKE_ENVIRONMENTS=[i.ENVIRONMENT.PRODUCTION,i.ENVIRONMENT.RELEASE_CANDIDATE]}}},{package:"$root$",file:"app/scripts/lib/network-controller/utils.ts"}],[121,{"../../../shared/constants/notifications":8553,"../platforms/extension":696,"@metamask/safe-event-emitter":3489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.NOTIFICATION_MANAGER_EVENTS=void 0;var r=a(e("@metamask/safe-event-emitter")),s=a(e("../platforms/extension")),i=e("../../../shared/constants/notifications");function a(e){return e&&e.__esModule?e:{default:e}}const o=n.NOTIFICATION_MANAGER_EVENTS={POPUP_CLOSED:"onPopupClosed"};class c extends r.default{constructor(){super(),this.platform=new s.default,this.platform.addOnRemovedListener(this._onWindowClosed.bind(this))}markAsAutomaticallyClosed(){this._popupAutomaticallyClosed=!0}async showPopup(e,t){this._popupId=t,this._setCurrentPopupId=e;const n=await this._getPopup(t);if(n)await this.platform.focusWindow(n.id);else{let e=0,t=0;try{const n=await this.platform.getLastFocusedWindow();t=n.top,e=Math.max(n.left+(n.width-i.NOTIFICATION_WIDTH),0)}catch(n){const{screenX:r,screenY:s,outerWidth:a}=window;t=Math.max(s,0),e=Math.max(r+(a-i.NOTIFICATION_WIDTH),0)}const n=await this.platform.openWindow({url:"notification.html",type:"popup",width:i.NOTIFICATION_WIDTH,height:i.NOTIFICATION_HEIGHT,left:e,top:t});n.left!==e&&"fullscreen"!==n.state&&await this.platform.updateWindowPosition(n.id,e,t),this._setCurrentPopupId(n.id),this._popupId=n.id}}_onWindowClosed(e){e===this._popupId&&(this._setCurrentPopupId(undefined),this._popupId=undefined,this.emit(o.POPUP_CLOSED,{automaticallyClosed:this._popupAutomaticallyClosed}),this._popupAutomaticallyClosed=undefined)}async _getPopup(){const e=await this.platform.getAllWindows();return this._getPopupIn(e)}_getPopupIn(e){return e?e.find(e=>e&&"popup"===e.type&&e.id===this._popupId):null}}n.default=c}}},{package:"$root$",file:"app/scripts/lib/notification-manager.js"}],[122,{"@metamask/keyring-api":2770,"@metamask/keyring-api/v2":2794,"@metamask/keyring-sdk/v2":2839,"@metamask/utils":4054},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.LatticeKeyringV2=void 0;var r=e("@metamask/keyring-api"),s=e("@metamask/keyring-api/v2"),i=e("@metamask/keyring-sdk/v2"),a=e("@metamask/utils");function o(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const l=[r.EthMethod.SignTransaction,r.EthMethod.PersonalSign,r.EthMethod.SignTypedDataV1,r.EthMethod.SignTypedDataV3,r.EthMethod.SignTypedDataV4],d={scopes:[r.EthScope.Eoa],custom:{createAccounts:!0}};var p=new WeakSet;class h extends i.EthKeyringWrapper{constructor(e){super({type:s.KeyringType.Lattice,inner:e.legacyKeyring,capabilities:d}),o(this,p),c(this,"entropySource",void 0),this.entropySource=e.entropySource,this.inner.appName="MetaMask"}async getAccounts(){return(await this.inner.getAccounts()).map(e=>{const t=(0,a.add0x)(e),n=this.registry.getAccountId(t);if(n){const e=this.registry.get(n);if(e)return e}return u(p,this,f).call(this,t)})}async createAccounts(e){return this.withLock(async()=>{if("custom"!==e.type)throw new Error(`Unsupported account creation type for LatticeKeyring: ${String(e.type)}. Supported type: 'custom'.`);const{entropySource:t,addressIndex:n}=e;if(t!==this.entropySource)throw new Error(`Entropy source mismatch: expected '${this.entropySource}', got '${String(t)}'`);if("number"!=typeof n||!Number.isInteger(n)||n<0)throw new Error(`Invalid addressIndex: ${String(n)}. Must be a non-negative integer.`);this.inner.setAccountToUnlock(n);const[r]=await this.inner.addAccounts(1);if(!r)throw new Error("Failed to create new account");return[u(p,this,f).call(this,(0,a.add0x)(r))]})}async deleteAccount(e){await this.withLock(async()=>{const{address:t}=await this.getAccount(e);this.inner.removeAccount((0,a.add0x)(t)),this.registry.delete(e)})}get hdPath(){return this.inner.hdPath}get appName(){return this.inner.appName}set appName(e){this.inner.appName=e}get network(){return this.inner.network}set network(e){this.inner.network=e}setHdPath(e){this.inner.setHdPath(e)}setAccountToUnlock(e){this.inner.setAccountToUnlock(e)}async addAccounts(e=1){return this.inner.addAccounts(e)}async getFirstPage(){return this.inner.getFirstPage()}async getNextPage(){return this.inner.getNextPage()}async getPreviousPage(){return this.inner.getPreviousPage()}isUnlocked(){return this.inner.isUnlocked()}async forgetDevice(){await this.withLock(async()=>{this.inner.forgetDevice(),this.registry.clear()})}}function f(e){const t={id:this.registry.register(e),type:r.EthAccountType.Eoa,address:e,scopes:[...this.capabilities.scopes],methods:[...l],options:{entropy:{type:r.KeyringAccountEntropyTypeOption.Custom}}};return this.registry.set(t),t}n.LatticeKeyringV2=h}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/lattice-keyring-v2.ts"}],[123,{"../../../../shared/constants/offscreen-communication":8554,"eth-lattice-keyring":6517},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.LatticeKeyringOffscreen=void 0;var r,s=(r=e("eth-lattice-keyring"))&&r.__esModule?r:{default:r},i=e("../../../../shared/constants/offscreen-communication");class a extends s.default{constructor(e={}){super(e)}async _getCreds(){try{if(this._hasCreds())return undefined;const e=this.appName?this.appName:"Unknown",t=`${i.KnownOrigins.lattice}?keyring=${e}&forceLogin=true`,n=await new Promise((e,n)=>{chrome.runtime.sendMessage({target:i.OffscreenCommunicationTarget.latticeOffscreen,params:{url:t}},t=>{chrome.runtime.lastError?n(chrome.runtime.lastError):t?.error?n(t.error):e(t?.result)})});if(!n?.deviceID||!n?.password)throw new Error("Invalid credentials returned from Lattice.");return n}catch(e){throw new Error(e)}}}n.LatticeKeyringOffscreen=a,function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(a,"type",void 0),a.type=s.default.type}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/lattice-offscreen-keyring.ts"}],[124,{"../../../../shared/constants/offscreen-communication":8554,"@ledgerhq/errors":1203,"@metamask/eth-ledger-bridge-keyring":2355,"@metamask/hw-wallet-sdk":2673},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerOffscreenBridge=void 0;var r=e("@metamask/eth-ledger-bridge-keyring"),s=e("@ledgerhq/errors"),i=e("@metamask/hw-wallet-sdk"),a=e("../../../../shared/constants/offscreen-communication");function o(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function c(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const u=4e3;var l=new WeakSet;async function d(e,{timeout:t}={}){return new Promise((n,o)=>{let c;t&&(c=setTimeout(()=>{o(new Error("Ledger iframe timeout"))},t)),chrome.runtime.sendMessage({...e,target:a.OffscreenCommunicationTarget.ledgerOffscreen},e=>{if(clearTimeout(c),chrome.runtime.lastError){const e=chrome.runtime.lastError.message;return void o(new Error(e))}if(e?.success)n(e.payload||e.success);else{const t=e?.payload?.error;if("HardwareWalletError"===t?.name&&"number"==typeof t?.code)o(new i.HardwareWalletError(t.message,{code:t.code,severity:t.severity,category:t.category,userMessage:t.userMessage}));else if(t&&"number"==typeof t.statusCode&&t.statusCode>0){const e=`0x${t.statusCode.toString(16)}`;(0,r.isKnownLedgerError)(e)?o((0,r.createLedgerError)(e)):o(new s.TransportStatusError(t.statusCode))}else o(t?.message?new Error(t.message,{cause:t}):new Error("Unknown Ledger error occurred"))}})})}n.LedgerOffscreenBridge=class{constructor(){o(this,l)}init(){return Promise.resolve()}destroy(){return Promise.resolve()}getOptions(){return Promise.resolve({})}setOptions(){return Promise.resolve()}attemptMakeApp(){return c(l,this,d).call(this,{action:a.LedgerAction.makeApp},{timeout:u})}updateTransportMethod(e){return c(l,this,d).call(this,{action:a.LedgerAction.updateTransport,params:{transportType:e}},{timeout:u})}getAppNameAndVersion(){return c(l,this,d).call(this,{action:a.LedgerAction.getAppNameAndVersion},{timeout:u})}getAppConfiguration(){return c(l,this,d).call(this,{action:a.LedgerAction.getAppConfiguration},{timeout:u})}getPublicKey(e){return c(l,this,d).call(this,{action:a.LedgerAction.getPublicKey,params:e})}deviceSignTransaction(e){return c(l,this,d).call(this,{action:a.LedgerAction.signTransaction,params:e})}deviceSignMessage(e){return c(l,this,d).call(this,{action:a.LedgerAction.signPersonalMessage,params:e})}deviceSignTypedData(e){return c(l,this,d).call(this,{action:a.LedgerAction.signTypedData,params:e})}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts"}],[125,{"../../../../shared/constants/hardware-wallets":8541,"@trezor/connect-web":5527,"@trezor/connect-web/lib/impl/core-in-suite-desktop":5526},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.TrezorMv2Bridge=void 0;var r=e("@trezor/connect-web/lib/impl/core-in-suite-desktop"),s=e("@trezor/connect-web"),i=e("../../../../shared/constants/hardware-wallets");function a(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t,n){return e.set(l(e,t),n),n}function u(e,t){return e.get(l(e,t))}function l(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function d(e){return e.success||e.payload.code!==i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE?e:{success:!1,payload:{error:i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE,code:i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE}}}var p=new WeakMap,h=new WeakMap;n.TrezorMv2Bridge=class{constructor(){o(this,"model",void 0),a(this,p,!1),a(this,h,!1)}async init(e){if(u(h,this)||(r.TrezorConnect.on(s.DEVICE_EVENT,e=>{e?.type===s.DEVICE.CONNECT&&(this.model=e?.payload?.features?.model)}),c(h,this,!0)),!u(p,this))try{await r.TrezorConnect.init(e),c(p,this,!0)}catch(e){if("object"==typeof e&&null!==e&&e.code===i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE)throw Object.assign(new Error(i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE),{code:i.TREZOR_DESKTOP_CONNECTION_MISSING_CODE});if(e instanceof Error)throw e;throw new Error(String(e))}}async dispose(){return c(p,this,!1),r.TrezorConnect.dispose()}getPublicKey(e){return r.TrezorConnect.getPublicKey(e).then(e=>d(e))}ethereumSignTransaction(e){return r.TrezorConnect.ethereumSignTransaction(e).then(e=>d(e))}ethereumSignMessage(e){return r.TrezorConnect.ethereumSignMessage(e).then(e=>d(e))}ethereumSignTypedData(e){return r.TrezorConnect.ethereumSignTypedData(e).then(e=>d(e))}getFeatures(){return r.TrezorConnect.getFeatures().then(e=>d(e))}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/trezor-mv2-bridge.ts"}],[126,{"../../../../shared/constants/offscreen-communication":8554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.TrezorOffscreenBridge=void 0;var r=e("../../../../shared/constants/offscreen-communication");function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.TrezorOffscreenBridge=class{constructor(){s(this,"model",void 0),s(this,"minorVersion",void 0)}init(e){return chrome.runtime.onMessage.addListener(e=>{e.target===r.OffscreenCommunicationTarget.extension&&e.event===r.OffscreenCommunicationEvents.trezorDeviceConnect&&(this.model=e.payload.model,this.minorVersion=e.payload.minorVersion)}),new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.init,params:e},()=>{t()})})}dispose(){return new Promise(e=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.dispose},()=>{e()})})}getPublicKey(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.getPublicKey,params:e},e=>{t(e)})})}ethereumSignTransaction(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.signTransaction,params:e},e=>{t(e)})})}ethereumSignMessage(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.signMessage,params:e},e=>{t(e)})})}ethereumSignTypedData(e){return new Promise(t=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.signTypedData,params:e},e=>{t(e)})})}getFeatures(){return new Promise(e=>{chrome.runtime.sendMessage({target:r.OffscreenCommunicationTarget.trezorOffscreen,action:r.TrezorAction.getFeatures},t=>{e(t)})})}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/trezor-offscreen-bridge.ts"}],[127,{"webextension-polyfill":8513},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.openUpdateTabAndReload=async function(e){try{await s.default.tabs.create({url:"https://metamask.io/updating",active:!0})}catch(e){console.error(e)}await e()};var r,s=(r=e("webextension-polyfill"))&&r.__esModule?r:{default:r}}}},{package:"$root$",file:"app/scripts/lib/open-update-tab-and-reload.ts"}],[128,{"../../../shared/lib/promise-with-resolvers":8718,lodash:7205,loglevel:7215},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OperationSafener=void 0;var r,s=e("lodash"),i=(r=e("loglevel"))&&r.__esModule?r:{default:r},a=e("../../../shared/lib/promise-with-resolvers");function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function u(e,t){return e.get(d(e,t))}function l(e,t,n){return e.set(d(e,t),n),n}function d(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var p=new WeakMap,h=new WeakMap;n.OperationSafener=class{constructor({op:e,wait:t,options:n}){c(this,p,void 0),c(this,h,null),o(this,"evacuate",()=>{if(u(h,this))return i.default.warn("already evacuating"),u(h,this);const e=u(p,this).flush();if(e){const{promise:t,resolve:n}=(0,a.withResolvers)();e.finally(n),l(h,this,t)}else l(h,this,Promise.resolve());return u(h,this)}),o(this,"execute",(...e)=>u(h,this)?(i.default.warn("evacuating, ignoring call to `execute`"),!1):(u(p,this).call(this,...e),!0));const r={mode:"exclusive"};l(p,this,(0,s.debounce)((...t)=>navigator.locks.request("operation-safener-lock",r,()=>e(...t)),t,n))}}}}},{package:"$root$",file:"app/scripts/lib/operation-safener.ts"}],[129,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(n,"__esModule",{value:!0}),n.IndexedDBPPOMStorage=void 0;const i=async(e,t,n)=>{const r=await crypto.subtle.digest("SHA-256",t);if(Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("")!==n)throw new Error(`Checksum mismatch for key ${e}`)};var a=new WeakSet;function o(e){return new Promise((t,n)=>{const r=indexedDB.open(this.storeName,this.dbVersion);r.onerror=e=>{n(new Error(`Failed to open database ${this.storeName}: ${e.target?.error}`))},r.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName,{keyPath:["name","chainId"]})},r.onsuccess=n=>{const r=n.target.result.transaction([this.storeName],e).objectStore(this.storeName);t(r)}})}n.IndexedDBPPOMStorage=class{constructor(e,t){r(this,a),s(this,"storeName",void 0),s(this,"dbVersion",void 0),this.storeName=e,this.dbVersion=t}async objectStoreAction(e,t,n="readonly"){return new Promise((r,s)=>{(function(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")})(a,this,o).call(this,n).then(n=>{const i=n[e](t);i.onsuccess=async e=>{r(e)},i.onerror=t=>{s(new Error(`Error in indexDB operation ${e}: ${t.target?.error}`))}}).catch(e=>{s(e)})})}async read(e,t){const n=await this.objectStoreAction("get",[e.name,e.chainId]),r=n.target?.result?.data;return await i(e,r,t),r}async write(e,t,n){await i(e,t,n),await this.objectStoreAction("put",{...e,data:t},"readwrite")}async delete(e){await this.objectStoreAction("delete",[e.name,e.chainId],"readwrite")}async dir(){const e=await this.objectStoreAction("getAllKeys");return e.target?.result.map(([e,t])=>({name:e,chainId:t}))}}}}},{package:"$root$",file:"app/scripts/lib/ppom/indexed-db-backend.ts"}],[130,{"../../../../shared/constants/app":8526,"../../../../shared/constants/security-provider":8564,"../../../../shared/constants/transaction":8575,"../../../../shared/lib/trace":8757,"./ppom-util":131,"@metamask/controller-utils":1625},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createPPOMMiddleware=function(e,t,n,l,d,p,h){return async(f,m,g)=>{try{const{securityAlertsEnabled:m}=t.state,{chainId:g}=n.getNetworkConfigurationByNetworkClientId(f.networkClientId)??{};if(!g)throw Error("ChainID not found for networkClientId");if(!m||!u.includes(f.method))return;const y=f.params[0];if("string"==typeof y){const{isSIWEMessage:e}=(0,r.detectSIWE)({data:y});if(e)return}else if(f.method===s.MESSAGE_TYPE.ETH_SEND_TRANSACTION){const{to:e}=y??{},t=d.listAccounts();if(t.some(({address:t})=>t?.toLowerCase()===e?.toLowerCase()))return}const b=(0,c.generateSecurityAlertId)();(0,a.trace)({name:a.TraceName.PPOMValidation,parentContext:f.traceContext},()=>(0,c.validateRequestWithPPOM)({ppomController:e,request:f,securityAlertId:b,chainId:g,updateSecurityAlertResponse:p,getSecurityAlertsConfig:h}));const w={...o.LOADING_SECURITY_ALERT_RESPONSE,securityAlertId:b};i.SIGNING_METHODS.includes(f.method)&&l.addSignatureSecurityAlertResponse(w),f.securityAlertResponse=w}catch(e){f.securityAlertResponse=(0,c.handlePPOMError)(e,"Error createPPOMMiddleware: ")}finally{g()}}};var r=e("@metamask/controller-utils"),s=e("../../../../shared/constants/app"),i=e("../../../../shared/constants/transaction"),a=e("../../../../shared/lib/trace"),o=e("../../../../shared/constants/security-provider"),c=e("./ppom-util");const u=Object.freeze(["eth_sendRawTransaction","eth_sendTransaction",...i.SIGNING_METHODS])}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-middleware.ts"}],[1305,{"@metamask/base-controller":1492,"@metamask/controller-utils":1625},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=n.controllerName=n.AddressType=void 0;const r=e("@metamask/base-controller"),s=e("@metamask/controller-utils");var i;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(i||(n.AddressType=i={})),n.controllerName="AddressBookController";const a=["list","set","delete","clear"],o={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};n.getDefaultAddressBookControllerState=()=>({addressBook:{}});class c extends r.BaseController{constructor({messenger:e,state:t}){const r={...(0,n.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:o,name:n.controllerName,state:r}),this.messenger.registerMethodActionHandlers(this,a)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,n)=>{const r=n;return[...t,...Object.values(e[r])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,s.toChecksumHexAddress)(t),![e,t].every(e=>(0,s.isSafeDynamicKey)(e))||!(0,s.isValidHexAddress)(t)||!this.state.addressBook[e]?.[t])return!1;const n={...this.state.addressBook[e][t]};return this.update(n=>{const r=n.addressBook[e];r?.[t]&&(delete r[t],0===Object.keys(r).length&&delete n.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",n),!0}set(e,t,n=(0,s.toHex)(1),r="",i){if(e=(0,s.toChecksumHexAddress)(e),!(0,s.isValidHexAddress)(e))return!1;const a={address:e,chainId:n,isEns:!1,memo:r,name:t,addressType:i,lastUpdatedAt:Date.now()},o=(0,s.normalizeEnsName)(t);return o&&(a.name=o,a.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[n]:{...this.state.addressBook[n],[e]:a}}}),"*"!==String(n)&&this.messenger.publish("AddressBookController:contactUpdated",a),!0}}n.AddressBookController=c,n.default=c}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],[1306,{"./AddressBookController.cjs":1305},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=void 0;var r=e("./AddressBookController.cjs");Object.defineProperty(n,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return r.getDefaultAddressBookControllerState}}),Object.defineProperty(n,"AddressBookController",{enumerable:!0,get:function(){return r.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],[1307,{"./AnalyticsLogger.cjs":1308,"./analyticsControllerStateValidator.cjs":1310,"./selectors.cjs":1312,"@metamask/base-controller":1492,lodash:7205,uuid:8155},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u,l,d,p,h,f,m,g=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},y=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnalyticsController=n.getDefaultAnalyticsControllerState=n.controllerName=void 0;const b=e("@metamask/base-controller"),w=e("lodash"),v=e("uuid"),_=e("./analyticsControllerStateValidator.cjs"),T=e("./AnalyticsLogger.cjs"),S=e("./selectors.cjs");function I(){return{optedIn:!1}}n.controllerName="AnalyticsController",n.getDefaultAnalyticsControllerState=I;const E={optedIn:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},analyticsId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!1},eventQueue:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}},k=["trackEvent","identify","trackView","optIn","optOut"];function A(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function C(e){return!!A(e)&&("string"==typeof e.messageId&&"string"==typeof e.timestamp&&("track"===e.type?"string"==typeof e.eventName&&(e.properties===undefined||A(e.properties))&&(e.context===undefined||A(e.context)):"identify"===e.type?"string"==typeof e.userId&&(e.traits===undefined||A(e.traits))&&(e.context===undefined||A(e.context)):"view"===e.type&&("string"==typeof e.name&&(e.properties===undefined||A(e.properties))&&(e.context===undefined||A(e.context)))))}class O extends b.BaseController{constructor({state:e,messenger:t,platformAdapter:c,isAnonymousEventsFeatureEnabled:u=!1,isEventQueuePersistenceEnabled:l=!1}){const d={optedIn:!1,...e};(0,_.validateAnalyticsControllerState)(d,!0===c.skipUUIDv4Check),super({name:n.controllerName,metadata:E,state:d,messenger:t}),r.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),g(this,i,u,"f"),g(this,a,l,"f"),g(this,s,c,"f"),g(this,o,!1,"f"),this.messenger.registerMethodActionHandlers(this,k),(0,T.projectLogger)("AnalyticsController initialized and ready",{enabled:S.analyticsControllerSelectors.selectEnabled(this.state),optedIn:this.state.optedIn,analyticsId:this.state.analyticsId,eventQueuePersistenceEnabled:y(this,a,"f")})}init(){if(y(this,o,"f"))(0,T.projectLogger)("AnalyticsController already initialized.");else{g(this,o,!0,"f");try{y(this,s,"f").onSetupCompleted(this.state.analyticsId)}catch(e){(0,T.projectLogger)("Error calling platformAdapter.onSetupCompleted",e)}y(this,r,"m",h).call(this)}}trackEvent(e,t){if(!S.analyticsControllerSelectors.selectEnabled(this.state))return;if(!e.hasProperties)return void y(this,r,"m",c).call(this,e.name,undefined,t);y(this,i,"f")&&y(this,r,"m",c).call(this,e.name,{...e.properties},t);const n=Object.keys(e.sensitiveProperties).length>0;y(this,i,"f")&&!n||y(this,r,"m",c).call(this,e.name,{...e.properties,...e.sensitiveProperties,...n&&{anonymous:!0}},t)}identify(e,t){S.analyticsControllerSelectors.selectEnabled(this.state)&&y(this,r,"m",u).call(this,this.state.analyticsId,e,t)}trackView(e,t,n){S.analyticsControllerSelectors.selectEnabled(this.state)&&y(this,r,"m",l).call(this,e,t,n)}optIn(){this.update(e=>{e.optedIn=!0})}optOut(){this.update(e=>{e.optedIn=!1}),y(this,r,"m",m).call(this)}}n.AnalyticsController=O,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,r=new WeakSet,c=function(e,t,n){if(!y(this,a,"f"))return void y(this,s,"f").track(e,t,n);const i={type:"track",eventName:e,messageId:(0,v.v4)(),timestamp:(new Date).toISOString(),...t===undefined?{}:{properties:t},...n===undefined?{}:{context:n}};y(this,r,"m",d).call(this,i)},u=function(e,t,n){if(!y(this,a,"f"))return void y(this,s,"f").identify(e,t,n);const i={type:"identify",userId:e,messageId:(0,v.v4)(),timestamp:(new Date).toISOString(),...t===undefined?{}:{traits:t},...n===undefined?{}:{context:n}};y(this,r,"m",d).call(this,i)},l=function(e,t,n){if(!y(this,a,"f"))return void y(this,s,"f").view(e,t,n);const i={type:"view",name:e,messageId:(0,v.v4)(),timestamp:(new Date).toISOString(),...t===undefined?{}:{properties:t},...n===undefined?{}:{context:n}};y(this,r,"m",d).call(this,i)},d=function(e){const t={...this.state.eventQueue??{},[e.messageId]:e};this.update(e=>{e.eventQueue=t}),y(this,r,"m",p).call(this,e)},p=function(e){const t=new Date(e.timestamp);if(Number.isNaN(t.getTime()))return(0,T.projectLogger)("Dropping queued analytics event with invalid timestamp",{messageId:e.messageId}),void y(this,r,"m",f).call(this,e.messageId);const n={messageId:e.messageId,timestamp:t,callback:t=>{t&&(0,T.projectLogger)("Queued analytics event delivery failed",{messageId:e.messageId,error:t}),y(this,r,"m",f).call(this,e.messageId)}};try{"track"===e.type?y(this,s,"f").track(e.eventName,(0,w.cloneDeep)(e.properties),(0,w.cloneDeep)(e.context),n):"identify"===e.type?y(this,s,"f").identify(e.userId,(0,w.cloneDeep)(e.traits),(0,w.cloneDeep)(e.context),n):y(this,s,"f").view(e.name,(0,w.cloneDeep)(e.properties),(0,w.cloneDeep)(e.context),n)}catch(t){(0,T.projectLogger)("Error sending queued analytics event",{messageId:e.messageId,error:t})}},h=function(){if(y(this,a,"f")&&this.state.eventQueue)if(S.analyticsControllerSelectors.selectEnabled(this.state))for(const[e,t]of Object.entries(this.state.eventQueue))C(t)&&t.messageId===e?y(this,r,"m",p).call(this,t):((0,T.projectLogger)("Dropping invalid queued analytics event",{messageId:e}),y(this,r,"m",f).call(this,e));else y(this,r,"m",m).call(this)},f=function(e){const t=this.state.eventQueue;if(!t||!Object.prototype.hasOwnProperty.call(t,e))return;const{[e]:n,...r}=t;this.update(e=>{e.eventQueue=r})},m=function(){this.state.eventQueue&&0!==Object.keys(this.state.eventQueue).length&&this.update(e=>{e.eventQueue={}})}}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/AnalyticsController.cjs"}],[1308,{"@metamask/utils":4054},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const r=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return r.createModuleLogger}}),n.projectLogger=(0,r.createProjectLogger)("analytics-controller")}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/AnalyticsLogger.cjs"}],[1309,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnalyticsPlatformAdapterSetupError=void 0;class r extends Error{constructor(e,t){super(e),this.name=this.constructor.name,t&&(this.cause=t)}}n.AnalyticsPlatformAdapterSetupError=r}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/AnalyticsPlatformAdapterSetupError.cjs"}],[131,{"../../../../shared/constants/app":8526,"../../../../shared/constants/security-provider":8564,"../../../../shared/constants/transaction":8575,"../../../../shared/lib/snaps/snaps":8742,"../../../../shared/lib/transaction.utils":8759,"../../../../shared/lib/typed-signature":8767,"./security-alerts-api":133,"@metamask/snaps-utils":3846,"@metamask/transaction-controller":3939,"@metamask/utils":4054,lodash:7205,uuid:8155},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.generateSecurityAlertId=function(){return(0,i.v4)()},n.handlePPOMError=b,n.normalizeSignatureRequest=w,n.updateSecurityAlertResponse=async function({appStateController:e,messenger:t,method:n,securityAlertId:r,securityAlertResponse:s,signatureController:i,transactionController:a}){if(l.SIGNING_METHODS.includes(n)){const n=await async function(e,t,n){const r=e=>Object.values(e.signatureRequests).find(e=>e.securityAlertResponse?.securityAlertId===t);return new Promise(s=>{const i=r(e.state);if(i)return void s(i);const a=e=>{const t=r(e);t&&(m("Found signature request",t),n.unsubscribe("SignatureController:stateChange",a),s(t))};m("Waiting for signature request",t),n.subscribe("SignatureController:stateChange",a)})}(i,r,t);return e.addSignatureSecurityAlertResponse({...s,securityAlertId:r}),n}const o=await async function(e,t,n){const r=e=>e.securityAlertResponse?.securityAlertId===t;return new Promise(s=>{const i=e.state.transactions.find(r);if(i)return void s(i);const a=e=>{r(e)&&(m("Found transaction metadata",e),n.unsubscribe("TransactionController:unapprovedTransactionAdded",a),s(e))};m("Waiting for transaction metadata",t),n.subscribe("TransactionController:unapprovedTransactionAdded",a)})}(a,r,t);return a.updateSecurityAlertResponse(o.id,{...s,securityAlertId:r}),o},n.validateRequestWithPPOM=async function({ppomController:e,request:t,securityAlertId:n,chainId:s,updateSecurityAlertResponse:i,getSecurityAlertsConfig:o}){try{const u=function(e,t){let n=(0,a.cloneDeep)(e);n=w(n,t),n=function(e,t){if(e.method!==h.MESSAGE_TYPE.ETH_SEND_TRANSACTION)return e;if(!Array.isArray(e.params)||!e.params[0])return e;const n=e.params[0];n.gas=t.txParams.gas,n.gasPrice=t.txParams.maxFeePerGas??t.txParams.gasPrice,delete n.gasLimit,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.type;const s=(0,r.normalizeTransactionParams)(n);return m("Normalized transaction params",s),{...e,params:[s]}}(n,t);const{delegationMock:s,id:i,jsonrpc:o,method:c,origin:u,params:l}=n;return{delegationMock:s,id:i,jsonrpc:o,method:c,origin:u,params:l}}(t,await i(t.method,n,c.LOADING_SECURITY_ALERT_RESPONSE));m("Normalized request",u);const l=(0,f.isSecurityAlertsAPIEnabled)()?await async function(e,t,n,r){try{return{...await(0,f.validateWithSecurityAlertsAPI)(t,n,r),source:c.SecurityAlertSource.API}}catch(r){return b(r,"Error validating request with security alerts API"),await v(e,n,t)}}(e,s,u,o):await v(e,u,s);await i(t.method,n,l)}catch(e){m("Error",e),await i(t.method,n,b(e,"Error validating JSON RPC using PPOM: "))}};var r=e("@metamask/transaction-controller"),s=e("@metamask/utils"),i=e("uuid"),a=e("lodash"),o=e("@metamask/snaps-utils"),c=e("../../../../shared/constants/security-provider"),u=e("../../../../shared/lib/snaps/snaps"),l=e("../../../../shared/constants/transaction"),d=e("../../../../shared/lib/typed-signature"),p=e("../../../../shared/lib/transaction.utils"),h=e("../../../../shared/constants/app"),f=e("./security-alerts-api");const m=(0,s.createProjectLogger)("ppom-util"),{sentry:g}=global,y={result_type:c.BlockaidResultType.Errored,reason:c.BlockaidReason.errored};function b(e,t,n=c.SecurityAlertSource.API){const r=function(e){if("object"==typeof e||"string"==typeof e)return e;return JSON.stringify(e)}(e),s=function(e){if(e instanceof Error)return`${e.name}: ${e.message}`;return JSON.stringify(e)}(e);return n===c.SecurityAlertSource.Local&&g?.captureException(e),console.error(t,r),{...y,description:s,source:n}}function w(e,t){if(e.method!==h.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3&&e.method!==h.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4)return e;if(!Array.isArray(e.params)||!e.params[1])return e;const n=(0,p.parseTypedDataMessage)(e.params[1]),r=(0,d.sanitizeMessageRecursively)(n.message,n.types,n.primaryType);let s=e.origin;if(t&&"decodedPermission"in t&&t.decodedPermission?.origin){const n=(0,o.isSnapId)(e.origin),r=n&&(0,u.isSnapPreinstalled)(e.origin);n&&r&&(s=t.decodedPermission.origin)}return{...e,origin:s,params:[e.params[0],JSON.stringify({...n,message:r})]}}async function v(e,t,n){try{return{...await e.usePPOM(e=>e.validateJsonRpc(t),n),source:c.SecurityAlertSource.Local}}catch(e){return b(e,"Error validating request with PPOM controller",c.SecurityAlertSource.Local)}}}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-util.ts"}],[1310,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateAnalyticsControllerState=n.isValidUUIDv4=void 0;const r=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;function s(e){return"string"==typeof e&&r.test(e)}n.isValidUUIDv4=s,n.validateAnalyticsControllerState=function(e,t){if(!e.analyticsId||!0!==t&&!s(e.analyticsId))throw new Error("Invalid analyticsId")}}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/analyticsControllerStateValidator.cjs"}],[1311,{"./AnalyticsController.cjs":1307,"./AnalyticsPlatformAdapterSetupError.cjs":1309,"./selectors.cjs":1312},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.analyticsControllerSelectors=n.AnalyticsPlatformAdapterSetupError=n.getDefaultAnalyticsControllerState=n.AnalyticsController=void 0;var r=e("./AnalyticsController.cjs");Object.defineProperty(n,"AnalyticsController",{enumerable:!0,get:function(){return r.AnalyticsController}}),Object.defineProperty(n,"getDefaultAnalyticsControllerState",{enumerable:!0,get:function(){return r.getDefaultAnalyticsControllerState}});var s=e("./AnalyticsPlatformAdapterSetupError.cjs");Object.defineProperty(n,"AnalyticsPlatformAdapterSetupError",{enumerable:!0,get:function(){return s.AnalyticsPlatformAdapterSetupError}});var i=e("./selectors.cjs");Object.defineProperty(n,"analyticsControllerSelectors",{enumerable:!0,get:function(){return i.analyticsControllerSelectors}})}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/index.cjs"}],[1312,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.analyticsControllerSelectors=void 0;n.analyticsControllerSelectors={selectAnalyticsId:e=>e.analyticsId,selectOptedIn:e=>e.optedIn,selectEnabled:e=>e.optedIn}}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/selectors.cjs"}],[1313,{"@metamask/base-controller":1492},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;const a=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class u extends a.BaseController{constructor({messenger:e,state:t,allAnnouncements:n}){const a={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:a}),r.add(this),i(this,r,"m",s).call(this,n)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const n of Object.keys(e).map(Number))t[n].isShown=e[n]})}}n.AnnouncementController=u,r=new WeakSet,s=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"}],[1314,{"./AnnouncementController.cjs":1313},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;var r=e("./AnnouncementController.cjs");Object.defineProperty(n,"AnnouncementController",{enumerable:!0,get:function(){return r.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],[132,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){let r;Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.PPOM=void 0,n.initSync=function(e){if(r!==undefined)return r;const t=k();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const n=new WebAssembly.Instance(e,t);return A(n,e)},n.main=function(){r.main()};const s="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&s.decode();let i=null;function a(){return null!==i&&0!==i.byteLength||(i=new Uint8Array(r.memory.buffer)),i}function o(e,t){return e>>>=0,s.decode(a().subarray(e,e+t))}const c=new Array(128).fill(undefined);c.push(undefined,null,!0,!1);let u=c.length;function l(e){u===c.length&&c.push(c.length+1);const t=u;return u=c[t],c[t]=e,t}function d(e){return c[e]}function p(e){const t=d(e);return function(e){e<132||(c[e]=u,u=e)}(e),t}let h=0;const f="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},m="function"==typeof f.encodeInto?function(e,t){return f.encodeInto(e,t)}:function(e,t){const n=f.encode(e);return t.set(n),{read:e.length,written:n.length}};function g(e,t,n){if(n===undefined){const n=f.encode(e),r=t(n.length,1)>>>0;return a().subarray(r,r+n.length).set(n),h=n.length,r}let r=e.length,s=t(r,1)>>>0;const i=a();let o=0;for(;o<r;o++){const t=e.charCodeAt(o);if(t>127)break;i[s+o]=t}if(o!==r){0!==o&&(e=e.slice(o)),s=n(s,r,r=o+3*e.length,1)>>>0;const t=a().subarray(s+o,s+r);o+=m(e,t).written}return h=o,s}let y=null;function b(){return null!==y&&0!==y.byteLength||(y=new Int32Array(r.memory.buffer)),y}function w(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let n="[";t>0&&(n+=w(e[0]));for(let r=1;r<t;r++)n+=", "+w(e[r]);return n+="]",n}const n=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(!(n.length>1))return toString.call(e);if(r=n[1],"Object"==r)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function v(e,t,n){r.wasm_bindgen__convert__closures__invoke1_mut(e,t,l(n))}function _(e,t){r._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__destroy(e,t)}let T=null;function S(e,t){const n=t(4*e.length,4)>>>0,s=(null!==T&&0!==T.byteLength||(T=new Uint32Array(r.memory.buffer)),T);for(let t=0;t<e.length;t++)s[n/4+t]=l(e[t]);return h=e.length,n}function I(e,t){try{return e.apply(this,t)}catch(e){r.__wbindgen_exn_store(l(e))}}class E{static __wrap(e){e>>>=0;const t=Object.create(E.prototype);return t.__wbg_ptr=e,t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();r.__wbg_ppom_free(e)}static new(e,t){const n=S(t,r.__wbindgen_malloc),s=h;return p(r.ppom_new(l(e),n,s))}validateJsonRpc(e){return p(r.ppom_validateJsonRpc(this.__wbg_ptr,l(e)))}static version(){return p(r.ppom_version())}}function k(){const e={wbg:{}};return e.wbg.__wbg_buffer_085ec1f694018c4f=function(e){return l(d(e).buffer)},e.wbg.__wbg_call_01734de55d61e11d=function(){return I(function(e,t,n){return l(d(e).call(d(t),d(n)))},arguments)},e.wbg.__wbg_call_4c92f6aec1e1d6e6=function(){return I(function(e,t,n,r){return l(d(e).call(d(t),d(n),d(r)))},arguments)},e.wbg.__wbg_from_d7c216d4616bb368=function(e){return l(Array.from(d(e)))},e.wbg.__wbg_get_44be0491f933a435=function(e,t){return l(d(e)[t>>>0])},e.wbg.__wbg_length_72e2208bbc0efc61=function(e){return d(e).length},e.wbg.__wbg_length_d813e535247d427e=function(e){return d(e).length},e.wbg.__wbg_length_fff51ee6522a1a18=function(e){return d(e).length},e.wbg.__wbg_new_43f1b47c28813cbd=function(e,t){try{var n={a:e,b:t};const s=new Promise((e,t)=>{const s=n.a;n.a=0;try{return function(e,t,n,s){r.wasm_bindgen__convert__closures__invoke2_mut(e,t,l(n),l(s))}(s,n.b,e,t)}finally{n.a=s}});return l(s)}finally{n.a=n.b=0}},e.wbg.__wbg_new_8125e318e6245eed=function(e){return l(new Uint8Array(d(e)))},e.wbg.__wbg_parse_670c19d4e984792e=function(){return I(function(e,t){return l(JSON.parse(o(e,t)))},arguments)},e.wbg.__wbg_ppom_new=function(e){return l(E.__wrap(e))},e.wbg.__wbg_resolve_53698b95aaf7fcf8=function(e){return l(Promise.resolve(d(e)))},e.wbg.__wbg_set_5cf90238115182c3=function(e,t,n){d(e).set(d(t),n>>>0)},e.wbg.__wbg_stringify_e25465938f3f611f=function(){return I(function(e){return l(JSON.stringify(d(e)))},arguments)},e.wbg.__wbg_then_b2267541e2a73865=function(e,t,n){return l(d(e).then(d(t),d(n)))},e.wbg.__wbg_then_f7e06ee3c11698eb=function(e,t){return l(d(e).then(d(t)))},e.wbg.__wbindgen_cb_drop=function(e){const t=p(e).original;if(1==t.cnt--)return t.a=0,!0;return!1},e.wbg.__wbindgen_closure_wrapper_wasm_bindgen__closure__Closure_T___wrap__breaks_if_inlined=function(e,t,n){const r=function(e,t,n,r){const s={a:e,b:t,cnt:1},i=(...e)=>{s.cnt++;const t=s.a;s.a=0;try{return r(t,s.b,...e)}finally{0===--s.cnt?n(t,s.b):s.a=t}};return i.original=s,i}(e,t,_,v);return l(r)},e.wbg.__wbindgen_debug_string=function(e,t){const n=g(w(d(t)),r.__wbindgen_malloc,r.__wbindgen_realloc),s=h;b()[e/4+1]=s,b()[e/4+0]=n},e.wbg.__wbindgen_error_new=function(e,t){return l(new Error(o(e,t)))},e.wbg.__wbindgen_is_undefined=function(e){return d(e)===undefined},e.wbg.__wbindgen_memory=function(){return l(r.memory)},e.wbg.__wbindgen_object_drop_ref=function(e){p(e)},e.wbg.__wbindgen_string_get=function(e,t){const n=d(t),s="string"==typeof n?n:undefined;var i,a=(i=s)===undefined||null===i?0:g(s,r.__wbindgen_malloc,r.__wbindgen_realloc),o=h;b()[e/4+1]=o,b()[e/4+0]=a},e.wbg.__wbindgen_string_new=function(e,t){return l(o(e,t))},e.wbg.__wbindgen_throw=function(e,t){throw new Error(o(e,t))},e}function A(e,t){return r=e.exports,C.__wbindgen_wasm_module=t,y=null,T=null,i=null,r.__wbindgen_start(),r}async function C(e){if(r!==undefined)return r;const t=k();("string"==typeof e||"function"==typeof Request&&e instanceof Request||"function"==typeof URL&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:s}=await async function(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}(await e,t);return A(n,s)}n.PPOM=E;n.default=C}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom.js"}],[134,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.qrKeyringBuilderFactory=function(e,t,n){const r=()=>new e({bridge:new t(n)});return r.type=e.type,r}}}},{package:"$root$",file:"app/scripts/lib/qr-keyring-builder-factory.ts"}],[135,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.requestRepair=async function(e){return await navigator.locks.request(r,{ifAvailable:!0},async function(t){return null!==t&&(await e(),!0)})};const r="repairDatabase"}}},{package:"$root$",file:"app/scripts/lib/repair.ts"}],[136,{"../../../../shared/constants/network":8552,"@metamask/rpc-errors":3487},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createUnsupportedMethodMiddleware=function(e=s.UNSUPPORTED_RPC_METHODS){return async function(t,n,s,i){return e.has(t.method)?i(r.rpcErrors.methodNotSupported()):s()}};var r=e("@metamask/rpc-errors"),s=e("../../../../shared/constants/network")}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.ts"}],[137,{"../../../../../shared/constants/app":8526,"../../../../../shared/constants/network":8552,"./ethereum-chain-utils":139,"@metamask/controller-utils":1625,"@metamask/network-controller":3031,"@metamask/rpc-errors":3487,lodash:7205,"uri-js":8123},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.addEthereumChainHandler=void 0;var r=function(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var s,i,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(s=t?r:n){if(s.has(e))return s.get(e);s.set(e,a)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?s(a,t,i):a[t]=e[t]);return a}(e,t)}(e("uri-js")),s=e("@metamask/controller-utils"),i=e("@metamask/network-controller"),a=e("@metamask/rpc-errors"),o=e("lodash"),c=e("../../../../../shared/constants/app"),u=e("../../../../../shared/constants/network"),l=e("./ethereum-chain-utils");const d=n.addEthereumChainHandler={implementation:async function(e,t,n,c,{addNetwork:d,updateNetwork:p,getNetworkConfigurationByChainId:h,setActiveNetwork:f,requestUserApproval:m,getCurrentChainIdForDomain:g,getCaveat:y,requestPermittedChainsPermissionIncrementalForOrigin:b,rejectApprovalRequestsForOrigin:w,setTokenNetworkFilter:v,setEnabledNetworks:_,getEnabledNetworks:T}){let S;try{S=(0,l.validateAddEthereumChainParams)(e.params[0])}catch(e){return c(e)}const{chainId:I,chainName:E,firstValidBlockExplorerUrl:k,firstValidRPCUrl:A,ticker:C}=S,{origin:O}=e,P=g(O),M=h(I);if(M&&M.chainId===I&&M.nativeCurrency!==C)return c(a.rpcErrors.invalidParams({message:`nativeCurrency.symbol does not match currency symbol for a network the user already has added with the same chainId. Received:\n${C}`}));let j=M,x=M?.rpcEndpoints.findIndex(({url:e})=>r.equal(e,A)),N=k?M?.blockExplorerUrls.findIndex(e=>r.equal(e,k)):undefined;const R=!M||x!==M.defaultRpcEndpointIndex||k&&N!==M.defaultBlockExplorerUrlIndex;if(R)try{if(await m({origin:O,type:s.ApprovalType.AddEthereumChain,requestData:{chainId:I,rpcPrefs:{blockExplorerUrl:k},chainName:E,rpcUrl:A,ticker:C}}),M){const e=(0,o.cloneDeep)(M);-1===x&&(e.rpcEndpoints=[...e.rpcEndpoints,{url:A,type:i.RpcEndpointType.Custom,name:E}],x=e.rpcEndpoints.length-1),k&&(-1===N&&(e.blockExplorerUrls=[...e.blockExplorerUrls,k],N=e.blockExplorerUrls.length-1),e.defaultBlockExplorerUrlIndex=N),j=await p(e.chainId,e,P===I?{replacementSelectedRpcEndpointIndex:e.defaultRpcEndpointIndex}:undefined)}else{const e=u.FEATURED_RPCS.find(e=>e.chainId===I),t=e?e.rpcEndpoints[e.defaultRpcEndpointIndex]:undefined;j=await d({blockExplorerUrls:k?[k]:[],defaultBlockExplorerUrlIndex:k?0:undefined,chainId:I,defaultRpcEndpointIndex:0,name:E,nativeCurrency:C,rpcEndpoints:[...t&&!r.equal(A,t.url)?[t]:[],{url:A,name:E,type:i.RpcEndpointType.Custom}]})}}catch(e){return c(e)}const D=M?.rpcEndpoints?.[M.defaultRpcEndpointIndex]?.networkClientId,F=j?.rpcEndpoints?.[j.defaultRpcEndpointIndex]?.networkClientId,B=D??F;return(0,l.switchChain)(t,c,I,B,{isAddFlow:!0,autoApprove:R,setActiveNetwork:f,getCaveat:y,requestPermittedChainsPermissionIncrementalForOrigin:b,rejectApprovalRequestsForOrigin:w,setTokenNetworkFilter:v,setEnabledNetworks:_,getEnabledNetworks:T})},hookNames:{addNetwork:!0,updateNetwork:!0,getNetworkConfigurationByChainId:!0,setActiveNetwork:!0,requestUserApproval:!0,getCurrentChainIdForDomain:!0,getCaveat:!0,requestPermittedChainsPermissionIncrementalForOrigin:!0,rejectApprovalRequestsForOrigin:!0,setTokenNetworkFilter:!0,setEnabledNetworks:!0,getEnabledNetworks:!0}},p={[c.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN]:d};n.default=p}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js"}],[138,{"../../../../../shared/constants/app":8526},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ethAccountsHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.ethAccountsHandler={implementation:async function(e,t,n,r,{getAccounts:s}){return t.result=s(),r()},hookNames:{getAccounts:!0}},i={[r.MESSAGE_TYPE.ETH_ACCOUNTS]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.ts"}],[139,{"../../../../../shared/constants/app":8526,"../../../../../shared/lib/network.utils":8707,"../../util":212,"@metamask/chain-agnostic-permission":1574,"@metamask/controller-utils":1625,"@metamask/rpc-errors":3487,"@metamask/snaps-utils":3846,"@metamask/utils":4054},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.switchChain=async function(e,t,n,s,{origin:u,isAddFlow:l,isSwitchFlow:d,autoApprove:p,setActiveNetwork:h,getCaveat:f,requestPermittedChainsPermissionIncrementalForOrigin:m,setTokenNetworkFilter:g,setEnabledNetworks:y,getEnabledNetworks:b,rejectApprovalRequestsForOrigin:w,requestUserApproval:v,hasApprovalRequestsForOrigin:_,toNetworkConfiguration:T,fromNetworkConfiguration:S}){try{const I=f({target:i.Caip25EndowmentPermissionName,caveatType:i.Caip25CaveatType});if(I){if((0,i.getPermittedEthChainIds)(I.value).includes(n))!_?.()||l||p||await v({origin:u,type:r.ApprovalType.SwitchEthereumChain,requestData:{toNetworkConfiguration:T,fromNetworkConfiguration:S}});else{let e;d&&(e={isSwitchEthereumChain:!0}),await m({chainId:n,autoApprove:p,metadata:e})}}else await m({chainId:n,autoApprove:p});if((0,o.isSnapId)(u)||w?.(),await h(s),!(0,o.isSnapId)(u))if(g(n),(0,c.isPrefixedFormattedHexString)(n)){const e=b(a.KnownCaipNamespace.Eip155);Object.keys(e).includes(n)||y(n)}else{const{namespace:e}=(0,a.parseCaipChainId)(n),t=b(e);Object.keys(t).includes(n)||y(n)}return e.result=null,t()}catch(e){return t(e)}},n.validateAddEthereumChainParams=function(e){if(!e||"object"!=typeof e)throw s.rpcErrors.invalidParams({message:`Expected single, object parameter. Received:\n${JSON.stringify(e)}`});const{chainId:t,chainName:n,blockExplorerUrls:r,nativeCurrency:i,rpcUrls:a,...o}=e,c=Object.keys(o).filter(e=>!["iconUrls"].includes(e));if(c.length>0)throw s.rpcErrors.invalidParams({message:`Received unexpected keys on object parameter. Unsupported keys:\n${c}`});const p=d(t);if(!a||!Array.isArray(a)||0===a.length)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${a}`});const h=e=>{const t=(0,l.getValidUrl)(e);return null!==t&&("localhost"===t.hostname||"127.0.0.1"===t.hostname||"https:"===t.protocol)},f=a.find(e=>h(e)),m=Array.isArray(r)?r.find(e=>h(e)):null;if(!f)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${a}`});if("string"!=typeof n||!n)throw s.rpcErrors.invalidParams({message:`Expected non-empty string 'chainName'. Received:\n${n}`});const g=n.length>100?n.substring(0,100):n;if(null!==i){if("object"!=typeof i||Array.isArray(i))throw s.rpcErrors.invalidParams({message:`Expected null or object 'nativeCurrency'. Received:\n${i}`});if(18!==i.decimals)throw s.rpcErrors.invalidParams({message:`Expected the number 18 for 'nativeCurrency.decimals' when 'nativeCurrency' is provided. Received: ${i.decimals}`});if(!i.symbol||"string"!=typeof i.symbol)throw s.rpcErrors.invalidParams({message:`Expected a string 'nativeCurrency.symbol'. Received: ${i.symbol}`})}const y=i?.symbol||u.UNKNOWN_TICKER_SYMBOL;if(y!==u.UNKNOWN_TICKER_SYMBOL&&("string"!=typeof y||y.length<1||y.length>6))throw s.rpcErrors.invalidParams({message:`Expected 1-6 character string 'nativeCurrency.symbol'. Received:\n${y}`});return{chainId:p,chainName:g,firstValidBlockExplorerUrl:m,firstValidRPCUrl:f,ticker:y}},n.validateChainId=d,n.validateSwitchEthereumChainParams=function(e){if(!e.params?.[0]||"object"!=typeof e.params[0])throw s.rpcErrors.invalidParams({message:`Expected single, object parameter. Received:\n${JSON.stringify(e.params)}`});const{chainId:t,...n}=e.params[0];if(Object.keys(n).length>0)throw s.rpcErrors.invalidParams({message:`Received unexpected keys on object parameter. Unsupported keys:\n${Object.keys(n)}`});return d(t)};var r=e("@metamask/controller-utils"),s=e("@metamask/rpc-errors"),i=e("@metamask/chain-agnostic-permission"),a=e("@metamask/utils"),o=e("@metamask/snaps-utils"),c=e("../../../../../shared/lib/network.utils"),u=e("../../../../../shared/constants/app"),l=e("../../util");function d(e){const t="string"==typeof e?e.toLowerCase():null;if(!(0,c.isPrefixedFormattedHexString)(t))throw s.rpcErrors.invalidParams({message:`Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'. Received:\n${e}`});if(!(0,c.isSafeChainId)(parseInt(e,16)))throw s.rpcErrors.invalidParams({message:`Invalid chain ID "${t}": numerical value greater than max safe value. Received:\n${e}`});return t}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js"}],[14,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BLOCKED_PORTS=n.BLOCKED_HOSTNAMES=void 0;n.BLOCKED_PORTS=["trezor-connect"],n.BLOCKED_HOSTNAMES=["execution.metamask.io","execution.consensys.io"]}}},{package:"$root$",file:"app/scripts/constants/background.ts"}],[140,{"../../../../../shared/constants/app":8526},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getProviderStateHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.getProviderStateHandler={implementation:async function(e,t,n,r,{getProviderState:s}){const i=e.params?.isInitializingStreamProvider;return t.result={...await s(e.origin,{isInitializingStreamProvider:i})},r()},hookNames:{getProviderState:!0}},i={[r.MESSAGE_TYPE.GET_PROVIDER_STATE]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.ts"}],[141,{"./add-ethereum-chain":137,"./eth-accounts":138,"./get-provider-state":140,"./log-web3-shim-usage":142,"./request-accounts":143,"./send-metadata":144,"./switch-ethereum-chain":145,"./wallet-getPermissions":146,"./wallet-requestPermissions":147,"./wallet-revokePermissions":148,"./watch-asset":149},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handlers=n.ethAccountsHandler=n.eip1193OnlyHandlers=void 0;var r=f(e("./add-ethereum-chain")),s=f(e("./eth-accounts")),i=f(e("./get-provider-state")),a=f(e("./log-web3-shim-usage")),o=f(e("./request-accounts")),c=f(e("./send-metadata")),u=f(e("./switch-ethereum-chain")),l=f(e("./watch-asset")),d=f(e("./wallet-getPermissions")),p=f(e("./wallet-requestPermissions")),h=f(e("./wallet-revokePermissions"));function f(e){return e&&e.__esModule?e:{default:e}}n.handlers={...r.default,...i.default,...a.default,...c.default,...l.default},n.eip1193OnlyHandlers={...u.default,...s.default,...o.default,...d.default,...p.default,...h.default},n.ethAccountsHandler=s.default}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/index.ts"}],[142,{"../../../../../shared/constants/app":8526},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.logWeb3ShimUsageHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.logWeb3ShimUsageHandler={implementation:function(e,t,n,r,{getWeb3ShimUsageState:s,setWeb3ShimUsageRecorded:i}){const{origin:a}=e;s(a)===undefined&&i(a);return t.result=!0,r()},hookNames:{getWeb3ShimUsageState:!0,setWeb3ShimUsageRecorded:!0}},i={[r.MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.ts"}],[143,{"../../../../../shared/constants/app":8526,"../../../../../shared/constants/metametrics":8548,"../../getIframeProperties":111,"../../util":212,"@metamask/rpc-errors":3487},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.requestEthereumAccountsHandler=n.default=void 0;var r=e("@metamask/rpc-errors"),s=e("../../../../../shared/constants/app"),i=e("../../../../../shared/constants/metametrics"),a=e("../../util"),o=e("../../getIframeProperties");const c=n.requestEthereumAccountsHandler={implementation:async function(e,t,n,c,{getAccounts:u,sendMetrics:d,metamaskState:p,getCaip25PermissionFromLegacyPermissionsForOrigin:h,requestPermissionsForOrigin:f}){const{origin:m}=e??{};if(l.has(m))return t.error=r.rpcErrors.resourceUnavailable(`Already processing ${s.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS}. Please wait.`),c();let g=u(m);if(g.length>0){try{l.add(m),t.result=g,c()}catch(e){c(e)}finally{l.delete(m)}return undefined}try{const e=h();await f(e)}catch(e){return c(e)}if(g=u(m),(0,a.shouldEmitDappViewedEvent)(p.analyticsId)){const t=!Object.keys(p.permissionHistory).includes(m),{mainFrameOrigin:n,frameId:r}=e,s=(0,o.getIframeProperties)({frameId:r,origin:m,mainFrameOrigin:n});d({event:i.MetaMetricsEventName.DappViewed,category:i.MetaMetricsEventCategory.InpageProvider,referrer:{url:m},properties:{is_first_visit:t,number_of_accounts:Object.keys(p.internalAccounts.accounts).length,number_of_accounts_connected:g.length,...s}},{excludeMetaMetricsId:!0})}return t.result=g,c()},hookNames:{getAccounts:!0,sendMetrics:!0,metamaskState:!0,getCaip25PermissionFromLegacyPermissionsForOrigin:!0,requestPermissionsForOrigin:!0}},u={[s.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS]:c};n.default=u;const l=new Set}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/request-accounts.ts"}],[144,{"../../../../../shared/constants/app":8526},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sendMetadataHandler=n.default=void 0;var r=e("../../../../../shared/constants/app");const s=n.sendMetadataHandler={implementation:function(e,t,n,r){return t.result=!0,r()}},i={[r.MESSAGE_TYPE.SEND_METADATA]:s};n.default=i}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/send-metadata.ts"}],[145,{"../../../../../shared/constants/app":8526,"./ethereum-chain-utils":139,"@metamask/rpc-errors":3487,"@metamask/snaps-utils":3846},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.switchEthereumChainHandler=n.default=void 0;var r=e("@metamask/rpc-errors"),s=e("@metamask/snaps-utils"),i=e("../../../../../shared/constants/app"),a=e("./ethereum-chain-utils");const o=n.switchEthereumChainHandler={implementation:async function(e,t,n,o,{getNetworkConfigurationByChainId:c,setActiveNetwork:u,requestUserApproval:l,getCaveat:d,getCurrentChainIdForDomain:p,requestPermittedChainsPermissionIncrementalForOrigin:h,rejectApprovalRequestsForOrigin:f,setTokenNetworkFilter:m,setEnabledNetworks:g,getEnabledNetworks:y,hasApprovalRequestsForOrigin:b}){let w;try{w=(0,a.validateSwitchEthereumChainParams)(e)}catch(e){return o(e)}const{origin:v}=e,_=p(v);if(_===w)return t.result=null,o();const T=c(w),S=T?.rpcEndpoints[T.defaultRpcEndpointIndex].networkClientId;if(!S)return o(r.providerErrors.custom({code:4902,message:`Unrecognized chain ID "${w}". Try adding the chain using ${i.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN} first.`}));const I=c(_),E=c(w);return(0,a.switchChain)(t,o,w,S,{origin:v,isSwitchFlow:!0,autoApprove:(0,s.isSnapId)(v),setActiveNetwork:u,getCaveat:d,requestPermittedChainsPermissionIncrementalForOrigin:h,rejectApprovalRequestsForOrigin:f,setTokenNetworkFilter:m,setEnabledNetworks:g,getEnabledNetworks:y,requestUserApproval:l,hasApprovalRequestsForOrigin:b,toNetworkConfiguration:E,fromNetworkConfiguration:I})},hookNames:{getNetworkConfigurationByChainId:!0,setActiveNetwork:!0,requestUserApproval:!0,getCaveat:!0,getCurrentChainIdForDomain:!0,requestPermittedChainsPermissionIncrementalForOrigin:!0,rejectApprovalRequestsForOrigin:!0,setTokenNetworkFilter:!0,setEnabledNetworks:!0,getEnabledNetworks:!0,hasApprovalRequestsForOrigin:!0}},c={[i.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN]:o};n.default=c}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js"}],[146,{"../../../../../shared/constants/permissions":8557,"../../../controllers/permissions":38,"@metamask/chain-agnostic-permission":1574,"@metamask/permission-controller":3153},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPermissionsHandler=n.default=void 0;var r=e("@metamask/permission-controller"),s=e("@metamask/chain-agnostic-permission"),i=e("../../../controllers/permissions"),a=e("../../../../../shared/constants/permissions");const o=n.getPermissionsHandler={implementation:async function(e,t,n,r,{getPermissionsForOrigin:o,getAccounts:c}){const u={...o()},l=u[s.Caip25EndowmentPermissionName],d=l?.caveats?.find(({type:e})=>e===s.Caip25CaveatType)?.value;if(delete u[s.Caip25EndowmentPermissionName],d){const e=c();e.length>0&&(u[a.RestrictedMethods.eth_accounts]={...l,parentCapability:a.RestrictedMethods.eth_accounts,caveats:[{type:a.CaveatTypes.restrictReturnedAccounts,value:e}]});const t=(0,s.getPermittedEthChainIds)(d);t.length>0&&(u[i.PermissionNames.permittedChains]={...l,parentCapability:i.PermissionNames.permittedChains,caveats:[{type:a.CaveatTypes.restrictNetworkSwitching,value:t}]})}return t.result=Object.values(u),r()},hookNames:{getPermissionsForOrigin:!0,getAccounts:!0}},c={[r.MethodNames.GetPermissions]:o};n.default=c}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-getPermissions.ts"}],[147,{"../../../../../shared/constants/permissions":8557,"../../../controllers/permissions":38,"@metamask/chain-agnostic-permission":1574,"@metamask/controller-utils":1625,"@metamask/permission-controller":3153,lodash:7205},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.requestPermissionsHandler=n.default=void 0;var r=e("lodash"),s=e("@metamask/controller-utils"),i=e("@metamask/permission-controller"),a=e("@metamask/chain-agnostic-permission"),o=e("../../../../../shared/constants/permissions"),c=e("../../../controllers/permissions");const u=n.requestPermissionsHandler={implementation:async function(e,t,n,u,{getAccounts:l,requestPermissionsForOrigin:d,getCaip25PermissionFromLegacyPermissionsForOrigin:p}){const{params:h}=e;if(!Array.isArray(h)||!(0,s.isPlainObject)(h[0]))return u((0,i.invalidParams)({data:{request:e}}));let[f]=h;delete f[a.Caip25EndowmentPermissionName];const m=(0,r.pick)(f,[o.RestrictedMethods.eth_accounts,c.PermissionNames.permittedChains]);delete f[o.RestrictedMethods.eth_accounts],delete f[c.PermissionNames.permittedChains];const g=Object.keys(m).length>0;if(g){const e=p(m);f={...f,...e}}let y={};const[b]=await d(f);if(y={...b},g){const e=y[a.Caip25EndowmentPermissionName];if(!e)throw new Error(`could not find ${a.Caip25EndowmentPermissionName} permission.`);const t=e.caveats?.find(({type:e})=>e===a.Caip25CaveatType)?.value;if(!t)throw new Error(`could not find ${a.Caip25CaveatType} in granted ${a.Caip25EndowmentPermissionName} permission.`);delete y[a.Caip25EndowmentPermissionName];const n=l(origin);y[o.RestrictedMethods.eth_accounts]={...e,parentCapability:o.RestrictedMethods.eth_accounts,caveats:[{type:o.CaveatTypes.restrictReturnedAccounts,value:n}]};const r=(0,a.getPermittedEthChainIds)(t);r.length>0&&(y[c.PermissionNames.permittedChains]={...e,parentCapability:c.PermissionNames.permittedChains,caveats:[{type:o.CaveatTypes.restrictNetworkSwitching,value:r}]})}return t.result=Object.values(y).filter(e=>e!==undefined),u()},hookNames:{getAccounts:!0,requestPermissionsForOrigin:!0,getCaip25PermissionFromLegacyPermissionsForOrigin:!0}},l={[i.MethodNames.RequestPermissions]:u};n.default=l}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-requestPermissions.ts"}],[148,{"../../../../../shared/constants/permissions":8557,"../../../controllers/permissions":38,"@metamask/chain-agnostic-permission":1574,"@metamask/permission-controller":3153,"@metamask/utils":4054},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.revokePermissionsHandler=n.default=void 0;var r=e("@metamask/permission-controller"),s=e("@metamask/utils"),i=e("@metamask/chain-agnostic-permission"),a=e("../../../../../shared/constants/permissions"),o=e("../../../controllers/permissions");const c=n.revokePermissionsHandler={implementation:function(e,t,n,c,{revokePermissionsForOrigin:u,rejectApprovalRequestsForOrigin:l}){const{params:d}=e,p=d?.[0];if(!p)return c((0,r.invalidParams)({data:{request:e}}));const h=Object.keys(p).filter(e=>e!==i.Caip25EndowmentPermissionName);if(!(0,s.isNonEmptyArray)(h))return c((0,r.invalidParams)({data:{request:e}}));const f=[a.RestrictedMethods.eth_accounts,o.PermissionNames.permittedChains],m=h.filter(e=>!f.includes(e));m.length!==h.length&&m.push(i.Caip25EndowmentPermissionName);u(m),m.includes(i.Caip25EndowmentPermissionName)&&l();return t.result=null,c()},hookNames:{revokePermissionsForOrigin:!0,rejectApprovalRequestsForOrigin:!0}},u={[r.MethodNames.RevokePermissions]:c};n.default=u}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.ts"}],[149,{"../../../../../shared/constants/app":8526,"@metamask/controller-utils":1625,"@metamask/rpc-errors":3487},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.watchAssetHandler=n.default=void 0;var r=e("@metamask/rpc-errors"),s=e("@metamask/controller-utils"),i=e("../../../../../shared/constants/app");const a=n.watchAssetHandler={implementation:async function(e,t,n,i,{handleWatchAssetRequest:a}){try{const{params:n,origin:o,networkClientId:c}=e;if(!n)return i(r.rpcErrors.invalidParams());const{options:u,type:l}=n,{tokenId:d}=u;return[s.ERC721,s.ERC1155].includes(l)&&d!==undefined&&"string"!=typeof d?i(r.rpcErrors.invalidParams({message:`Expected parameter 'tokenId' to be type 'string'. Received type '${typeof d}'`})):(await a({asset:u,type:l,origin:o??"",networkClientId:c??""}),t.result=!0,i())}catch(e){return i(e)}},hookNames:{handleWatchAssetRequest:!0}},o={[i.MESSAGE_TYPE.WATCH_ASSET]:a,[i.MESSAGE_TYPE.WATCH_ASSET_LEGACY]:a};n.default=o}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/watch-asset.ts"}],[15,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.COOKIE_ID_MARKETING_WHITELIST_ORIGINS=n.COOKIE_ID_MARKETING_WHITELIST=void 0;const r=n.COOKIE_ID_MARKETING_WHITELIST=["https://metamask.io","https://learn.metamask.io","https://mmi-support.zendesk.com","https://community.metamask.io","https://support.metamask.io"];n.COOKIE_ID_MARKETING_WHITELIST_ORIGINS=r.map(e=>new URL(e).origin)}}},{package:"$root$",file:"app/scripts/constants/marketing-site-whitelist.ts"}],[150,{"./createUnsupportedMethodMiddleware":136,"./handlers":141,"@metamask/json-rpc-engine":2691,"@metamask/multichain-api-middleware":2993},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var r={createEip1193MethodMiddleware:!0,createEthAccountsMethodMiddleware:!0,createMultichainApiMethodMiddleware:!0,createMultichainInvokedMethodMiddleware:!0};n.createMultichainInvokedMethodMiddleware=n.createMultichainApiMethodMiddleware=n.createEthAccountsMethodMiddleware=n.createEip1193MethodMiddleware=void 0;var s=e("@metamask/json-rpc-engine"),i=e("@metamask/multichain-api-middleware"),a=e("./handlers"),o=e("./createUnsupportedMethodMiddleware");Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in n&&n[e]===o[e]||Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}}))});const c=e=>{0};n.createEip1193MethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:{...a.handlers,...a.eip1193OnlyHandlers},hooks:e,onError:c});n.createEthAccountsMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:a.ethAccountsHandler,hooks:e,onError:c});n.createMultichainApiMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:i.methodHandlers,hooks:e,onError:c});n.createMultichainInvokedMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:a.handlers,hooks:e,onError:c})}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/index.ts"}],[151,{"../../../shared/lib/snaps/snaps":8742,"@metamask/rpc-errors":3487},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createRpcBlockingCallbacks=function(e){const t=Symbol("rpc-blocking");return{onBeforeRequest:()=>e.blockingSymbols.add(t),onAfterRequest:()=>e.blockingSymbols.delete(t)}},n.default=function({allowedOrigins:e,errorMessage:t="Cannot process requests at this time",state:n}){return function(i,a,o,c){if(0===n.blockingSymbols.size)return o();const{origin:u}=i;if(!u)return c(r.rpcErrors.internal(`No origin specified for request with method ${i.method}`));return e.includes(u)||(0,s.isSnapPreinstalled)(u)?o():c(r.rpcErrors.resourceUnavailable(t))}};var r=e("@metamask/rpc-errors"),s=e("../../../shared/lib/snaps/snaps")}}},{package:"$root$",file:"app/scripts/lib/rpcBlockingMiddleware.ts"}],[152,{"../../../shared/lib/error":8663,"../../../shared/lib/sentry":8734,"./operation-safener":128,"webextension-polyfill":8513},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getRequestSafeReload=function(e){const t=new o.OperationSafener({op:async t=>{try{if("data"===e.storageKind){if(!t)throw new Error("State must be provided for 'data' storageKind");await e.set(t)}else await e.persist()}catch(e){(0,i.captureException)((0,a.createSentryError)("MetaMask - Persistence failed",e))}},wait:1e3});return{safePersist:async(...e)=>t.execute(...e),requestSafeReload:async()=>{await t.evacuate(),globalThis.setTimeout(()=>{s.default.runtime.reload()},c)},evacuate:()=>t.evacuate()}};var r,s=(r=e("webextension-polyfill"))&&r.__esModule?r:{default:r},i=e("../../../shared/lib/sentry"),a=e("../../../shared/lib/error"),o=e("./operation-safener");const c=150}}},{package:"$root$",file:"app/scripts/lib/safe-reload.ts"}],[153,{"../../../../shared/constants/metametrics":8548,"../../../../shared/lib/sentry":8734,"../../controllers/analytics":22,loglevel:7215},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.runSeedlessOnboardingMigrations=async function(e){const{completedOnboarding:t}=e.call("OnboardingController:getState");if(!t)return;try{await e.call("SeedlessOnboardingController:runMigrations")&&(0,i.trackEvent)((0,i.createEventBuilder)(a.MetaMetricsEventName.SeedlessOnboardingMigrationCompleted).addCategory(a.MetaMetricsEventCategory.Background).addProperties({migration_version:e.call("SeedlessOnboardingController:getState").migrationVersion}).build())}catch(t){const n=t instanceof Error,r=n?t.message:"Unknown error",c=n?t:new Error(r);try{(0,i.trackEvent)((0,i.createEventBuilder)(a.MetaMetricsEventName.SeedlessOnboardingMigrationFailed).addCategory(a.MetaMetricsEventCategory.Background).addProperties({migration_version:e.call("SeedlessOnboardingController:getState").migrationVersion,error:r}).build())}catch(e){s.default.warn("Failed to track seedless onboarding migration failure",e)}try{(0,o.captureException)(c)}catch(e){s.default.warn("Failed to capture seedless onboarding migration failure",e)}throw c}};var r,s=(r=e("loglevel"))&&r.__esModule?r:{default:r},i=e("../../controllers/analytics"),a=e("../../../../shared/constants/metametrics"),o=e("../../../../shared/lib/sentry")}}},{package:"$root$",file:"app/scripts/lib/seedless-onboarding/run-migrations.ts"}],[1532,{"./bridge-status-controller.intent.cjs":1533,"./constants.cjs":1534,"./quote-status-manager/constants.cjs":1536,"./quote-status-manager/errors.cjs":1537,"./quote-status-manager/quotes-status-manager.cjs":1543,"./strategy/index.cjs":1549,"./strategy/types.cjs":1552,"./types.cjs":1553,"./utils/accounts.cjs":1554,"./utils/authentication.cjs":1555,"./utils/bridge-status.cjs":1556,"./utils/bridge.cjs":1557,"./utils/history.cjs":1560,"./utils/metrics.cjs":1563,"./utils/network.cjs":1564,"./utils/trace.cjs":1567,"./utils/transaction.cjs":1568,"@metamask/bridge-controller":1501,"@metamask/polling-controller":3326,"@metamask/transaction-controller":3939,"@metamask/utils":4054},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u,l,d,p,h,f,m,g,y,b,w,v,_,T,S,I,E,k,A,C,O,P=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},M=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},j=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusController=void 0;const x=e("@metamask/bridge-controller"),N=e("@metamask/bridge-controller"),R=e("@metamask/polling-controller"),D=e("@metamask/transaction-controller"),F=e("@metamask/utils"),B=e("./bridge-status-controller.intent.cjs"),q=e("./constants.cjs"),L=e("./quote-status-manager/constants.cjs"),H=(e("./quote-status-manager/errors.cjs"),e("./quote-status-manager/quotes-status-manager.cjs")),U=j(e("./strategy/index.cjs")),$=e("./strategy/types.cjs"),W=e("./types.cjs"),Q=e("./utils/accounts.cjs"),K=e("./utils/authentication.cjs"),G=e("./utils/bridge.cjs"),z=e("./utils/bridge-status.cjs"),V=e("./utils/history.cjs"),J=e("./utils/metrics.cjs"),Y=e("./utils/network.cjs"),X=e("./utils/trace.cjs"),Z=e("./utils/transaction.cjs"),ee={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},quoteUpdateStatusStore:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}},te=["startPollingForBridgeTxStatus","wipeBridgeStatus","resetState","submitTx","submitIntent","submitBatchSell","restartPollingForFailedAttempts","getBridgeHistoryItemByTxMetaId"];class ne extends((0,R.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,clientProduct:j,clientVersion:R,fetchFn:ne,addTransactionBatchFn:re,config:se,traceFn:ie,onQuoteStatusManagerError:ae,isQuoteStatusManagerEnabled:oe}){super({name:q.BRIDGE_STATUS_CONTROLLER_NAME,metadata:ee,messenger:e,state:{...q.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),r.set(this,{}),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u.set(this,void 0),l.set(this,void 0),d.set(this,({txMeta:e,historyKey:t,isApprovalTxMeta:n})=>{const r=!!t&&this.state.txHistory[t]?.status.status===N.StatusTypes.FAILED;M(this,I,"f").call(this,{historyKey:t,status:N.StatusTypes.FAILED,txHash:n?undefined:e.hash,completionTime:Date.now()}),e.status!==D.TransactionStatus.rejected&&(r||((e.type&&(0,Z.isCrossChainTx)(e.type)||(0,Z.hasNestedSwapTransactions)(e))&&M(this,i,"f").reportFinalised(e.id,!1),M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Failed,t,(0,J.getEVMTxPropertiesFromTransactionMeta)(e))))}),p.set(this,({txMeta:e,historyKey:t,isApprovalTxMeta:n})=>{if(n)return;M(this,I,"f").call(this,{historyKey:t,txHash:e.hash});if(e.type===D.TransactionType.swap||(0,Z.hasNestedSwapTransactions)(e)){M(this,I,"f").call(this,{historyKey:t,status:N.StatusTypes.COMPLETE,completionTime:Date.now()});const n=t?this.state.txHistory[t]:undefined;t&&n&&e.hash&&!(0,N.isNonEvmChainId)(n.quote.srcChainId)&&M(this,f,"f").call(this,t,e.hash,e.id),M(this,i,"f").reportFinalised(e.id,!0),M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,t)}else t&&M(this,w,"f").call(this,t)}),h.set(this,(e,t)=>{if(!t?.id||!t.hash)return;const n=this.state.txHistory[e];n&&(0,N.isNonEvmChainId)(n.quote.srcChainId)&&M(this,f,"f").call(this,e,t.hash,t.id)}),f.set(this,(e,t,n)=>{const r=this.state.txHistory[e];r?.quoteId&&r.reportedSubmittedTxHash!==t&&(M(this,i,"f").reportSubmitted(r.quoteId,t,n),this.update(n=>{const r=n.txHistory[e];r&&(r.reportedSubmittedTxHash=t)}))}),this.resetState=()=>{M(this,i,"f").destroy(),this.update(e=>{e.txHistory=q.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory,e.quoteUpdateStatusStore=q.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.quoteUpdateStatusStore})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=q.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const t=(0,Y.getSelectedChainId)(this.messenger);M(this,k,"f").call(this,e,t)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:n}=e;if(!t&&!n)throw new Error("Either txMetaId or txHash must be provided");let s;if(t?this.state.txHistory[t]&&(s=t):n&&(s=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===n)),!s)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${n}`));const i=this.state.txHistory[s],a=i.attempts?.counter??0;if(this.update(e=>{s&&(e.txHistory[s].attempts=undefined)}),(0,V.shouldPollHistoryItem)(i)){M(this,r,"f")[s]||(M(this,w,"f").call(this,s),M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.PollingStatusUpdated,s,{polling_status:N.PollingStatus.ManuallyRestarted,retry_attempts:a}))}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],m.set(this,()=>{if(M(this,i,"f").enabled)for(const[e,t]of Object.entries(this.state.txHistory)){const{quoteId:n,txMetaId:r}=t;if(!n||!r)continue;if(Date.now()-t.startTime>L.QUOTE_STATUS_BACKFILL_WINDOW_MS)continue;const s=t.status.srcChain.txHash??(0,Z.getTransactionMetaById)(this.messenger,r)?.hash;s&&M(this,f,"f").call(this,e,s,r)}}),g.set(this,()=>{const{txHistory:e}=this.state;Object.entries(e).filter(([e,t])=>t.status.status===N.StatusTypes.PENDING||t.status.status===N.StatusTypes.UNKNOWN).filter(([e,t])=>{if(!t.txMetaId)return!1;return!M(this,r,"f")[t.txMetaId]}).filter(([e,t])=>(0,V.shouldPollHistoryItem)(t)).forEach(([e,t])=>{(0,z.shouldSkipFetchDueToFetchFailures)(t.attempts)||M(this,w,"f").call(this,e)})}),y.set(this,(e,...t)=>{const n=(0,V.getInitialHistoryItem)(...t);return this.update(t=>{t.txHistory[e]=n}),e}),b.set(this,(e,t,n)=>{this.update(r=>{(0,V.rekeyHistoryItemInState)(r,e,t,n)})}),w.set(this,e=>{const t=M(this,r,"f")[e];t&&this.stopPollingByPollingToken(t);const n=this.state.txHistory[e];n&&(0,V.shouldPollHistoryItem)(n)&&(M(this,r,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;if(!t?.id)throw new Error("Cannot start polling: bridgeTxMeta.id is required for polling");const n=M(this,y,"f").call(this,t.id,e);M(this,w,"f").call(this,n)},this._executePoll=async e=>{await M(this,T,"f").call(this,e)},v.set(this,e=>{const{attempts:t}=this.state.txHistory[e],n=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},s=M(this,r,"f")[e];if(n.counter>=q.MAX_ATTEMPTS&&s){this.stopPollingByPollingToken(s),delete M(this,r,"f")[e];this.state.txHistory[e]&&M(this,C,"f").call(this,e,N.PollingStatus.MaxPollingReached)}M(this,I,"f").call(this,{historyKey:e,attempts:n})}),_.set(this,async e=>{if(this.state.txHistory[e]&&await(0,z.shouldWaitForFinalBridgeStatus)(this.messenger,this.state.txHistory[e]))return;const t=M(this,r,"f")[e];M(this,C,"f").call(this,e,N.PollingStatus.InvalidTransactionHash),t&&(this.stopPollingByPollingToken(t),delete M(this,r,"f")[e]),M(this,i,"f").reportFinalised(e,!1),M(this,E,"f").call(this,e)}),T.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state,n=t[e];if(n&&!(0,z.shouldSkipFetchDueToFetchFailures)(n.attempts))try{let t,u=[];if(n.quote.intent){const r=await M(this,s,"f").getIntentTransactionStatus(e,n.quote.srcChainId,n.quote.intent.protocol,M(this,a,"f"),n.status.srcChain.txHash);if(null===r?.bridgeStatus||r?.bridgeStatus===undefined)return;t=r.bridgeStatus.status;const i=t.srcChain.txHash;i&&M(this,f,"f").call(this,e,i,e)}else{const r=M(this,S,"f").call(this,e);if(!r)return;M(this,f,"f").call(this,e,r,e);const s=(0,z.getStatusRequestWithSrcTxHash)(n.quote,r),l=(n.quoteId?await(0,z.fetchBridgeQuoteStatus)(M(this,i,"f"),n.quoteId):null)??await(0,z.fetchBridgeTxStatus)(s,M(this,a,"f"),await(0,K.getJwt)(this.messenger),M(this,o,"f"),M(this,c,"f").customBridgeApiBaseUrl);t=l.status,u=l.validationFailures}if(u.length>0)throw M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:u,refresh_count:n.attempts?.counter??0}),new Error(`Bridge status validation failed: ${u.join(", ")}`);const l={...n,status:t,completionTime:t.status===N.StatusTypes.COMPLETE||t.status===N.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=l}),n.quote.intent&&M(this,s,"f").syncTransactionFromIntentStatus(e,n);const d=M(this,r,"f")[e];if(t.status===N.StatusTypes.COMPLETE||t.status===N.StatusTypes.FAILED){d&&(this.stopPollingByPollingToken(d),delete M(this,r,"f")[e]);const s=l.status.srcChain.txHash;s&&M(this,f,"f").call(this,e,s,e),M(this,i,"f").reportFinalised(e,t.status===N.StatusTypes.COMPLETE),t.status===N.StatusTypes.COMPLETE&&(M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",n.quote.destAsset.assetId)),t.status===N.StatusTypes.FAILED&&M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),M(this,v,"f").call(this,e)}finally{await M(this,_,"f").call(this,e)}}),S.set(this,e=>{const{txHistory:t}=this.state,n=t[e].status.srcChain.txHash;if(n||(0,N.isNonEvmChainId)(t[e].quote.srcChainId))return n;const r=(0,Z.getTransactionMetaById)(this.messenger,e);if(!r)return undefined;const s=[D.TransactionStatus.confirmed,D.TransactionStatus.dropped,D.TransactionStatus.rejected,D.TransactionStatus.failed].includes(r.status)?r.hash:undefined;return M(this,I,"f").call(this,{historyKey:e,txHash:s}),s}),I.set(this,({historyKey:e,status:t,txHash:n,attempts:r,completionTime:s})=>{e&&this.update(i=>{t&&(i.txHistory[e].status.status=t),n&&(i.txHistory[e].status.srcChain.txHash=n),r&&(i.txHistory[e].attempts=r),s&&(i.txHistory[e].completionTime=s)})}),E.set(this,e=>{this.update(t=>{delete t.txHistory[e]})}),k.set(this,(e,t)=>{const n=Object.keys(this.state.txHistory).filter(n=>{const r=this.state.txHistory[n],s=(0,F.numberToHex)(r.quote.srcChainId);return r.account===e&&s===t});n.forEach(e=>{M(this,r,"f")[e]&&(this.stopPollingByPollingToken(M(this,r,"f")[e]),delete M(this,r,"f")[e])}),this.update(e=>{e.txHistory=n.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),A.set(this,async(e,t)=>{let n;const r=(0,U.default)(e);for await(const{type:s,payload:a}of r)try{switch(s){case $.SubmitStep.RekeyHistoryItem:M(this,b,"f").call(this,a.oldHistoryKey,a.newHistoryKey,a.tradeMeta),a.tradeMeta.hash&&M(this,f,"f").call(this,a.newHistoryKey,a.tradeMeta.hash,a.tradeMeta.id);break;case $.SubmitStep.UpdateBatchTransactions:(0,Z.updateTransactionsInBatch)({messenger:this.messenger,allTradesWithMetadata:a.quoteAndTxMetas});break;case $.SubmitStep.SetTradeMeta:n=a.tradeMeta;break;case $.SubmitStep.AddHistoryItem:M(this,y,"f").call(this,a.historyKey,{...a,...t,quoteResponse:a.quoteResponse,accountAddress:e.selectedAccount.address,isStxEnabled:e.isStxEnabled,slippagePercentage:0}),M(this,h,"f").call(this,a.historyKey,a.bridgeTxMeta);break;case $.SubmitStep.StartPolling:M(this,w,"f").call(this,a.historyKey);break;case $.SubmitStep.PublishCompletedEvent:M(this,i,"f").reportFinalised(a.historyKey,!0),M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,a.historyKey);break;default:throw new Error(`Unknown submit step type: ${String(s)}`)}}catch(e){console.error("Failed to add to bridge history and start polling.",e)}return n}),this.submitTx=async(e,t,n,r,s=N.MetaMetricsSwapsEventSource.Unknown,i,d,p,h,f)=>{const m=Array.isArray(t)?t:[t],g=m[0],{quote:y}=g,b=Date.now();(0,G.stopPollingForQuotes)(this.messenger,r);const w=(0,Q.getAccountByAddress)(this.messenger,e);if(!w)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const v=(0,N.getAccountHardwareType)(w),_=M(this,a,"f")===W.BridgeClientId.MOBILE&&null!==v,T=(0,N.isCrossChain)(y.srcChainId,y.destChainId),S=m.some(({featureId:e})=>e===x.FeatureId.BATCH_SELL)?(0,D.generateBatchId)():undefined,I=(0,J.getPreConfirmationPropertiesFromQuote)(g,n,v,s,i,d,p,h,S);try{M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Submitted,undefined,{...I,...f&&{input_primary_denomination:f}});const e=!(0,N.isNonEvmChainId)(y.srcChainId)&&await(0,Z.checkIsDelegatedAccount)(this.messenger,w.address,[(0,N.formatChainIdToHex)(y.srcChainId)]),t={messenger:this.messenger,quoteResponses:m,batchSellTrades:h,isStxEnabled:n,isBridgeTx:T,isDelegatedAccount:e,selectedAccount:w,requireApproval:_,clientId:M(this,a,"f"),bridgeApiBaseUrl:M(this,c,"f").customBridgeApiBaseUrl,addTransactionBatchFn:M(this,u,"f"),fetchFn:M(this,o,"f"),traceFn:M(this,l,"f"),batchId:S};return await M(this,l,"f").call(this,(0,X.getTraceParams)(g,n),async()=>await M(this,A,"f").call(this,t,{startTime:b,location:s,abTests:i,activeAbTests:d,tokenSecurityTypeDestination:p,inputPrimaryDenomination:f}))}catch(e){throw M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...I}),e}},this.submitIntent=async e=>{const{quoteResponse:t,accountAddress:n,location:r,abTests:s,activeAbTests:i,tokenSecurityTypeDestination:a,inputPrimaryDenomination:o,isStxEnabled:c=!1,quotesReceivedContext:u}=e;return await this.submitTx(n,t,c,u,r,s,i,a,undefined,o)},this.submitBatchSell=async e=>{const t=(0,G.getBatchSellTrades)(this.messenger);return await this.submitTx(e.accountAddress,e.quoteResponses.filter(e=>null!==e),e.isStxEnabled??!1,e.quotesReceivedContext,e.location,e.abTests,e.activeAbTests,e.tokenSecurityTypeDestination,t)},C.set(this,(e,t)=>{const n=this.state.txHistory[e];M(this,O,"f").call(this,N.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{polling_status:t,retry_attempts:n.attempts?.counter??0})}),O.set(this,(e,t,n)=>{const r=t?this.state.txHistory[t]:undefined,s=n?.feature_id??r?.featureId??x.FeatureId.UNIFIED_SWAP_BRIDGE;if(!q.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS.includes(s)&&e!==N.UnifiedSwapBridgeEventName.StatusValidationFailed)return;const i=t?this.state.txHistory?.[t]?.abTests:undefined,a=t?this.state.txHistory?.[t]?.activeAbTests:undefined,o=n?.ab_tests??i,c=n?.active_ab_tests??a,u=r?.location??n?.location??N.MetaMetricsSwapsEventSource.Unknown,l={action_type:N.MetricsActionType.SWAPBRIDGE_V1,feature_id:s??x.FeatureId.UNIFIED_SWAP_BRIDGE,...r?.batchId?{batch_id:r.batchId}:{},...n??{},location:u,...o&&Object.keys(o).length>0&&{ab_tests:o},...c&&c.length>0&&{active_ab_tests:c}};if(!r)return void(0,G.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:l});const{approvalTxId:d,quote:p}=r,h=(0,J.getRequestParamFromHistory)(r);if(e===N.UnifiedSwapBridgeEventName.StatusValidationFailed)return void(0,G.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:{...l,chain_id_source:h.chain_id_source,chain_id_destination:h.chain_id_destination,token_address_source:h.token_address_source,token_address_destination:h.token_address_destination,token_security_type_destination:h.token_security_type_destination,refresh_count:r.attempts?.counter??0}});const f=(0,Q.getAccountByAddress)(this.messenger,r.account),m=(0,Z.getTransactions)(this.messenger),g=m.find(e=>e.id===t),y=m.find(e=>e.id===d),b={...l,...h,...(0,J.getRequestMetadataFromHistory)(r,f),...(0,J.getTradeDataFromHistory)(r),...(0,J.getTxStatusesFromHistory)(r),...(0,J.getFinalizedTxProperties)(r,g,y),...(0,J.getPriceImpactFromQuote)(p),...e===N.UnifiedSwapBridgeEventName.Completed&&r.inputPrimaryDenomination&&{input_primary_denomination:r.inputPrimaryDenomination}};(0,G.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:b})}),P(this,a,n,"f"),P(this,o,ne,"f"),P(this,u,re,"f"),P(this,c,{customBridgeApiBaseUrl:se?.customBridgeApiBaseUrl??q.BRIDGE_PROD_API_BASE_URL},"f"),P(this,l,ie??((e,t)=>t?.()),"f"),P(this,s,new B.IntentManager({messenger:this.messenger,customBridgeApiBaseUrl:M(this,c,"f").customBridgeApiBaseUrl,fetchFn:M(this,o,"f")}),"f"),P(this,i,new H.QuoteStatusManager({messenger:this.messenger,clientId:M(this,a,"f"),clientProduct:j,clientVersion:R,apiBaseUrl:M(this,c,"f").customBridgeApiBaseUrl,initialData:this.state.quoteUpdateStatusStore,onPersistUpdates:e=>{this.update(t=>{t.quoteUpdateStatusStore=e})},entryTtlMs:L.QUOTE_STATUS_UPDATE_ENTRY_TTL,updateIntervalMs:L.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS,onError:ae,isEnabled:oe}),"f"),this.messenger.registerMethodActionHandlers(this,te),this.setIntervalLength(q.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionStatusUpdated",({txMeta:e,historyKey:t,historyItem:n,isApprovalTxMeta:r})=>{if(!e)return;const{type:s,status:i}=e;if(s&&(0,Z.isCrossChainTx)(s)||t||n)switch(i){case D.TransactionStatus.submitted:e.hash&&e.type&&(0,Z.isCrossChainTx)(e.type)&&!r&&t&&M(this,f,"f").call(this,t,e.hash,e.id);break;case D.TransactionStatus.confirmed:M(this,p,"f").call(this,{txMeta:e,historyKey:t,isApprovalTxMeta:r});break;case D.TransactionStatus.failed:case D.TransactionStatus.dropped:case D.TransactionStatus.rejected:M(this,d,"f").call(this,{txMeta:e,historyKey:t,isApprovalTxMeta:r})}},({transactionMeta:e})=>{const t=(0,V.getMatchingHistoryEntryForTxMeta)(this.state.txHistory,e),n=(0,V.getMatchingHistoryEntryForApprovalTxMeta)(this.state.txHistory,e),r=t??n;return{historyKey:r?.[0],historyItem:r?.[1],txMeta:e,isApprovalTxMeta:r?.[1]?.approvalTxId===e.id}}),M(this,m,"f").call(this),M(this,i,"f").init(),M(this,g,"f").call(this)}}n.BridgeStatusController=ne,r=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,d=new WeakMap,p=new WeakMap,h=new WeakMap,f=new WeakMap,m=new WeakMap,g=new WeakMap,y=new WeakMap,b=new WeakMap,w=new WeakMap,v=new WeakMap,_=new WeakMap,T=new WeakMap,S=new WeakMap,I=new WeakMap,E=new WeakMap,k=new WeakMap,A=new WeakMap,C=new WeakMap,O=new WeakMap}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],[1533,{"./utils/authentication.cjs":1555,"./utils/intent-api.cjs":1561,"./utils/transaction.cjs":1568,"./utils/validators.cjs":1569,"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.IntentManager=void 0;const u=e("@metamask/bridge-controller"),l=e("./utils/authentication.cjs"),d=e("./utils/intent-api.cjs"),p=e("./utils/transaction.cjs");e("./utils/validators.cjs");n.IntentManager=class{constructor({messenger:e,customBridgeApiBaseUrl:t,fetchFn:n}){r.add(this),s.set(this,void 0),i.set(this,new Map),this.getIntentTransactionStatus=async(e,t,n,s,i)=>{try{const o=await this.intentApi.getOrderStatus(e,n,t,s);return c(this,r,"m",a).call(this,e,o,t,i)}catch(e){if(e instanceof Error)throw new Error(`[Intent polling] Failed to get intent order status from API: ${e.message}`);return undefined}},this.syncTransactionFromIntentStatus=(e,t)=>{const n=t.originalTransactionId??t.txMetaId;if(!n)return;const r=c(this,i,"f").get(e);if(r)try{const t=(0,p.getTransactionMetaById)(c(this,s,"f"),n);if(!t)return void console.warn("[Intent polling] Skipping update, transaction not found",{originalTxId:n,bridgeHistoryKey:e});const{bridgeStatus:a,orderStatus:o}=r,l=a?.txHash,d=a?.status.status===u.StatusTypes.COMPLETE,h=a?.status.status===u.StatusTypes.COMPLETE||a?.status.status===u.StatusTypes.FAILED,f=t.txReceipt,m=l?{txReceipt:{...f,transactionHash:l,status:d?"0x1":"0x0"}}:{};(0,p.updateTransaction)(c(this,s,"f"),t,{status:a?.transactionStatus,...l?{hash:l}:{},...m},`BridgeStatusController - Intent order status updated: ${o}`),h&&c(this,i,"f").delete(e)}catch(t){console.error("[Intent polling] Failed to update transaction status",{originalTxId:n,bridgeHistoryKey:e,error:t})}},o(this,s,e,"f"),this.intentApi=new d.IntentApiImpl(t,n,async()=>await(0,l.getJwt)(e))}},s=new WeakMap,i=new WeakMap,r=new WeakSet,a=function(e,t,n,r){const s=(0,d.translateIntentOrderToBridgeStatus)(t,n,r),a={orderStatus:t.status,bridgeStatus:s};return c(this,i,"f").set(e,a),a}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs"}],[1534,{"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS=n.TraceName=n.APPROVAL_DELAY_MS=n.BRIDGE_PROD_API_BASE_URL=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS=n.MAX_ATTEMPTS=n.REFRESH_INTERVAL_MS=void 0;const r=e("@metamask/bridge-controller");var s;n.REFRESH_INTERVAL_MS=1e4,n.MAX_ATTEMPTS=7,n.DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS=1728e5,n.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{},quoteUpdateStatusStore:{}},n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",n.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(s||(n.TraceName=s={})),n.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS=[r.FeatureId.QUICK_BUY_FOLLOW_TRADING,r.FeatureId.QUICK_BUY_TOKEN_DETAILS,r.FeatureId.QUICK_BUY_EXPLORE,r.FeatureId.UNIFIED_SWAP_BRIDGE,r.FeatureId.BATCH_SELL]}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],[1535,{"./bridge-status-controller.cjs":1532,"./constants.cjs":1534,"./quote-status-manager/constants.cjs":1536,"./quote-status-manager/errors.cjs":1537,"./types.cjs":1553,"./utils/history.cjs":1560},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isBatchSellHistoryItem=n.getBatchSellHistoryItemsForTxHash=n.BridgeStatusController=n.BridgeStatusAction=n.BridgeId=n.MAX_ATTEMPTS=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.REFRESH_INTERVAL_MS=n.BaseQuoteStatusUpdateErrorTypes=n.QuoteStatusGetError=n.QuoteStatusUpdateError=void 0;var r=e("./quote-status-manager/errors.cjs");Object.defineProperty(n,"QuoteStatusUpdateError",{enumerable:!0,get:function(){return r.QuoteStatusUpdateError}}),Object.defineProperty(n,"QuoteStatusGetError",{enumerable:!0,get:function(){return r.QuoteStatusGetError}});var s=e("./quote-status-manager/constants.cjs");Object.defineProperty(n,"BaseQuoteStatusUpdateErrorTypes",{enumerable:!0,get:function(){return s.BaseQuoteStatusUpdateErrorTypes}});var i=e("./constants.cjs");Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return i.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return i.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(n,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return i.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(n,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return i.MAX_ATTEMPTS}});var a=e("./types.cjs");Object.defineProperty(n,"BridgeId",{enumerable:!0,get:function(){return a.BridgeId}}),Object.defineProperty(n,"BridgeStatusAction",{enumerable:!0,get:function(){return a.BridgeStatusAction}});var o=e("./bridge-status-controller.cjs");Object.defineProperty(n,"BridgeStatusController",{enumerable:!0,get:function(){return o.BridgeStatusController}});var c=e("./utils/history.cjs");Object.defineProperty(n,"getBatchSellHistoryItemsForTxHash",{enumerable:!0,get:function(){return c.getBatchSellHistoryItemsForTxHash}}),Object.defineProperty(n,"isBatchSellHistoryItem",{enumerable:!0,get:function(){return c.isBatchSellHistoryItem}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/index.cjs"}],[1536,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a;Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusFetchWithRetryOutcomeType=n.AllowedQuoteStatusStateTransitions=n.QuoteStatusStateToBackendStatus=n.QuoteStatusState=n.QuoteStatusUpdateRetryableBackendTypes=n.QuoteStatusUpdateBackendOnChainMismatchTypes=n.QuoteStatusBackendValues=n.BaseQuoteStatusUpdateErrorTypes=n.QuoteStatusUpdateBackendErrorType=n.QuoteStatusBackendStatus=n.QUOTE_STATUS_BACKFILL_WINDOW_MS=n.QUOTE_STATUS_UPDATE_ENTRY_TTL=n.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS=void 0,n.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS=18e5,n.QUOTE_STATUS_UPDATE_ENTRY_TTL=108e5,n.QUOTE_STATUS_BACKFILL_WINDOW_MS=432e5,function(e){e.Served="SERVED",e.Submitted="SUBMITTED",e.FinalizedSuccess="FINALIZED_SUCCESS",e.FinalizedFailed="FINALIZED_FAILED"}(r||(n.QuoteStatusBackendStatus=r={})),function(e){e.QuoteNotFound="QUOTE_NOT_FOUND",e.ConcurrentUpdate="CONCURRENT_UPDATE",e.InvalidStatusTransaction="INVALID_STATUS_TRANSITION",e.SrcTxHashRequiredForFinalized="SRC_TX_HASH_REQUIRED_FOR_FINALIZED",e.PersistQuoteStatusFailed="PERSIST_QUOTE_STATUS_FAILED",e.TransactionNotIndexed="TRANSACTION_NOT_INDEXED",e.TxDataMissingHash="TX_DATA_MISSING_HASH",e.TxDataMissingTrade="TX_DATA_MISSING_TRADE",e.TxDataMismatch="TX_DATA_MISMATCH",e.SvmTradeDeserializeFailed="SVM_TRADE_DESERIALIZE_FAILED",e.QuoteStatusOnChainMismatch="QUOTE_STATUS_ONCHAIN_MISMATCH"}(s||(n.QuoteStatusUpdateBackendErrorType=s={})),n.BaseQuoteStatusUpdateErrorTypes=[s.QuoteNotFound,s.ConcurrentUpdate,s.SrcTxHashRequiredForFinalized,s.PersistQuoteStatusFailed,s.TransactionNotIndexed,s.TxDataMissingHash,s.TxDataMissingTrade,s.TxDataMismatch,s.SvmTradeDeserializeFailed],n.QuoteStatusBackendValues=[r.Served,r.Submitted,r.FinalizedSuccess,r.FinalizedFailed],n.QuoteStatusUpdateBackendOnChainMismatchTypes=[s.InvalidStatusTransaction,s.QuoteStatusOnChainMismatch],n.QuoteStatusUpdateRetryableBackendTypes=[s.ConcurrentUpdate,s.TransactionNotIndexed],function(e){e.Submitted="Submitted",e.FinalizedSuccess="FinalizedSuccess",e.FinalizedFailed="FinalizedFailed",e.Completed="Completed",e.Expired="Expired"}(i||(n.QuoteStatusState=i={})),n.QuoteStatusStateToBackendStatus={[i.Submitted]:r.Submitted,[i.FinalizedSuccess]:r.FinalizedSuccess,[i.FinalizedFailed]:r.FinalizedFailed,[i.Completed]:null,[i.Expired]:null},n.AllowedQuoteStatusStateTransitions={[i.Submitted]:[i.FinalizedFailed,i.FinalizedSuccess,i.Expired],[i.FinalizedFailed]:[i.Completed,i.Expired],[i.FinalizedSuccess]:[i.Completed,i.Expired],[i.Completed]:[],[i.Expired]:[]},function(e){e.Accepted="accepted",e.RetryableExhausted="retryableExhausted",e.NonRetryable="nonRetryable",e.Interrupted="interrupted"}(a||(n.QuoteStatusFetchWithRetryOutcomeType=a={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/constants.cjs"}],[1537,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusGetError=n.QuoteStatusUpdateError=void 0;class r extends Error{constructor(e,t){super(`${t.errorType?`[${t.errorType}] `:""}${e}`),this.details=t,this.name=r.name,Object.setPrototypeOf(this,r.prototype)}}n.QuoteStatusUpdateError=r;class s extends Error{constructor(e,t,n=!1){super(e),this.details=t,this.retryable=n,this.name=s.name,Object.setPrototypeOf(this,s.prototype)}}n.QuoteStatusGetError=s}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/errors.cjs"}],[1538,{"../types.cjs":1553,"../utils/authentication.cjs":1555,"./constants.cjs":1536,"./errors.cjs":1537,"./quote-status-get-with-retry-outcome.cjs":1540,"./quote-status-update-with-retry-outcome.cjs":1542,"./utils.cjs":1544,"./validators.cjs":1545,"@metamask/bridge-controller":1501,"@metamask/superstruct":3882},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusApiService=void 0;const d=e("@metamask/bridge-controller"),p=e("@metamask/superstruct"),h=(e("../types.cjs"),e("../utils/authentication.cjs")),f=e("./constants.cjs"),m=e("./errors.cjs"),g=e("./quote-status-get-with-retry-outcome.cjs"),y=e("./quote-status-update-with-retry-outcome.cjs"),b=e("./utils.cjs"),w=e("./validators.cjs");n.QuoteStatusApiService=class{constructor({messenger:e,clientId:t,clientProduct:n,clientVersion:l,apiBaseUrl:d,onError:p}){r.set(this,void 0),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u(this,r,e,"f"),u(this,s,t,"f"),u(this,i,n,"f"),u(this,a,l,"f"),u(this,o,d,"f"),u(this,c,p,"f")}async updateQuoteStatus(e,t){const n=await(0,h.getJwt)(l(this,r,"f")),u=await globalThis.fetch(`${l(this,o,"f")}/quote/updateStatus`,{method:"POST",headers:{"Content-Type":"application/json","x-metamask-clientproduct":l(this,i,"f"),...l(this,a,"f")?{"x-metamask-clientversion":l(this,a,"f")}:{},...(0,d.getClientHeaders)({clientId:l(this,s,"f"),jwt:n})},body:JSON.stringify(e),signal:t});if(u.ok)return null;const p=await u.json();try{return(0,w.validateQuoteStatusUpdateResponse)(p),p}catch(t){throw l(this,c,"f")?.call(this,new m.QuoteStatusUpdateError("unexpected response shape from quote/updateStatus",{quoteId:e.quoteId})),t}}async getQuoteStatus(e,t){const n=await(0,h.getJwt)(l(this,r,"f")),u=await globalThis.fetch(`${l(this,o,"f")}/getQuoteStatus?quoteId=${e.quoteId}`,{method:"GET",headers:{"Content-Type":"application/json","x-metamask-clientproduct":l(this,i,"f"),...l(this,a,"f")?{"x-metamask-clientversion":l(this,a,"f")}:{},...(0,d.getClientHeaders)({clientId:l(this,s,"f"),jwt:n})},signal:t});if(!u.ok){const t=u.status>=500,n=new m.QuoteStatusGetError(`request error to getQuoteStatus [${u.status}: ${u.statusText}]`,{quoteId:e.quoteId},t);throw l(this,c,"f")?.call(this,n),n}const f=await u.json();try{return(0,w.validateQuoteStatusGetResponse)(f),f}catch(t){if(t instanceof p.StructError){const n=[];for(const{path:e}of t.failures()){const t=f?.submittedTx?.bridge??"unknown",r=e?.join(".")||"unknown";n.push([t,r].join("|"))}const r=new m.QuoteStatusGetError("unexpected response shape from getQuoteStatus",{quoteId:e.quoteId,validationFailures:n});throw l(this,c,"f")?.call(this,r),r}throw t}}async updateQuoteStatusWithRetry(e,t,n){for(let r=0;r<=t.maxRetries;r+=1){if(r>0&&await(0,b.sleep)(t.delayMsBetweenRetries),n?.aborted||!1===t.retry?.())return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);try{const t=await this.updateQuoteStatus(e,n);if(null===t)return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Accepted);if(!f.QuoteStatusUpdateRetryableBackendTypes.includes(t.type))return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.NonRetryable,t)}catch(e){if(n?.aborted)return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);throw e}}return new y.QuoteStatusUpdateWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted)}async getQuoteStatusWithRetry(e,t,n){for(let r=0;r<=t.maxRetries;r+=1){if(r>0&&await(0,b.sleep)(t.delayMsBetweenRetries),n?.aborted)return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);try{const t=await this.getQuoteStatus(e,n);return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Accepted,t)}catch(e){if(n?.aborted)return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.Interrupted);if(e instanceof m.QuoteStatusGetError&&!e.retryable)return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.NonRetryable,undefined,e)}}return new g.QuoteStatusGetWithRetryOutcome(f.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted)}},r=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-api-service.cjs"}],[1539,{"./constants.cjs":1536,"./quote-status-state-fsm.cjs":1541},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusEntryStore=void 0;const d=e("./constants.cjs"),p=e("./quote-status-state-fsm.cjs");class h{static hash(e){return`${e.quoteId}:${e.srcTxHash}`}constructor({onPersistUpdates:e,entryTtlMs:t,initial:n}){r.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),u(this,a,e,"f"),u(this,i,t,"f"),u(this,s,new Map(Object.entries(n??{}).map(([e,t])=>{const n=new p.QuoteStatusStateFsm(t.status);return[e,{...t,status:n}]})),"f");for(const e of l(this,s,"f").values())l(this,r,"m",o).call(this,e)}put(e,t){const n=l(this,s,"f").get(e);if(n)return!n.txMetaId&&t.txMetaId&&(n.txMetaId=t.txMetaId,l(this,r,"m",c).call(this)),n;const i=Date.now(),a={...t,createdAt:i,lastAttemptAt:i};return l(this,s,"f").set(e,a),l(this,r,"m",o).call(this,a),l(this,r,"m",c).call(this),a}values(){return this.expireStaleEntries(),l(this,s,"f").values()}getByQuoteId(e){this.expireStaleEntries();const t=[];for(const n of l(this,s,"f").values())n.quoteId===e&&t.push(n);return t}get size(){return l(this,s,"f").size}getByTxMetaId(e){for(const t of l(this,s,"f").values())if(t.txMetaId===e)return this.expireEntryIfStale(t),t;return null}get(e){const t=l(this,s,"f").get(e);return t?(this.expireEntryIfStale(t),t):null}update(e){l(this,s,"f").has(h.hash(e))&&l(this,r,"m",c).call(this)}expireStaleEntries(){for(const e of l(this,s,"f").values())this.entryHasExpired(e)&&e.status.transitionTo(d.QuoteStatusState.Expired)}entryHasExpired(e){return Date.now()-e.createdAt>l(this,i,"f")}expireEntryIfStale(e){return!!this.entryHasExpired(e)&&(e.status.transitionTo(d.QuoteStatusState.Expired),!0)}clear(){for(const e of l(this,s,"f").values())e.status.removeAllListeners();l(this,s,"f").clear()}}n.QuoteStatusEntryStore=h,s=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakSet,o=function(e){e.status.onStateUpdate(()=>l(this,r,"m",c).call(this))},c=function(){const e={};for(const[t,n]of l(this,s,"f"))e[t]={...n,status:n.status.state};l(this,a,"f").call(this,e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-entry-store.cjs"}],[1540,{"./constants.cjs":1536,"./errors.cjs":1537},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusGetWithRetryOutcome=void 0;e("./constants.cjs"),e("./errors.cjs");n.QuoteStatusGetWithRetryOutcome=class{constructor(e,t,n){this.type=e,this.response=t,this.error=n}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs"}],[1541,{"./constants.cjs":1536},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusStateFsm=void 0;const u=e("./constants.cjs");n.QuoteStatusStateFsm=class{constructor(e=u.QuoteStatusState.Submitted){r.add(this),s.set(this,void 0),i.set(this,new Set),o(this,s,e,"f")}get state(){return c(this,s,"f")}canTransitionTo(e){return u.AllowedQuoteStatusStateTransitions[c(this,s,"f")]?.includes(e)??!1}transitionTo(e){if(!this.canTransitionTo(e))return!1;const t=c(this,s,"f");return o(this,s,e,"f"),c(this,r,"m",a).call(this,{previousState:t,nextState:e}),!0}onStateUpdate(e){return c(this,i,"f").add(e),()=>c(this,i,"f").delete(e)}removeAllListeners(){c(this,i,"f").clear()}toJson(){return{state:this.state}}},s=new WeakMap,i=new WeakMap,r=new WeakSet,a=function(e){for(const t of[...c(this,i,"f")])t(e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-state-fsm.cjs"}],[1542,{"./constants.cjs":1536},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusUpdateWithRetryOutcome=void 0;e("./constants.cjs");n.QuoteStatusUpdateWithRetryOutcome=class{constructor(e,t){this.type=e,this.response=t}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs"}],[1543,{"../types.cjs":1553,"../utils/transaction.cjs":1568,"./constants.cjs":1536,"./errors.cjs":1537,"./quote-status-api-service.cjs":1538,"./quote-status-entry-store.cjs":1539,"./quote-status-get-with-retry-outcome.cjs":1540,"./quote-status-state-fsm.cjs":1541,"./quote-status-update-with-retry-outcome.cjs":1542,"@metamask/transaction-controller":3939},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a,o,c,u,l,d,p,h,f,m,g,y,b,w,v,_=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},T=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.QuoteStatusManager=void 0;const S=e("@metamask/transaction-controller"),I=(e("../types.cjs"),e("../utils/transaction.cjs")),E=e("./constants.cjs"),k=e("./errors.cjs"),A=e("./quote-status-api-service.cjs"),C=e("./quote-status-entry-store.cjs"),O=(e("./quote-status-get-with-retry-outcome.cjs"),e("./quote-status-state-fsm.cjs"));e("./quote-status-update-with-retry-outcome.cjs");n.QuoteStatusManager=class{constructor({messenger:e,clientId:t,clientProduct:n,clientVersion:d,apiBaseUrl:p,onError:h,isEnabled:f,onPersistUpdates:m,entryTtlMs:g,updateIntervalMs:y,initialData:b}){r.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u.set(this,void 0),l.set(this,null),_(this,o,f,"f"),_(this,c,h,"f"),_(this,u,y,"f"),_(this,s,e,"f"),_(this,i,new A.QuoteStatusApiService({messenger:e,clientId:t,clientProduct:n,clientVersion:d,apiBaseUrl:p,onError:h}),"f"),_(this,a,new C.QuoteStatusEntryStore({onPersistUpdates:m,entryTtlMs:g,initial:b}),"f")}get enabled(){return Boolean(T(this,o,"f")?.call(this))}reportFinalised(e,t){if(!T(this,o,"f")?.call(this))return;const n=T(this,a,"f").getByTxMetaId(e);if(!n)return void T(this,c,"f")?.call(this,new k.QuoteStatusUpdateError("reporting finalization status but entry was not found",{quoteId:""}));const s=t?E.QuoteStatusState.FinalizedSuccess:E.QuoteStatusState.FinalizedFailed;n.status.canTransitionTo(s)&&(n.status.transitionTo(s),T(this,r,"m",p).call(this),T(this,r,"m",y).call(this,n))}reportSubmitted(e,t,n){if(!T(this,o,"f")?.call(this))return;const s=T(this,a,"f").getByQuoteId(e).some(e=>e.status.state!==E.QuoteStatusState.Submitted);if(s)return;const i=C.QuoteStatusEntryStore.hash({quoteId:e,srcTxHash:t}),c=T(this,a,"f").put(i,{quoteId:e,srcTxHash:t,txMetaId:n,status:new O.QuoteStatusStateFsm(E.QuoteStatusState.Submitted)});T(this,r,"m",p).call(this),T(this,r,"m",y).call(this,c)}destroy(){T(this,r,"m",h).call(this),T(this,a,"f").clear()}init(){T(this,r,"m",d).call(this);for(const e of T(this,a,"f").values()){if(e.status.state!==E.QuoteStatusState.Submitted||!e.txMetaId)continue;const t=(0,I.getTransactionMetaById)(T(this,s,"f"),e.txMetaId);if(!t)continue;(t.type!==undefined&&(0,I.isCrossChainTx)(t.type)||(0,I.hasNestedSwapTransactions)(t))&&(t.status===S.TransactionStatus.confirmed?this.reportFinalised(e.txMetaId,!0):t.status!==S.TransactionStatus.failed&&t.status!==S.TransactionStatus.dropped||this.reportFinalised(e.txMetaId,!1))}}async getStatus(e,t={maxRetries:0,delayMsBetweenRetries:1e3}){if(!T(this,o,"f")?.call(this))return undefined;return T(this,i,"f").getQuoteStatusWithRetry({quoteId:e},{maxRetries:t.maxRetries??0,delayMsBetweenRetries:t.delayMsBetweenRetries??1e3}).catch(()=>undefined)}},s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,r=new WeakSet,d=function(){for(const e of T(this,a,"f").values())T(this,r,"m",y).call(this,e);T(this,r,"m",m).call(this)&&T(this,r,"m",p).call(this)},p=function(){null===T(this,l,"f")&&_(this,l,setInterval(()=>T(this,r,"m",f).call(this),T(this,u,"f")),"f")},h=function(){null!==T(this,l,"f")&&(clearInterval(T(this,l,"f")),_(this,l,null,"f"))},f=function(){if(!T(this,o,"f")?.call(this))return;const e=[...T(this,a,"f").values()];if(T(this,r,"m",m).call(this))for(const t of e)T(this,r,"m",y).call(this,t);else T(this,r,"m",h).call(this)},m=function(){for(const e of T(this,a,"f").values()){const{state:t}=e.status;if(!(t===E.QuoteStatusState.Completed||t===E.QuoteStatusState.Expired)&&e.acknowledgedState!==t)return!0}return!1},g=function(){T(this,r,"m",m).call(this)||T(this,r,"m",h).call(this)},y=function e(t){if(t.acknowledgedState===t.status.state)return;const n=t.status.state,s=E.QuoteStatusStateToBackendStatus[n];if(null===s)return void T(this,r,"m",g).call(this);T(this,i,"f").updateQuoteStatusWithRetry({quoteId:t.quoteId,srcTxHash:t.srcTxHash,newStatus:s},{maxRetries:5,delayMsBetweenRetries:3e3,retry:()=>{const e=T(this,a,"f").get(C.QuoteStatusEntryStore.hash(t));return Boolean(e&&e.status.state===n&&e.acknowledgedState!==n)}}).then(s=>{switch(s.type){case E.QuoteStatusFetchWithRetryOutcomeType.Accepted:{const s=T(this,a,"f").get(C.QuoteStatusEntryStore.hash(t));return s?s.status.state!==n?(T(this,r,"m",e).call(this,s),undefined):n===E.QuoteStatusState.FinalizedSuccess||n===E.QuoteStatusState.FinalizedFailed?(T(this,r,"m",b).call(this,s),undefined):(s.acknowledgedState=n,T(this,a,"f").update(s),T(this,r,"m",g).call(this),undefined):undefined}case E.QuoteStatusFetchWithRetryOutcomeType.NonRetryable:return T(this,r,"m",v).call(this,t,s),undefined;case E.QuoteStatusFetchWithRetryOutcomeType.Interrupted:return T(this,r,"m",e).call(this,t),undefined;case E.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted:return t.lastAttemptAt=Date.now(),T(this,a,"f").update(t),undefined;default:return undefined}}).catch(()=>{t.lastAttemptAt=Date.now(),T(this,a,"f").update(t)})},b=function(e,t){t&&e.status.canTransitionTo(t)&&e.status.transitionTo(t),e.status.canTransitionTo(E.QuoteStatusState.Completed)&&e.status.transitionTo(E.QuoteStatusState.Completed),T(this,r,"m",g).call(this)},w=function(e){e.status.canTransitionTo(E.QuoteStatusState.Expired)&&e.status.transitionTo(E.QuoteStatusState.Expired),T(this,r,"m",g).call(this)},v=function(e,t){const{response:n}=t,s={[E.QuoteStatusBackendStatus.FinalizedSuccess]:E.QuoteStatusState.FinalizedSuccess,[E.QuoteStatusBackendStatus.FinalizedFailed]:E.QuoteStatusState.FinalizedFailed};if(n?.type!==E.QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction||n.currentStatus!==E.QuoteStatusBackendStatus.FinalizedSuccess&&n.currentStatus!==E.QuoteStatusBackendStatus.FinalizedFailed){if(n?.type===E.QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction||n?.type===E.QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch){const t=s[n.currentStatus];if(t){if(e.status.canTransitionTo(t))return e.status.transitionTo(t),void T(this,r,"m",y).call(this,e);if(e.status.state===t)return;return e.status.state!==E.QuoteStatusState.Completed&&e.status.state!==E.QuoteStatusState.Expired&&T(this,c,"f")?.call(this,new k.QuoteStatusUpdateError(`reporting finalization status but entry cannot transition from "${e.status.state}" to "${t}"`,{quoteId:e.quoteId})),void T(this,r,"m",b).call(this,e)}}T(this,r,"m",w).call(this,e),T(this,c,"f")?.call(this,new k.QuoteStatusUpdateError("abandoning entry due to non-retryable error",{quoteId:e.quoteId,errorType:n?.type}))}else T(this,r,"m",b).call(this,e,s[n.currentStatus])}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quotes-status-manager.cjs"}],[1544,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sleep=void 0;n.sleep=e=>new Promise(t=>setTimeout(t,e))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/utils.cjs"}],[1545,{"../utils/validators.cjs":1569,"./constants.cjs":1536,"@metamask/superstruct":3882},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateQuoteStatusGetResponse=n.QuoteStatusGetResponseSchema=n.validateQuoteStatusUpdateResponse=n.QuoteStatusUpdateResponseSchema=void 0;const r=e("@metamask/superstruct"),s=e("../utils/validators.cjs"),i=e("./constants.cjs"),a=(0,r.type)({statusCode:(0,r.number)(),message:(0,r.string)(),type:(0,r.enums)(i.QuoteStatusUpdateBackendOnChainMismatchTypes),currentStatus:(0,r.enums)(i.QuoteStatusBackendValues),newStatus:(0,r.enums)(i.QuoteStatusBackendValues)}),o=(0,r.type)({statusCode:(0,r.number)(),message:(0,r.string)(),type:(0,r.enums)(i.BaseQuoteStatusUpdateErrorTypes)});n.QuoteStatusUpdateResponseSchema=(0,r.union)([a,o]),n.validateQuoteStatusUpdateResponse=function(e){(0,r.assert)(e,n.QuoteStatusUpdateResponseSchema)},n.QuoteStatusGetResponseSchema=(0,r.type)({submittedTx:(0,r.optional)(s.StatusResponseSchema)}),n.validateQuoteStatusGetResponse=function(e){(0,r.assert)(e,n.QuoteStatusGetResponseSchema)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/validators.cjs"}],[1546,{"../utils/transaction.cjs":1568,"./types.cjs":1552,"@metamask/transaction-controller":3939},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitBatchSellHandler=void 0;const r=e("@metamask/transaction-controller"),s=e("../utils/transaction.cjs"),i=e("./types.cjs"),a=({quoteResponse:{quoteId:e,quote:t}})=>e??t.requestId;n.submitBatchSellHandler=async function*(e){const{requireApproval:t,quoteResponses:n,messenger:o,addTransactionBatchFn:c,isDelegatedAccount:u,batchSellTrades:l,batchId:d}=e,p=(0,s.toQuoteAndTxMetadataBatch)({quoteResponses:n,batchSellTrades:l}),{gasIncluded7702:h,gasIncluded:f,gasSponsored:m}=l,g=p.find(({type:e})=>e===r.TransactionType.tokenMethodTransfer)?.tx.to,y=await(0,s.getAddTransactionBatchParams)({messenger:o,tradeData:p,requireApproval:t,isDelegatedAccount:u,atomic:!1,disable7702:(0,s.shouldDisable7702)(h,f,u),isGasFeeSponsored:m,isGasFeeIncluded:Boolean(h),batchId:d,skipInitialGasEstimate:h?u:Boolean(g),excludeNativeTokenForFee:!g}),{batchId:b}=await c(y),w=(0,s.findAllTransactionsInBatch)({messenger:o,batchId:b,tradeData:p}).filter(e=>(0,s.isTradeTx)(e.type)&&e.txMeta!==undefined),v=w.find(({txMeta:e})=>e?.type&&((0,s.isTradeTx)(e.type)||(0,s.hasNestedSwapTransactions)(e))),_=v?.txMeta;if(!_)throw new Error("Failed to add BatchSell trade to history: txMeta not found");if(yield{type:i.SubmitStep.SetTradeMeta,payload:{tradeMeta:_}},(0,s.is7702Tx)(_)||(0,s.hasNestedSwapTransactions)(_)){const e=Array.from(new Set(w.map(a)));yield{type:i.SubmitStep.AddHistoryItem,payload:{historyKey:_.id,quoteResponse:v.quoteResponse,batchSellData:l,quoteIds:e,bridgeTxMeta:_}};for(const e of w){const{quoteResponse:t}=e;yield{type:i.SubmitStep.AddHistoryItem,payload:{historyKey:a(e),quoteResponse:t,batchSellData:l}}}}else for(const{txMeta:e,quoteResponse:t}of w)yield{type:i.SubmitStep.AddHistoryItem,payload:{historyKey:e.id,quoteResponse:t,batchSellData:l,bridgeTxMeta:e}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/batch-sell-strategy.cjs"}],[1547,{"../utils/transaction.cjs":1568,"./types.cjs":1552},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitBatchHandler=void 0;const r=e("../utils/transaction.cjs"),s=e("./types.cjs");n.submitBatchHandler=async function*(e){const{requireApproval:t,quoteResponses:[n],messenger:i,isBridgeTx:a,addTransactionBatchFn:o,isDelegatedAccount:c}=e,u=(0,r.toQuoteAndTxMetadata)({quoteResponse:n,isBridgeTx:a}),l=await(0,r.getAddTransactionBatchParams)({tradeData:u,requireApproval:t,isDelegatedAccount:c,messenger:i,atomic:!0,disable7702:(0,r.shouldDisable7702)(n.quote.gasIncluded7702,n.quote.gasIncluded,c),isGasFeeSponsored:Boolean(n.quote.gasSponsored),isGasFeeIncluded:Boolean(n.quote.gasIncluded7702)}),{batchId:d}=await o(l),p=(0,r.findAllTransactionsInBatch)({messenger:i,batchId:d,tradeData:u});yield{type:s.SubmitStep.UpdateBatchTransactions,payload:{quoteAndTxMetas:p}};const h=p.find(({type:e,txMeta:t})=>(0,r.isTradeTx)(e)&&t)?.txMeta,f=p.find(({type:e,txMeta:t})=>(0,r.isApprovalTx)(e)&&t)?.txMeta;if(!h)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");yield{type:s.SubmitStep.SetTradeMeta,payload:{tradeMeta:h}},yield{type:s.SubmitStep.AddHistoryItem,payload:{historyKey:h.id,approvalTxId:f?.id,bridgeTxMeta:{id:h.id,hash:h.hash,batchId:h.batchId},quoteResponse:n}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/batch-strategy.cjs"}],[1548,{"../utils/accounts.cjs":1554,"../utils/network.cjs":1564,"../utils/trace.cjs":1567,"../utils/transaction.cjs":1568,"./types.cjs":1552,"@metamask/bridge-controller":1501,"@metamask/transaction-controller":3939},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitEvmHandler=n.handleEvmApprovals=n.handleSingleTx=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/transaction-controller"),i=e("../utils/accounts.cjs"),a=e("../utils/network.cjs"),o=e("../utils/trace.cjs"),c=e("../utils/transaction.cjs"),u=e("./types.cjs");n.handleSingleTx=async({messenger:e,trade:t,transactionType:n,requireApproval:s=!1,txFee:o,actionId:u=(0,c.generateActionId)()})=>{if(!(0,i.getAccountByAddress)(e,t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const l=(0,r.formatChainIdToHex)(t.chainId),d=(0,a.getNetworkClientIdByChainId)(e,l),p={actionId:u,networkClientId:d,requireApproval:s,type:n,origin:"metamask",isInternal:!0},h=await(0,c.toTransactionParams)(e,t,d,l,o);return await(0,c.addTransaction)(e,{...h,from:t.from},p)};n.handleEvmApprovals=async e=>await e.traceFn((0,o.getApprovalTraceParams)(e.quoteResponses[0],e.isStxEnabled),async()=>await(async e=>{const{quoteResponses:[t],isBridgeTx:i}=e,{approval:a,resetApproval:o}=t;if(!a||!(0,r.isEvmTxData)(a))return undefined;const c=i?s.TransactionType.bridgeApproval:s.TransactionType.swapApproval;if(o&&await(0,n.handleSingleTx)({...e,transactionType:c,trade:o}),a){const t=await(0,n.handleSingleTx)({...e,transactionType:c,trade:a});return t?.id}})(e)),n.submitEvmHandler=async function*(e){const{quoteResponses:[t],requireApproval:r,isBridgeTx:i}=e,a=await(0,n.handleEvmApprovals)(e);a&&await(0,c.handleApprovalDelay)(t.quote.srcChainId),await(0,c.handleMobileHardwareWalletDelay)(r),r&&a&&await(0,c.waitForTxConfirmation)(e.messenger,a);const o=(0,c.generateActionId)();yield{type:u.SubmitStep.AddHistoryItem,payload:{historyKey:o,approvalTxId:a,actionId:o,quoteResponse:t}};const l=i?s.TransactionType.bridge:s.TransactionType.swap,d=await(0,n.handleSingleTx)({...e,transactionType:l,trade:t.trade,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined,actionId:o});yield{type:u.SubmitStep.RekeyHistoryItem,payload:{oldHistoryKey:o,newHistoryKey:d.id,tradeMeta:d}},yield{type:u.SubmitStep.SetTradeMeta,payload:{tradeMeta:d}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/evm-strategy.cjs"}],[1549,{"./batch-sell-strategy.cjs":1546,"./batch-strategy.cjs":1547,"./evm-strategy.cjs":1548,"./intent-strategy.cjs":1550,"./non-evm-strategy.cjs":1551,"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});const r=e("@metamask/bridge-controller"),s=e("./batch-sell-strategy.cjs"),i=e("./batch-strategy.cjs"),a=e("./evm-strategy.cjs"),o=e("./intent-strategy.cjs"),c=e("./non-evm-strategy.cjs"),u=e=>{const t=e.quoteResponses.flatMap(e=>[e.trade,e.approval,e.resetApproval]).filter(e=>e!==undefined);switch(e.quoteResponses[0].quote.srcChainId){case r.ChainId.SOLANA:return t.every(e=>"string"==typeof e);case r.ChainId.BTC:return t.every(r.isBitcoinTrade);case r.ChainId.STELLAR:return t.every(e=>"string"==typeof e||(0,r.isStellarTrade)(e));case r.ChainId.TRON:return t.every(r.isTronTrade);default:return t.every(r.isEvmTxData)}};n.default=e=>{const{quoteResponses:[t],isStxEnabled:n,isDelegatedAccount:l}=e;if((0,r.isNonEvmChainId)(t.quote.srcChainId)){if(!u(e))throw new Error("Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction");return(0,c.submitNonEvmHandler)(e)}if(!u(e))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");if(t.quote.intent)return(0,o.submitIntentHandler)(e);if((e=>Boolean(e.batchSellTrades)&&e.quoteResponses.length>=1)(e))return(0,s.submitBatchSellHandler)(e);return n||t.quote.gasIncluded7702||l?(0,i.submitBatchHandler)(e):(0,a.submitEvmHandler)(e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/index.cjs"}],[1550,{"../utils/authentication.cjs":1555,"../utils/intent-api.cjs":1561,"../utils/keyring.cjs":1562,"../utils/network.cjs":1564,"../utils/transaction.cjs":1568,"./evm-strategy.cjs":1548,"./types.cjs":1552,"@metamask/bridge-controller":1501,"@metamask/transaction-controller":3939},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitIntentHandler=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/transaction-controller"),i=e("../utils/authentication.cjs"),a=e("../utils/intent-api.cjs"),o=e("../utils/keyring.cjs"),c=e("../utils/network.cjs"),u=e("../utils/transaction.cjs"),l=e("./evm-strategy.cjs"),d=e("./types.cjs");n.submitIntentHandler=async function*(e){const t=await(0,l.handleEvmApprovals)(e);t&&await(0,u.waitForTxConfirmation)(e.messenger,t);const{orderUid:n,orderStatus:p}=await(async e=>{const{quoteResponses:[t],messenger:n,selectedAccount:r,clientId:s,fetchFn:c,bridgeApiBaseUrl:u}=e,{srcChainId:l,requestId:d}=t.quote,p=(0,a.getIntentFromQuote)(t),h=await(0,o.signTypedMessage)({messenger:n,accountAddress:r.address,typedData:p.typedData}),{id:f,status:m}=await(0,a.postSubmitOrder)({params:{srcChainId:l,quoteId:d,signature:h,order:p.order,userAddress:r.address,aggregatorId:p.protocol},clientId:s,jwt:await(0,i.getJwt)(n),fetchFn:c,bridgeApiBaseUrl:u});return{orderUid:f,orderStatus:m}})(e),h=await(async(e,t)=>{const{quoteResponses:[n],messenger:i,isBridgeTx:o,selectedAccount:l}=t,{quote:{srcChainId:d}}=n,p=o?s.TransactionType.bridge:s.TransactionType.swap,h=(0,c.getNetworkClientIdByChainId)(i,d);if(!(0,r.isEvmTxData)(n.trade))throw new Error("Failed to submit intent: trade is not an EVM transaction");const f=(0,a.getIntentFromQuote)(n),m={chainId:(0,r.formatChainIdToHex)(d),from:l.address,to:f.settlementContract??"0x9008D19f58AAbd9eD0D60971565AA8510560ab41",data:`0x${e?.slice(-8)}`,value:"0x0",gas:"0x5208",gasPrice:"0x3b9aca00"};return await(0,u.addSyntheticTransaction)(i,m,{requireApproval:!1,networkClientId:h,type:p})})(n,{...e,requireApproval:!1,isStxEnabled:!1});yield{type:d.SubmitStep.SetTradeMeta,payload:{tradeMeta:{...h,status:(0,a.mapIntentOrderStatusToTransactionStatus)(p)}}},yield{type:d.SubmitStep.AddHistoryItem,payload:{historyKey:n,bridgeTxMeta:{id:h?.id},approvalTxId:t,originalTransactionId:h?.id,quoteResponse:e.quoteResponses[0]}},yield{type:d.SubmitStep.StartPolling,payload:{historyKey:n}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/intent-strategy.cjs"}],[1551,{"../utils/snaps.cjs":1565,"../utils/trace.cjs":1567,"../utils/transaction.cjs":1568,"./types.cjs":1552,"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.submitNonEvmHandler=void 0;const r=e("@metamask/bridge-controller"),s=e("../utils/snaps.cjs"),i=e("../utils/trace.cjs"),a=e("../utils/transaction.cjs"),o=e("./types.cjs");n.submitNonEvmHandler=async function*(e){const{quoteResponses:[t],isBridgeTx:n}=e,c=await(async e=>{const{quoteResponses:[t],traceFn:n}=e,r=await n((0,i.getApprovalTraceParams)(t,!1),async()=>t.approval?(await(0,s.handleNonEvmTx)(e.messenger,t.approval,t,e.selectedAccount)).id:undefined);return r?(await(0,a.handleApprovalDelay)(t.quote.srcChainId),r):undefined})(e),u=await(0,s.handleNonEvmTx)(e.messenger,t.trade,t,e.selectedAccount);yield{type:o.SubmitStep.SetTradeMeta,payload:{tradeMeta:u}},yield{type:o.SubmitStep.AddHistoryItem,payload:{historyKey:u.id,approvalTxId:c,bridgeTxMeta:{id:u.id,hash:u.hash},quoteResponse:t}},yield{type:o.SubmitStep.StartPolling,payload:{historyKey:u.id}},(0,r.isTronChainId)(t.quote.srcChainId)||n||(yield{type:o.SubmitStep.PublishCompletedEvent,payload:{historyKey:u.id}})}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/non-evm-strategy.cjs"}],[1552,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r;Object.defineProperty(n,"__esModule",{value:!0}),n.SubmitStep=void 0,function(e){e.AddHistoryItem="addHistoryItem",e.RekeyHistoryItem="rekeyHistoryItem",e.StartPolling="startPolling",e.PublishCompletedEvent="publishCompletedEvent",e.SetTradeMeta="setTradeMeta",e.UpdateBatchTransactions="updateBatchTransactions"}(r||(n.SubmitStep=r={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/types.cjs"}],[1553,{"./constants.cjs":1534,"./quote-status-manager/constants.cjs":1536,"./utils/validators.cjs":1569},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusAction=n.BridgeId=n.BridgeClientId=void 0;e("./constants.cjs"),e("./quote-status-manager/constants.cjs"),e("./utils/validators.cjs");var r,s,i;!function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(r||(n.BridgeClientId=r={})),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"}(s||(n.BridgeId=s={})),function(e){e.StartPollingForBridgeTxStatus="StartPollingForBridgeTxStatus",e.WipeBridgeStatus="WipeBridgeStatus",e.GetState="GetState",e.ResetState="ResetState",e.SubmitTx="SubmitTx",e.SubmitIntent="SubmitIntent",e.RestartPollingForFailedAttempts="RestartPollingForFailedAttempts",e.GetBridgeHistoryItemByTxMetaId="GetBridgeHistoryItemByTxMetaId"}(i||(n.BridgeStatusAction=i={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/types.cjs"}],[1554,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAccountByAddress=void 0;n.getAccountByAddress=(e,t)=>e.call("AccountsController:getAccountByAddress",t)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/accounts.cjs"}],[1555,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getJwt=void 0;n.getJwt=async e=>{try{return await e.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/authentication.cjs"}],[1556,{"../constants.cjs":1534,"../quote-status-manager/quotes-status-manager.cjs":1543,"./history.cjs":1560,"./network.cjs":1564,"./validators.cjs":1569,"@metamask/bridge-controller":1501,"@metamask/superstruct":3882},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getStatusRequestParams=n.shouldWaitForFinalBridgeStatus=n.shouldSkipFetchDueToFetchFailures=n.getStatusRequestWithSrcTxHash=n.fetchBridgeTxStatus=n.fetchBridgeQuoteStatus=n.getStatusRequestDto=n.getBridgeStatusUrl=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/superstruct"),i=e("../constants.cjs"),a=(e("../quote-status-manager/quotes-status-manager.cjs"),e("./history.cjs")),o=e("./network.cjs"),c=e("./validators.cjs");n.getBridgeStatusUrl=e=>`${e}/getTxStatus`;n.getStatusRequestDto=e=>{const{quote:t,...n}=e;return{...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};n.fetchBridgeQuoteStatus=async(e,t)=>{const n=await e.getStatus(t),r=n?.response?.submittedTx;return r?{status:r,validationFailures:n.error?.details?.validationFailures??[]}:null};n.fetchBridgeTxStatus=async(e,t,i,a,o)=>{const u=(0,n.getStatusRequestDto)(e),l=new URLSearchParams(u),d=`${(0,n.getBridgeStatusUrl)(o)}?${l.toString()}`,p=await a(d,{headers:(0,r.getClientHeaders)({clientId:t,jwt:i})}),h=[];try{(0,c.validateBridgeStatusResponse)(p)}catch(t){t instanceof s.StructError&&t.failures().forEach(({path:t})=>{const n=p?.bridge??(e.bridge||e.bridgeId)??"unknown",r=t?.join(".")||"unknown";h.push([n,r].join("|"))})}return{status:p,validationFailures:h}};n.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:n,bridges:r,srcChainId:s,destChainId:i,refuel:a}=e;return{bridgeId:n,srcTxHash:t,bridge:r[0],srcChainId:s,destChainId:i,quote:e,refuel:Boolean(a)}};n.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=i.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1};n.shouldWaitForFinalBridgeStatus=async(e,t)=>{if(!(0,a.isHistoryItemTooOld)(e,t)||![r.StatusTypes.PENDING,r.StatusTypes.UNKNOWN].includes(t.status.status))return!0;if((0,r.isNonEvmChainId)(t.quote.srcChainId))return!1;let n;try{n=(0,o.getNetworkClientByChainId)(e,t.quote.srcChainId)}catch{return!0}return!!t.status.srcChain.txHash&&n.request({method:"eth_getTransactionReceipt",params:[t.status.srcChain.txHash]}).then(e=>!!e).catch(()=>!1)};n.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs"}],[1557,{"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.trackMetricsEvent=n.getBatchSellTrades=n.stopPollingForQuotes=void 0;const r=e("@metamask/bridge-controller");n.stopPollingForQuotes=(e,t)=>{e.call("BridgeController:stopPollingForQuotes",r.AbortReason.TransactionSubmitted,t)};n.getBatchSellTrades=e=>e.call("BridgeController:getState").batchSellTrades;n.trackMetricsEvent=({messenger:e,eventName:t,properties:n})=>{e.call("BridgeController:trackUnifiedSwapBridgeEvent",t,n)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge.cjs"}],[1558,{"../constants.cjs":1534,"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getMaxPendingHistoryItemAgeMs=void 0;const r=e("@metamask/bridge-controller"),s=e("../constants.cjs");n.getMaxPendingHistoryItemAgeMs=e=>(0,r.getBridgeFeatureFlags)(e).maxPendingHistoryItemAgeMs??s.DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/feature-flags.cjs"}],[1559,{"bignumber.js":1570},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calcActualGasUsed=void 0;const r=e("bignumber.js"),s=(e,t)=>e&&t?new r.BigNumber(e,16).times(new r.BigNumber(t,16)):null;n.calcActualGasUsed=({pricingData:e},t,n)=>{const i=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,a=s(t?.gasUsed,t?.effectiveGasPrice)?.plus(s(n?.gasUsed,n?.effectiveGasPrice)??0),o=a?.div(new r.BigNumber(10).pow(18)).toString(10);return a&&o?{amount:a.toString(10),usd:i?.multipliedBy(o).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],[1560,{"./feature-flags.cjs":1558,"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isHistoryItemTooOld=n.shouldPollHistoryItem=n.getInitialHistoryItem=n.getHistoryKey=n.getBatchSellHistoryItemsForTxHash=n.getMatchingHistoryEntryForApprovalTxMeta=n.getMatchingHistoryEntryForTxMeta=n.isBatchSellHistoryItem=n.rekeyHistoryItemInState=void 0;const r=e("@metamask/bridge-controller"),s=e("./feature-flags.cjs"),i=(e,t)=>({...e,txMetaId:t.id,originalTransactionId:e.originalTransactionId??t.id,status:{...e.status,srcChain:{...e.status.srcChain,txHash:t.hash??e.status.srcChain?.txHash}}});n.rekeyHistoryItemInState=(e,t,n,r)=>{const s=e.txHistory[t];return!!s&&(e.txHistory[n]={...s,...i(s,r)},delete e.txHistory[t],!0)};n.isBatchSellHistoryItem=e=>Boolean(e?.batchSellData);n.getMatchingHistoryEntryForTxMeta=(e,t)=>Object.entries(e).find(([e,r])=>{const{txMetaId:s,actionId:i,batchId:a,status:{srcChain:{txHash:o}}}=r;return e===t.id||e===t.actionId||s===t.id||!!i&&i===t.actionId||Boolean(a)&&!(0,n.isBatchSellHistoryItem)(r)&&a===t.batchId||!!o&&o.toLowerCase()===t.hash?.toLowerCase()});n.getMatchingHistoryEntryForApprovalTxMeta=(e,t)=>Object.entries(e).find(([e,n])=>!!n.approvalTxId&&n.approvalTxId===t.id);n.getBatchSellHistoryItemsForTxHash=(e,t)=>{const n=Object.values(e);if(!t)return{historyItems:[],is7702Batch:!1};const r=n.find(({status:e,txMetaId:n})=>e.srcChain.txHash?.toLowerCase()===t.toLowerCase()||n===t);return{historyItems:(r?.quoteIds?.map(t=>e[t])??n.filter(({batchId:e})=>e&&r?.batchId&&e===r.batchId)).filter(e=>e!==undefined),is7702Batch:Boolean(r)&&Boolean(r?.quoteIds?.length)}},n.getHistoryKey=function(e,t,n){const r=e??t??n;if(!r)throw new Error("Cannot add tx to history: either actionId, bridgeTxMeta.id, or syntheticTransactionId must be provided");return r};n.getInitialHistoryItem=e=>{const{bridgeTxMeta:t,quoteResponse:n,startTime:s,slippagePercentage:i,initialDestAssetBalance:a,targetContractAddress:o,approvalTxId:c,isStxEnabled:u,location:l,abTests:d,activeAbTests:p,accountAddress:h,originalTransactionId:f,actionId:m,tokenSecurityTypeDestination:g,inputPrimaryDenomination:y,batchSellData:b,quoteIds:w}=e,v={txMetaId:t?.id,actionId:m,originalTransactionId:f??t?.id,batchId:t?.batchId,quote:n.quote,quoteId:n.quoteId,startTime:s,estimatedProcessingTimeInSeconds:n.estimatedProcessingTimeInSeconds,slippagePercentage:i,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:a,targetContractAddress:o,account:h,status:{status:r.StatusTypes.PENDING,srcChain:{chainId:n.quote.srcChainId,txHash:(0,r.isNonEvmChainId)(n.quote.srcChainId)||!u?t?.hash:undefined}},hasApprovalTx:Boolean(n.approval),approvalTxId:c,isStxEnabled:Boolean(u),featureId:n.featureId,location:l,...d&&{abTests:d},...p&&{activeAbTests:p},...g!==undefined&&{tokenSecurityTypeDestination:g},...y!==undefined&&{inputPrimaryDenomination:y}};return b&&(v.batchSellData=b),w&&(v.quoteIds=w),v};n.shouldPollHistoryItem=e=>{const t=Boolean(e?.quote?.intent);return[(0,r.isCrossChain)(e.quote.srcChainId,e.quote.destChainId),t,(0,r.isTronChainId)(e.quote.srcChainId)].some(Boolean)};n.isHistoryItemTooOld=(e,t)=>{const n=(0,s.getMaxPendingHistoryItemAgeMs)(e);return Date.now()-t.startTime>n}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/history.cjs"}],[1561,{"./validators.cjs":1569,"@metamask/bridge-controller":1501,"@metamask/transaction-controller":3939},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,a=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.postSubmitOrder=n.getIntentFromQuote=n.mapIntentOrderStatusToTransactionStatus=n.translateIntentOrderToBridgeStatus=n.IntentApiImpl=void 0;const c=e("@metamask/bridge-controller"),u=e("@metamask/transaction-controller"),l=e("./validators.cjs");n.IntentApiImpl=class{constructor(e,t,n){r.set(this,void 0),s.set(this,void 0),i.set(this,void 0),a(this,r,e,"f"),a(this,s,t,"f"),a(this,i,n,"f")}async getOrderStatus(e,t,n,a){const u=`${o(this,r,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${n}`;try{const e=await o(this,i,"f").call(this),t=await o(this,s,"f").call(this,u,{method:"GET",headers:(0,c.getClientHeaders)({clientId:a,jwt:e})});if(!(0,l.validateIntentStatusResponse)(t))throw new Error("Invalid getOrderStatus response");return t}catch(e){if(e instanceof Error)throw new Error(`Failed to get order status: ${e.message}`);throw new Error("Failed to get order status")}}},r=new WeakMap,s=new WeakMap,i=new WeakMap;function d(e){switch(e){case l.IntentOrderStatus.PENDING:case l.IntentOrderStatus.SUBMITTED:return u.TransactionStatus.submitted;case l.IntentOrderStatus.CONFIRMED:case l.IntentOrderStatus.COMPLETED:return u.TransactionStatus.confirmed;case l.IntentOrderStatus.FAILED:case l.IntentOrderStatus.EXPIRED:case l.IntentOrderStatus.CANCELLED:return u.TransactionStatus.failed;default:return u.TransactionStatus.submitted}}n.translateIntentOrderToBridgeStatus=(e,t,n)=>{let r;switch(e.status){case l.IntentOrderStatus.CONFIRMED:case l.IntentOrderStatus.COMPLETED:r=c.StatusTypes.COMPLETE;break;case l.IntentOrderStatus.FAILED:case l.IntentOrderStatus.EXPIRED:case l.IntentOrderStatus.CANCELLED:r=c.StatusTypes.FAILED;break;case l.IntentOrderStatus.PENDING:r=c.StatusTypes.PENDING;break;case l.IntentOrderStatus.SUBMITTED:r=c.StatusTypes.SUBMITTED;break;default:r=c.StatusTypes.UNKNOWN}const s=e.txHash??n;return{status:{status:r,srcChain:{chainId:t,txHash:s}},txHash:s,transactionStatus:d(e.status)}},n.mapIntentOrderStatusToTransactionStatus=d,n.getIntentFromQuote=function(e){const{intent:t}=e.quote;if(!t)throw new Error("submitIntent: missing intent data");return t};n.postSubmitOrder=async({params:e,clientId:t,jwt:n,fetchFn:r,bridgeApiBaseUrl:s})=>{const i=`${s}/submitOrder`;try{const s=await r(i,{method:"POST",headers:{"Content-Type":"application/json",...(0,c.getClientHeaders)({clientId:t,jwt:n})},body:JSON.stringify(e)});if(!(0,l.validateIntentStatusResponse)(s))throw new Error("Invalid submitOrder response");return s}catch(e){if(e instanceof Error)throw new Error(`Failed to submit intent: ${e.message}`);throw new Error("Failed to submit intent")}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs"}],[1562,{"@metamask/keyring-controller":2798},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.signTypedMessage=void 0;const r=e("@metamask/keyring-controller");n.signTypedMessage=async({messenger:e,accountAddress:t,typedData:n})=>await e.call("KeyringController:signTypedMessage",{from:t,data:n},r.SignTypedDataVersion.V4)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/keyring.cjs"}],[1563,{"./gas.cjs":1559,"./swap-received-amount.cjs":1566,"@metamask/bridge-controller":1501,"@metamask/transaction-controller":3939,"bignumber.js":1570},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getEVMTxPropertiesFromTransactionMeta=n.getRequestMetadataFromHistory=n.getTradeDataFromHistory=n.getPreConfirmationPropertiesFromQuote=n.getPriceImpactFromQuote=n.getTradeDataFromQuote=n.getRequestParamFromHistory=n.getFinalizedTxProperties=n.getTxStatusesFromHistory=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/transaction-controller"),i=e("bignumber.js"),a=e("./gas.cjs"),o=e("./swap-received-amount.cjs");n.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:n,quote:s})=>{const i=e.srcChain.txHash?r.StatusTypes.COMPLETE:r.StatusTypes.PENDING,a=e.destChain?.txHash?e.status:r.StatusTypes.PENDING,o=(0,r.formatChainIdToHex)(s.srcChainId),c=(0,r.isEthUsdt)(o,s.srcAsset.address),u=e.srcChain.txHash?r.StatusTypes.COMPLETE:undefined,l=e.srcChain.txHash?r.StatusTypes.COMPLETE:r.StatusTypes.PENDING;return{allowance_reset_transaction:c?u:undefined,approval_transaction:t||n?l:undefined,source_transaction:i,destination_transaction:e.status===r.StatusTypes.FAILED?r.StatusTypes.FAILED:a}};n.getFinalizedTxProperties=(e,t,n)=>{const r=n?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===s.TransactionType.swap?t?.time:e.completionTime,u=(0,a.calcActualGasUsed)(e,t?.txReceipt,n?.txReceipt),l=t?.type===s.TransactionType.swap?(0,o.getActualSwapReceivedAmount)(e,u,t):(0,o.getActualBridgeReceivedAmount)(e),d=e.pricingData?.quotedGasAmount&&u?.amount?new i.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new i.BigNumber(10).pow(18)).div(u.amount).toNumber():0,p=e.pricingData?.quotedReturnInUsd&&l?.usd?new i.BigNumber(e.pricingData.quotedReturnInUsd).div(l.usd).toNumber():0;return{actual_time_minutes:c&&r?(c-r)/6e4:0,usd_actual_return:Number(l?.usd??0),usd_actual_gas:u?.usd??0,quote_vs_execution_ratio:p,quoted_vs_used_gas_ratio:d}};n.getRequestParamFromHistory=e=>({chain_id_source:(0,r.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,r.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId,token_security_type_destination:e.tokenSecurityTypeDestination??null});n.getTradeDataFromQuote=(e,t)=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??t?.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??t?.gasIncluded7702??!1,provider:(0,r.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});n.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});n.getPreConfirmationPropertiesFromQuote=(e,t,s,i,a,o,c,u,l)=>{const{quote:d}=e;return{...(0,n.getPriceImpactFromQuote)(d),...(0,n.getTradeDataFromQuote)(e,u),chain_id_source:(0,r.formatChainIdToCaip)(d.srcChainId),token_symbol_source:d.srcAsset.symbol,token_address_source:d.srcAsset.assetId,chain_id_destination:(0,r.formatChainIdToCaip)(d.destChainId),token_symbol_destination:d.destAsset.symbol,token_address_destination:d.destAsset.assetId,token_security_type_destination:c??null,account_hardware_type:s,is_hardware_wallet:null!==s,swap_type:(0,r.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:r.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1,location:i,...a&&Object.keys(a).length>0&&{ab_tests:a},...o&&o.length>0&&{active_ab_tests:o},...l?{batch_id:l}:{},feature_id:e.featureId??r.FeatureId.UNIFIED_SWAP_BRIDGE}};n.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,r.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});n.getRequestMetadataFromHistory=(e,t)=>{const{quote:n,slippagePercentage:s,isStxEnabled:i}=e,a=(0,r.getAccountHardwareType)(t);return{slippage_limit:s,custom_slippage:(0,r.isCustomSlippage)(s),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,r.getSwapType)(n.srcChainId,n.destChainId),account_hardware_type:a,is_hardware_wallet:null!==a,stx_enabled:i??!1,security_warnings:[]}};n.getEVMTxPropertiesFromTransactionMeta=(e,t)=>{const n=(0,r.getAccountHardwareType)(t);return{source_transaction:[s.TransactionStatus.failed,s.TransactionStatus.dropped,s.TransactionStatus.rejected].includes(e.status)?r.StatusTypes.FAILED:r.StatusTypes.COMPLETE,error_message:[`Transaction ${e.status}`,e.error?.message].filter(Boolean).join(". "),chain_id_source:(0,r.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,r.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:0,stx_enabled:!1,token_address_source:(0,r.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,r.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",token_security_type_destination:null,custom_slippage:!1,account_hardware_type:n,is_hardware_wallet:null!==n,swap_type:e.type&&[s.TransactionType.swap,s.TransactionType.swapApproval].includes(e.type)?r.MetricsSwapType.SINGLE:r.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:r.MetricsActionType.SWAPBRIDGE_V1,...e.batchId?{batch_id:e.batchId}:{}}}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],[1564,{"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getNetworkClientByChainId=n.getNetworkClientIdByChainId=n.getSelectedChainId=void 0;const r=e("@metamask/bridge-controller");n.getSelectedChainId=e=>{const{selectedNetworkClientId:t}=e.call("NetworkController:getState");return e.call("NetworkController:getNetworkClientById",t).configuration.chainId};n.getNetworkClientIdByChainId=(e,t)=>{const n=(0,r.formatChainIdToHex)(t);return e.call("NetworkController:findNetworkClientIdByChainId",n)};n.getNetworkClientByChainId=(e,t)=>{const r=(0,n.getNetworkClientIdByChainId)(e,t);return e.call("NetworkController:getNetworkClientById",r).provider}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/network.cjs"}],[1565,{"@metamask/bridge-controller":1501,"@metamask/snaps-controllers":3597,"@metamask/transaction-controller":3939,uuid:8155},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handleNonEvmTx=n.handleNonEvmTxResponse=n.getTxMetaFields=n.getClientRequest=n.createClientTransactionRequest=void 0;const r=e("@metamask/bridge-controller"),s=(e("@metamask/snaps-controllers"),e("@metamask/transaction-controller")),i=e("uuid");n.createClientTransactionRequest=(e,t,n,r,s)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,i.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:n,accountId:r,...s&&{options:s}}}});n.getClientRequest=(e,t,s,i,a,o)=>{const c=(0,r.formatChainIdToCaip)(t),u=(0,r.extractTradeData)(e);let l;return(0,r.isStellarTrade)(e)&&(a===undefined&&o===undefined||(l={...a!==undefined&&{sourceAssetId:a},...o!==undefined&&{destAssetId:o}})),(0,r.isTronTrade)(e)&&(l={visible:e.visible,type:e.raw_data?.contract?.[0]?.type}),(0,n.createClientTransactionRequest)(i,u,c,s,l)};n.getTxMetaFields=(e,t)=>{let n;try{n=(0,r.formatChainIdToHex)(e.quote.destChainId)}catch{n=s.CHAIN_IDS.MAINNET}return{destinationChainId:n,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};n.handleNonEvmTxResponse=(e,t,a,o)=>{const c=o.address,u=o.metadata.snap?.id;let l;"string"==typeof e?l=e:e&&"object"==typeof e&&("transactionId"in e&&e.transactionId?l=e.transactionId:"result"in e&&e.result&&"object"==typeof e.result?l=e.result.signature||e.result.txid||e.result.hash||e.result.txHash:"signature"in e&&e.signature&&"string"==typeof e.signature&&(l=e.signature));const d=(0,r.isCrossChain)(a.quote.srcChainId,a.quote.destChainId);let p;try{p=(0,r.formatChainIdToHex)(a.quote.srcChainId)}catch{p="0x1"}const h=(0,r.extractTradeData)(t);return{...(0,n.getTxMetaFields)(a),time:Date.now(),id:l??(0,i.v4)(),chainId:p,networkClientId:u??"mainnet",txParams:{from:c,data:h},type:d?s.TransactionType.bridge:s.TransactionType.swap,status:s.TransactionStatus.submitted,hash:l,origin:u,isSolana:!0,isBridgeTx:d}};n.handleNonEvmTx=async(e,t,r,s)=>{if(!s.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const i=(0,n.getClientRequest)(t,r.quote.srcChainId,s.id,s.metadata?.snap?.id,r.quote.srcAsset.assetId,r.quote.destAsset.assetId),a=await e.call("SnapController:handleRequest",i);return(0,n.handleNonEvmTxResponse)(a,t,r,s)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],[1566,{"@metamask/bridge-controller":1501,"bignumber.js":1570},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getActualBridgeReceivedAmount=n.getActualSwapReceivedAmount=void 0;const r=e("@metamask/bridge-controller"),s=e("bignumber.js");n.getActualSwapReceivedAmount=(e,t,n)=>{const{pricingData:i}=e,a=e.quote.destTokenAmount;if(!n?.txReceipt)return null;const o=(0,r.isNativeAddress)(e.quote.destAsset.address)?((e,t,n)=>{const{preTxBalance:r,postTxBalance:i}=n;return r&&i&&r!==i?t&&i&&r?new s.BigNumber(i,16).minus(r,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new s.BigNumber(e.quote.destTokenAmount).div(new s.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,n):((e,t)=>{const{txReceipt:n}=t;if(!n?.logs||"0x0"===n.status)return null;const{account:r,quote:i}=e,a=n.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),n=e.address?.toLowerCase()===i.destAsset.address?.toLowerCase(),s=e.topics?.[2]&&(e.topics[2]===r||e.topics[2].match(r?.slice(2)));return t&&n&&s});return a?.data?new s.BigNumber(a.data,16).div(new s.BigNumber(10).pow(i.destAsset.decimals)):null})(e,n),c=i?.quotedReturnInUsd&&a?new s.BigNumber(i.quotedReturnInUsd).div(a).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:o,usd:o&&c?c.multipliedBy(o):null}};n.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:n,status:r}=e,i=n?.quotedReturnInUsd?new s.BigNumber(n.quotedReturnInUsd).div(t.destTokenAmount):null,a=r.destChain?.amount;return a&&i?{amount:a,usd:i.multipliedBy(a).toString(10)}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs"}],[1567,{"../constants.cjs":1534,"@metamask/bridge-controller":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getApprovalTraceParams=n.getTraceParams=void 0;const r=e("@metamask/bridge-controller"),s=e("../constants.cjs");n.getTraceParams=(e,t)=>({name:(0,r.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?s.TraceName.BridgeTransactionCompleted:s.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,r.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}});n.getApprovalTraceParams=(e,t)=>({name:(0,r.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)?s.TraceName.BridgeTransactionApprovalCompleted:s.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,r.formatChainIdToCaip)(e.quote.srcChainId),stxEnabled:t}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/trace.cjs"}]],[],{});