import{T as w,a as T,b as B,c as I,d as L}from"./BaYslAJW.js";import{B as M,Q as q,f as U,g as z,U as G,V as N,W as y,K as $,o as n,h as d,w as f,b as m,i as a,n as i,c as h,F as x,E as V,a as D,t as E,L as F,T as K,N as P,k as S,l as _}from"./B96cjQS3.js";import j from"./Cj3_emzb.js";import"./CebhLaJS.js";import"./De8PC2oi.js";const A={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"}},J={__name:"ProseCodeGroup",props:K({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,k=M(),s=q(p,"modelValue"),C=U(),r=z("prose.codeGroup",c),o=S(()=>_({extend:_(A),...C.ui?.prose?.codeGroup||{}})()),g=P(1),v=S(()=>(g.value,k.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 G(()=>{if(c.sync){const e=`code-group-${c.sync}`,t=N(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))})}}),$(()=>g.value++),(e,t)=>(n(),d(a(L),{modelValue:s.value,"onUpdate:modelValue":t[0]||(t[0]=l=>s.value=l),"default-value":p.defaultValue,"unmount-on-hide":!1,class:i(o.value.root({class:[a(r)?.root,c.class]}))},{default:f(()=>[m(a(w),{class:i(o.value.list({class:a(r)?.list}))},{default:f(()=>[m(a(T),{class:i(o.value.indicator({class:a(r)?.indicator}))},null,8,["class"]),(n(!0),h(x,null,V(v.value,(l,u)=>(n(),d(a(B),{key:u,value:String(u),class:i(o.value.trigger({class:a(r)?.trigger}))},{default:f(()=>[m(j,{icon:l.icon,filename:l.label,class:i(o.value.triggerIcon({class:a(r)?.triggerIcon}))},null,8,["icon","filename","class"]),D("span",{class:i(o.value.triggerLabel({class:a(r)?.triggerLabel}))},E(l.label),3)]),_:2},1032,["value","class"]))),128))]),_:1},8,["class"]),(n(!0),h(x,null,V(v.value,(l,u)=>(n(),d(a(I),{key:u,value:String(u),"as-child":""},{default:f(()=>[(n(),d(F(l.component),{"hide-header":"",tabindex:"-1"}))]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue","default-value","class"]))}};export{J as default};
