import{j as e,a6 as w,ak as x}from"./vendor-mui-core-CKKG_1TN.js";import{g as v,p as k,b as c}from"./vendor-hooks-DQAdyHrE.js";import{I as T}from"./invitation-CnuNtRnn.js";import{K as I}from"./landing-page-B5QvkHHO.js";import{V as P,ah as j}from"./vendor-ux-DjXlxcvL.js";import{u as R,b as S,e as E,c as N,H as W}from"./index-BEfIUbZC.js";import{g as b}from"./get-safe-url-DxqVk96E.js";import{c as C}from"./passport-C_PAxd9K.js";import{u as F}from"./vendor-react-CTtPmzVP.js";import"./vendor-utils-CUs2ebe7.js";import"./index-C96Fw4Lj.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Cin9Rizr.js";import"./sdk-CMvNWVGa.js";import"./wrap-locale-CFhaO2KZ.js";import"./index-BoLm67SH.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BCP2x3BR.js";import"./create-passport-svg-DeDfPZeD.js";function Z(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=F(),{t:u}=P(),n=r.get("id"),p=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=c(()=>{if(o.error)throw o.error;return o?.data}),g=c(async(t,i=s=>s)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(p){const s=decodeURIComponent(p);s.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?d(s,{replace:!0}):window.location.href=b(s)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?e.jsx(w,{}):e.jsxs(I,{did:window.blocklet?.appPid,children:[e.jsx(W,{children:e.jsxs("title",{children:[u("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),e.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:C,onLoginSuccess:g,inService:!0,status:h.state})})]})}export{Z as default};
