@contentbit/studio 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +8 -4
  2. package/dist/client/assets/api-DbvlDnoO.js +1 -0
  3. package/dist/client/assets/document-RcoEgi0r.js +1 -0
  4. package/dist/client/assets/{index-DTXIZgkK.js → index-BOeG6kVU.js} +2 -2
  5. package/dist/client/assets/routes-cJNV3NIG.js +1 -0
  6. package/dist/server/assets/{_tanstack-start-manifest_v-wPlN1Hjy.js → _tanstack-start-manifest_v-BSt6T4tK.js} +4 -4
  7. package/dist/server/assets/{document-DjmCb_Rp.js → document-DlS34LM6.js} +1 -1
  8. package/dist/server/assets/{document-CxPFBdxd.js → document-G8TsI311.js} +49 -15
  9. package/dist/server/assets/{router-D4DnWGjU.js → router-734kIJxk.js} +2 -2
  10. package/dist/server/assets/{routes-BVJt9Z6a.js → routes-FGdym0e5.js} +28 -4
  11. package/dist/server/assets/{routes-6jOjWQ0D.js → routes-p0tk6PAr.js} +1 -1
  12. package/dist/server/index.d.ts.map +1 -1
  13. package/dist/server/index.js +27 -8
  14. package/dist/server/preview.d.ts +4 -2
  15. package/dist/server/preview.d.ts.map +1 -1
  16. package/dist/server/preview.js +1 -1
  17. package/dist/server/scan.d.ts.map +1 -1
  18. package/dist/server/scan.js +84 -222
  19. package/dist/server/server.js +2 -2
  20. package/dist/server/types.d.ts +21 -2
  21. package/dist/server/types.d.ts.map +1 -1
  22. package/package.json +5 -5
  23. package/src/routes/document.tsx +39 -0
  24. package/src/routes/index.tsx +21 -1
  25. package/src/server/index.ts +43 -14
  26. package/src/server/preview.ts +3 -2
  27. package/src/server/scan.test.ts +138 -0
  28. package/src/server/scan.ts +107 -277
  29. package/src/server/types.ts +21 -2
  30. package/dist/client/assets/api-MWiK2l_P.js +0 -1
  31. package/dist/client/assets/document-w62o-wDp.js +0 -1
  32. package/dist/client/assets/routes-Dg9spe-7.js +0 -1
