import{b as y}from"./ViewLayoutSection.vue-BXfzZm28.js";import{g as h,_ as C,a0 as z,v as B,z as E,j as I}from"./ReferenceContentLoader-Z8YmHBVJ.js";import{bl as V}from"./navigation-BzNQiq4W.js";import{d as w,r as g,w as j,J as F,i as m,o,h as n,b as c,k as u,g as f,n as p,l as a,F as x}from"./index-DPl1iiyq.js";import"./__vite-browser-external-D7Ct-6yo.js";const N={class:"flex h-full w-full flex-col gap-2 pt-8"},M={class:"flex min-h-8 items-center justify-between gap-2 pl-1.5"},$={class:"has-[:focus-visible]:bg-b-1 group relative z-1 flex flex-col rounded-lg"},D={class:"flex h-full min-h-[calc(1rem*4)] flex-col"},P={key:1,class:"text-c-3 flex h-full items-center justify-center rounded-lg border p-4"},U=w({__name:"MarkdownInput",props:{modelValue:{},environment:{},envVariables:{},workspace:{}},emits:["update:modelValue"],setup(_,{emit:s}){const d=s,t=g("preview"),r=g(null);j(t,l=>{l==="edit"&&F(()=>{var e;(e=r.value)==null||e.focus()})});const v=()=>{requestAnimationFrame(()=>{t.value="preview"})};return(l,e)=>(o(),m("div",N,[n("div",M,[e[5]||(e[5]=n("h3",{class:"font-bold"},"Description",-1)),t.value==="preview"?(o(),c(a(V),{key:0,class:"text-c-2 hover:text-c-1 flex items-center gap-2",size:"sm",type:"button",variant:"outlined",onClick:e[0]||(e[0]=i=>t.value="edit")},{default:f(()=>[p(a(h),{icon:"Pencil",size:"sm",thickness:"1.5"}),e[4]||(e[4]=n("span",null,"Edit",-1))]),_:1,__:[4]})):u("",!0)]),n("div",$,[n("div",D,[t.value==="preview"?(o(),m(x,{key:0},[l.modelValue&&l.modelValue.trim().length?(o(),m(x,{key:0},[l.modelValue?(o(),c(a(C),{key:0,class:"h-full flex-1 rounded border border-transparent p-1.5 hover:border-(--scalar-background-3)",value:l.modelValue,withImages:"",onDblclick:e[1]||(e[1]=i=>t.value="edit")},null,8,["value"])):u("",!0),e[6]||(e[6]=n("div",{class:"brightness-lifted bg-b-1 absolute inset-0 -z-1 hidden rounded group-hover:block group-has-[:focus-visible]:hidden"},null,-1))],64)):(o(),m("div",P,[p(a(V),{class:"hover:bg-b-2 hover:text-c-1 text-c-2 flex items-center gap-2",size:"sm",variant:"ghost",onClick:e[2]||(e[2]=i=>t.value="edit")},{default:f(()=>[p(a(h),{icon:"Pencil",size:"sm",thickness:"1.5"}),e[7]||(e[7]=n("span",null,"Write a description",-1))]),_:1,__:[7]})]))],64)):u("",!0),t.value==="edit"?(o(),c(z,{key:1,ref_key:"codeInputRef",ref:r,class:"h-full flex-1 border px-0.5 py-0",envVariables:l.envVariables,environment:l.environment,modelValue:l.modelValue,workspace:l.workspace,onBlur:v,"onUpdate:modelValue":e[3]||(e[3]=i=>d("update:modelValue",i))},null,8,["envVariables","environment","modelValue","workspace"])):u("",!0)])])]))}}),W=B(U,[["__scopeId","data-v-5997a667"]]),S=w({__name:"CollectionOverview",setup(_){const{activeCollection:s,activeEnvironment:d,activeEnvVariables:t,activeWorkspace:r}=E(),{collectionMutators:v}=I(),l=e=>{s.value&&v.edit(s.value.uid,"info.description",e)};return(e,i)=>(o(),c(y,null,{default:f(()=>{var b,k;return[a(d)&&a(r)?(o(),c(W,{key:0,envVariables:a(t),environment:a(d),modelValue:((k=(b=a(s))==null?void 0:b.info)==null?void 0:k.description)??"",workspace:a(r),"onUpdate:modelValue":l},null,8,["envVariables","environment","modelValue","workspace"])):u("",!0)]}),_:1}))}});export{S as default};
