function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = ["./SpaceCreatePopup.BZbPtUXX.js","./entry.BWtf2SiU.js","./entry.DKnXpSCN.css","./transition.CmQdahoH.js","./keyboard.ByfE0G_y.js","./open-closed.sdySVmhb.js","./env.DaWd-ERT.js","./dialog.4oCZ_M34.js","./portal.B_Y3muFE.js","./hidden.DcY_hcDg.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } import{d as L,q as j,u as B,r as P,a as A,w as D,x as E,f as m,g as x,i as n,Y as N,h as a,z as k,y,F as I,G as V,j as p,n as q,E as F,t as O,S as R,l as T,C as G,_ as U}from"./entry.BWtf2SiU.js";import{_ as Y}from"./Palette.vue.Bvazpcp_.js";import{_ as H}from"./SafeIcon.vue.BDcPo_mo.js";import{_ as J}from"./nuxt-link.sHp60w4E.js";import{a as K}from"./spaceResourceContext.B0EiNlao.js";import{a as M}from"./asyncData.Cq14hwYe.js";import{s as Q,h as W}from"./loadingBar.CY2HullU.js";import"./transition.CmQdahoH.js";import"./keyboard.ByfE0G_y.js";import"./open-closed.sdySVmhb.js";import"./env.DaWd-ERT.js";import"./search.DTcjPPkM.js";import"./userLibrary.DIXo-1Q0.js";import"./helpers.2e_jRVUR.js";import"./pro.hqbVbRHD.js";import"./dialog.4oCZ_M34.js";import"./portal.B_Y3muFE.js";import"./hidden.DcY_hcDg.js";import"./_commonjsHelpers.BosuxZz1.js";const X=T(()=>U(()=>import("./SpaceCreatePopup.BZbPtUXX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(b=>b.default||b)),Z={class:"bg-kit-50 min-h-screen"},ee={class:"z-20 left-4 flex items-center h-screen top-0 fixed pointer-events-none"},te={class:"bg-kit-100 border rounded flex-col flex pointer-events-auto"},oe={class:"drop-shadow-md"},se={class:"z-20 right-4 flex items-center h-screen top-0 fixed pointer-events-none"},ne={class:"bg-kit-100 border rounded flex-col flex pointer-events-auto"},Ce=L({__name:"space",async setup(b){let d,h;const v=j().$db(),u=B(),_=P(!1),w=G(),z=A(),g=K(),{data:S,pending:re,error:ae,refresh:C}=([d,h]=D(async()=>M("spaceSidebar",async()=>{var e;if(!((e=u.value)!=null&&e.data))return[];const o=await v.from("space_members").select("spaces(id,name,icon)").eq("user_id",u.value.data.id);if(o.error)throw o.error;return o.data.map(r=>r.spaces)})),d=await d,h(),d),$=async o=>{var s,i,f,c;Q();const{data:e,error:r}=await v.from("spaces").insert({name:o.name,icon:o.icon,user_id:(i=(s=u.value)==null?void 0:s.data)==null?void 0:i.id}).select("id").single();if(W(),r){w.fire({title:"Error",text:r.message,icon:"error"});return}await v.from("space_members").insert({user_id:(c=(f=u.value)==null?void 0:f.data)==null?void 0:c.id,space_id:e==null?void 0:e.id,role:"owner"}),_.value=!1,C(),q(`/spaces/${e==null?void 0:e.id}`)};return(o,e)=>{const r=Y,s=H,i=J,f=X,c=E("auto-animate");return m(),x("div",Z,[n(r),N(o.$slots,"default"),a("section",ee,[k((m(),x("aside",te,[n(i,{to:"/spaces",class:"p-4 text-xl rounded bg-kit-100 hover:bg-kit-50 transition-colors flex justify-center items-center"},{default:y(()=>[n(s,{icon:"tabler:home"})]),_:1}),(m(!0),x(I,null,V(p(S),t=>(m(),F(i,{key:t.id,to:`/spaces/${t.id}`,"aria-label":t.name,class:R([{"bg-kit-50":p(z).params.space_id===t.id},"p-4 text-xl inline-block bg-kit-100 hover:bg-kit-50 transition-colors hint hint--tooltip hint--right hint--rounded"])},{default:y(()=>[a("span",oe,O(t.icon),1)]),_:2},1032,["to","aria-label","class"]))),128)),a("button",{onClick:e[0]||(e[0]=t=>_.value=!0),class:"p-4 text-xl rounded bg-kit-100 hover:bg-kit-50 transition-colors flex justify-center items-center"},[n(s,{icon:"tabler:plus"})])])),[[c]])]),a("section",se,[k((m(),x("aside",ne,[a("button",{onClick:e[1]||(e[1]=t=>{var l;return(l=p(g))==null?void 0:l.zoomIn()}),class:"p-4 text-xl rounded bg-kit-100 hover:bg-kit-50 transition-colors flex justify-center items-center"},[n(s,{icon:"tabler:zoom-in"})]),a("button",{onClick:e[2]||(e[2]=t=>{var l;return(l=p(g))==null?void 0:l.zoomOut()}),class:"p-4 text-xl rounded bg-kit-100 hover:bg-kit-50 transition-colors flex justify-center items-center"},[n(s,{icon:"tabler:zoom-out"})])])),[[c]])]),n(f,{"is-open":p(_),onClose:e[3]||(e[3]=t=>_.value=!1),onSave:$,class:"fixed inset-0 z-30"},null,8,["is-open"])])}}});export{Ce as default};