import{u as g,L as h,M as v,N as x,t as b,A as i,z as s,x as o,B as S,O as a,P as V,Q as K,R as q}from"./CVseRzdt.js";import{r,c as k,s as B}from"./CnZMOK9T.js";import{u as C}from"./BL-m9H7_.js";import{_ as z}from"./uwzMbIC2.js";import{_ as N}from"./-yoBIeRq.js";const T={class:"pt-20 fit"},U={class:"row justify-center items-center"},$={class:"col-12 col-sm-6 col-md-4 col-lg-3"},w={class:"bg-zinc-800 rounded-sm text-center p-6"},A={class:"text-lg"},E={class:"pt-10"},O=o("br",null,null,-1),Q={class:"pt-4"},R=o("br",null,null,-1),Y={__name:"index",setup(j){const _=g(),d=x(),e=h({loading:!1,entry:{url:"http://localhost:4000",secretKey:""}});async function u(){e.loading=!0,r.setServer(e.entry.url),k.set("_STUDIO_SECRET_KEY_",e.entry.secretKey||"");var n=await r.fetchStudio({secret:e.entry.secretKey}).then(t=>t).catch(t=>t);if(n!=null&&n.auth){C().updateAuth(!0);let t=n==null?void 0:n.data;B.cf=t,r.setTenant(t.tenants[0]),r.saveConfig(),_.push("/space/data")}else d.notify({icon:"mdi-alert",iconColor:"red",message:"Unauthorized , please contact Administrator"});console.log(n),e.loading=!1}return(n,t)=>{const m=V,c=K,p=q,f=z,y=N;return b(),v(y,null,{default:i(()=>[s(f,{class:""},{default:i(()=>[o("div",T,[o("div",U,[o("div",$,[o("div",w,[o("div",A,[s(m,{size:"lg",name:"bi-alt"}),S(" Stdio")]),o("div",E,[s(c,{outlined:"",modelValue:a(e).entry.url,"onUpdate:modelValue":t[0]||(t[0]=l=>a(e).entry.url=l),label:"Server url"},null,8,["modelValue"]),s(c,{outlined:"",modelValue:a(e).entry.secretKey,"onUpdate:modelValue":t[1]||(t[1]=l=>a(e).entry.secretKey=l),label:"Secret Key"},null,8,["modelValue"])]),O,o("div",Q,[s(p,{class:"text-black font-bold",loading:a(e).loading,onClick:t[2]||(t[2]=l=>u()),"no-caps":"",color:"primary",label:"Open studio"},null,8,["loading"])]),R])])])])]),_:1})]),_:1})}}};export{Y as default};
