import{b as w}from"./ViewLayoutSection.vue-CpGXOmxA.js";import{b,T as k,B as _,q as y,s as B,V as C,g as z}from"./ReferenceContentLoader-34zh6S1n.js";import{d as g,y as V,z as E,K as I,c as m,o,a as s,b as u,j as c,w as f,e as p,u as a,F as h}from"./index-CDPBytck.js";import"./DocumentMobileHeader.vue-CtBquMK3.js";import"./__vite-browser-external-D7Ct-6yo.js";const F={class:"flex h-full w-full flex-col gap-2 pt-8"},N={class:"flex min-h-8 items-center justify-between gap-2 pl-1.5"},j={class:"has-[:focus-visible]:bg-b-1 group relative z-1 flex flex-col rounded-lg"},q={class:"flex h-full min-h-[calc(1rem*4)] flex-col"},D={key:1,class:"text-c-3 flex h-full items-center justify-center rounded-lg border p-4"},M=g({__name:"MarkdownInput",props:{modelValue:{},environment:{},envVariables:{},workspace:{}},emits:["update:modelValue"],setup(x,{emit:n}){const d=n,t=V("preview"),r=V(null);E(t,l=>{l==="edit"&&I(()=>{r.value?.focus()})});const v=()=>{requestAnimationFrame(()=>{t.value="preview"})};return(l,e)=>(o(),m("div",F,[s("div",N,[e[5]||(e[5]=s("h3",{class:"font-bold"},"Description",-1)),t.value==="preview"?(o(),u(a(k),{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(b),{icon:"Pencil",size:"sm",thickness:"1.5"}),e[4]||(e[4]=s("span",null,"Edit",-1))]),_:1,__:[4]})):c("",!0)]),s("div",j,[s("div",q,[t.value==="preview"?(o(),m(h,{key:0},[l.modelValue&&l.modelValue.trim().length?(o(),m(h,{key:0},[l.modelValue?(o(),u(a(_),{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"])):c("",!0),e[6]||(e[6]=s("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",D,[p(a(k),{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(b),{icon:"Pencil",size:"sm",thickness:"1.5"}),e[7]||(e[7]=s("span",null,"Write a description",-1))]),_:1,__:[7]})]))],64)):c("",!0),t.value==="edit"?(o(),u(y,{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"])):c("",!0)])])]))}}),P=B(M,[["__scopeId","data-v-5997a667"]]),K=g({__name:"CollectionOverview",setup(x){const{activeCollection:n,activeEnvironment:d,activeEnvVariables:t,activeWorkspace:r}=C(),{collectionMutators:v}=z(),l=e=>{n.value&&v.edit(n.value.uid,"info.description",e)};return(e,i)=>(o(),u(w,null,{default:f(()=>[a(d)&&a(r)?(o(),u(P,{key:0,envVariables:a(t),environment:a(d),modelValue:a(n)?.info?.description??"",workspace:a(r),"onUpdate:modelValue":l},null,8,["envVariables","environment","modelValue","workspace"])):c("",!0)]),_:1}))}});export{K as default};