@@ -1 +0,0 @@
1
- import{a as e,n as t,o as n,r,s as i}from"./index-DTXIZgkK.js";import{a,c as o,i as s,l as c,o as l,s as u,t as d}from"./api-MWiK2l_P.js";var f=c(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),p=c(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),m=c(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),h=c(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),g=i(n()),_=e();function v(){let e=t.useSearch(),[n,i]=(0,g.useState)(null),[c,v]=(0,g.useState)(null),[w,T]=(0,g.useState)(!1);async function E(){if(!e.path){v(`Missing document path.`);return}T(!0),v(null);try{i(await d(e.path))}catch(e){v(e instanceof Error?e.message:String(e))}finally{T(!1)}}return(0,g.useEffect)(()=>{E()},[e.path]),(0,_.jsxs)(`main`,{className:`min-h-svh bg-background text-foreground`,children:[(0,_.jsx)(`header`,{className:`border-b bg-muted/30`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5 px-5 py-5`,children:[(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,children:[(0,_.jsx)(s,{asChild:!0,variant:`outline`,className:`w-fit gap-2`,children:(0,_.jsxs)(r,{to:`/`,search:{q:``,status:`all`,sort:`status`,dir:`asc`},children:[(0,_.jsx)(f,{className:`size-4`}),`Dashboard`]})}),(0,_.jsxs)(s,{onClick:E,disabled:w,className:`w-fit gap-2`,children:[(0,_.jsx)(u,{className:w?`size-4 animate-spin`:`size-4`}),`Refresh`]})]}),n?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:n.file.relativePath}),(0,_.jsx)(`h1`,{className:`mt-1 break-words text-3xl font-semibold tracking-tight`,children:n.file.title}),(0,_.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs`,children:[(0,_.jsx)(b,{children:n.file.status}),(0,_.jsxs)(b,{children:[n.file.words,` words`]}),(0,_.jsxs)(b,{children:[n.file.blocks,` blocks`]}),(0,_.jsxs)(b,{children:[n.file.links,` links`]})]})]}):(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:`contentbit studio`}),(0,_.jsx)(`h1`,{className:`mt-1 text-3xl font-semibold tracking-tight`,children:`Document detail`})]})]})}),(0,_.jsxs)(`section`,{className:`mx-auto grid max-w-7xl gap-5 px-5 py-5 xl:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[c&&(0,_.jsx)(y,{title:`Error`,icon:(0,_.jsx)(a,{className:`size-4`}),children:c}),!n&&!c&&(0,_.jsx)(y,{title:`Loading`,icon:(0,_.jsx)(u,{className:`size-4`}),children:`Scanning document...`}),n&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(y,{title:`Preview`,icon:(0,_.jsx)(l,{className:`size-4`}),children:(0,_.jsx)(`div`,{className:`studio-preview`,dangerouslySetInnerHTML:{__html:n.previewHtml}})}),(0,_.jsx)(y,{title:`Source`,icon:(0,_.jsx)(h,{className:`size-4`}),children:(0,_.jsx)(`pre`,{className:`max-h-[34rem] overflow-auto whitespace-pre-wrap break-words bg-muted p-4 font-mono text-xs leading-5`,children:n.source})})]})]}),n&&(0,_.jsxs)(`aside`,{className:`space-y-5`,children:[(0,_.jsx)(y,{title:`Stats`,icon:(0,_.jsx)(m,{className:`size-4`}),children:(0,_.jsx)(x,{items:[[`words`,n.stats.length.words],[`reading`,`${n.stats.length.readingMinutes} min`],[`sections`,n.stats.outline.length],[`images`,n.stats.images.total],[`missing alt`,n.stats.images.missingAlt],[`external`,n.stats.links.external]]})}),(0,_.jsxs)(y,{title:`Links`,icon:(0,_.jsx)(o,{className:`size-4`}),children:[(0,_.jsx)(S,{title:`Outgoing`,items:n.linksTo}),(0,_.jsx)(S,{title:`Backlinks`,items:n.linkedFrom})]}),(0,_.jsx)(y,{title:`Keywords`,icon:(0,_.jsx)(p,{className:`size-4`}),children:n.file.keywords?(0,_.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[n.file.keywords.primary&&(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`text-xs uppercase text-muted-foreground`,children:`Primary`}),(0,_.jsx)(`p`,{className:`mt-1 font-medium`,children:n.file.keywords.primary})]}),(n.file.keywords.secondary?.length??0)>0&&(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`text-xs uppercase text-muted-foreground`,children:`Secondary`}),(0,_.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:n.file.keywords.secondary?.map(e=>(0,_.jsx)(b,{children:e},e))})]})]}):(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No keyword frontmatter found.`})}),(0,_.jsx)(y,{title:`Findings`,icon:(0,_.jsx)(a,{className:`size-4`}),children:n.findings.length>0?(0,_.jsx)(`ul`,{className:`space-y-3`,children:n.findings.map((e,t)=>(0,_.jsx)(C,{finding:e},`${e.code}-${e.line??0}-${t}`))}):(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No findings for this document.`})})]})]})]})}function y({title:e,icon:t,children:n}){return(0,_.jsxs)(`section`,{className:`border bg-background`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/40 px-4 py-3`,children:[t,(0,_.jsx)(`h2`,{className:`text-sm font-semibold`,children:e})]}),(0,_.jsx)(`div`,{className:`p-4`,children:n})]})}function b({children:e}){return(0,_.jsx)(`span`,{className:`inline-flex border bg-background px-2 py-0.5 text-xs`,children:e})}function x({items:e}){return(0,_.jsx)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden border bg-border`,children:e.map(([e,t])=>(0,_.jsxs)(`div`,{className:`bg-background p-3`,children:[(0,_.jsx)(`div`,{className:`font-mono text-lg font-semibold`,children:t}),(0,_.jsx)(`div`,{className:`text-[0.65rem] uppercase text-muted-foreground`,children:e})]},e))})}function S({title:e,items:t}){return(0,_.jsxs)(`div`,{className:`mb-4 last:mb-0`,children:[(0,_.jsx)(`p`,{className:`mb-2 text-xs uppercase text-muted-foreground`,children:e}),t.length>0?(0,_.jsx)(`ul`,{className:`space-y-1 text-sm`,children:t.map((e,t)=>(0,_.jsx)(`li`,{className:`truncate border bg-muted/40 px-2 py-1`,children:w(e)},`${w(e)}-${t}`))}):(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`None`})]})}function C({finding:e}){return(0,_.jsxs)(`li`,{className:`border bg-muted/30 p-3 text-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,_.jsx)(`span`,{className:`font-medium ${e.severity===`error`?`text-destructive`:e.severity===`warning`?`text-amber-700`:`text-blue-700`}`,children:e.code}),e.line&&(0,_.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`:`,e.line]})]}),(0,_.jsx)(`p`,{className:`mt-1`,children:e.message}),e.hint&&(0,_.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:e.hint})]})}function w(e){return typeof e==`string`?e:e.target??e.key??e.slug}export{v as component};
@@ -1 +0,0 @@
1
- import{a as e,i as t,o as n,r,s as i,t as a}from"./index-DTXIZgkK.js";import{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p}from"./api-MWiK2l_P.js";var m=l(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),h=l(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),g=l(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),_=l(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),v=l(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),y=i(n()),b=e();function x(){let e=a.useSearch(),n=t({from:`/`}),[r,i]=(0,y.useState)(null),[l,m]=(0,y.useState)(null),[g,x]=(0,y.useState)(null),[D,A]=(0,y.useState)(!1);async function j(){A(!0),x(null);try{let[e,t]=await Promise.all([f(),u()]);i(e),m(t)}catch(e){x(e instanceof Error?e.message:String(e))}finally{A(!1)}}(0,y.useEffect)(()=>{j()},[]);let M=(0,y.useMemo)(()=>{if(!r)return[];let t=e.q.toLowerCase().trim();return r.files.filter(n=>{let r=[n.relativePath,n.title,n.slug,n.key,n.locale,n.keywords?.primary,...n.keywords?.secondary??[]].filter(Boolean).join(` `).toLowerCase();return(e.status===`all`||n.status===e.status)&&r.includes(t)}).sort((t,n)=>k(t,n,e.sort,e.dir))},[r,e.dir,e.q,e.sort,e.status]);function N(e){n({to:`/`,search:t=>({...t,...e})})}function P(t){N({sort:t,dir:e.sort===t&&e.dir===`asc`?`desc`:`asc`})}return(0,b.jsxs)(`main`,{className:`min-h-svh bg-background text-foreground`,children:[(0,b.jsx)(`section`,{className:`border-b bg-muted/30`,children:(0,b.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-6 px-5 py-6`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-end md:justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`font-mono text-xs uppercase text-muted-foreground`,children:`contentbit studio`}),(0,b.jsx)(`h1`,{className:`mt-1 text-3xl font-semibold tracking-tight`,children:`Content dashboard`}),(0,b.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm text-muted-foreground`,children:`Read-only view of content health, structure, links, keywords, and previews.`})]}),(0,b.jsxs)(c,{onClick:j,disabled:D,className:`w-fit gap-2`,children:[(0,b.jsx)(p,{className:D?`size-4 animate-spin`:`size-4`}),`Refresh`]})]}),r&&(0,b.jsxs)(`div`,{className:`grid gap-px overflow-hidden rounded-sm border bg-border md:grid-cols-4`,children:[(0,b.jsx)(C,{label:`files`,value:r.summary.files,icon:(0,b.jsx)(_,{className:`size-4`})}),(0,b.jsx)(C,{label:`findings`,value:r.summary.errors+r.summary.warnings+r.summary.suggestions,icon:(0,b.jsx)(o,{className:`size-4`}),tone:r.summary.errors>0?`bad`:r.summary.warnings>0?`warn`:`ok`}),(0,b.jsx)(C,{label:`blocks`,value:r.summary.blocks,icon:(0,b.jsx)(h,{className:`size-4`})}),(0,b.jsx)(C,{label:`graph`,value:r.linkGraph?`${r.linkGraph.pages}/${r.linkGraph.links}`:`off`,icon:(0,b.jsx)(s,{className:`size-4`})})]})]})}),(0,b.jsxs)(`section`,{className:`mx-auto grid max-w-7xl gap-5 px-5 py-5 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 md:flex-row`,children:[(0,b.jsxs)(`label`,{className:`relative flex min-w-0 flex-1 items-center`,children:[(0,b.jsx)(d,{className:`pointer-events-none absolute left-3 size-4 text-muted-foreground`}),(0,b.jsx)(`input`,{value:e.q,onChange:e=>N({q:e.target.value}),placeholder:`Search path, title, slug, keyword...`,className:`h-10 w-full border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-foreground`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1 border bg-background p-1`,children:[(0,b.jsx)(v,{className:`mx-2 size-4 text-muted-foreground`}),[`all`,`error`,`warning`,`suggestion`,`healthy`].map(t=>(0,b.jsx)(`button`,{onClick:()=>N({status:t}),className:e.status===t?`bg-foreground px-2.5 py-1.5 text-xs font-medium text-background`:`px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground`,children:t},t))]})]}),(0,b.jsxs)(`div`,{className:`overflow-hidden border`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_0.6fr_0.6fr_0.6fr_2rem] gap-px border-b bg-border text-xs font-medium uppercase text-muted-foreground`,children:[(0,b.jsx)(O,{label:`Document`,active:e.sort===`document`,onClick:()=>P(`document`)}),(0,b.jsx)(O,{label:`Status`,active:e.sort===`status`,onClick:()=>P(`status`)}),(0,b.jsx)(O,{label:`Blocks`,active:e.sort===`blocks`,onClick:()=>P(`blocks`)}),(0,b.jsx)(O,{label:`Keywords`,active:e.sort===`keywords`,onClick:()=>P(`keywords`)}),(0,b.jsx)(`div`,{className:`bg-muted/50 px-2 py-2`})]}),g?(0,b.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:g}):r?(0,b.jsxs)(`div`,{className:`divide-y`,children:[M.map(e=>(0,b.jsx)(S,{file:e},e.path)),M.length===0&&(0,b.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No documents match the current filters.`})]}):(0,b.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Scanning content...`})]})]}),(0,b.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[(0,b.jsxs)(T,{title:`Link graph`,children:[r?.linkGraph?(0,b.jsxs)(`div`,{className:`grid grid-cols-3 gap-px overflow-hidden border bg-border text-center`,children:[(0,b.jsx)(w,{value:r.linkGraph.pages,label:`pages`}),(0,b.jsx)(w,{value:r.linkGraph.links,label:`links`}),(0,b.jsx)(w,{value:r.linkGraph.orphans,label:`orphans`})]}):(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No slug frontmatter detected.`}),l&&l.edges.length>0&&(0,b.jsx)(`ul`,{className:`mt-3 flex max-h-56 flex-col gap-2 overflow-auto text-xs`,children:l.edges.slice(0,12).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:e.status===`unresolved`?`text-destructive`:`text-muted-foreground`,children:e.status}),(0,b.jsx)(`span`,{className:`truncate`,children:e.target})]},`${e.from}-${e.target}-${t}`))})]}),(0,b.jsx)(T,{title:`Block usage`,children:r&&Object.keys(r.blockUsage).length>0?(0,b.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(r.blockUsage).map(([e,t])=>(0,b.jsxs)(`span`,{className:`border bg-muted px-2 py-1 font-mono text-xs`,children:[e,` x`,t]},e))}):(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No blocks found yet.`})}),(0,b.jsx)(T,{title:`Keyword coverage`,children:r&&(0,b.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,b.jsx)(E,{label:`primary`,value:r.keywordCoverage.withPrimary,total:r.keywordCoverage.total}),(0,b.jsx)(E,{label:`secondary`,value:r.keywordCoverage.withSecondary,total:r.keywordCoverage.total})]})})]})]})]})}function S({file:e}){return(0,b.jsxs)(r,{to:`/document`,search:{path:e.path},className:`grid grid-cols-[1.4fr_0.6fr_0.6fr_0.6fr_2rem] gap-px bg-border text-sm transition-colors hover:bg-foreground/20`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 bg-background px-3 py-3`,children:[(0,b.jsx)(`p`,{className:`truncate font-medium`,children:e.title}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.relativePath})]}),(0,b.jsx)(`div`,{className:`bg-background px-3 py-3`,children:(0,b.jsx)(D,{status:e.status})}),(0,b.jsx)(`div`,{className:`bg-background px-3 py-3 font-mono text-xs`,children:e.blocks}),(0,b.jsx)(`div`,{className:`bg-background px-3 py-3 text-xs text-muted-foreground`,children:e.keywords?.primary?`primary`:`missing`}),(0,b.jsx)(`div`,{className:`flex items-center justify-center bg-background px-2 py-3`,children:(0,b.jsx)(m,{className:`size-4 text-muted-foreground`})})]})}function C({label:e,value:t,icon:n,tone:r}){return(0,b.jsxs)(`div`,{className:`bg-background p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex items-center justify-between text-muted-foreground`,children:[(0,b.jsx)(`span`,{className:`text-xs uppercase`,children:e}),n]}),(0,b.jsx)(`div`,{className:`font-mono text-3xl font-semibold ${r===`bad`?`text-destructive`:r===`warn`?`text-amber-600`:r===`ok`?`text-emerald-600`:`text-foreground`}`,children:t})]})}function w({value:e,label:t}){return(0,b.jsxs)(`div`,{className:`bg-background px-2 py-2`,children:[(0,b.jsx)(`div`,{className:`font-mono text-lg font-semibold`,children:e}),(0,b.jsx)(`div`,{className:`text-[0.65rem] uppercase text-muted-foreground`,children:t})]})}function T({title:e,children:t}){return(0,b.jsxs)(`section`,{className:`border bg-background p-4`,children:[(0,b.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:e}),t]})}function E({label:e,value:t,total:n}){let r=n===0?0:Math.round(t/n*100);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`mb-1 flex justify-between text-xs`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,b.jsxs)(`span`,{className:`font-mono`,children:[r,`%`]})]}),(0,b.jsx)(`div`,{className:`h-2 bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full bg-foreground`,style:{width:`${r}%`}})})]})}function D({status:e}){return(0,b.jsx)(`span`,{className:`inline-flex border px-2 py-0.5 text-xs ${e===`error`?`border-destructive/40 bg-destructive/10 text-destructive`:e===`warning`?`border-amber-500/40 bg-amber-500/10 text-amber-700`:e===`suggestion`?`border-blue-500/40 bg-blue-500/10 text-blue-700`:`border-emerald-500/40 bg-emerald-500/10 text-emerald-700`}`,children:e})}function O({label:e,active:t,onClick:n}){return(0,b.jsxs)(`button`,{className:t?`flex items-center gap-1 bg-muted px-3 py-2 text-foreground`:`flex items-center gap-1 bg-muted/50 px-3 py-2 hover:text-foreground`,onClick:n,children:[e,(0,b.jsx)(g,{className:`size-3`})]})}function k(e,t,n,r){let i=r===`asc`?1:-1,a={error:0,warning:1,suggestion:2,healthy:3};return((n===`status`?a[e.status]-a[t.status]:n===`blocks`?e.blocks-t.blocks:n===`keywords`?A(e)-A(t):n===`findings`?j(e)-j(t):e.relativePath.localeCompare(t.relativePath))||e.relativePath.localeCompare(t.relativePath))*i}function A(e){return+!!e.keywords?.primary+ +!!e.keywords?.secondary?.length}function j(e){return e.findings.errors*100+e.findings.warnings*10+e.findings.suggestions}export{x as component};