import{d as b,r as k,u as e,b as s,c,bP as m,w as o,f as u,b0 as d,cb as l,cM as w,cy as h,v}from"./registerWidgets.faec4901.js";import{W as L}from"./workspaces.6b009dc4.js";import{L as f}from"./DocsButton.vue_vue_type_script_setup_true_lang.24289042.js";import{p as I}from"./popupNotifcation.e99d1f33.js";import{a as D}from"./asyncComputed.04758d6d.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="fcdcd781-a5c8-438a-9588-ec3d8834e1db",n._sentryDebugIdIdentifier="sentry-dbid-fcdcd781-a5c8-438a-9588-ec3d8834e1db")}catch{}})();const B=b({__name:"LoginBlock",setup(n){const t=k(!1),{loading:i,result:a,refetch:p}=D(()=>f.get());async function y(){const r=prompt(`Login to our console at https://cloud.abstra.io and get an API Key to deploy your Projects.

Enter your API Key here:`);!r||(await f.create(r),p())}async function _(){!a.value||(await a.value.delete(),p())}async function g(){if(!!a.value){t.value=!0;try{await L.deploy(),window.open(`https://cloud.abstra.io/projects/${a.value.projectId}/builds`,"_blank")}catch(r){I("Deploy failed",String(r))}t.value=!1}}return(r,C)=>e(i)?(s(),c(e(m),{key:0})):e(a)?(s(),c(e(h),{key:1},{default:o(()=>[u(e(l),{href:`https://cloud.abstra.io/projects/${e(a).projectId}`,target:"_blank"},{default:o(()=>[d("Go to console ")]),_:1},8,["href"]),t.value?(s(),c(e(l),{key:1},{default:o(()=>[d("Deploying ...")]),_:1})):(s(),c(e(w),{key:0,title:"Are you sure you want to deploy this project to Abstra Cloud?",onConfirm:g},{default:o(()=>[u(e(l),null,{default:o(()=>[d("Deploy")]),_:1})]),_:1})),u(e(l),{onClick:_},{default:o(()=>[d("Logout")]),_:1})]),_:1})):(s(),c(e(l),{key:2,onClick:y},{default:o(()=>[d("Login to deploy")]),_:1}))}});const M=v(B,[["__scopeId","data-v-227d4310"]]);export{M as L};
//# sourceMappingURL=LoginBlock.b18f1e5b.js.map
