import{d as g,r as k,u as e,b as s,c as l,bP as m,w as o,f as d,b0 as c,cb as u,cM as w,cy as h,v}from"./registerWidgets.1e9167ab.js";import{W as L}from"./workspaces.681666ae.js";import{L as f}from"./DocsButton.vue_vue_type_script_setup_true_lang.5ae278fd.js";import{p as I}from"./popupNotifcation.16e89f12.js";import{a as D}from"./asyncComputed.8a644895.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="a750c143-fe36-49b7-9921-304b481e6fb3",a._sentryDebugIdIdentifier="sentry-dbid-a750c143-fe36-49b7-9921-304b481e6fb3")}catch{}})();const B=g({__name:"LoginBlock",setup(a){const t=k(!1),{loading:i,result:n,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 _(){!n.value||(await n.value.delete(),p())}async function b(){if(!!n.value){t.value=!0;try{await L.deploy(),window.open(`https://cloud.abstra.io/projects/${n.value.projectId}/builds`,"_blank")}catch(r){I("Deploy failed",String(r))}t.value=!1}}return(r,C)=>e(i)?(s(),l(e(m),{key:0})):e(n)?(s(),l(e(h),{key:1},{default:o(()=>[d(e(u),{href:`https://cloud.abstra.io/projects/${e(n).projectId}`,target:"_blank"},{default:o(()=>[c("Go to console ")]),_:1},8,["href"]),t.value?(s(),l(e(u),{key:1},{default:o(()=>[c("Deploying ...")]),_:1})):(s(),l(e(w),{key:0,title:"Are you sure you want to deploy this project to Abstra Cloud?",onConfirm:b},{default:o(()=>[d(e(u),null,{default:o(()=>[c("Deploy")]),_:1})]),_:1})),d(e(u),{onClick:_},{default:o(()=>[c("Logout")]),_:1})]),_:1})):(s(),l(e(u),{key:2,onClick:y},{default:o(()=>[c("Login to deploy")]),_:1}))}});const M=v(B,[["__scopeId","data-v-227d4310"]]);export{M as L};
//# sourceMappingURL=LoginBlock.baf9b64b.js.map
