import{j as s,a6 as w,ak as x}from"./vendor-mui-core-DnR6WYuU.js";import{g as v,q as k,b as p}from"./vendor-hooks-DpqqC65c.js";import{I as T}from"./invitation-DaAeUQvL.js";import{K as I}from"./landing-page-DQd97swG.js";import{V as P,a5 as j}from"./vendor-ux-KtPBvlG0.js";import{u as R,a as S,d as E,c as N,H as W}from"./index-DGg3AL9l.js";import{g as C}from"./get-safe-url-CqIO9371.js";import{c as F}from"./passport-BeTGnBZp.js";import{u as L}from"./vendor-react-CTtPmzVP.js";import"./vendor-utils-BqKQizRf.js";import"./index-XVoTh0rZ.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Bavobyzn.js";import"./sdk-BZuN1V4h.js";import"./wrap-locale-C-cgVToU.js";import"./index-A-uhNQXl.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DRfhQ9Yl.js";import"./create-passport-svg-Cs4mVLsE.js";function Z(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=L(),{t:u}=P(),n=r.get("id"),c=r.get("redirect"),h=v({state:""}),o=k(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(o.error)throw o.error;return o?.data}),g=p(async(t,i=e=>e)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=C(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(w,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(W,{children:s.jsxs("title",{children:[u("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),s.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:F,onLoginSuccess:g,inService:!0,status:h.state})})]})}export{Z as default};
