(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[285],{46754(__unused_webpack_module,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{ZL:()=>F.Z,_2:()=>J._2,b1:()=>Y,or:()=>U,vJ:()=>J.vJ});var t=__webpack_require__(171097);var e=__webpack_require__.n(t);var a=__webpack_require__(860012);var r=__webpack_require__(879505);var n=__webpack_require__(413279);var o=__webpack_require__.n(n);var s=__webpack_require__(296639);__webpack_require__(480021);var i=__webpack_require__(655204);var l=__webpack_require__(764130);var c=__webpack_require__(490335);var u=__webpack_require__(441670);var d=__webpack_require__(630496);var g=__webpack_require__(537324);var v=__webpack_require__(796213);var p=__webpack_require__(299150);var w=__webpack_require__(721127);var m=__webpack_require__(55638);var h=__webpack_require__(802870);var f=__webpack_require__(163305);var S=__webpack_require__(657218);var k=__webpack_require__(177540);var y=__webpack_require__(365337);var b=__webpack_require__(936007);var A=__webpack_require__(79222);var M=__webpack_require__(302764);var T=__webpack_require__(667855);var L=__webpack_require__(354779);var P=__webpack_require__(83432);var C=__webpack_require__(212814);var E=__webpack_require__(438174);var O=__webpack_require__(90260);var _=__webpack_require__(609654);var H=__webpack_require__(885830);var I=__webpack_require__(597436);var N=__webpack_require__(321505);var x=__webpack_require__(345791);var D=__webpack_require__(947266);var F=__webpack_require__(760264);var J=__webpack_require__(259016);e().setLevel(globalThis.METAMASK_DEBUG?"debug":"warn",!1);let B=(0,i.Y)();let U=(t,e)=>{(0,_.R3)(t),t.onNotification(async t=>{let{method:a}=t;if(a==="sendUpdate")(await B.promise).dispatch(A.M_O(t.params[0]));else if(a===w.c9)await e(t.params[0]);else if(a==="perpsStreamUpdate")(0,x.SB)().handleBackgroundUpdate(t.params[0]);else if(a!==k.g)throw new Error(`Internal JSON-RPC Notification Not Handled:

 ${JSON.stringify(t)}`)})};async function Y(t){let{backgroundConnection:e,initialState:a}=t;let r=await K(a,t);return await e.startSendingPatches(),j(r),r}async function $(t,e){!t.featureFlags&&(t.featureFlags={});let{currentLocaleMessages:a,enLocaleMessages:r}=await (0,h.UN)(t.currentLocale);t.textDirection==="rtl"&&(0,m.s)("rtl");let n={activeTab:e,metamask:t,appState:{},localeMessages:{currentLocale:t.currentLocale,current:a,en:r}};if((0,l.mc)()===v.YY||(0,l.mc)()===v.x$){let{origin:t}=n.activeTab;let e=(0,T.B4u)(n);let a=(0,y._)(n);let r=a&&(0,s.vI)(a,e);let o=(0,P.pm)(n);let i=(0,P.mD)(n);t&&i&&!o[t]&&e.length>0&&!r&&(n[c._1.unconnectedAccount]={state:L.nK.OPEN},A.dij(t))}let o=(0,M.Ay)(n);B.resolve(o);let i=(0,T.EcM)(t);let u=(0,O.A)(i,t.unapprovedPersonalMsgs,t.unapprovedDecryptMsgs,t.unapprovedEncryptionPublicKeyMsgs,t.unapprovedTypedMessages,t.networkId,(0,S.gr)({metamask:t}));return u.length>0&&o.dispatch(A.Z23({id:u[0].id})),o}async function K(t,e){let{traceContext:n}=e;(0,N.KO)();let o=(0,H.M)({metamask:t});let s=await (0,f.uP)({name:f.dg.SetupStore,parentContext:n,tags:o},()=>$(t,e.activeTab));globalThis.metamask={updateCurrentLocale:t=>{s.dispatch(A.DAg(t))},setFeatureFlag:(t,e)=>{s.dispatch(A.B4g(t,e))}},await (0,f.uP)({name:f.dg.InitialActions,parentContext:n},()=>R(s));let i=(0,D._)();return(0,f.uP)({name:f.dg.FirstRender,parentContext:n},()=>(0,r.render)(a.createElement(E.A,{store:s,uiMessenger:i}),e.container)),s}async function R(t){let a=t.getState();try{let r=(0,p.Y0)().toLowerCase();let{os:n}=a.metamask.browserEnvironment||{};n&&r&&t.dispatch(A.OdJ(n,r)).catch(t=>{e().error("Failed to update browser environment:",t)})}catch(t){e().error("Failed to get browser name:",t)}let r=(0,T.UyX)(a);if(r&&await t.dispatch(A.o$f(r)),(0,l.mc)()===v.YY){let e=Date.now();globalThis.metamask.id=e,await t.dispatch(A.AJb(e))}try{let e=async e=>{(0,C.QA)(e)&&await t.dispatch(A.s8B(!1,!1))};await e(a);let r=setInterval(()=>{let a=t.getState();let n=(0,T.SPM)(a);let o=(0,T.nT$)(a);if(n!==null&&!o){clearInterval(r);return}e(a)},I.a)}catch(t){e().error("[Metamask] checkIsSeedlessPasswordOutdated error",t)}}async function Z(t){let e={...t.getState()};return e.version=globalThis.platform.getVersion(),e.browser=window.navigator.userAgent,e.metamask=(0,g.ao)({...e.metamask,socialLoginEmail:undefined}),e}function j(t){window.stateHooks.reloadExtension=()=>{o().runtime.reload()},window.stateHooks.getCleanAppState=async function(){return Z(t)},window.stateHooks.getSentryAppState=function(){let e=t.getState();return(0,u.c)({...e,metamask:(0,g.ao)(e.metamask)},d.z)},window.stateHooks.getLogs=function(){let{logs:e}=t.getState().metamask;return Object.values(e).sort((t,e)=>{return t.timestamp-e.timestamp})},(0,b.De)(!1?0:.1),!0&&(0,b.sr)()}window.logStateString=async function(){let t=await window.stateHooks.getCleanAppState();return t.logs=window.stateHooks.getLogs(),t.platform=await o().runtime.getPlatformInfo(),JSON.stringify(t,null,2)},window.logState=async function(t){try{let e=await window.logStateString();t?(await navigator.clipboard.writeText(e),console.log("State log copied")):console.log(e)}catch(t){console.error(t.message)}}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);