import{t as e}from"./jsx-runtime-wTfS3W87.js";var t=e(),n=/(?:[\u{1F300}-\u{1F9FF}\u{1FA00}-\u{1FA9F}\u{1FAA0}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]\u{FE0F}?|\u{FE0F}|\u{200D}|\u{20E3}|[\u{E0020}-\u{E007F}])/gu,r=e=>e.replace(n,``).replace(/\s{2,}/g,` `).trim(),i=e=>r(e).split(/(\*\*.*?\*\*|\*.*?\*)/g).map((e,n)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,t.jsx)(`strong`,{style:{fontWeight:600,color:`var(--text-1)`},children:e.slice(2,-2)},n):e.startsWith(`*`)&&e.endsWith(`*`)?(0,t.jsx)(`em`,{style:{fontStyle:`normal`,fontWeight:500,color:`var(--text-1)`},children:e.slice(1,-1)},n):(0,t.jsx)(`span`,{children:e},n)),a=e=>e.startsWith(`|`)&&e.endsWith(`|`)&&e.includes(`|`),o=e=>/^[-*_]{3,}\s*$/.test(e.trim()),s=e=>/^>\s?/.test(e),c=e=>/^\d+[.)]\s+/.test(e),l=e=>/^#{1,4}\s+/.test(e.trim()),u=(e,n)=>{let r=e.trim();return o(r)?(0,t.jsx)(`div`,{style:{height:1,background:`var(--border-soft)`,margin:`4px 0`}},n):l(r)?(0,t.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:`var(--text-1)`,margin:n>0?`8px 0 2px`:`0 0 2px`},children:i(r.replace(/^#+\s+/,``))},n):r.startsWith(`- `)||r.startsWith(`* `)?(0,t.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,t.jsx)(`span`,{style:{color:`var(--accent)`,lineHeight:1.5},children:`•`}),(0,t.jsx)(`span`,{style:{whiteSpace:`pre-wrap`},children:i(r.replace(/^[-*]\s+/,``))})]},n):c(r)?(0,t.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,t.jsxs)(`span`,{style:{color:`var(--text-2)`,fontWeight:600,minWidth:16,lineHeight:1.5},children:[r.match(/^(\d+)[.)]\s+/)?.[1]||``,`.`]}),(0,t.jsx)(`span`,{style:{whiteSpace:`pre-wrap`},children:i(r.replace(/^\d+[.)]\s+/,``))})]},n):(0,t.jsx)(`div`,{children:i(e)},n)},d=e=>{let t=e.split(`
`),n=[],r=[],i=!1,s=()=>{if(!r.length)return;let e=r.join(`
`).trim();e&&n.push(e),r=[]};for(let e=0;e<t.length;e++){let c=t[e],u=c.trim();if(a(u)){i||=(s(),!0),r.push(c);continue}if(i&&=(s(),!1),o(u)){s(),n.push(u);continue}if(l(u)){s(),r.push(c);continue}if(!u){s();continue}r.push(c)}return s(),n};function f({text:e,style:n}){let l=r(String(e||``).trim());if(!l)return null;let f=d(l);return(0,t.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,...n},children:f.map((e,n)=>{let r=e.split(`
`).map(e=>e.trim()).filter(Boolean),l=r[0]||``;if(r.length===1&&o(l))return(0,t.jsx)(`div`,{style:{height:1,background:`var(--border-soft)`,margin:`4px 0`}},n);if(r.every(e=>s(e)))return(0,t.jsx)(`div`,{style:{paddingLeft:12,borderLeft:`3px solid var(--border)`,color:`var(--text-2)`,fontSize:13,lineHeight:1.7},children:i(r.map(e=>e.replace(/^>\s?/,``)).join(`
`))},n);if(r.every(e=>a(e.trim()))){let e=r.map(e=>e.trim()).filter(Boolean).map(e=>e.split(`|`).filter((e,t,n)=>t>0&&t<n.length-1).map(e=>e.trim())),a=e.findIndex(e=>e.every(e=>/^[\s:|-]+$/.test(e)&&e.replace(/[\s:|-]/g,``)===``)),o=a>0?e[a-1]:e[0],s=a>=0?e.slice(a+1):e.slice(1);if(s.length)return(0,t.jsx)(`div`,{style:{overflowX:`auto`},children:(0,t.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:13,border:`1px solid var(--border)`},children:[(0,t.jsx)(`thead`,{children:(0,t.jsx)(`tr`,{style:{background:`var(--surface2)`},children:o.map((e,n)=>(0,t.jsx)(`th`,{style:{padding:`8px 12px`,border:`1px solid var(--border)`,textAlign:`left`,fontWeight:600,color:`var(--text-1)`},children:i(e)},n))})}),(0,t.jsx)(`tbody`,{children:s.map((e,n)=>(0,t.jsx)(`tr`,{children:e.map((e,n)=>(0,t.jsx)(`td`,{style:{padding:`8px 12px`,border:`1px solid var(--border)`},children:i(e)},n))},n))})]})},n)}if(/^#{1,4}\s+/.test(l))return(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:`var(--text-1)`,marginBottom:6,marginTop:n>0?8:0},children:i(l.replace(/^#+\s+/,``))}),(0,t.jsx)(`div`,{style:{display:`grid`,gap:6},children:r.slice(1).map((e,n)=>e.startsWith(`- `)||e.startsWith(`* `)?(0,t.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,t.jsx)(`span`,{style:{color:`var(--accent)`,lineHeight:1.5},children:`•`}),(0,t.jsx)(`span`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-2)`},children:i(e.replace(/^[-*]\s+/,``))})]},n):c(e)?(0,t.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,t.jsxs)(`span`,{style:{color:`var(--text-2)`,fontWeight:600,minWidth:16,lineHeight:1.5},children:[e.match(/^(\d+)[.)]\s+/)?.[1]||``,`.`]}),(0,t.jsx)(`span`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-2)`},children:i(e.replace(/^\d+[.)]\s+/,``))})]},n):(0,t.jsx)(`div`,{style:{color:`var(--text-2)`},children:i(e)},n))})]},`${n}_${l}`);if(r.filter(c).length>=Math.max(2,r.length-1)){let e=c(r[0])?``:r[0],a=e?r.slice(1):r;return(0,t.jsxs)(`div`,{children:[e?(0,t.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:`var(--text-1)`,marginBottom:6},children:i(e)}):null,(0,t.jsx)(`div`,{style:{display:`grid`,gap:6},children:a.map((e,r)=>(0,t.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,t.jsxs)(`span`,{style:{color:`var(--text-2)`,fontWeight:600,minWidth:16,lineHeight:1.5},children:[e.match(/^(\d+)[.)]\s+/)?.[1]||`${r+1}`,`.`]}),(0,t.jsx)(`span`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-2)`},children:i(e.replace(/^\d+[.)]\s+/,``))})]},`${n}_${r}`))})]},`${n}_${l}`)}if(r.filter(e=>e.startsWith(`- `)||e.startsWith(`* `)).length>=Math.max(2,r.length-1)){let e=r[0].startsWith(`- `)||r[0].startsWith(`* `)?``:r[0],a=e?r.slice(1):r;return(0,t.jsxs)(`div`,{children:[e?(0,t.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:`var(--text-1)`,marginBottom:6},children:i(e)}):null,(0,t.jsx)(`div`,{style:{display:`grid`,gap:6},children:a.map((e,r)=>(0,t.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,t.jsx)(`span`,{style:{color:`var(--accent)`,lineHeight:1.5},children:`•`}),(0,t.jsx)(`span`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-2)`},children:i(e.replace(/^[-*]\s+/,``))})]},`${n}_${r}`))})]},`${n}_${l}`)}let d=l.match(/^([^：]{1,16})：\s*(.*)$/);if(d){let e=[d[2],...r.slice(1)].filter(Boolean).join(`
`);return(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:`var(--text-1)`,marginBottom:4},children:i(d[1])}),(0,t.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-2)`},children:i(e)})]},`${n}_${d[1]}`)}return(0,t.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-2)`,lineHeight:1.7},children:r.map((e,t)=>u(e,t))},`${n}_${l}`)})})}export{f as t};