LavaPack.loadBundle([[100,{"../../../../shared/constants/defi-referrals":8533},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"}],[1005,{"@firebase/component":1006,"@firebase/logger":1008,"@firebase/util":1011,idb:6892},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 a.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=L.get(e);if(!t&&e===F&&(0,a.getDefaultAppConfig)())return J();if(!t)throw K.create("no-app",{appName:e});return t},n.getApps=function(){return Array.from(L.values())},n.initializeApp=J,n.initializeServerApp=function(e,t){if((0,a.isBrowser)()&&!(0,a.isWebWorker)())throw K.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let 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 K.create("finalization-registry-not-supported",{});const i=""+(c=JSON.stringify(s),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),o=q.get(i);var c;if(o)return o.incRefCount(t.releaseOnDeref),o;const u=new r.ComponentContainer(i);for(const e of H.values())u.addComponent(e);const l=new V(n,t,i,u);return q.set(i,l),l},n.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw K.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"),a=e("@firebase/util"),i=e("idb");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class o{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const c="@firebase/app",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",T="@firebase/functions",S="@firebase/functions-compat",_="@firebase/installations",I="@firebase/installations-compat",E="@firebase/messaging",k="@firebase/messaging-compat",A="@firebase/performance",C="@firebase/performance-compat",P="@firebase/remote-config",O="@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",[T]:"fire-fn",[S]:"fire-fn-compat",[_]:"fire-iid",[I]:"fire-iid-compat",[E]:"fire-fcm",[k]:"fire-fcm-compat",[A]:"fire-perf",[C]:"fire-perf-compat",[P]:"fire-rc",[O]:"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"},L=n._apps=new Map,q=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 L.values())U(t,e);for(const t of q.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 G={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},K=new a.ErrorFactory("app","Firebase",G);
/**
 * @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 K.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class V extends z{constructor(e,t,n,r){const s=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,a={name:n,automaticDataCollectionEnabled:s};if(e.apiKey!==undefined)super(e,a,r);else{super(e.options,a,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 K.create("server-app-deleted")}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.SDK_VERSION="11.2.0";function J(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const s=Object.assign({name:F,automaticDataCollectionEnabled:!1},t),i=s.name;if("string"!=typeof i||!i)throw K.create("bad-app-name",{appName:String(i)});if(n||(n=(0,a.getDefaultAppConfig)()),!n)throw K.create("no-options");const o=L.get(i);if(o){if((0,a.deepEqual)(n,o.options)&&(0,a.deepEqual)(s,o.config))return o;throw K.create("duplicate-app",{appName:i})}const c=new r.ComponentContainer(i);for(const e of H.values())c.addComponent(e);const u=new z(n,s,c);return L.set(i,u),u}async function Y(e){let t=!1;const n=e.name;if(L.has(n))t=!0,L.delete(n);else if(q.has(n)){e.decRefCount()<=0&&(q.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 a=null!==(s=B[e])&&void 0!==s?s:e;n&&(a+=`-${n}`);const i=a.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${a}" with version "${t}":`];return i&&e.push(`library name "${a}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void l.warn(e.join(" "))}$(new r.Component(`${a}-version`,()=>({library:a,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,i.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw K.create("idb-open",{originalErrorMessage:e.message})})),ee}async function 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 a.FirebaseError)l.warn(e.message);else{const t=K.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});l.warn(t.message)}}}function 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 ie(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=ae();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===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=ae(),{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,a.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 ae(){return(new Date).toISOString().substring(0,10)}class ie{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,a.isIndexedDBAvailable)()&&(0,a.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),n=await t.objectStore(Z).get(re(e));return await t.done,n}catch(e){if(e instanceof a.FirebaseError)l.warn(e.message);else{const t=K.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});l.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const 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,a.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:e})).length}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ce;ce="",$(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"}],[1006,{"@firebase/util":1011},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 a{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new 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 a=this.instances.get(r);return a&&e(a,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=a;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 a(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/component",file:"node_modules/@firebase/component/dist/esm/index.esm2017.js"}],[1007,{"@firebase/app":1005,"@firebase/component":1006,"@firebase/util":1011,idb:6892},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=T(e,t),s={method:"DELETE",headers:r},a=await S(()=>fetch(n,s));if(!a.ok)throw await w("Delete Installation",a)}(t,n),await q(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"),a=e("@firebase/util"),i=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 a.ErrorFactory("installations","Installations",f);function g(e){return e instanceof a.FirebaseError&&e.code.includes("request-failed")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function 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 T(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 S(e){const t=await e();return t.status>=500&&t.status<600?e():t}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function _(e){return new Promise(t=>{setTimeout(t,e)})}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const 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 P(e,t){const n=A(e);O(n,t),function(e,t){const n=j();n&&n.postMessage({key:e,fid:t});x()}(n,t)}function O(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=>{O(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,i.openDB)(N,R,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(D)}})),F}async function L(e,t){const n=A(e),r=(await B()).transaction(D,"readwrite"),s=r.objectStore(D),a=await s.get(n);return await s.put(t,n),await r.done,a&&a.fid===t.fid||P(e,t.fid),t}async function q(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),a=await s.get(n),i=t(a);return i===undefined?await s.delete(n):await s.put(i,n),await r.done,!i||a&&a.fid===i.fid||P(e,i.fid),i}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function 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),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const i={fid:n,authVersion:d,appId:e.appId,sdkVersion:l},o={method:"POST",headers:s,body:JSON.stringify(i)},c=await S(()=>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 L(e.appConfig,n)}catch(n){throw g(n)&&409===n.customData.serverCode?await q(e.appConfig):await L(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 _(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 G({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=T(e,n),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}const i={installation:{sdkVersion:l,appId:e.appId}},o={method:"POST",headers:s,body:JSON.stringify(i)},c=await S(()=>fetch(r,o));if(c.ok){return b(await c.json())}throw await w("Generate Auth Token",c)}async function K(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 _(100),n=await z(e.appConfig);const r=n.authToken;return 0===r.requestStatus?K(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 G(e,t),r=Object.assign(Object.assign({},t),{authToken:n});return await L(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 L(e.appConfig,n)}else await q(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):K(t).catch(console.error),n.fid}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function Y(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(n);return(await K(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"}],[1008,{},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 a={debug:n.LogLevel.DEBUG,verbose:n.LogLevel.VERBOSE,info:n.LogLevel.INFO,warn:n.LogLevel.WARN,error:n.LogLevel.ERROR,silent:n.LogLevel.SILENT},i=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=i,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?a[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,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=a[t.level]),s.userLogHandler=null===e?null:(t,s,...a)=>{const i=a.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");s>=(null!=r?r:t.logLevel)&&e({level:n.LogLevel[s].toLowerCase(),message:i,args:a,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],[1009,{"@firebase/app":1005,"@firebase/component":1006,"@firebase/installations":1007,"@firebase/util":1011,idb:6892},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 P.create("only-available-in-window");e.swRegistration||await q(e);return async function(e){const t=await E(e.firebaseDependencies);t&&(await O(e.firebaseDependencies,t.token),await async function(e){const t=A(e),n=(await I()).transaction(S,"readwrite");await n.objectStore(S).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,a.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,i.getApp)()){return z().then(e=>{if(!e)throw P.create("unsupported-browser")},e=>{throw P.create("indexed-db-unsupported")}),(0,i._getProvider)((0,a.getModularInstance)(e),"messaging").getImmediate()},n.getToken=async function(e,t){return H(e=(0,a.getModularInstance)(e),t)},n.isSupported=z,n.onMessage=function(e,t){return function(e,t){if(!navigator)throw P.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,a.getModularInstance)(e),t)},e("@firebase/installations");var r=e("@firebase/component"),s=e("idb"),a=e("@firebase/util"),i=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",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",T=1,S="firebase-messaging-store";let _=null;function I(){return _||(_=(0,s.openDB)(v,T,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(S)}})),_}async function E(e){const t=A(e),n=await I(),r=await n.transaction(S).objectStore(S).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,a)=>{var i;if(r<2)return;if(!n.objectStoreNames.contains(w))return;const o=a.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!==(i=e.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey: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(S,"readwrite");return await r.objectStore(S).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."},P=new a.ErrorFactory("messaging","Messaging",C);async function O(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 P.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw P.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,a=t.p256dh===e.p256dh;return n&&r&&s&&a}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(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 a;try{const n=await fetch(`${M(e.appConfig)}/${t.token}`,s);a=await n.json()}catch(e){throw P.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw P.create("token-update-failed",{errorInfo:e})}if(!a.token)throw P.create("token-update-no-token");return a.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 O(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 a;try{const t=await fetch(M(e.appConfig),s);a=await t.json()}catch(e){throw P.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw P.create("token-subscribe-failed",{errorInfo:e})}if(!a.token)throw P.create("token-subscribe-no-token");return a.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 a=t.notification.icon;a&&(e.notification.icon=a)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,r,s,a,i;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===(a=t.notification)||void 0===a?void 0:a.click_action;o&&(e.fcmOptions.link=o);const c=null===(i=t.fcmOptions)||void 0===i?void 0:i.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}function B(e){return P.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @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 L{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 q(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 P.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 P.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw P.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 q(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw P.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",G=e=>{const t=new L(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>$(t,e)),t},K=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>H(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function z(){try{await(0,a.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,a.isIndexedDBAvailable)()&&(0,a.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,i._registerComponent)(new r.Component("messaging",G,"PUBLIC")),(0,i._registerComponent)(new r.Component("messaging-internal",K,"PRIVATE")),(0,i.registerVersion)(W,Q),(0,i.registerVersion)(W,Q,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],[101,{"../../../../shared/constants/defi-referrals":8533,"../../../../shared/constants/network":8549,"../../../../shared/lib/delegation/utils":8653},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:i}=e.getNetworkClientById(n),o=(0,a.toFunctionSelector)("traderReferralCodes(address)"),c=`${o}${t.toLowerCase().replace("0x","").padStart(64,"0")}`,u=await i.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"),a=e("../../../../shared/lib/delegation/utils")}}},{package:"$root$",file:"app/scripts/lib/defi-referrals/referral-onchain-check.ts"}],[1010,{"@firebase/app":1005,"@firebase/component":1006,"@firebase/installations":1007,"@firebase/util":1011,idb:6892},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"),a=e("@firebase/util"),i=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const o="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var 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,a)=>{var i;if(r<2)return;if(!n.objectStoreNames.contains(f))return;const o=a.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!==(i=e.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey: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 T={"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."},S=new a.ErrorFactory("messaging","Messaging",T);async function _(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 S.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw S.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,a=t.p256dh===e.p256dh;return n&&r&&s&&a}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(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 a;try{const n=await fetch(`${I(e.appConfig)}/${t.token}`,s);a=await n.json()}catch(e){throw S.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw S.create("token-update-failed",{errorInfo:e})}if(!a.token)throw S.create("token-update-no-token");return a.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 _(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return P(e.firebaseDependencies,n)}return P(e.firebaseDependencies,n)}async function C(e){const t=await b(e.firebaseDependencies);t&&(await _(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 P(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 a;try{const t=await fetch(I(e.appConfig),s);a=await t.json()}catch(e){throw S.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw S.create("token-subscribe-failed",{errorInfo:e})}if(!a.token)throw S.create("token-subscribe-no-token");return a.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await w(e,r),r.token}async function O(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 O(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 a=t.notification.icon;a&&(e.notification.icon=a)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,r,s,a,i;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===(a=t.notification)||void 0===a?void 0:a.click_action;o&&(e.fcmOptions.link=o);const c=null===(i=t.fcmOptions)||void 0===i?void 0:i.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}(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 a=e.data,"object"==typeof a&&a&&"google.c.a.c_id"in a?self.location.origin:null;var a;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(r);if(!s)return;const a=new URL(s,self.location.href),i=new URL(self.location.origin);if(a.host!==i.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}(a);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 S.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 a=await b(t.firebaseDependencies);await C(t),t.vapidKey=null!==(r=null===(n=null==a?void 0:a.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 a.isIndexedDBAvailable()&&await a.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */i._registerComponent(new 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=a.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getMessaging=function(e=i.getApp()){return F().then(e=>{if(!e)throw S.create("unsupported-browser")},e=>{throw S.create("indexed-db-unsupported")}),i._getProvider(a.getModularInstance(e),"messaging-sw").getImmediate()},n.isSupported=F,n.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw S.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=a.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],[1011,{_process:7496},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=P,n=O){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 a=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(a)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,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 a of r){if(!s.includes(a))return!1;const r=t[a],i=n[a];if(E(r)&&E(i)){if(!e(r,i))return!1}else if(r!==i)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=_,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 a=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},i=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],a=t+1<e.length,i=a?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,u=s>>2,l=(3&s)<<4|i>>4;let d=(15&i)<<2|c>>6,p=63&c;o||(p=64,a||(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(a(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 a=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&a)}else if(s>239&&s<365){const a=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(a>>10)),t[r++]=String.fromCharCode(56320+(1023&a))}else{const a=e[n++],i=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&a)<<6|63&i)}}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++)],a=t<e.length?n[e.charAt(t)]:0;++t;const i=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==a||null==i||null==c)throw new o;const u=s<<2|a>>4;if(r.push(u),64!==i){const e=a<<4&240|i>>2;if(r.push(e),64!==c){const e=i<<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=a(e);return i.encodeByteArray(t,!0)};n.base64Encode=c;const u=function(e){return c(e).replace(/\./g,"")};n.base64urlEncodeWithoutPadding=u;const l=function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function 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,T.prototype.create)}}n.FirebaseError=v;class T{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],a=s?function(e,t){return e.replace(S,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(s,n):"Error",i=`${this.serviceName}: ${a} (${r}).`;return new v(r,i,n)}}n.ErrorFactory=T;const S=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function _(e){return JSON.parse(e)}const I=function(e){let t={},n={},r={},s="";try{const a=e.split(".");t=_(l(a[0])||""),n=_(l(a[1])||""),s=a[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,a=this.chain_[0],i=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^i&(o^c),s=1518500249):(r=i^o^c,s=1859775393):e<60?(r=i&o|c&(i|o),s=2400959708):(r=i^o^c,s=3395469782);const t=(a<<5|a>>>27)+r+u+s+n[e]&4294967295;u=c,c=o,o=4294967295&(i<<30|i>>>2),i=a,a=t}this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+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 a=this.inbuf_;for(;r<t;){if(0===a)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(s[a]=e.charCodeAt(r),++a,++r,a===this.blockSize){this.compress_(s),a=0;break}}else for(;r<t;)if(s[a]=e[r],++a,++r,a===this.blockSize){this.compress_(s),a=0;break}}this.inbuf_=a,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let 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 a=e.charCodeAt(s);if(a>=55296&&a<=56319){const t=a-55296;s++,r(s<e.length,"Surrogate pair missing trail surrogate.");a=65536+(t<<10)+(e.charCodeAt(s)-56320)}a<128?t[n++]=a:a<2048?(t[n++]=a>>6|192,t[n++]=63&a|128):a<65536?(t[n++]=a>>12|224,t[n++]=a>>6&63|128,t[n++]=63&a|128):(t[n++]=a>>18|240,t[n++]=a>>12&63|128,t[n++]=a>>6&63|128,t[n++]=63&a|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
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 P=1e3,O=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,{"@metamask/browser-passworder":1568},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,a)=>(0,r.encrypt)(t,n,s,a,{algorithm:"PBKDF2",params:{iterations:e}}),a=e=>async(t,n,s)=>(0,r.encryptWithDetail)(t,n,s,{algorithm:"PBKDF2",params:{iterations:e}}),i=e=>async(t,n,s,a)=>(0,r.keyFromPassword)(t,n,s,a??{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:a(e),decrypt:r.decrypt,decryptWithKey:r.decryptWithKey,decryptWithDetail:r.decryptWithDetail,keyFromPassword:i(e),isVaultUpdated:o(e),importKey:r.importKey,exportKey:r.exportKey,generateSalt:r.generateSalt})}}},{package:"$root$",file:"app/scripts/lib/encryptor-factory.ts"}],[103,{},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"}],[104,{"./ens-registry.json":103},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"}],[1043,{},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 a(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 a extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}n.EvalError=a}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],[1044,{"@json-schema-tools/reference-resolver":1049,"@json-schema-tools/traverse":1052,"fast-safe-stringify":6626},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,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function o(e){try{c(r.throw(e))}catch(e){a(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(i,o)}c((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,s,a,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)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 i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}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}),n.NonStringRefError=void 0;var o=i(e("@json-schema-tools/traverse")),c=i(e("@json-schema-tools/reference-resolver")),u=i(e("fast-safe-stringify")),l=function(e){this.name="NonStringRefError",this.message=["NonStringRefError","Found an improperly formatted $ref in schema. $ref must be a string","schema in question: ".concat((0,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,a=Object.keys(this.options.protocolHandlerMap);s<a.length;s++){var i=a[s];c.default.protocolHandlerMap[i]=this.options.protocolHandlerMap[i]}this.schema=n,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return s(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return s(this,void 0,void 0,function(){var t,n,s,i,u,l,p,h,f,m,g,y=this;return a(this,function(a){switch(a.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return y.refCache[e]===undefined}),n=[],s=0,i=t,a.label=1;case 1:return s<i.length?(u=i[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=a.sent(),a.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=a.sent(),this.refCache[u]=d(l,g),[3,8];case 7:this.refCache[u]=l,a.label=8;case 8:return[3,10];case 9:this.refCache[u]=l,a.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 a.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,o.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new l(t);e.push(t.$ref)}return t}),e},e}();n.default=p}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],[1045,{"./dereferencer":1044},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")),a=e("./dereferencer");Object.defineProperty(n,"NonStringRefError",{enumerable:!0,get:function(){return a.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"}],[1046,{},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"}],[1047,{"./errors":1048,"isomorphic-fetch":6928},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,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function o(e){try{c(r.throw(e))}catch(e){a(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(i,o)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,s,a,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)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 i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}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 i=e("./errors"),o=a(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 i.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 i.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"}],[1048,{},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 a=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};n.InvalidRemoteURLError=a;var i=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};n.InvalidFileSystemPathError=i}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],[1049,{"./default-protocol-handler-map":1047,"./reference-resolver":1050},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,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function o(e){try{c(r.throw(e))}catch(e){a(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(i,o)}c((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,s,a,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)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 i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}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 o=i(e("./default-protocol-handler-map")),c=i(e("./reference-resolver")),u=r(r({},o.default),{file:function(){return s(void 0,void 0,void 0,function(){return a(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"}],[105,{},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 a=e=>({name:e,type:"bytes32"}),i=[r("setContent",[a("node"),a("hash")],[],"nonpayable"),r("content",[a("node")],[{name:"",type:"bytes32"}],"view"),r("supportsInterface",[{name:"interfaceID",type:"bytes4"}],[{name:"",type:"bool"}],"pure"),r("setText",[a("node"),{name:"key",type:"string"},{name:"value",type:"string"}],[],"nonpayable"),r("ABI",[a("node"),{name:"contentTypes",type:"uint256"}],[{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],"view"),r("setPubkey",[a("node"),a("x"),a("y")],[],"nonpayable"),r("setContenthash",[a("node"),{name:"hash",type:"bytes"}],[],"nonpayable"),r("addr",[a("node")],[{name:"",type:"address"}],"view"),r("text",[a("node"),{name:"key",type:"string"}],[{name:"",type:"string"}],"view"),r("setABI",[a("node"),{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],[],"nonpayable"),r("name",[a("node")],[{name:"",type:"string"}],"view"),r("setName",[a("node"),{name:"name",type:"string"}],[],"nonpayable"),r("contenthash",[a("node")],[{name:"",type:"bytes"}],"view"),r("pubkey",[a("node")],[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],"view"),r("setAddr",[a("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=i}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/resolver.ts"}],[1050,{"./errors":1048,"./resolve-pointer":1051},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,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function o(e){try{c(r.throw(e))}catch(e){a(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(i,o)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,s,a,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(i=0)),i;)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 i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}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 i=e("./errors"),o=a(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,a,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]),a=n[0],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(a,t)];case 2:return c=s.sent(),[3,4];case 3:throw u=s.sent(),new i.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 i.InvalidFileSystemPathError(e);l=0,d=Object.keys(this.protocolHandlerMap),s.label=5;case 5:return l<d.length?(p=d[l],a.startsWith(p)?[4,this.protocolHandlerMap[p](a,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 i.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"}],[1051,{"@json-schema-spec/json-pointer":1043},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")),a=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=a,n.default=function(e,t){try{var n=e.replace("#","");return s.default.parse(n).shmeval(t)}catch(t){throw new a(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],[1052,{},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,a=t.length;s<a;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 a=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},i=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,a(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,a(h),o(p,2)))),d.push(t),f.push([t,y]);var b=function(t,n){var r=i(t,d);return r?(m.push(r),!0===g.skipFirstMutation&&r===d[0]?c(t,!0,a(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=i(t.items,d);if(w)if(m.push(w),!0===g.skipFirstMutation&&w===d[0])y.items=c(t.items,!0,a(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=t.properties,S={};Object.keys(t.properties).forEach(function(e){S[e]=b(T[e],s(s([],h,!0),["properties",e.toString()],!1))}),y.properties=S}if(t.patternProperties!==undefined){var _=t.patternProperties,I={};Object.keys(t.patternProperties).forEach(function(e){I[e]=b(_[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,a(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,{"./contracts/registry":104,"./contracts/resolver":105,"@ensdomains/content-hash":800,"@ethersproject/contracts":915,"@ethersproject/providers":953,"eth-ens-namehash":6513},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 a.Web3Provider(e),h=new i.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 i.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")),a=e("@ethersproject/providers"),i=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"}],[107,{"../../../../shared/lib/fetch-with-timeout":8663,"./resolver":106,"base32-encode":6226,"base64-js":6227,"webextension-polyfill":8510},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:i}){const c=l.map(e=>`*://*.${e}/*`);return a.default.webRequest.onErrorOccurred.addListener(d,{urls:c,types:["main_frame"]}),{remove(){a.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=i(),m=`https://app.ens.domains/name/${c}`;f&&h&&await a.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),a={padding:!1};g=`https://${(0,r.default)(t,"RFC4648-HEX",a).toLowerCase()}.siasky.net${l}${d||""}${p||""}`}}catch(e){console.warn(e)}finally{g&&(f||!f&&g!==m)&&await a.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")),a=c(e("webextension-polyfill")),i=c(e("../../../../shared/lib/fetch-with-timeout")),o=c(e("./resolver"));function c(e){return e&&e.__esModule?e:{default:e}}const u=(0,i.default)(),l=["eth"]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/setup.js"}],[108,{},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 a(e,t){return e.get(i(e,t))}function i(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 a(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 a(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(i(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)};i(u,this,d).call(this,e,r).addListener(s),t.set(r,{listener:s,args:n})}a(c,this).set(e,t)}i(u,this,l).call(this,n)}addListener(e,t,n){const r=i(u,this,d).call(this,e,t);r.addListener(n);const s=a(c,this).get(e);if(s){const i=s.get(t);if(i){r.removeListener(i.listener),s.delete(t),0===s.size&&a(c,this).delete(e);const{args:o}=i;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,i),a(c,this).set(e,s),r.addListener(i.listener));break}}catch(n){const d=u+1;throw d!==l&&(o.splice(0,d),s.set(t,i),a(c,this).set(e,s),r.addListener(i.listener)),n}}}}once(e,t){return new Promise(n=>{const r=i(u,this,d).call(this,e,t),s=a(c,this).get(e);if(s){const i=s.get(t),o=i?.args.length;if(o)return n(i.args.shift()),r.removeListener(i.listener),void(1===o&&(s.delete(t),0===s.size&&a(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"}],[109,{"@metamask/snaps-sdk":3726,"@metamask/snaps-utils":3843},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,a){const{method:i,params:o}=n,{handleRequest:c,snapId:u,onBeforeRequest:l,onAfterRequest:d}=e;if(!u)throw new s.InternalError(`No snapId configured for method ${i}`);const p=a.get("origin");if(!p)throw new s.InternalError(`No origin specified for method ${i}`);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:i,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"}],[110,{},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"}],[111,{lodash:7202},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"}],[112,{},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"}],[114,{"../../../shared/lib/messenger-tracing":8690,"../../../shared/lib/sentry":8730,"@metamask/messenger":2892},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:i,captureException:s.captureException});return(0,a.wrapMessengerWithTracing)(e)};var r=e("@metamask/messenger"),s=e("../../../shared/lib/sentry"),a=e("../../../shared/lib/messenger-tracing");const i=n.ROOT_MESSENGER_NAMESPACE="Root"}}},{package:"$root$",file:"app/scripts/lib/messenger.ts"}],[116,{"../util":211},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:a}=t;if("eth_getTransactionCount"!==s)return r();const[i,o]=a;return"pending"!==o?r():await e(i,n.get("networkClientId"))}},n.createPendingTxMiddleware=function({getPendingTransactionByHash:e}){return async({request:t,next:n})=>{const{method:s,params:a}=t;if("eth_getTransactionByHash"!==s)return n();const[i]=a,o=e(i);return o?(0,r.formatTxMetaForRpcResult)(o):n()}};var r=e("../util")}}},{package:"$root$",file:"app/scripts/lib/middleware/pending.ts"}],[117,{"../../../../shared/lib/stores/persistence-manager":8744,"@metamask/utils":4051,events:6606,loglevel:7212},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")),a=e("@metamask/utils"),i=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,a.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(i(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 a=new Set,i=await e.migrate(r,a);if(o(r,e),void 0!==i)throw new Error("Migrator - migration returned value when none expected");if(0===a.size)s.default.debug(`Migrator - migration ${e.version} did not report any changes`);else for(const e of a)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,a.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 i(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:i.PersistenceManager.defaultStorageKind,version:this.defaultVersion}}}}n.default=c}}},{package:"$root$",file:"app/scripts/lib/migrator/index.js"}],[118,{"../../../../shared/constants/metametrics":8545,"../../../../shared/lib/only-keep-host":8705,"../../controllers/analytics":22,"../util":211,"./utils":119,"@metamask/utils":4051,loglevel:7212},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:a,retryReason:o,rpcMethodName:c,traceId:u,type:l}){d(i.MetaMetricsEventName.RpcServiceDegraded,{chainId:e,duration:t,endpointUrl:n,error:r,infuraProjectId:s,analyticsId:a,retryReason:o,rpcMethodName:c,traceId:u,type:l})},n.onRpcEndpointUnavailable=function({chainId:e,endpointUrl:t,error:n,infuraProjectId:r,analyticsId:s}){d(i.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},a=e("@metamask/utils"),i=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,a.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,a.isObject)(d)&&"httpStatus"in d&&(0,a.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(i.MetaMetricsEventCategory.Network).addProperties(w).build())}}}},{package:"$root$",file:"app/scripts/lib/network-controller/messenger-action-handlers.ts"}],[119,{"../../../../shared/constants/build":8527,"@metamask/network-controller":3028,"@metamask/remote-feature-flag-controller":3476},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)<i;return!0}(t)};var r=e("@metamask/network-controller"),s=e("@metamask/remote-feature-flag-controller"),a=e("../../../../shared/constants/build");const i=.01,o=n.PRODUCTION_LIKE_ENVIRONMENTS=[a.ENVIRONMENT.PRODUCTION,a.ENVIRONMENT.RELEASE_CANDIDATE]}}},{package:"$root$",file:"app/scripts/lib/network-controller/utils.ts"}],[120,{"../../../shared/constants/notifications":8550,"../platforms/extension":693,"@metamask/safe-event-emitter":3486},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=i(e("@metamask/safe-event-emitter")),s=i(e("../platforms/extension")),a=e("../../../shared/constants/notifications");function i(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-a.NOTIFICATION_WIDTH),0)}catch(n){const{screenX:r,screenY:s,outerWidth:i}=window;t=Math.max(s,0),e=Math.max(r+(i-a.NOTIFICATION_WIDTH),0)}const n=await this.platform.openWindow({url:"notification.html",type:"popup",width:a.NOTIFICATION_WIDTH,height:a.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"}],[121,{"@metamask/keyring-api":2767,"@metamask/keyring-api/v2":2791,"@metamask/keyring-sdk/v2":2836,"@metamask/utils":4051},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"),a=e("@metamask/keyring-sdk/v2"),i=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 a.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,i.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,i.add0x)(r))]})}async deleteAccount(e){await this.withLock(async()=>{const{address:t}=await this.getAccount(e);this.inner.removeAccount((0,i.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"}],[122,{"../../../../shared/constants/offscreen-communication":8551,"eth-lattice-keyring":6514},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},a=e("../../../../shared/constants/offscreen-communication");class i extends s.default{constructor(e={}){super(e)}async _getCreds(){try{if(this._hasCreds())return undefined;const e=this.appName?this.appName:"Unknown",t=`${a.KnownOrigins.lattice}?keyring=${e}&forceLogin=true`,n=await new Promise((e,n)=>{chrome.runtime.sendMessage({target:a.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=i,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}(i,"type",void 0),i.type=s.default.type}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/lattice-offscreen-keyring.ts"}],[123,{"../../../../shared/constants/offscreen-communication":8551,"@ledgerhq/errors":1200,"@metamask/eth-ledger-bridge-keyring":2352,"@metamask/hw-wallet-sdk":2670},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"),a=e("@metamask/hw-wallet-sdk"),i=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:i.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 a.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:i.LedgerAction.makeApp},{timeout:u})}updateTransportMethod(e){return c(l,this,d).call(this,{action:i.LedgerAction.updateTransport,params:{transportType:e}},{timeout:u})}getAppNameAndVersion(){return c(l,this,d).call(this,{action:i.LedgerAction.getAppNameAndVersion},{timeout:u})}getAppConfiguration(){return c(l,this,d).call(this,{action:i.LedgerAction.getAppConfiguration},{timeout:u})}getPublicKey(e){return c(l,this,d).call(this,{action:i.LedgerAction.getPublicKey,params:e})}deviceSignTransaction(e){return c(l,this,d).call(this,{action:i.LedgerAction.signTransaction,params:e})}deviceSignMessage(e){return c(l,this,d).call(this,{action:i.LedgerAction.signPersonalMessage,params:e})}deviceSignTypedData(e){return c(l,this,d).call(this,{action:i.LedgerAction.signTypedData,params:e})}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts"}],[124,{"../../../../shared/constants/hardware-wallets":8538,"@trezor/connect-web":5524,"@trezor/connect-web/lib/impl/core-in-suite-desktop":5523},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"),a=e("../../../../shared/constants/hardware-wallets");function i(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!==a.TREZOR_DESKTOP_CONNECTION_MISSING_CODE?e:{success:!1,payload:{error:a.TREZOR_DESKTOP_CONNECTION_MISSING_CODE,code:a.TREZOR_DESKTOP_CONNECTION_MISSING_CODE}}}var p=new WeakMap,h=new WeakMap;n.TrezorMv2Bridge=class{constructor(){o(this,"model",void 0),i(this,p,!1),i(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===a.TREZOR_DESKTOP_CONNECTION_MISSING_CODE)throw Object.assign(new Error(a.TREZOR_DESKTOP_CONNECTION_MISSING_CODE),{code:a.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"}],[125,{"../../../../shared/constants/offscreen-communication":8551},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"}],[126,{"webextension-polyfill":8510},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"}],[127,{"../../../shared/lib/promise-with-resolvers":8714,lodash:7202,loglevel:7212},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"),a=(r=e("loglevel"))&&r.__esModule?r:{default:r},i=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 a.default.warn("already evacuating"),u(h,this);const e=u(p,this).flush();if(e){const{promise:t,resolve:n}=(0,i.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)?(a.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"}],[128,{},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 a=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 i=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,i),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")})(i,this,o).call(this,n).then(n=>{const a=n[e](t);a.onsuccess=async e=>{r(e)},a.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 a(e,r,t),r}async write(e,t,n){await a(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"}],[129,{"../../../../shared/constants/app":8523,"../../../../shared/constants/security-provider":8561,"../../../../shared/constants/transaction":8572,"../../../../shared/lib/trace":8753,"./ppom-util":130,"@metamask/controller-utils":1622},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,i.trace)({name:i.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};a.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"),a=e("../../../../shared/constants/transaction"),i=e("../../../../shared/lib/trace"),o=e("../../../../shared/constants/security-provider"),c=e("./ppom-util");const u=Object.freeze(["eth_sendRawTransaction","eth_sendTransaction",...a.SIGNING_METHODS])}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-middleware.ts"}],[130,{"../../../../shared/constants/app":8523,"../../../../shared/constants/security-provider":8561,"../../../../shared/constants/transaction":8572,"../../../../shared/lib/snaps/snaps":8738,"../../../../shared/lib/transaction.utils":8755,"../../../../shared/lib/typed-signature":8763,"./security-alerts-api":132,"@metamask/snaps-utils":3843,"@metamask/transaction-controller":3936,"@metamask/utils":4051,lodash:7202,uuid:8152},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,a.v4)()},n.handlePPOMError=b,n.normalizeSignatureRequest=w,n.updateSecurityAlertResponse=async function({appStateController:e,messenger:t,method:n,securityAlertId:r,securityAlertResponse:s,signatureController:a,transactionController:i}){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 a=r(e.state);if(a)return void s(a);const i=e=>{const t=r(e);t&&(m("Found signature request",t),n.unsubscribe("SignatureController:stateChange",i),s(t))};m("Waiting for signature request",t),n.subscribe("SignatureController:stateChange",i)})}(a,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 a=e.state.transactions.find(r);if(a)return void s(a);const i=e=>{r(e)&&(m("Found transaction metadata",e),n.unsubscribe("TransactionController:unapprovedTransactionAdded",i),s(e))};m("Waiting for transaction metadata",t),n.subscribe("TransactionController:unapprovedTransactionAdded",i)})}(i,r,t);return i.updateSecurityAlertResponse(o.id,{...s,securityAlertId:r}),o},n.validateRequestWithPPOM=async function({ppomController:e,request:t,securityAlertId:n,chainId:s,updateSecurityAlertResponse:a,getSecurityAlertsConfig:o}){try{const u=function(e,t){let n=(0,i.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:a,jsonrpc:o,method:c,origin:u,params:l}=n;return{delegationMock:s,id:a,jsonrpc:o,method:c,origin:u,params:l}}(t,await a(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 a(t.method,n,l)}catch(e){m("Error",e),await a(t.method,n,b(e,"Error validating JSON RPC using PPOM: "))}};var r=e("@metamask/transaction-controller"),s=e("@metamask/utils"),a=e("uuid"),i=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"}],[1302,{"@metamask/base-controller":1489,"@metamask/controller-utils":1622},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 a;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(a||(n.AddressType=a={})),n.controllerName="AddressBookController";const i=["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,i)}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="",a){if(e=(0,s.toChecksumHexAddress)(e),!(0,s.isValidHexAddress)(e))return!1;const i={address:e,chainId:n,isEns:!1,memo:r,name:t,addressType:a,lastUpdatedAt:Date.now()},o=(0,s.normalizeEnsName)(t);return o&&(i.name=o,i.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[n]:{...this.state.addressBook[n],[e]:i}}}),"*"!==String(n)&&this.messenger.publish("AddressBookController:contactUpdated",i),!0}}n.AddressBookController=c,n.default=c}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],[1303,{"./AddressBookController.cjs":1302},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"}],[1304,{"./AnalyticsLogger.cjs":1305,"./analyticsControllerStateValidator.cjs":1307,"./selectors.cjs":1309,"@metamask/base-controller":1489,lodash:7202,uuid:8152},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,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"),T=e("./analyticsControllerStateValidator.cjs"),S=e("./AnalyticsLogger.cjs"),_=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 P extends b.BaseController{constructor({state:e,messenger:t,platformAdapter:c,isAnonymousEventsFeatureEnabled:u=!1,isEventQueuePersistenceEnabled:l=!1}){const d={optedIn:!1,...e};(0,T.validateAnalyticsControllerState)(d,!0===c.skipUUIDv4Check),super({name:n.controllerName,metadata:E,state:d,messenger:t}),r.add(this),s.set(this,void 0),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),g(this,a,u,"f"),g(this,i,l,"f"),g(this,s,c,"f"),g(this,o,!1,"f"),this.messenger.registerMethodActionHandlers(this,k),(0,S.projectLogger)("AnalyticsController initialized and ready",{enabled:_.analyticsControllerSelectors.selectEnabled(this.state),optedIn:this.state.optedIn,analyticsId:this.state.analyticsId,eventQueuePersistenceEnabled:y(this,i,"f")})}init(){if(y(this,o,"f"))(0,S.projectLogger)("AnalyticsController already initialized.");else{g(this,o,!0,"f");try{y(this,s,"f").onSetupCompleted(this.state.analyticsId)}catch(e){(0,S.projectLogger)("Error calling platformAdapter.onSetupCompleted",e)}y(this,r,"m",h).call(this)}}trackEvent(e,t){if(!_.analyticsControllerSelectors.selectEnabled(this.state))return;if(!e.hasProperties)return void y(this,r,"m",c).call(this,e.name,undefined,t);y(this,a,"f")&&y(this,r,"m",c).call(this,e.name,{...e.properties},t);const n=Object.keys(e.sensitiveProperties).length>0;y(this,a,"f")&&!n||y(this,r,"m",c).call(this,e.name,{...e.properties,...e.sensitiveProperties,...n&&{anonymous:!0}},t)}identify(e,t){_.analyticsControllerSelectors.selectEnabled(this.state)&&y(this,r,"m",u).call(this,this.state.analyticsId,e,t)}trackView(e,t,n){_.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=P,s=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakSet,c=function(e,t,n){if(!y(this,i,"f"))return void y(this,s,"f").track(e,t,n);const a={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,a)},u=function(e,t,n){if(!y(this,i,"f"))return void y(this,s,"f").identify(e,t,n);const a={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,a)},l=function(e,t,n){if(!y(this,i,"f"))return void y(this,s,"f").view(e,t,n);const a={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,a)},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,S.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,S.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,S.projectLogger)("Error sending queued analytics event",{messageId:e.messageId,error:t})}},h=function(){if(y(this,i,"f")&&this.state.eventQueue)if(_.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,S.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"}],[1305,{"@metamask/utils":4051},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"}],[1306,{},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"}],[1307,{},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"}],[1308,{"./AnalyticsController.cjs":1304,"./AnalyticsPlatformAdapterSetupError.cjs":1306,"./selectors.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.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 a=e("./selectors.cjs");Object.defineProperty(n,"analyticsControllerSelectors",{enumerable:!0,get:function(){return a.analyticsControllerSelectors}})}}},{package:"@metamask/analytics-controller",file:"node_modules/@metamask/analytics-controller/dist/index.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.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"}],[131,{},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 a=null;function i(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(r.memory.buffer)),a}function o(e,t){return e>>>=0,s.decode(i().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 i().subarray(r,r+n.length).set(n),h=n.length,r}let r=e.length,s=t(r,1)>>>0;const a=i();let o=0;for(;o<r;o++){const t=e.charCodeAt(o);if(t>127)break;a[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=i().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 T(e,t){r._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__destroy(e,t)}let S=null;function _(e,t){const n=t(4*e.length,4)>>>0,s=(null!==S&&0!==S.byteLength||(S=new Uint32Array(r.memory.buffer)),S);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=_(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},a=(...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 a.original=s,a}(e,t,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 a,i=(a=s)===undefined||null===a?0:g(s,r.__wbindgen_malloc,r.__wbindgen_realloc),o=h;b()[e/4+1]=o,b()[e/4+0]=i},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,S=null,a=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"}],[1310,{"@metamask/base-controller":1489},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a=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 i=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class u extends i.BaseController{constructor({messenger:e,state:t,allAnnouncements:n}){const i={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:i}),r.add(this),a(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"}],[1311,{"./AnnouncementController.cjs":1310},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"}],[133,{},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"}],[134,{},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"}],[135,{"../../../../shared/constants/network":8549,"@metamask/rpc-errors":3484},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,a){return e.has(t.method)?a(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"}],[136,{"../../../../../shared/constants/app":8523,"../../../../../shared/constants/network":8549,"./ethereum-chain-utils":138,"@metamask/controller-utils":1622,"@metamask/network-controller":3028,"@metamask/rpc-errors":3484,lodash:7202,"uri-js":8120},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,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(s=t?r:n){if(s.has(e))return s.get(e);s.set(e,i)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?s(i,t,a):i[t]=e[t]);return i}(e,t)}(e("uri-js")),s=e("@metamask/controller-utils"),a=e("@metamask/network-controller"),i=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:T,getEnabledNetworks:S}){let _;try{_=(0,l.validateAddEthereumChainParams)(e.params[0])}catch(e){return c(e)}const{chainId:I,chainName:E,firstValidBlockExplorerUrl:k,firstValidRPCUrl:A,ticker:C}=_,{origin:P}=e,O=g(P),M=h(I);if(M&&M.chainId===I&&M.nativeCurrency!==C)return c(i.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:P,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:a.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,O===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:a.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:T,getEnabledNetworks:S})},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"}],[137,{"../../../../../shared/constants/app":8523},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}},a={[r.MESSAGE_TYPE.ETH_ACCOUNTS]:s};n.default=a}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.ts"}],[138,{"../../../../../shared/constants/app":8523,"../../../../../shared/lib/network.utils":8703,"../../util":211,"@metamask/chain-agnostic-permission":1571,"@metamask/controller-utils":1622,"@metamask/rpc-errors":3484,"@metamask/snaps-utils":3843,"@metamask/utils":4051},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:T,toNetworkConfiguration:S,fromNetworkConfiguration:_}){try{const I=f({target:a.Caip25EndowmentPermissionName,caveatType:a.Caip25CaveatType});if(I){if((0,a.getPermittedEthChainIds)(I.value).includes(n))!T?.()||l||p||await v({origin:u,type:r.ApprovalType.SwitchEthereumChain,requestData:{toNetworkConfiguration:S,fromNetworkConfiguration:_}});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(i.KnownCaipNamespace.Eip155);Object.keys(e).includes(n)||y(n)}else{const{namespace:e}=(0,i.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:a,rpcUrls:i,...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(!i||!Array.isArray(i)||0===i.length)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${i}`});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=i.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${i}`});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!==a){if("object"!=typeof a||Array.isArray(a))throw s.rpcErrors.invalidParams({message:`Expected null or object 'nativeCurrency'. Received:\n${a}`});if(18!==a.decimals)throw s.rpcErrors.invalidParams({message:`Expected the number 18 for 'nativeCurrency.decimals' when 'nativeCurrency' is provided. Received: ${a.decimals}`});if(!a.symbol||"string"!=typeof a.symbol)throw s.rpcErrors.invalidParams({message:`Expected a string 'nativeCurrency.symbol'. Received: ${a.symbol}`})}const y=a?.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"),a=e("@metamask/chain-agnostic-permission"),i=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"}],[139,{"../../../../../shared/constants/app":8523},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 a=e.params?.isInitializingStreamProvider;return t.result={...await s(e.origin,{isInitializingStreamProvider:a})},r()},hookNames:{getProviderState:!0}},a={[r.MESSAGE_TYPE.GET_PROVIDER_STATE]:s};n.default=a}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.ts"}],[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,{"./add-ethereum-chain":136,"./eth-accounts":137,"./get-provider-state":139,"./log-web3-shim-usage":141,"./request-accounts":142,"./send-metadata":143,"./switch-ethereum-chain":144,"./wallet-getPermissions":145,"./wallet-requestPermissions":146,"./wallet-revokePermissions":147,"./watch-asset":148},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")),a=f(e("./get-provider-state")),i=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,...a.default,...i.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"}],[141,{"../../../../../shared/constants/app":8523},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:a}){const{origin:i}=e;s(i)===undefined&&a(i);return t.result=!0,r()},hookNames:{getWeb3ShimUsageState:!0,setWeb3ShimUsageRecorded:!0}},a={[r.MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE]:s};n.default=a}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.ts"}],[142,{"../../../../../shared/constants/app":8523,"../../../../../shared/constants/metametrics":8545,"../../getIframeProperties":110,"../../util":211,"@metamask/rpc-errors":3484},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"),a=e("../../../../../shared/constants/metametrics"),i=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,i.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:a.MetaMetricsEventName.DappViewed,category:a.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"}],[143,{"../../../../../shared/constants/app":8523},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()}},a={[r.MESSAGE_TYPE.SEND_METADATA]:s};n.default=a}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/send-metadata.ts"}],[144,{"../../../../../shared/constants/app":8523,"./ethereum-chain-utils":138,"@metamask/rpc-errors":3484,"@metamask/snaps-utils":3843},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"),a=e("../../../../../shared/constants/app"),i=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,i.validateSwitchEthereumChainParams)(e)}catch(e){return o(e)}const{origin:v}=e,T=p(v);if(T===w)return t.result=null,o();const S=c(w),_=S?.rpcEndpoints[S.defaultRpcEndpointIndex].networkClientId;if(!_)return o(r.providerErrors.custom({code:4902,message:`Unrecognized chain ID "${w}". Try adding the chain using ${a.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN} first.`}));const I=c(T),E=c(w);return(0,i.switchChain)(t,o,w,_,{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={[a.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN]:o};n.default=c}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js"}],[145,{"../../../../../shared/constants/permissions":8554,"../../../controllers/permissions":38,"@metamask/chain-agnostic-permission":1571,"@metamask/permission-controller":3150},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"),a=e("../../../controllers/permissions"),i=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[i.RestrictedMethods.eth_accounts]={...l,parentCapability:i.RestrictedMethods.eth_accounts,caveats:[{type:i.CaveatTypes.restrictReturnedAccounts,value:e}]});const t=(0,s.getPermittedEthChainIds)(d);t.length>0&&(u[a.PermissionNames.permittedChains]={...l,parentCapability:a.PermissionNames.permittedChains,caveats:[{type:i.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"}],[146,{"../../../../../shared/constants/permissions":8554,"../../../controllers/permissions":38,"@metamask/chain-agnostic-permission":1571,"@metamask/controller-utils":1622,"@metamask/permission-controller":3150,lodash:7202},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"),a=e("@metamask/permission-controller"),i=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,a.invalidParams)({data:{request:e}}));let[f]=h;delete f[i.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[i.Caip25EndowmentPermissionName];if(!e)throw new Error(`could not find ${i.Caip25EndowmentPermissionName} permission.`);const t=e.caveats?.find(({type:e})=>e===i.Caip25CaveatType)?.value;if(!t)throw new Error(`could not find ${i.Caip25CaveatType} in granted ${i.Caip25EndowmentPermissionName} permission.`);delete y[i.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,i.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={[a.MethodNames.RequestPermissions]:u};n.default=l}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-requestPermissions.ts"}],[147,{"../../../../../shared/constants/permissions":8554,"../../../controllers/permissions":38,"@metamask/chain-agnostic-permission":1571,"@metamask/permission-controller":3150,"@metamask/utils":4051},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"),a=e("@metamask/chain-agnostic-permission"),i=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!==a.Caip25EndowmentPermissionName);if(!(0,s.isNonEmptyArray)(h))return c((0,r.invalidParams)({data:{request:e}}));const f=[i.RestrictedMethods.eth_accounts,o.PermissionNames.permittedChains],m=h.filter(e=>!f.includes(e));m.length!==h.length&&m.push(a.Caip25EndowmentPermissionName);u(m),m.includes(a.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"}],[148,{"../../../../../shared/constants/app":8523,"@metamask/controller-utils":1622,"@metamask/rpc-errors":3484},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"),a=e("../../../../../shared/constants/app");const i=n.watchAssetHandler={implementation:async function(e,t,n,a,{handleWatchAssetRequest:i}){try{const{params:n,origin:o,networkClientId:c}=e;if(!n)return a(r.rpcErrors.invalidParams());const{options:u,type:l}=n,{tokenId:d}=u;return[s.ERC721,s.ERC1155].includes(l)&&d!==undefined&&"string"!=typeof d?a(r.rpcErrors.invalidParams({message:`Expected parameter 'tokenId' to be type 'string'. Received type '${typeof d}'`})):(await i({asset:u,type:l,origin:o??"",networkClientId:c??""}),t.result=!0,a())}catch(e){return a(e)}},hookNames:{handleWatchAssetRequest:!0}},o={[a.MESSAGE_TYPE.WATCH_ASSET]:i,[a.MESSAGE_TYPE.WATCH_ASSET_LEGACY]:i};n.default=o}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/watch-asset.ts"}],[149,{"./createUnsupportedMethodMiddleware":135,"./handlers":140,"@metamask/json-rpc-engine":2688,"@metamask/multichain-api-middleware":2990},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"),a=e("@metamask/multichain-api-middleware"),i=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:{...i.handlers,...i.eip1193OnlyHandlers},hooks:e,onError:c});n.createEthAccountsMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:i.ethAccountsHandler,hooks:e,onError:c});n.createMultichainApiMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:a.methodHandlers,hooks:e,onError:c});n.createMultichainInvokedMethodMiddleware=e=>(0,s.createMethodMiddleware)({handlers:i.handlers,hooks:e,onError:c})}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/index.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,{"../../../shared/lib/snaps/snaps":8738,"@metamask/rpc-errors":3484},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(a,i,o,c){if(0===n.blockingSymbols.size)return o();const{origin:u}=a;if(!u)return c(r.rpcErrors.internal(`No origin specified for request with method ${a.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"}],[151,{"../../../shared/lib/error":8659,"../../../shared/lib/sentry":8730,"./operation-safener":127,"webextension-polyfill":8510},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,a.captureException)((0,i.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},a=e("../../../shared/lib/sentry"),i=e("../../../shared/lib/error"),o=e("./operation-safener");const c=150}}},{package:"$root$",file:"app/scripts/lib/safe-reload.ts"}],[152,{"../../../../shared/constants/metametrics":8545,"../../../../shared/lib/sentry":8730,"../../controllers/analytics":22,loglevel:7212},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,a.trackEvent)((0,a.createEventBuilder)(i.MetaMetricsEventName.SeedlessOnboardingMigrationCompleted).addCategory(i.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,a.trackEvent)((0,a.createEventBuilder)(i.MetaMetricsEventName.SeedlessOnboardingMigrationFailed).addCategory(i.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},a=e("../../controllers/analytics"),i=e("../../../../shared/constants/metametrics"),o=e("../../../../shared/lib/sentry")}}},{package:"$root$",file:"app/scripts/lib/seedless-onboarding/run-migrations.ts"}],[1529,{"./bridge-status-controller.intent.cjs":1530,"./constants.cjs":1531,"./quote-status-manager/constants.cjs":1533,"./quote-status-manager/errors.cjs":1534,"./quote-status-manager/quotes-status-manager.cjs":1540,"./strategy/index.cjs":1546,"./strategy/types.cjs":1549,"./types.cjs":1550,"./utils/accounts.cjs":1551,"./utils/authentication.cjs":1552,"./utils/bridge-status.cjs":1553,"./utils/bridge.cjs":1554,"./utils/history.cjs":1557,"./utils/metrics.cjs":1560,"./utils/network.cjs":1561,"./utils/trace.cjs":1564,"./utils/transaction.cjs":1565,"@metamask/bridge-controller":1498,"@metamask/polling-controller":3323,"@metamask/transaction-controller":3936,"@metamask/utils":4051},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,o,c,u,l,d,p,h,f,m,g,y,b,w,v,T,S,_,I,E,k,A,C,P,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},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"),L=e("./constants.cjs"),q=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"),G=e("./utils/authentication.cjs"),K=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:ae,onQuoteStatusManagerError:ie,isQuoteStatusManagerEnabled:oe}){super({name:L.BRIDGE_STATUS_CONTROLLER_NAME,metadata:ee,messenger:e,state:{...L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),r.set(this,{}),s.set(this,void 0),a.set(this,void 0),i.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,a,"f").reportFinalised(e.id,!1),M(this,P,"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,a,"f").reportFinalised(e.id,!0),M(this,P,"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,a,"f").reportSubmitted(r.quoteId,t,n),this.update(n=>{const r=n.txHistory[e];r&&(r.reportedSubmittedTxHash=t)}))}),this.resetState=()=>{M(this,a,"f").destroy(),this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory,e.quoteUpdateStatusStore=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.quoteUpdateStatusStore})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=L.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 a=this.state.txHistory[s],i=a.attempts?.counter??0;if(this.update(e=>{s&&(e.txHistory[s].attempts=undefined)}),(0,V.shouldPollHistoryItem)(a)){M(this,r,"f")[s]||(M(this,w,"f").call(this,s),M(this,P,"f").call(this,N.UnifiedSwapBridgeEventName.PollingStatusUpdated,s,{polling_status:N.PollingStatus.ManuallyRestarted,retry_attempts:i}))}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],m.set(this,()=>{if(M(this,a,"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>q.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,S,"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>=L.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})}),T.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,a,"f").reportFinalised(e,!1),M(this,E,"f").call(this,e)}),S.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,i,"f"),n.status.srcChain.txHash);if(null===r?.bridgeStatus||r?.bridgeStatus===undefined)return;t=r.bridgeStatus.status;const a=t.srcChain.txHash;a&&M(this,f,"f").call(this,e,a,e)}else{const r=M(this,_,"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,a,"f"),n.quoteId):null)??await(0,z.fetchBridgeTxStatus)(s,M(this,i,"f"),await(0,G.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,P,"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,a,"f").reportFinalised(e,t.status===N.StatusTypes.COMPLETE),t.status===N.StatusTypes.COMPLETE&&(M(this,P,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",n.quote.destAsset.assetId)),t.status===N.StatusTypes.FAILED&&M(this,P,"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,T,"f").call(this,e)}}),_.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(a=>{t&&(a.txHistory[e].status.status=t),n&&(a.txHistory[e].status.srcChain.txHash=n),r&&(a.txHistory[e].attempts=r),s&&(a.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:i}of r)try{switch(s){case $.SubmitStep.RekeyHistoryItem:M(this,b,"f").call(this,i.oldHistoryKey,i.newHistoryKey,i.tradeMeta),i.tradeMeta.hash&&M(this,f,"f").call(this,i.newHistoryKey,i.tradeMeta.hash,i.tradeMeta.id);break;case $.SubmitStep.UpdateBatchTransactions:(0,Z.updateTransactionsInBatch)({messenger:this.messenger,allTradesWithMetadata:i.quoteAndTxMetas});break;case $.SubmitStep.SetTradeMeta:n=i.tradeMeta;break;case $.SubmitStep.AddHistoryItem:M(this,y,"f").call(this,i.historyKey,{...i,...t,quoteResponse:i.quoteResponse,accountAddress:e.selectedAccount.address,isStxEnabled:e.isStxEnabled,slippagePercentage:0}),M(this,h,"f").call(this,i.historyKey,i.bridgeTxMeta);break;case $.SubmitStep.StartPolling:M(this,w,"f").call(this,i.historyKey);break;case $.SubmitStep.PublishCompletedEvent:M(this,a,"f").reportFinalised(i.historyKey,!0),M(this,P,"f").call(this,N.UnifiedSwapBridgeEventName.Completed,i.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,a,d,p,h,f)=>{const m=Array.isArray(t)?t:[t],g=m[0],{quote:y}=g,b=Date.now();(0,K.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),T=M(this,i,"f")===W.BridgeClientId.MOBILE&&null!==v,S=(0,N.isCrossChain)(y.srcChainId,y.destChainId),_=m.some(({featureId:e})=>e===x.FeatureId.BATCH_SELL)?(0,D.generateBatchId)():undefined,I=(0,J.getPreConfirmationPropertiesFromQuote)(g,n,v,s,a,d,p,h,_);try{M(this,P,"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:S,isDelegatedAccount:e,selectedAccount:w,requireApproval:T,clientId:M(this,i,"f"),bridgeApiBaseUrl:M(this,c,"f").customBridgeApiBaseUrl,addTransactionBatchFn:M(this,u,"f"),fetchFn:M(this,o,"f"),traceFn:M(this,l,"f"),batchId:_};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:a,activeAbTests:d,tokenSecurityTypeDestination:p,inputPrimaryDenomination:f}))}catch(e){throw M(this,P,"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:a,tokenSecurityTypeDestination:i,inputPrimaryDenomination:o,isStxEnabled:c=!1,quotesReceivedContext:u}=e;return await this.submitTx(n,t,c,u,r,s,a,i,undefined,o)},this.submitBatchSell=async e=>{const t=(0,K.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,P,"f").call(this,N.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{polling_status:t,retry_attempts:n.attempts?.counter??0})}),P.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(!L.ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS.includes(s)&&e!==N.UnifiedSwapBridgeEventName.StatusValidationFailed)return;const a=t?this.state.txHistory?.[t]?.abTests:undefined,i=t?this.state.txHistory?.[t]?.activeAbTests:undefined,o=n?.ab_tests??a,c=n?.active_ab_tests??i,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,K.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,K.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,K.trackMetricsEvent)({messenger:this.messenger,eventName:e,properties:b})}),O(this,i,n,"f"),O(this,o,ne,"f"),O(this,u,re,"f"),O(this,c,{customBridgeApiBaseUrl:se?.customBridgeApiBaseUrl??L.BRIDGE_PROD_API_BASE_URL},"f"),O(this,l,ae??((e,t)=>t?.()),"f"),O(this,s,new B.IntentManager({messenger:this.messenger,customBridgeApiBaseUrl:M(this,c,"f").customBridgeApiBaseUrl,fetchFn:M(this,o,"f")}),"f"),O(this,a,new H.QuoteStatusManager({messenger:this.messenger,clientId:M(this,i,"f"),clientProduct:j,clientVersion:R,apiBaseUrl:M(this,c,"f").customBridgeApiBaseUrl,initialData:this.state.quoteUpdateStatusStore,onPersistUpdates:e=>{this.update(t=>{t.quoteUpdateStatusStore=e})},entryTtlMs:q.QUOTE_STATUS_UPDATE_ENTRY_TTL,updateIntervalMs:q.QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS,onError:ie,isEnabled:oe}),"f"),this.messenger.registerMethodActionHandlers(this,te),this.setIntervalLength(L.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionStatusUpdated",({txMeta:e,historyKey:t,historyItem:n,isApprovalTxMeta:r})=>{if(!e)return;const{type:s,status:a}=e;if(s&&(0,Z.isCrossChainTx)(s)||t||n)switch(a){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,a,"f").init(),M(this,g,"f").call(this)}}n.BridgeStatusController=ne,r=new WeakMap,s=new WeakMap,a=new WeakMap,i=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,T=new WeakMap,S=new WeakMap,_=new WeakMap,I=new WeakMap,E=new WeakMap,k=new WeakMap,A=new WeakMap,C=new WeakMap,P=new WeakMap}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],[1530,{"./utils/authentication.cjs":1552,"./utils/intent-api.cjs":1558,"./utils/transaction.cjs":1565,"./utils/validators.cjs":1566,"@metamask/bridge-controller":1498},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,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),a.set(this,new Map),this.getIntentTransactionStatus=async(e,t,n,s,a)=>{try{const o=await this.intentApi.getOrderStatus(e,n,t,s);return c(this,r,"m",i).call(this,e,o,t,a)}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,a,"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:i,orderStatus:o}=r,l=i?.txHash,d=i?.status.status===u.StatusTypes.COMPLETE,h=i?.status.status===u.StatusTypes.COMPLETE||i?.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:i?.transactionStatus,...l?{hash:l}:{},...m},`BridgeStatusController - Intent order status updated: ${o}`),h&&c(this,a,"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,a=new WeakMap,r=new WeakSet,i=function(e,t,n,r){const s=(0,d.translateIntentOrderToBridgeStatus)(t,n,r),i={orderStatus:t.status,bridgeStatus:s};return c(this,a,"f").set(e,i),i}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.cjs"}],[1531,{"@metamask/bridge-controller":1498},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"}],[1532,{"./bridge-status-controller.cjs":1529,"./constants.cjs":1531,"./quote-status-manager/constants.cjs":1533,"./quote-status-manager/errors.cjs":1534,"./types.cjs":1550,"./utils/history.cjs":1557},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 a=e("./constants.cjs");Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return a.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return a.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(n,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return a.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(n,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return a.MAX_ATTEMPTS}});var i=e("./types.cjs");Object.defineProperty(n,"BridgeId",{enumerable:!0,get:function(){return i.BridgeId}}),Object.defineProperty(n,"BridgeStatusAction",{enumerable:!0,get:function(){return i.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"}],[1533,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i;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"}(a||(n.QuoteStatusState=a={})),n.QuoteStatusStateToBackendStatus={[a.Submitted]:r.Submitted,[a.FinalizedSuccess]:r.FinalizedSuccess,[a.FinalizedFailed]:r.FinalizedFailed,[a.Completed]:null,[a.Expired]:null},n.AllowedQuoteStatusStateTransitions={[a.Submitted]:[a.FinalizedFailed,a.FinalizedSuccess,a.Expired],[a.FinalizedFailed]:[a.Completed,a.Expired],[a.FinalizedSuccess]:[a.Completed,a.Expired],[a.Completed]:[],[a.Expired]:[]},function(e){e.Accepted="accepted",e.RetryableExhausted="retryableExhausted",e.NonRetryable="nonRetryable",e.Interrupted="interrupted"}(i||(n.QuoteStatusFetchWithRetryOutcomeType=i={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/constants.cjs"}],[1534,{},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"}],[1535,{"../types.cjs":1550,"../utils/authentication.cjs":1552,"./constants.cjs":1533,"./errors.cjs":1534,"./quote-status-get-with-retry-outcome.cjs":1537,"./quote-status-update-with-retry-outcome.cjs":1539,"./utils.cjs":1541,"./validators.cjs":1542,"@metamask/bridge-controller":1498,"@metamask/superstruct":3879},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,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),a.set(this,void 0),i.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,a,n,"f"),u(this,i,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,a,"f"),...l(this,i,"f")?{"x-metamask-clientversion":l(this,i,"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,a,"f"),...l(this,i,"f")?{"x-metamask-clientversion":l(this,i,"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,a=new WeakMap,i=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"}],[1536,{"./constants.cjs":1533,"./quote-status-state-fsm.cjs":1538},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,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),a.set(this,void 0),i.set(this,void 0),u(this,i,e,"f"),u(this,a,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 a=Date.now(),i={...t,createdAt:a,lastAttemptAt:a};return l(this,s,"f").set(e,i),l(this,r,"m",o).call(this,i),l(this,r,"m",c).call(this),i}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,a,"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,a=new WeakMap,i=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,i,"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"}],[1537,{"./constants.cjs":1533,"./errors.cjs":1534},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"}],[1538,{"./constants.cjs":1533},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,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),a.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",i).call(this,{previousState:t,nextState:e}),!0}onStateUpdate(e){return c(this,a,"f").add(e),()=>c(this,a,"f").delete(e)}removeAllListeners(){c(this,a,"f").clear()}toJson(){return{state:this.state}}},s=new WeakMap,a=new WeakMap,r=new WeakSet,i=function(e){for(const t of[...c(this,a,"f")])t(e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/quote-status-manager/quote-status-state-fsm.cjs"}],[1539,{"./constants.cjs":1533},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"}],[1540,{"../types.cjs":1550,"../utils/transaction.cjs":1565,"./constants.cjs":1533,"./errors.cjs":1534,"./quote-status-api-service.cjs":1535,"./quote-status-entry-store.cjs":1536,"./quote-status-get-with-retry-outcome.cjs":1537,"./quote-status-state-fsm.cjs":1538,"./quote-status-update-with-retry-outcome.cjs":1539,"@metamask/transaction-controller":3936},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i,o,c,u,l,d,p,h,f,m,g,y,b,w,v,T=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},S=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 _=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"),P=(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),a.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),u.set(this,void 0),l.set(this,null),T(this,o,f,"f"),T(this,c,h,"f"),T(this,u,y,"f"),T(this,s,e,"f"),T(this,a,new A.QuoteStatusApiService({messenger:e,clientId:t,clientProduct:n,clientVersion:d,apiBaseUrl:p,onError:h}),"f"),T(this,i,new C.QuoteStatusEntryStore({onPersistUpdates:m,entryTtlMs:g,initial:b}),"f")}get enabled(){return Boolean(S(this,o,"f")?.call(this))}reportFinalised(e,t){if(!S(this,o,"f")?.call(this))return;const n=S(this,i,"f").getByTxMetaId(e);if(!n)return void S(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),S(this,r,"m",p).call(this),S(this,r,"m",y).call(this,n))}reportSubmitted(e,t,n){if(!S(this,o,"f")?.call(this))return;const s=S(this,i,"f").getByQuoteId(e).some(e=>e.status.state!==E.QuoteStatusState.Submitted);if(s)return;const a=C.QuoteStatusEntryStore.hash({quoteId:e,srcTxHash:t}),c=S(this,i,"f").put(a,{quoteId:e,srcTxHash:t,txMetaId:n,status:new P.QuoteStatusStateFsm(E.QuoteStatusState.Submitted)});S(this,r,"m",p).call(this),S(this,r,"m",y).call(this,c)}destroy(){S(this,r,"m",h).call(this),S(this,i,"f").clear()}init(){S(this,r,"m",d).call(this);for(const e of S(this,i,"f").values()){if(e.status.state!==E.QuoteStatusState.Submitted||!e.txMetaId)continue;const t=(0,I.getTransactionMetaById)(S(this,s,"f"),e.txMetaId);if(!t)continue;(t.type!==undefined&&(0,I.isCrossChainTx)(t.type)||(0,I.hasNestedSwapTransactions)(t))&&(t.status===_.TransactionStatus.confirmed?this.reportFinalised(e.txMetaId,!0):t.status!==_.TransactionStatus.failed&&t.status!==_.TransactionStatus.dropped||this.reportFinalised(e.txMetaId,!1))}}async getStatus(e,t={maxRetries:0,delayMsBetweenRetries:1e3}){if(!S(this,o,"f")?.call(this))return undefined;return S(this,a,"f").getQuoteStatusWithRetry({quoteId:e},{maxRetries:t.maxRetries??0,delayMsBetweenRetries:t.delayMsBetweenRetries??1e3}).catch(()=>undefined)}},s=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,r=new WeakSet,d=function(){for(const e of S(this,i,"f").values())S(this,r,"m",y).call(this,e);S(this,r,"m",m).call(this)&&S(this,r,"m",p).call(this)},p=function(){null===S(this,l,"f")&&T(this,l,setInterval(()=>S(this,r,"m",f).call(this),S(this,u,"f")),"f")},h=function(){null!==S(this,l,"f")&&(clearInterval(S(this,l,"f")),T(this,l,null,"f"))},f=function(){if(!S(this,o,"f")?.call(this))return;const e=[...S(this,i,"f").values()];if(S(this,r,"m",m).call(this))for(const t of e)S(this,r,"m",y).call(this,t);else S(this,r,"m",h).call(this)},m=function(){for(const e of S(this,i,"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(){S(this,r,"m",m).call(this)||S(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 S(this,r,"m",g).call(this);S(this,a,"f").updateQuoteStatusWithRetry({quoteId:t.quoteId,srcTxHash:t.srcTxHash,newStatus:s},{maxRetries:5,delayMsBetweenRetries:3e3,retry:()=>{const e=S(this,i,"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=S(this,i,"f").get(C.QuoteStatusEntryStore.hash(t));return s?s.status.state!==n?(S(this,r,"m",e).call(this,s),undefined):n===E.QuoteStatusState.FinalizedSuccess||n===E.QuoteStatusState.FinalizedFailed?(S(this,r,"m",b).call(this,s),undefined):(s.acknowledgedState=n,S(this,i,"f").update(s),S(this,r,"m",g).call(this),undefined):undefined}case E.QuoteStatusFetchWithRetryOutcomeType.NonRetryable:return S(this,r,"m",v).call(this,t,s),undefined;case E.QuoteStatusFetchWithRetryOutcomeType.Interrupted:return S(this,r,"m",e).call(this,t),undefined;case E.QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted:return t.lastAttemptAt=Date.now(),S(this,i,"f").update(t),undefined;default:return undefined}}).catch(()=>{t.lastAttemptAt=Date.now(),S(this,i,"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),S(this,r,"m",g).call(this)},w=function(e){e.status.canTransitionTo(E.QuoteStatusState.Expired)&&e.status.transitionTo(E.QuoteStatusState.Expired),S(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 S(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&&S(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 S(this,r,"m",b).call(this,e)}}S(this,r,"m",w).call(this,e),S(this,c,"f")?.call(this,new k.QuoteStatusUpdateError("abandoning entry due to non-retryable error",{quoteId:e.quoteId,errorType:n?.type}))}else S(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"}],[1541,{},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"}],[1542,{"../utils/validators.cjs":1566,"./constants.cjs":1533,"@metamask/superstruct":3879},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"),a=e("./constants.cjs"),i=(0,r.type)({statusCode:(0,r.number)(),message:(0,r.string)(),type:(0,r.enums)(a.QuoteStatusUpdateBackendOnChainMismatchTypes),currentStatus:(0,r.enums)(a.QuoteStatusBackendValues),newStatus:(0,r.enums)(a.QuoteStatusBackendValues)}),o=(0,r.type)({statusCode:(0,r.number)(),message:(0,r.string)(),type:(0,r.enums)(a.BaseQuoteStatusUpdateErrorTypes)});n.QuoteStatusUpdateResponseSchema=(0,r.union)([i,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"}],[1543,{"../utils/transaction.cjs":1565,"./types.cjs":1549,"@metamask/transaction-controller":3936},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"),a=e("./types.cjs"),i=({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))),T=v?.txMeta;if(!T)throw new Error("Failed to add BatchSell trade to history: txMeta not found");if(yield{type:a.SubmitStep.SetTradeMeta,payload:{tradeMeta:T}},(0,s.is7702Tx)(T)||(0,s.hasNestedSwapTransactions)(T)){const e=Array.from(new Set(w.map(i)));yield{type:a.SubmitStep.AddHistoryItem,payload:{historyKey:T.id,quoteResponse:v.quoteResponse,batchSellData:l,quoteIds:e,bridgeTxMeta:T}};for(const e of w){const{quoteResponse:t}=e;yield{type:a.SubmitStep.AddHistoryItem,payload:{historyKey:i(e),quoteResponse:t,batchSellData:l}}}}else for(const{txMeta:e,quoteResponse:t}of w)yield{type:a.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"}],[1544,{"../utils/transaction.cjs":1565,"./types.cjs":1549},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:a,isBridgeTx:i,addTransactionBatchFn:o,isDelegatedAccount:c}=e,u=(0,r.toQuoteAndTxMetadata)({quoteResponse:n,isBridgeTx:i}),l=await(0,r.getAddTransactionBatchParams)({tradeData:u,requireApproval:t,isDelegatedAccount:c,messenger:a,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:a,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"}],[1545,{"../utils/accounts.cjs":1551,"../utils/network.cjs":1561,"../utils/trace.cjs":1564,"../utils/transaction.cjs":1565,"./types.cjs":1549,"@metamask/bridge-controller":1498,"@metamask/transaction-controller":3936},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"),a=e("../utils/accounts.cjs"),i=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,a.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,i.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:a}=e,{approval:i,resetApproval:o}=t;if(!i||!(0,r.isEvmTxData)(i))return undefined;const c=a?s.TransactionType.bridgeApproval:s.TransactionType.swapApproval;if(o&&await(0,n.handleSingleTx)({...e,transactionType:c,trade:o}),i){const t=await(0,n.handleSingleTx)({...e,transactionType:c,trade:i});return t?.id}})(e)),n.submitEvmHandler=async function*(e){const{quoteResponses:[t],requireApproval:r,isBridgeTx:a}=e,i=await(0,n.handleEvmApprovals)(e);i&&await(0,c.handleApprovalDelay)(t.quote.srcChainId),await(0,c.handleMobileHardwareWalletDelay)(r),r&&i&&await(0,c.waitForTxConfirmation)(e.messenger,i);const o=(0,c.generateActionId)();yield{type:u.SubmitStep.AddHistoryItem,payload:{historyKey:o,approvalTxId:i,actionId:o,quoteResponse:t}};const l=a?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"}],[1546,{"./batch-sell-strategy.cjs":1543,"./batch-strategy.cjs":1544,"./evm-strategy.cjs":1545,"./intent-strategy.cjs":1547,"./non-evm-strategy.cjs":1548,"@metamask/bridge-controller":1498},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"),a=e("./batch-strategy.cjs"),i=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,a.submitBatchHandler)(e):(0,i.submitEvmHandler)(e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/strategy/index.cjs"}],[1547,{"../utils/authentication.cjs":1552,"../utils/intent-api.cjs":1558,"../utils/keyring.cjs":1559,"../utils/network.cjs":1561,"../utils/transaction.cjs":1565,"./evm-strategy.cjs":1545,"./types.cjs":1549,"@metamask/bridge-controller":1498,"@metamask/transaction-controller":3936},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"),a=e("../utils/authentication.cjs"),i=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,i.getIntentFromQuote)(t),h=await(0,o.signTypedMessage)({messenger:n,accountAddress:r.address,typedData:p.typedData}),{id:f,status:m}=await(0,i.postSubmitOrder)({params:{srcChainId:l,quoteId:d,signature:h,order:p.order,userAddress:r.address,aggregatorId:p.protocol},clientId:s,jwt:await(0,a.getJwt)(n),fetchFn:c,bridgeApiBaseUrl:u});return{orderUid:f,orderStatus:m}})(e),h=await(async(e,t)=>{const{quoteResponses:[n],messenger:a,isBridgeTx:o,selectedAccount:l}=t,{quote:{srcChainId:d}}=n,p=o?s.TransactionType.bridge:s.TransactionType.swap,h=(0,c.getNetworkClientIdByChainId)(a,d);if(!(0,r.isEvmTxData)(n.trade))throw new Error("Failed to submit intent: trade is not an EVM transaction");const f=(0,i.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)(a,m,{requireApproval:!1,networkClientId:h,type:p})})(n,{...e,requireApproval:!1,isStxEnabled:!1});yield{type:d.SubmitStep.SetTradeMeta,payload:{tradeMeta:{...h,status:(0,i.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"}],[1548,{"../utils/snaps.cjs":1562,"../utils/trace.cjs":1564,"../utils/transaction.cjs":1565,"./types.cjs":1549,"@metamask/bridge-controller":1498},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"),a=e("../utils/trace.cjs"),i=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,a.getApprovalTraceParams)(t,!1),async()=>t.approval?(await(0,s.handleNonEvmTx)(e.messenger,t.approval,t,e.selectedAccount)).id:undefined);return r?(await(0,i.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"}],[1549,{},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"}],[1550,{"./constants.cjs":1531,"./quote-status-manager/constants.cjs":1533,"./utils/validators.cjs":1566},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,a;!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"}(a||(n.BridgeStatusAction=a={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/types.cjs"}],[1551,{},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"}],[1552,{},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"}],[1553,{"../constants.cjs":1531,"../quote-status-manager/quotes-status-manager.cjs":1540,"./history.cjs":1557,"./network.cjs":1561,"./validators.cjs":1566,"@metamask/bridge-controller":1498,"@metamask/superstruct":3879},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"),a=e("../constants.cjs"),i=(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,a,i,o)=>{const u=(0,n.getStatusRequestDto)(e),l=new URLSearchParams(u),d=`${(0,n.getBridgeStatusUrl)(o)}?${l.toString()}`,p=await i(d,{headers:(0,r.getClientHeaders)({clientId:t,jwt:a})}),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:a,refuel:i}=e;return{bridgeId:n,srcTxHash:t,bridge:r[0],srcChainId:s,destChainId:a,quote:e,refuel:Boolean(i)}};n.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=a.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1};n.shouldWaitForFinalBridgeStatus=async(e,t)=>{if(!(0,i.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"}],[1554,{"@metamask/bridge-controller":1498},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"}],[1555,{"../constants.cjs":1531,"@metamask/bridge-controller":1498},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"}],[1556,{"bignumber.js":1567},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 a=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,i=s(t?.gasUsed,t?.effectiveGasPrice)?.plus(s(n?.gasUsed,n?.effectiveGasPrice)??0),o=i?.div(new r.BigNumber(10).pow(18)).toString(10);return i&&o?{amount:i.toString(10),usd:a?.multipliedBy(o).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],[1557,{"./feature-flags.cjs":1555,"@metamask/bridge-controller":1498},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"),a=(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,...a(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:a,batchId:i,status:{srcChain:{txHash:o}}}=r;return e===t.id||e===t.actionId||s===t.id||!!a&&a===t.actionId||Boolean(i)&&!(0,n.isBatchSellHistoryItem)(r)&&i===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:a,initialDestAssetBalance:i,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:a,pricingData:{amountSent:n.sentAmount?.amount??"0",amountSentInUsd:n.sentAmount?.usd??undefined,quotedGasInUsd:n.gasFee?.effective?.usd??undefined,quotedReturnInUsd:n.toTokenAmount?.usd??undefined,quotedGasAmount:n.gasFee?.effective?.amount??undefined},initialDestAssetBalance:i,targetContractAddress:o,account: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"}],[1558,{"./validators.cjs":1566,"@metamask/bridge-controller":1498,"@metamask/transaction-controller":3936},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,a,i=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),a.set(this,void 0),i(this,r,e,"f"),i(this,s,t,"f"),i(this,a,n,"f")}async getOrderStatus(e,t,n,i){const u=`${o(this,r,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${n}`;try{const e=await o(this,a,"f").call(this),t=await o(this,s,"f").call(this,u,{method:"GET",headers:(0,c.getClientHeaders)({clientId:i,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,a=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 a=`${s}/submitOrder`;try{const s=await r(a,{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"}],[1559,{"@metamask/keyring-controller":2795},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"}],[156,{"../../../../shared/lib/trace":8753},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.addPersonalMessage=async function({signatureParams:e,signatureController:t}){return s(e,t,"newUnsignedPersonalMessage")},n.addTypedMessage=async function({signatureParams:e,signatureController:t}){return s(e,t,"newUnsignedTypedMessage")};var r=e("../../../../shared/lib/trace");async function s(e,t,n){const[s,a,i,o]=e,{id:c,method:u,params:l}=a,d={id:c,method:u,params:l,origin:i.get("origin"),networkClientId:i.get("networkClientId"),securityAlertResponse:i.get("securityAlertResponse")},p=c?.toString();(0,r.endTrace)({name:r.TraceName.Middleware,id:p});const h=await t[n](s,d,o);return(0,r.endTrace)({name:r.TraceName.Signature,id:p}),h}}}},{package:"$root$",file:"app/scripts/lib/signature/util.ts"}],[1560,{"./gas.cjs":1556,"./swap-received-amount.cjs":1563,"@metamask/bridge-controller":1498,"@metamask/transaction-controller":3936,"bignumber.js":1567},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"),a=e("bignumber.js"),i=e("./gas.cjs"),o=e("./swap-received-amount.cjs");n.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:n,quote:s})=>{const a=e.srcChain.txHash?r.StatusTypes.COMPLETE:r.StatusTypes.PENDING,i=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:a,destination_transaction:e.status===r.StatusTypes.FAILED?r.StatusTypes.FAILED:i}};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,i.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 a.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new a.BigNumber(10).pow(18)).div(u.amount).toNumber():0,p=e.pricingData?.quotedReturnInUsd&&l?.usd?new a.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,a,i,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:a,...i&&Object.keys(i).length>0&&{ab_tests:i},...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:a}=e,i=(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:i,is_hardware_wallet:null!==i,stx_enabled:a??!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"}],[1561,{"@metamask/bridge-controller":1498},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"}],[1562,{"@metamask/bridge-controller":1498,"@metamask/snaps-controllers":3594,"@metamask/transaction-controller":3936,uuid:8152},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")),a=e("uuid");n.createClientTransactionRequest=(e,t,n,r,s)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,a.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:n,accountId:r,...s&&{options:s}}}});n.getClientRequest=(e,t,s,a,i,o)=>{const c=(0,r.formatChainIdToCaip)(t),u=(0,r.extractTradeData)(e);let l;return(0,r.isStellarTrade)(e)&&(i===undefined&&o===undefined||(l={...i!==undefined&&{sourceAssetId:i},...o!==undefined&&{destAssetId:o}})),(0,r.isTronTrade)(e)&&(l={visible:e.visible,type:e.raw_data?.contract?.[0]?.type}),(0,n.createClientTransactionRequest)(a,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,i,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)(i.quote.srcChainId,i.quote.destChainId);let p;try{p=(0,r.formatChainIdToHex)(i.quote.srcChainId)}catch{p="0x1"}const h=(0,r.extractTradeData)(t);return{...(0,n.getTxMetaFields)(i),time:Date.now(),id:l??(0,a.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 a=(0,n.getClientRequest)(t,r.quote.srcChainId,s.id,s.metadata?.snap?.id,r.quote.srcAsset.assetId,r.quote.destAsset.assetId),i=await e.call("SnapController:handleRequest",a);return(0,n.handleNonEvmTxResponse)(i,t,r,s)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],[1563,{"@metamask/bridge-controller":1498,"bignumber.js":1567},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:a}=e,i=e.quote.destTokenAmount;if(!n?.txReceipt)return null;const o=(0,r.isNativeAddress)(e.quote.destAsset.address)?((e,t,n)=>{const{preTxBalance:r,postTxBalance:a}=n;return r&&a&&r!==a?t&&a&&r?new s.BigNumber(a,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:a}=e,i=n.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),n=e.address?.toLowerCase()===a.destAsset.address?.toLowerCase(),s=e.topics?.[2]&&(e.topics[2]===r||e.topics[2].match(r?.slice(2)));return t&&n&&s});return i?.data?new s.BigNumber(i.data,16).div(new s.BigNumber(10).pow(a.destAsset.decimals)):null})(e,n),c=a?.quotedReturnInUsd&&i?new s.BigNumber(a.quotedReturnInUsd).div(i).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,a=n?.quotedReturnInUsd?new s.BigNumber(n.quotedReturnInUsd).div(t.destTokenAmount):null,i=r.destChain?.amount;return i&&a?{amount:i,usd:a.multipliedBy(i).toString(10)}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs"}],[1564,{"../constants.cjs":1531,"@metamask/bridge-controller":1498},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"}],[1565,{"../constants.cjs":1531,"./accounts.cjs":1551,"./network.cjs":1561,"@metamask/bridge-controller":1498,"@metamask/controller-utils":1622,"@metamask/transaction-controller":3936,"@metamask/utils":4051},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.updateTransactionsInBatch=n.findAllTransactionsInBatch=n.getAddTransactionBatchParams=n.toTransactionParams=n.toQuoteAndTxMetadataBatch=n.toQuoteAndTxMetadata=n.waitForTxConfirmation=n.handleMobileHardwareWalletDelay=n.handleApprovalDelay=n.addSyntheticTransaction=n.generateActionId=n.addTransaction=n.checkIsDelegatedAccount=n.updateTransaction=n.getTransactionMetaByHash=n.getTransactionMetaById=n.getTransactions=n.getGasFeeEstimates=n.hasNestedSwapTransactions=n.shouldDisable7702=n.is7702Tx=n.isCrossChainTx=n.isTradeTx=n.isApprovalTx=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/controller-utils"),a=e("@metamask/transaction-controller"),i=e("@metamask/utils"),o=e("../constants.cjs"),c=e("./accounts.cjs"),u=e("./network.cjs");n.isApprovalTx=e=>e===a.TransactionType.bridgeApproval||e===a.TransactionType.swapApproval;n.isTradeTx=e=>e===a.TransactionType.bridge||e===a.TransactionType.swap;n.isCrossChainTx=e=>(0,n.isTradeTx)(e)||(0,n.isApprovalTx)(e);n.is7702Tx=e=>Array.isArray(e.txParams.authorizationList)&&e.txParams.authorizationList.length>0||Boolean(e.delegationAddress);n.shouldDisable7702=(e=!1,t=!1,n=!1)=>!e&&!(n&&!t);n.hasNestedSwapTransactions=e=>Boolean(e?.nestedTransactions?.some(e=>e.type===a.TransactionType.swap));n.getGasFeeEstimates=async(e,t)=>{const{estimates:n}=await e.call("TransactionController:estimateGasFee",t);return n?.type===a.GasFeeEstimateType.FeeMarket?n[r.BRIDGE_PREFERRED_GAS_ESTIMATE]:undefined};n.getTransactions=e=>e.call("TransactionController:getState").transactions??[];n.getTransactionMetaById=(e,t)=>(0,n.getTransactions)(e).find(e=>e.id===t);n.getTransactionMetaByHash=(e,t)=>(0,n.getTransactions)(e).find(e=>e.hash?.toLowerCase()===t?.toLowerCase());n.updateTransaction=(e,t,n,r)=>e.call("TransactionController:updateTransaction",{...t,...n},r);n.checkIsDelegatedAccount=async(e,t,n)=>{try{return(await e.call("TransactionController:isAtomicBatchSupported",{address:t,chainIds:n})).some(e=>e.isSupported&&e.delegationAddress)}catch{return!1}};n.addTransaction=async(e,...t)=>{const{result:r}=await e.call("TransactionController:addTransaction",...t);return await(async(e,t)=>{const r=await t,s=(0,n.getTransactionMetaByHash)(e,r);if(!s)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return s})(e,r)};n.generateActionId=()=>(Date.now()+Math.random()).toString();n.addSyntheticTransaction=async(e,...t)=>{const{transactionMeta:r}=await e.call("TransactionController:addTransaction",t[0],{origin:"metamask",actionId:(0,n.generateActionId)(),isStateOnly:!0,isInternal:!0,...t[1]});return r};n.handleApprovalDelay=async e=>{if([r.ChainId.LINEA,r.ChainId.BASE].includes(e)){(0,i.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,o.APPROVAL_DELAY_MS));await e}};n.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};n.waitForTxConfirmation=async(e,t,{timeoutMs:r=3e5,pollMs:s=3e3}={})=>{const i=Date.now();for(;;){const o=(0,n.getTransactionMetaById)(e,t);if(o){if(o.status===a.TransactionStatus.confirmed)return o;if(o.status===a.TransactionStatus.failed||o.status===a.TransactionStatus.dropped||o.status===a.TransactionStatus.rejected)throw new Error("Approval transaction did not confirm")}if(Date.now()-i>r)throw new Error("Timed out waiting for approval confirmation");await new Promise(e=>setTimeout(e,s))}};n.toQuoteAndTxMetadata=({quoteResponse:e,isBridgeTx:t})=>{const n=[],s=t?a.TransactionType.bridgeApproval:a.TransactionType.swapApproval;return e.resetApproval&&n.push({quoteResponse:e,tx:e.resetApproval,type:s,txFee:e.quote.feeData[r.FeeType.TX_FEE]}),e.approval&&(0,r.isEvmTxData)(e.approval)&&n.push({quoteResponse:e,tx:e.approval,type:s,txFee:e.quote.feeData[r.FeeType.TX_FEE]}),n.push({quoteResponse:e,tx:e.trade,type:t?a.TransactionType.bridge:a.TransactionType.swap,assetsFiatValues:{sending:e.sentAmount?.valueInCurrency?.toString(),receiving:e.toTokenAmount?.valueInCurrency?.toString()},txFee:e.quote.feeData[r.FeeType.TX_FEE]}),n};n.toQuoteAndTxMetadataBatch=({quoteResponses:e,batchSellTrades:t})=>{const n=[],{transactions:s,gasIncluded7702:i,gasIncluded:o,gasSponsored:c=!1}=t;for(const t of s){const{type:s,maxFeePerGas:u,maxPriorityFeePerGas:l,...d}=t,p=e.find(({approval:e,trade:t})=>t?.data.toLowerCase()===d.data.toLowerCase()||e?.data.toLowerCase()===d.data.toLowerCase())??e[0],h={...p,quote:{...p.quote,gasIncluded:o,gasIncluded7702:i,gasSponsored:c}},f={tx:d,quoteResponse:h,txFee:{maxFeePerGas:u,maxPriorityFeePerGas:l}};s===r.BatchSellTransactionType.TRADE?n.push({...f,type:a.TransactionType.swap,assetsFiatValues:{sending:p.sentAmount?.valueInCurrency?.toString(),receiving:p.toTokenAmount?.valueInCurrency?.toString()}}):n.push({...f,type:s===r.BatchSellTransactionType.APPROVAL?a.TransactionType.swapApproval:a.TransactionType.tokenMethodTransfer})}return n};n.toTransactionParams=async(e,{chainId:t,gasLimit:r,...a},o,c,u)=>{const l={data:a.data,to:a.to,from:a.from,value:a.value,gas:r?(0,s.toHex)(r):undefined};if(u)return{...l,maxFeePerGas:(0,i.isStrictHexString)(u.maxFeePerGas)?u.maxFeePerGas:(0,s.toHex)(u.maxFeePerGas),maxPriorityFeePerGas:(0,i.isStrictHexString)(u.maxPriorityFeePerGas)?u.maxPriorityFeePerGas:(0,s.toHex)(u.maxPriorityFeePerGas)};const d=await(0,n.getGasFeeEstimates)(e,{transactionParams:l,networkClientId:o,chainId:c});return{...l,maxFeePerGas:d?.maxFeePerGas,maxPriorityFeePerGas:d?.maxPriorityFeePerGas}};n.getAddTransactionBatchParams=async({messenger:e,tradeData:t,requireApproval:s=!1,isDelegatedAccount:a,...i})=>{const o=t[0].tx,l=(0,c.getAccountByAddress)(e,o.from);if(!l)throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const d=(0,r.formatChainIdToHex)(o.chainId),p=(0,u.getNetworkClientIdByChainId)(e,d),h=await Promise.all(t.map(async({tx:t,txFee:r,assetsFiatValues:s,type:a})=>({params:await(0,n.toTransactionParams)(e,t,p,d,r),assetsFiatValues:s,type:a})));return{networkClientId:p,requireApproval:s,origin:"metamask",from:l.address,isInternal:!0,transactions:h,...i}};n.findAllTransactionsInBatch=({messenger:e,batchId:t,tradeData:r})=>{const s=(0,n.getTransactions)(e).filter(e=>e.batchId===t);return r.map(e=>{const{tx:t,type:r}=e;return{...e,txMeta:s.find(e=>{if((0,n.is7702Tx)(e)){if((0,n.isTradeTx)(r)&&e.type===a.TransactionType.batch)return!0;if((0,n.isApprovalTx)(r)&&e.txParams.data===t.data)return!0}return e.txParams.data===t.data})}})};n.updateTransactionsInBatch=({messenger:e,allTradesWithMetadata:t})=>t.map(t=>{const{txMeta:r,type:s}=t;if(r){(0,n.updateTransaction)(e,r,{type:s},`Update tx type to ${s}`);const a={...r,type:s};return{...t,txMeta:a,type:s}}return t})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"}],[1566,{"@metamask/bridge-controller":1498,"@metamask/superstruct":3879},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateIntentStatusResponse=n.IntentOrderStatus=n.validateBridgeStatusResponse=n.StatusResponseSchema=void 0;const r=e("@metamask/bridge-controller"),s=e("@metamask/superstruct"),a=(0,s.number)(),i=(0,s.type)({}),o=(0,s.type)({chainId:a,txHash:(0,s.optional)((0,s.string)()),amount:(0,s.optional)((0,s.string)()),token:(0,s.optional)((0,s.union)([i,r.BridgeAssetSchema]))}),c=(0,s.type)({chainId:a,txHash:(0,s.optional)((0,s.string)()),amount:(0,s.optional)((0,s.string)()),token:(0,s.optional)((0,s.union)([i,r.BridgeAssetSchema]))}),u=(0,s.type)({});n.StatusResponseSchema=(0,s.type)({status:(0,s.enums)(Object.values(r.StatusTypes)),srcChain:o,destChain:(0,s.optional)(c),bridge:(0,s.optional)((0,s.string)()),isExpectedToken:(0,s.optional)((0,s.boolean)()),isUnrecognizedRouterAddress:(0,s.optional)((0,s.boolean)()),refuel:(0,s.optional)(u)});var l;n.validateBridgeStatusResponse=e=>((0,s.assert)(e,n.StatusResponseSchema),!0),function(e){e.PENDING="pending",e.SUBMITTED="submitted",e.CONFIRMED="confirmed",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.EXPIRED="expired"}(l||(n.IntentOrderStatus=l={}));const d=(0,s.type)({id:(0,s.string)(),status:(0,s.enums)(Object.values(l)),txHash:(0,s.optional)((0,s.string)()),metadata:(0,s.type)({txHashes:(0,s.optional)((0,s.union)([(0,s.array)((0,s.string)()),(0,s.string)()]))})});n.validateIntentStatusResponse=e=>(0,s.is)(e,d)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}]],[],{});