import{_ as h}from"./Ba76BwjT.js";import{e as v,u as g,v as b,x as y,j as x,c as a,a as s,f as l,t as k,b as w,w as C,p as S,i as N,o as n,d as R}from"./DpdQcRr7.js";import{u as V}from"./D7eJvyae.js";import{b as q,a as B}from"./Ca4dpdo4.js";import"./BcpEzrWT.js";import"./DuJ0NDcC.js";import"./D1zzHZdQ.js";const E={class:"hero is-white"},M={class:"hero-body"},U={class:"container has-text-centered"},j={key:0},A={class:"notification is-danger is-light is-inline-block"},D={class:"mt-4"},H={key:1},G=v({__name:"callback",setup(K){g({title:"ログイン処理中"});const d=V(),_=b(),i=y(),m=S(),t=N("");return x(async()=>{const r=i.query.code,e=i.query.state,o=i.query.error;if(o){t.value=`ログインがキャンセルされました (${o})`;return}if(!r){t.value="認可コードがありません";return}const f=q(),c=B();if(!e||e!==f){t.value="state が一致しません（不正なリダイレクトの可能性があります）";return}if(!c){t.value="PKCE verifier が見つかりません。もう一度ログインしてください";return}const p=m.public.oauthRedirectUri,u=await d.loginWithCode(r,c,p);u.success?await _.push("/user"):t.value=u.error||"ログインに失敗しました"}),(r,e)=>{const o=h;return n(),a("section",E,[s("div",M,[s("div",U,[l(t)?(n(),a("div",j,[s("div",A,k(l(t)),1),s("div",D,[w(o,{to:"/login",class:"button is-primary is-light"},{default:C(()=>[...e[0]||(e[0]=[R("ログインに戻る",-1)])]),_:1})])])):(n(),a("div",H,[...e[1]||(e[1]=[s("button",{class:"button is-loading is-white is-large",disabled:""},null,-1),s("p",{class:"mt-3 has-text-grey"},"ログイン処理中...",-1)])]))])])])}}});export{G as default};
