import{j as e,a7 as w,al as c,bg as C,T as S,aT as l}from"./vendor-mui-core-D7t4vMS5.js";import{u as k,n as y,b as T,e as b,U as A,l as D,c as E,w as R}from"./index-Ca33rdd_.js";import{H as I}from"./addon-N_sS-Sx6.js";import{K as P}from"./landing-page-BJAji-kI.js";import{W as F,b4 as W}from"./vendor-ux-Dl3wVbv_.js";import{r as H}from"./vendor-hooks-DAZ1H6Va.js";import{r as o}from"./vendor-react-DX7tU9aY.js";import{s as L}from"./vendor-arcblock-ivFYo5vP.js";import"./vendor-utils-BzQg432x.js";import"./theme-mode-toggle-BltDSXhy.js";import"./question-mark-circle.svg-B0bcUgC5.js";import"./use-blocklet-logo-BWPJOOVd.js";function Q(){const{t:s,locale:p}=F(),{api:f,session:d}=k(),{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(C,{style:{fontSize:80}})}),e.jsx(S,{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:600*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(L)`
  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{Q as default};
