import{j as a}from"./jsx-runtime.CyXy1Ci3.js";import{m as b}from"./marked.esm.BhM9K_2c.js";import{r as d}from"./index.CaZlGE7t.js";b.use({mangle:!1,headerIds:!1});const x=({children:m})=>{const[t,s]=d.useState(0),[c,f]=d.useState(!1),n=d.useRef([]);d.useEffect(()=>{c?n.current[t]?.focus():f(!0)},[t]);const o=Array.from(m.props.value.matchAll(/<div\s+data-name="([^"]+)"[^>]*>(.*?)<\/div>/gs),e=>({name:e[1],children:e[0]})),p=(e,r)=>{e.key==="Enter"||e.key===" "?s(r):e.key==="ArrowRight"?s((t+1)%o.length):e.key==="ArrowLeft"&&s((t-1+o.length)%o.length)};return a.jsxs("div",{className:"overflow-hidden rounded-lg border border-border dark:border-darkmode-border",children:[a.jsx("ul",{className:"glass-t-borderless m-0 list-none flex border-b border-border dark:border-darkmode-border",children:o.map((e,r)=>a.jsx("li",{className:`my-0 px-8 cursor-pointer border-b-[3px] pt-2 pb-1 text-lg text-txt-s dark:text-darkmode-txt-s border-border dark:border-darkmode-border 
                ${r===t&&"border-b-[3px] text-txt-p dark:text-darkmode-txt-p border-txt-p dark:border-darkmode-txt-p"}
              `,role:"tab",tabIndex:r===t?0:-1,onKeyDown:l=>p(l,r),onClick:()=>s(r),ref:l=>n.current[r]=l,children:e.name},r))}),o.map((e,r)=>a.jsx("div",{className:t===r?"tab-content block px-5":"hidden",dangerouslySetInnerHTML:{__html:b.parse(e.children)}},r))]})};export{x as default};
