import{T as w,a as B,b as I,c as T,d as L}from"./DewHeYIb.js";import{Q as M,_ as q,a0 as G,a1 as z,G as U,bC as $,w as y,bt as D,a as d,p as f,ac as n,s as a,al as F,v as N,c as h,am as x,o as i,B as m,e as _,F as S,r as V,af as P,ag as j,W as A}from"./B3fabVUf.js";import E from"./C-sCiTCq.js";import"./B6bUjJBd.js";const K={slots:{root:"relative group *:not-first:!my-0 *:not-first:!static my-5",list:"relative flex items-center gap-1 border border-muted bg-default border-b-0 rounded-t-md overflow-x-auto p-2",indicator:"absolute left-0 inset-y-2 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position) transition-[translate,width] duration-200 bg-elevated rounded-md shadow-xs",trigger:["relative inline-flex items-center gap-1.5 text-default data-[state=active]:text-highlighted hover:bg-elevated/50 px-2 py-1.5 text-sm rounded-md disabled:cursor-not-allowed disabled:opacity-75 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary focus:outline-none","transition-colors"],triggerIcon:"size-4 shrink-0",triggerLabel:"truncate"}},H={__name:"ProseCodeGroup",props:F({defaultValue:{type:String,required:!1,default:"0"},sync:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1}},{modelValue:{type:String},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const c=p,C=M(),s=q(p,"modelValue"),k=G(),r=z("prose.codeGroup",c),o=h(()=>x({extend:x(K),...k.ui?.prose?.codeGroup||{}})()),g=N(1),v=h(()=>(g.value,C.default?.()?.flatMap(b).filter(Boolean)||[]));function b(e,t){return typeof e.type=="symbol"?e.children?.map(b):{label:e.props?.filename||e.props?.label||`${t}`,icon:e.props?.icon,component:e}}return U(()=>{if(c.sync){const e=`code-group-${c.sync}`,t=$(e,()=>localStorage.getItem(e));y(t,()=>{t.value&&(s.value=t.value)},{immediate:!0}),y(s,()=>{s.value&&(t.value=s.value,localStorage.setItem(e,s.value))})}}),D(()=>g.value++),(e,t)=>(i(),d(a(w),{modelValue:s.value,"onUpdate:modelValue":t[0]||(t[0]=l=>s.value=l),"default-value":p.defaultValue,"unmount-on-hide":!1,class:n(o.value.root({class:[a(r)?.root,c.class]}))},{default:f(()=>[m(a(B),{class:n(o.value.list({class:a(r)?.list}))},{default:f(()=>[m(a(I),{class:n(o.value.indicator({class:a(r)?.indicator}))},null,8,["class"]),(i(!0),_(S,null,V(v.value,(l,u)=>(i(),d(a(T),{key:u,value:String(u),class:n(o.value.trigger({class:a(r)?.trigger}))},{default:f(()=>[m(E,{icon:l.icon,filename:l.label,class:n(o.value.triggerIcon({class:a(r)?.triggerIcon}))},null,8,["icon","filename","class"]),P("span",{class:n(o.value.triggerLabel({class:a(r)?.triggerLabel}))},j(l.label),3)]),_:2},1032,["value","class"]))),128))]),_:1},8,["class"]),(i(!0),_(S,null,V(v.value,(l,u)=>(i(),d(a(L),{key:u,value:String(u),"as-child":""},{default:f(()=>[(i(),d(A(l.component),{"hide-header":"",tabindex:"-1"}))]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue","default-value","class"]))}};export{H as default};
