import{j as e,a6 as k,ak as c,b0 as S,T as w,at as l}from"./vendor-mui-core-CnXrAOs3.js";import{a as C,d as y,s as T,b,t as A,S as D,c as E,v as R}from"./index-Cq3xfsOS.js";import{H as I}from"./addon-BgN564dt.js";import{K as P}from"./landing-page-C-nrxraJ.js";import{V as F,n as H}from"./vendor-ux-5OlTXZBe.js";import{k as L}from"./vendor-hooks-CjESGRlR.js";import{r as o}from"./vendor-react-Dvs43sk9.js";import{s as W}from"./vendor-arcblock-CqplRmyi.js";import"./vendor-utils-cJEl_UEd.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./lottie-web-4koyQiv_.js";function M(){const{t:s,locale:p}=F(),{api:f,session:d}=C(),{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=L(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(k,{});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(S,{style:{fontSize:80}})}),e.jsx(w,{variant:"h5",sx:{my:4},children:s("team.transferApp.successTitle")}),e.jsx("a",{href:`${E.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`,children:e.jsx(H,{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:p,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 _=l(W)`
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
`,z=l.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};
