(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[8792],{748792(__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__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{"default":()=>S});var e=__webpack_require__(860012);var t=__webpack_require__(48084);var a=__webpack_require__(107495);var r=__webpack_require__(305142);var l=__webpack_require__(706794);var o=__webpack_require__(848574);var n=__webpack_require__(556734);var i=__webpack_require__(568894);var s=__webpack_require__(126528);var c=__webpack_require__(805600);var u=__webpack_require__(53784);var m=__webpack_require__(466770);var d=__webpack_require__(68940);var v=__webpack_require__(79222);var p=__webpack_require__(423533);var f=__webpack_require__(682988);var b=__webpack_require__(518176);var g=__webpack_require__(667855);var C=__webpack_require__(858753);var E=__webpack_require__(677465);var k=__webpack_require__(225087);var w=__webpack_require__(965657);var h=__webpack_require__(917214);let S=function(){let S=(0,t.wA)();let y=(0,a.Zp)();let B=(0,h.P)();let{trackEvent:D,createEventBuilder:M}=(0,b.s)();let T=(0,t.d4)(g.nT$);let A=(0,t.d4)(g.AbV);let[L,R]=(0,e.useState)("");let[x,N]=(0,e.useState)("");let[$,P]=(0,e.useState)(!1);let[_,z]=(0,e.useState)(!1);let[F,V]=(0,e.useState)(!1);let[W,j]=(0,e.useState)(undefined);let[H,I]=(0,e.useState)(!1);let J=(0,e.useCallback)(async(e,t)=>{if(!T&&!t)return;I(!0);try{if(T&&await S((0,v.zFo)()),await S((0,v.Pbw)(!0)),await S((0,v.ks_)(C.S.restore)),await S((0,v.mrz)(e,x)),D(M(f.gP.WalletRestored).addCategory(f.FZ.Retention).build()),j(e),N(""),A){I(!1),z(!1),V(!0);return}y(p.Sg,{replace:!0})}catch(e){I(!1),z(!1),console.error("[RestoreVault] Error during import:",e)}},[T,A,x,S,D,y]);let Z=(0,e.useCallback)(()=>{z(!0)},[]);let G=(0,e.useCallback)(()=>{if(H)return;z(!1)},[H]);let Q=(0,e.useCallback)(e=>{e.preventDefault(),S((0,v.ews)()),y(p.Sg,{replace:!0})},[S,y]);let q=_||H;let K=(0,e.useCallback)(()=>{y(p.Sg,{replace:!0})},[y]);let O;return O=F?e.createElement(E.A,{onNext:K,password:W}):q?e.createElement(w.i,{isSocialLoginFlow:!1,onSubmit:J,onBack:G,loading:H}):e.createElement(e.Fragment,null,e.createElement(s.a,null,e.createElement(s.a,{marginBottom:4},e.createElement(c.a,{iconName:r.$M.ArrowLeft,color:r.Li.IconDefault,size:l.f.Md,"data-testid":"import-srp-back-button",onClick:Q,ariaLabel:B("back")})),e.createElement(s.a,{className:"text-left",marginBottom:2},e.createElement(d.E,{variant:o.J3.HeadingLg},B("importAWallet"))),e.createElement(s.a,{marginBottom:4},e.createElement(d.E,{variant:o.J3.BodyMd,color:o.r7.TextAlternative},B("restoreWalletDescription",[e.createElement(u.Q,{key:"secret-recovery-phrase",onClick:()=>P(!0)},B("secretRecoveryPhrase"))]))),e.createElement(k.A,{error:L,setSecretRecoveryPhrase:N,onClearCallback:()=>R(""),showDescription:!1,toggleSrpDetailsModal:$,onSrpDetailsModalClose:()=>P(!1)})),e.createElement(s.a,{flexDirection:n.uV.Column,justifyContent:n.TE.Center,alignItems:n.RE.Center,className:"w-full text-left"},e.createElement(m.$,{size:i.Mp.Lg,"data-testid":"import-srp-confirm",onClick:Z,disabled:!x.trim()||Boolean(L),className:"import-srp__continue-button w-full"},B("continue")))),e.createElement(s.a,{flexDirection:n.uV.Column,justifyContent:n.TE.Between,gap:4,className:"import-srp-restore-vault h-full rounded-lg border border-solid","data-testid":"import-srp-restore-vault",borderColor:n.fu.BorderMuted,backgroundColor:n.v$.BackgroundDefault},O)}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);