import{c as x,d as T,u as b,o as k,a as E,b as r,e as o,F as _,f as p,g as t,t as c,L as I,r as A,C as z,h as N,i as l}from"./index.js";/**
 * @license lucide-vue-next v0.486.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B=x("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-vue-next v0.486.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R=x("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),V={class:"flex min-h-screen items-center justify-center bg-background px-6 text-center"},q={class:"max-w-md"},F={class:"text-2xl font-semibold text-foreground"},L={class:"mt-3 text-muted-foreground"},M={class:"text-2xl font-semibold text-foreground"},O={class:"mt-3 text-muted-foreground"},S={class:"text-2xl font-semibold text-foreground"},w={class:"mt-3 text-muted-foreground"},P=15,j=1e3,X=T({__name:"OAuthCompletionPage",setup(D){const f=N(),{t:n}=b(),g=n("sidebar.title.answers"),d=e=>typeof f.query[e]=="string"?f.query[e]:"",s={connection:d("connection"),connectionType:d("connectionType"),type:d("credentialType")},v=Object.values(s).every(Boolean),i=A("verifying");let y=0,u=null;function C(e){return e.connection===s.connection&&e.connectionType===s.connectionType&&e.type===s.type}async function h(){var e;try{const{data:a}=await z.getUserConnections(),m=(e=a==null?void 0:a.credentials)==null?void 0:e.find(C);if(m!=null&&m.credentialEntered){i.value="success";return}}catch{}if(y+=1,y>=P){i.value="failed";return}u=globalThis.setTimeout(()=>void h(),j)}return k(()=>{if(!v){i.value="failed";return}h()}),E(()=>{u&&globalThis.clearTimeout(u)}),(e,a)=>(l(),r("main",V,[o("section",q,[i.value==="success"?(l(),r(_,{key:0},[p(t(B),{class:"mx-auto mb-5 size-12 text-green-600","aria-hidden":"true"}),o("h1",F,c(t(n)("connection_credentials.oauth_completion.title")),1),o("p",L,c(t(n)("connection_credentials.oauth_completion.close_tab")),1)],64)):i.value==="verifying"?(l(),r(_,{key:1},[p(t(I),{class:"mx-auto mb-5 size-12 animate-spin text-primary","aria-hidden":"true"}),o("h1",M,c(t(n)("connection_credentials.oauth_completion.verifying_title")),1),o("p",O,c(t(n)("connection_credentials.oauth_completion.verifying_description")),1)],64)):(l(),r(_,{key:2},[p(t(R),{class:"mx-auto mb-5 size-12 text-destructive","aria-hidden":"true"}),o("h1",S,c(t(n)("connection_credentials.oauth_completion.failed_title")),1),o("p",w,c(t(n)("connection_credentials.oauth_completion.failed_description",{AppName:t(g)})),1)],64))])]))}});export{X as default};
