import{j as e,a6 as w,ak as c,bu as k,T as C,at as p}from"./vendor-mui-core-CKKG_1TN.js";import{u as S,o as y,b as T,e as b,W as A,m as D,c as E,w as R}from"./index-BEfIUbZC.js";import{H as I}from"./addon-B42_QFF5.js";import{K as P}from"./landing-page-B5QvkHHO.js";import{V as F,F as W}from"./vendor-ux-DjXlxcvL.js";import{p as H}from"./vendor-hooks-DQAdyHrE.js";import{r as o}from"./vendor-react-CTtPmzVP.js";import{s as L}from"./vendor-arcblock-BCP2x3BR.js";import"./vendor-utils-CUs2ebe7.js";import"./lottie-web-4koyQiv_.js";import"./question-mark-circle.svg-GhTaklFN.js";function M(){const{t:s,locale:l}=F(),{api:f,session:d}=S(),{searchParams:m}=new URL(window.location.href),[u,x]=o.useState(!1),a=m.get("transferId"),h=window?.env?.appId,g=o.useCallback(async()=>{const{data:t}=await y.get("/blocklet/transfer",{params:{transferId:a}});return t},[a]),r=H(g),j=o.useCallback(async(t,i)=>{t&&(T(i(t.sessionToken)),b(i(t.refreshToken))),await d.refresh(),x(!0)},[]);if(r.loading)return e.jsx(w,{});if(r.error)return e.jsx(z,{children:e.jsx(A,{status:"404",title:r.error?.response?.data,description:""})});const v=r.data.status==="success";let n;return v||u?n=e.jsxs(e.Fragment,{children:[e.jsx(_,{children:e.jsx(I,{SessionContext:D})}),e.jsx(c,{sx:{pt:1,color:"success.main"},children:e.jsx(k,{style:{fontSize:80}})}),e.jsx(C,{variant:"h5",sx:{my:4},children:s("team.transferApp.successTitle")}),e.jsx("a",{href:`${E.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`,children:e.jsx(W,{variant:"contained",children:s("team.transferApp.visitDashboard")})})]}):n=e.jsx(R,{popup:!0,open:!0,action:"receive-transfer-app-owner",checkFn:f.get,forceConnected:!1,autoConnect:!1,checkTimeout:10*60*1e3,onSuccess:j,onClose:()=>{},locale:l,messages:{title:s("team.transferApp.receiveDialog.title"),scan:s("team.transferApp.receiveDialog.scan"),confirm:s("team.transferApp.receiveDialog.confirm"),success:s("team.transferApp.receiveDialog.success")},extraParams:{transferId:a,appDid:h},hideCloseButton:!0}),e.jsx(P,{did:window.blocklet?.appPid,children:e.jsx(c,{sx:{maxWidth:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:n})})}const _=p(L)`
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
`,z=p.div`
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f6f8fa;
`;export{M as default};
