youiyoux 0.1.13 → 0.1.14

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 (77) hide show
  1. package/dist/chunks/{chunk-ZWVWENSB.js → chunk-A2IZOTJG.js} +1 -1
  2. package/dist/chunks/{chunk-5I2VHSEN.js → chunk-ALQVHSF2.js} +1 -1
  3. package/dist/chunks/{chunk-EV62TUDV.js → chunk-EN64OSUT.js} +230 -288
  4. package/dist/chunks/{chunk-DX2NKY2M.js → chunk-F3KCL226.js} +4 -4
  5. package/dist/chunks/chunk-FTF4MBV5.js +110 -0
  6. package/dist/chunks/{chunk-PCLXMWZ2.js → chunk-HII2I2PI.js} +3 -3
  7. package/dist/chunks/{chunk-XOXF2ILO.js → chunk-HIXGUALJ.js} +1 -1
  8. package/dist/chunks/{chunk-N5Z5A637.js → chunk-JGEVNQ5R.js} +2 -2
  9. package/dist/chunks/{chunk-PWGZRP3C.js → chunk-MIUG2Z43.js} +180 -8
  10. package/dist/chunks/{chunk-NF4OJYKC.js → chunk-S7UN5KQK.js} +1 -1
  11. package/dist/chunks/{chunk-ZOQW6LNH.js → chunk-TPP4HLDB.js} +446 -29
  12. package/dist/chunks/ingest-OF4Z33L2.js +52 -0
  13. package/dist/chunks/{src-HVYMF4S2.js → src-3LEBH7E3.js} +7 -7
  14. package/dist/chunks/{src-IKDQ2BZO.js → src-4BOFDAZD.js} +1 -1
  15. package/dist/chunks/{src-4QOHR5GC.js → src-6JO73FOS.js} +3 -3
  16. package/dist/chunks/{src-E6ZPFKPR.js → src-7LETTRRF.js} +23 -3
  17. package/dist/chunks/{src-PBM76LFQ.js → src-7SHBAJEO.js} +2 -2
  18. package/dist/chunks/{src-R7JGKOYI.js → src-CCGTRT5J.js} +18 -4
  19. package/dist/chunks/{src-624TVB6T.js → src-LUPO3O76.js} +2 -2
  20. package/dist/chunks/{src-YC64NNQ3.js → src-WMGLZKYK.js} +2 -2
  21. package/dist/hub/assets/{CandidatePanel-DfntneYT.js → CandidatePanel-BbE2xCN2.js} +1 -1
  22. package/dist/hub/assets/CatalogScreen-CBlaW1-N.js +1 -0
  23. package/dist/hub/assets/ChangesScreen-WaA9Y7zq.js +1 -0
  24. package/dist/hub/assets/{CheatSheet-B1dXTYTW.js → CheatSheet-CGfTS7zw.js} +1 -1
  25. package/dist/hub/assets/{CommandPalette-LBZHJ659.js → CommandPalette-D4WigyuD.js} +1 -1
  26. package/dist/hub/assets/{DiscoverScreen-Yd3gVUG4.js → DiscoverScreen-CVtcQCM4.js} +2 -2
  27. package/dist/hub/assets/DraftEditor-Mp1bT8-o.js +5 -0
  28. package/dist/hub/assets/{GapsScreen-DPYGlNnA.js → GapsScreen-DzB0TfH3.js} +1 -1
  29. package/dist/hub/assets/{HomeScreen-BCPPk7mz.js → HomeScreen-BVxjYDtc.js} +1 -1
  30. package/dist/hub/assets/InventoryScreen-D33_YchG.js +1 -0
  31. package/dist/hub/assets/{LibraryScreen-BVXhOVPU.js → LibraryScreen-B8lAJBGW.js} +1 -1
  32. package/dist/hub/assets/{Opened-CJyMbxqV.js → Opened-DgNa-hGA.js} +1 -1
  33. package/dist/hub/assets/{OrgApp-Dxs_7CxZ.js → OrgApp-Q8YNFE-z.js} +1 -1
  34. package/dist/hub/assets/{Preview-DWFP0BIe.js → Preview-yu3LaZKL.js} +1 -1
  35. package/dist/hub/assets/{RuleDetail-C2fTlLJL.js → RuleDetail-BqVdc20s.js} +1 -1
  36. package/dist/hub/assets/{RulesScreen-BABeAGJg.js → RulesScreen-mb3OUlOB.js} +1 -1
  37. package/dist/hub/assets/{ScreenImage-CyhKm_nj.js → ScreenImage-DUMSgBJL.js} +1 -1
  38. package/dist/hub/assets/{ScreensScreen-8Ih8byGy.js → ScreensScreen-DjN5mwSP.js} +1 -1
  39. package/dist/hub/assets/{SearchField-hF-6-YDM.js → SearchField-ByftoJws.js} +1 -1
  40. package/dist/hub/assets/{Segmented-Dzi1x49S.js → Segmented-CTMaLPgh.js} +1 -1
  41. package/dist/hub/assets/{ServiceDown-S4ya0Cob.js → ServiceDown-BghtjpTn.js} +1 -1
  42. package/dist/hub/assets/{SpecimenCapture-e_pgT4Sp.js → SpecimenCapture-CglZ4bn-.js} +1 -1
  43. package/dist/hub/assets/{Specimens-D_9hjlJH.js → Specimens-D5ehj5-O.js} +2 -2
  44. package/dist/hub/assets/{StackScreen-J2FQilLW.js → StackScreen-w5hCLj_R.js} +1 -1
  45. package/dist/hub/assets/{StubScreens-DAkMph3i.js → StubScreens-DfF4aAbp.js} +1 -1
  46. package/dist/hub/assets/{StyleScreen-C5WytSZU.js → StyleScreen-DKkerxmC.js} +1 -1
  47. package/dist/hub/assets/{Tabs-DU-fFRDV.js → Tabs-B1IFs-wv.js} +1 -1
  48. package/dist/hub/assets/TokenDetail-BPTZ9o6J.js +1 -0
  49. package/dist/hub/assets/TokensScreen-CKnQuVaT.js +1 -0
  50. package/dist/hub/assets/{WorkspaceScreen-CzZ16fPZ.js → WorkspaceScreen-DwjGW6eY.js} +1 -1
  51. package/dist/hub/assets/{client-Bdgr12LP.js → client-uMxZXiDl.js} +1 -1
  52. package/dist/hub/assets/{discover-va2KFuK_.js → discover-Yfb0eB14.js} +1 -1
  53. package/dist/hub/assets/{dist-CC_p8DIj.js → dist-BvRlRM3Z.js} +1 -1
  54. package/dist/hub/assets/{dist-C8tf4g8c.js → dist-CL3qgCbi.js} +1 -1
  55. package/dist/hub/assets/{dist-YTWqg5sS.js → dist-tjVfXRHc.js} +1 -1
  56. package/dist/hub/assets/{family-tiles-qaK1-_c8.js → family-tiles-dZqjsxro.js} +1 -1
  57. package/dist/hub/assets/link-2-dzvhLwTC.js +1 -0
  58. package/dist/hub/assets/main-DNLr0KzQ.css +2 -0
  59. package/dist/hub/assets/main-Djqho539.js +2 -0
  60. package/dist/hub/assets/{try-live-Iys3nCBG.js → try-live-Dxsjf62v.js} +1 -1
  61. package/dist/hub/assets/{workflow-C53UBmRZ.js → workflow-Bv814-L8.js} +1 -1
  62. package/dist/hub/index.html +2 -2
  63. package/dist/hub-previews.js +6 -6
  64. package/dist/hub-server.js +3 -3
  65. package/dist/hub-snapshot.js +1 -1
  66. package/dist/schema/youi.library.schema.json +3 -1
  67. package/dist/youi.js +8 -7
  68. package/dist/youiyoux.js +8 -7
  69. package/package.json +4 -4
  70. package/dist/hub/assets/CatalogScreen-kpFYZqX3.js +0 -1
  71. package/dist/hub/assets/ChangesScreen-Chu-Ui1B.js +0 -1
  72. package/dist/hub/assets/DraftEditor-QH9Sa_Uc.js +0 -5
  73. package/dist/hub/assets/InventoryScreen-SleB733C.js +0 -1
  74. package/dist/hub/assets/TokenDetail-CDY1xxb9.js +0 -1
  75. package/dist/hub/assets/TokensScreen-Sx4aICWk.js +0 -1
  76. package/dist/hub/assets/main-cvOFSjox.js +0 -2
  77. package/dist/hub/assets/main-pNY4iNRo.css +0 -2
@@ -1,3 +1,3 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{n as r,t as i}from"./DraftEditor-QH9Sa_Uc.js";import{a,i as o,n as s,o as c,s as l}from"./RuleDetail-C2fTlLJL.js";import{i as u,r as d,t as f}from"./ServiceDown-S4ya0Cob.js";import{t as p}from"./shield-check-0ka0kQct.js";import{t as m}from"./clsx-DB0hHKMi.js";import{H as h,L as g,U as _,a as v,dt as y,ft as b,i as x,mt as S,n as C,o as w,pt as T,r as E,rt as D,s as O,tt as k}from"./main-cvOFSjox.js";import{a as A,i as j,n as M}from"./workflow-C53UBmRZ.js";import{r as N,t as P}from"./Badge-CUJUit4d.js";import{n as F,t as I}from"./Section-BTnvUq_W.js";import{t as L}from"./CodeBlock-CsiGFgvI.js";var R=e(t(),1),z=n(),B=60,V=new Set([`draft`,`previewed`,`approved`]);async function H(){let[e,t,{drafts:n}]=await Promise.all([A.info(),A.rules(),A.drafts()]);return{info:e,published:t,drafts:n}}var U=e=>D(e)?.name??e;function W(){let[e,t]=(S()[`*`]??``).split(`/`),n=j(H,`rules`);return n.state.status===`loading`?(0,z.jsx)(E,{}):e===`draft`&&t?n.state.status===`error`?(0,z.jsx)(f,{error:n.state.error,onRetry:n.reload}):(0,z.jsx)(ee,{id:t,live:n.state.value,onChanged:n.reload}):n.state.status===`ready`?(0,z.jsx)(q,{rows:G(n.state.value),selected:e||null,live:n.state.value,onChanged:n.reload}):(0,z.jsx)(K,{selected:e||null})}function G(e){return e.published.rules.map(({rule:t,components:n,flagged:r,notRun:i,places:a})=>({rule:t,components:n,flagged:r,...i?{notRun:i}:{},places:a,draft:e.drafts.find(e=>e.kind===`rule`&&e.ruleId===t.id&&V.has(e.status))??null})).sort((e,t)=>e.rule.title.localeCompare(t.rule.title))}function K({selected:e}){let t=h(),n=_(),r=(0,R.useMemo)(()=>{if(t.status!==`ready`)return null;let e=n.status===`ready`?n.value:null;return[...t.value.rules.values()].map(n=>{let r=e?.violationsByRule.get(n.id)??null,i=e?s(e.reports,n):[];return{rule:n,components:t.value.ruleComponents.get(n.id)??[],flagged:r?.length??null,...i.length?{notRun:i.join(`; `)}:{},places:r??[],draft:null}})},[t,n]);return r?(0,z.jsx)(q,{rows:r,selected:e,live:null,onChanged:()=>void 0}):(0,z.jsx)(x,{state:t,onRetry:g,what:`the catalog`})}function q({rows:e,selected:t,live:n,onChanged:r}){let[,i]=T(),[a,o]=(0,R.useState)(null),s=t?e.find(e=>U(e.rule.id)===t)??null:null,c=async e=>{o(null);try{let t=await e();r(),i(`/rules/draft/${t.id}`)}catch(e){o(M(e).message)}},l=e=>{e.draft?i(`/rules/draft/${e.draft.id}`):c(()=>A.edit(e.rule.id))};return(0,z.jsx)(v,{listLabel:`Rules`,backHref:`/rules`,hasDetail:s!==null,list:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{title:`Rules`,count:e.length,children:n&&(0,z.jsxs)(O,{variant:`primary`,size:`sm`,onClick:()=>void c(A.create),children:[(0,z.jsx)(u,{}),` New rule`]})}),(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[a&&(0,z.jsx)(`p`,{className:`border-b border-line bg-danger-soft px-4 py-2 text-small text-ink-2`,children:a}),(0,z.jsx)(`p`,{className:`border-b border-line px-4 py-2.5 text-small text-muted`,children:n?(0,z.jsxs)(z.Fragment,{children:[`Live rules of `,(0,z.jsx)(`span`,{className:`font-medium text-ink-2`,children:n.info.project.id}),`, from `,n.info.design.branch,`@`,n.info.design.head.slice(0,7),`. Places from a scan at `,new Date(n.published.scannedAt).toLocaleTimeString(),`.`]}):`From the snapshot. Start the rule editor to edit rules and see live places.`}),(0,z.jsx)(`ul`,{children:e.map(e=>(0,z.jsx)(J,{row:e,active:e===s},e.rule.id))})]})]}),detail:s?(0,z.jsx)(X,{row:s,live:n,onEdit:()=>l(s)}):(0,z.jsx)(Q,{live:n})})}function J({row:e,active:t}){return(0,z.jsx)(`li`,{children:(0,z.jsxs)(y,{href:`/rules/${U(e.rule.id)}`,"aria-current":t?`page`:void 0,className:m(`block border-b border-line px-4 py-2.5 hover:bg-raised`,t&&`bg-raised`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body text-ink`,children:e.rule.title}),e.draft&&(0,z.jsx)(r,{draft:e.draft})]}),(0,z.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 text-small text-muted`,children:[(0,z.jsx)(N,{severity:e.rule.severity}),e.rule.rollout&&(0,z.jsxs)(`span`,{children:[`→ error`,e.rule.rollout.after?` ${e.rule.rollout.after}`:` later`]}),(0,z.jsx)(`span`,{className:`truncate`,children:e.rule.check.engine===`advisory`?`advisory`:e.rule.check.engine===`youi`?e.rule.check.id:`custom check`}),(0,z.jsx)(`span`,{className:`ml-auto tabular`,children:e.flagged===null?``:e.flagged===0?`clean`:`${e.flagged} ${e.flagged===1?`place`:`places`}`})]})]})})}function Y(e){return e.severity===`error`?`Error: fails youiyoux check`:e.severity===`off`?`Off`:`Warning${e.rollout?`, becoming an error ${e.rollout.after?`after ${e.rollout.after}`:`later`}`:``}`}function X({row:e,live:t,onEdit:n}){let{rule:i}=e,a=t?.info.checks.find(e=>i.check.engine===`youi`?e.id===i.check.id:e.engine===i.check.engine)?.label;return(0,z.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,z.jsxs)(`header`,{className:`border-b border-line px-6 pt-5 pb-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg border border-line bg-raised text-ink-2`,children:(0,z.jsx)(p,{className:`size-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`text-title outline-none`,children:i.title}),(0,z.jsx)(N,{severity:i.severity}),i.rollout&&(0,z.jsxs)(P,{tone:`outline`,children:[`→ error `,i.rollout.after??`later`]})]}),(0,z.jsx)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:i.id})]}),t&&(0,z.jsxs)(O,{variant:e.draft?`outline`:`primary`,size:`sm`,onClick:n,children:[(0,z.jsx)(l,{}),` `,e.draft?`Open draft`:`Edit rule`]})]}),(0,z.jsx)(`p`,{className:`mt-3 max-w-2xl text-reading text-ink`,children:i.statement}),e.draft&&(0,z.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-small text-muted`,children:[(0,z.jsx)(r,{draft:e.draft}),` A draft of this rule is open (revision `,e.draft.revision,`).`]})]}),(0,z.jsxs)(`div`,{className:`space-y-8 p-6`,children:[(0,z.jsx)(F,{title:`Where it is broken`,count:e.flagged??void 0,children:(0,z.jsx)(Z,{row:e})}),(0,z.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-2`,children:[(0,z.jsx)(F,{title:`How it is checked`,children:(0,z.jsx)(I,{rows:[[`Check`,a??o(i)],[`Level`,Y(i)],[`Files`,(0,z.jsx)(`code`,{className:`font-mono text-mono-sm`,children:i.files.join(`, `)})],[`Followed by`,e.components.length?(0,z.jsx)(`span`,{className:`flex flex-wrap gap-x-2`,children:e.components.map(e=>(0,z.jsx)(y,{href:k(e,`rules`),className:`text-accent hover:underline`,children:U(e)},e))}):`No component yet`]]})}),(0,z.jsx)(F,{title:`Why`,children:(0,z.jsx)(`p`,{className:`text-body text-ink-2`,children:i.rationale||`No rationale recorded.`})})]}),(0,z.jsx)(F,{title:`For agents`,children:(0,z.jsx)(`blockquote`,{className:`rounded-md border-l-2 border-line-strong bg-sunken px-3 py-2 text-body text-ink-2`,children:i.agent})}),(i.examples.bad.length>0||i.examples.good.length>0)&&(0,z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,z.jsx)(F,{title:`Breaks the rule`,children:(0,z.jsx)(L,{code:i.examples.bad.join(`
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{n as r,t as i}from"./DraftEditor-Mp1bT8-o.js";import{a,i as o,n as s,o as c,s as l}from"./RuleDetail-BqVdc20s.js";import{i as u,r as d,t as f}from"./ServiceDown-BghtjpTn.js";import{t as p}from"./shield-check-0ka0kQct.js";import{t as m}from"./clsx-DB0hHKMi.js";import{H as h,L as g,U as _,a as v,dt as y,ft as b,i as x,mt as S,n as C,o as w,pt as T,r as E,rt as D,s as O,tt as k}from"./main-Djqho539.js";import{a as A,i as j,n as M}from"./workflow-Bv814-L8.js";import{r as N,t as P}from"./Badge-CUJUit4d.js";import{n as F,t as I}from"./Section-BTnvUq_W.js";import{t as L}from"./CodeBlock-CsiGFgvI.js";var R=e(t(),1),z=n(),B=60,V=new Set([`draft`,`previewed`,`approved`]);async function H(){let[e,t,{drafts:n}]=await Promise.all([A.info(),A.rules(),A.drafts()]);return{info:e,published:t,drafts:n}}var U=e=>D(e)?.name??e;function W(){let[e,t]=(S()[`*`]??``).split(`/`),n=j(H,`rules`);return n.state.status===`loading`?(0,z.jsx)(E,{}):e===`draft`&&t?n.state.status===`error`?(0,z.jsx)(f,{error:n.state.error,onRetry:n.reload}):(0,z.jsx)(ee,{id:t,live:n.state.value,onChanged:n.reload}):n.state.status===`ready`?(0,z.jsx)(q,{rows:G(n.state.value),selected:e||null,live:n.state.value,onChanged:n.reload}):(0,z.jsx)(K,{selected:e||null})}function G(e){return e.published.rules.map(({rule:t,components:n,flagged:r,notRun:i,places:a})=>({rule:t,components:n,flagged:r,...i?{notRun:i}:{},places:a,draft:e.drafts.find(e=>e.kind===`rule`&&e.ruleId===t.id&&V.has(e.status))??null})).sort((e,t)=>e.rule.title.localeCompare(t.rule.title))}function K({selected:e}){let t=h(),n=_(),r=(0,R.useMemo)(()=>{if(t.status!==`ready`)return null;let e=n.status===`ready`?n.value:null;return[...t.value.rules.values()].map(n=>{let r=e?.violationsByRule.get(n.id)??null,i=e?s(e.reports,n):[];return{rule:n,components:t.value.ruleComponents.get(n.id)??[],flagged:r?.length??null,...i.length?{notRun:i.join(`; `)}:{},places:r??[],draft:null}})},[t,n]);return r?(0,z.jsx)(q,{rows:r,selected:e,live:null,onChanged:()=>void 0}):(0,z.jsx)(x,{state:t,onRetry:g,what:`the catalog`})}function q({rows:e,selected:t,live:n,onChanged:r}){let[,i]=T(),[a,o]=(0,R.useState)(null),s=t?e.find(e=>U(e.rule.id)===t)??null:null,c=async e=>{o(null);try{let t=await e();r(),i(`/rules/draft/${t.id}`)}catch(e){o(M(e).message)}},l=e=>{e.draft?i(`/rules/draft/${e.draft.id}`):c(()=>A.edit(e.rule.id))};return(0,z.jsx)(v,{listLabel:`Rules`,backHref:`/rules`,hasDetail:s!==null,list:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{title:`Rules`,count:e.length,children:n&&(0,z.jsxs)(O,{variant:`primary`,size:`sm`,onClick:()=>void c(A.create),children:[(0,z.jsx)(u,{}),` New rule`]})}),(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[a&&(0,z.jsx)(`p`,{className:`border-b border-line bg-danger-soft px-4 py-2 text-small text-ink-2`,children:a}),(0,z.jsx)(`p`,{className:`border-b border-line px-4 py-2.5 text-small text-muted`,children:n?(0,z.jsxs)(z.Fragment,{children:[`Live rules of `,(0,z.jsx)(`span`,{className:`font-medium text-ink-2`,children:n.info.project.id}),`, from `,n.info.design.branch,`@`,n.info.design.head.slice(0,7),`. Places from a scan at `,new Date(n.published.scannedAt).toLocaleTimeString(),`.`]}):`From the snapshot. Start the rule editor to edit rules and see live places.`}),(0,z.jsx)(`ul`,{children:e.map(e=>(0,z.jsx)(J,{row:e,active:e===s},e.rule.id))})]})]}),detail:s?(0,z.jsx)(X,{row:s,live:n,onEdit:()=>l(s)}):(0,z.jsx)(Q,{live:n})})}function J({row:e,active:t}){return(0,z.jsx)(`li`,{children:(0,z.jsxs)(y,{href:`/rules/${U(e.rule.id)}`,"aria-current":t?`page`:void 0,className:m(`block border-b border-line px-4 py-2.5 hover:bg-raised`,t&&`bg-raised`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body text-ink`,children:e.rule.title}),e.draft&&(0,z.jsx)(r,{draft:e.draft})]}),(0,z.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 text-small text-muted`,children:[(0,z.jsx)(N,{severity:e.rule.severity}),e.rule.rollout&&(0,z.jsxs)(`span`,{children:[`→ error`,e.rule.rollout.after?` ${e.rule.rollout.after}`:` later`]}),(0,z.jsx)(`span`,{className:`truncate`,children:e.rule.check.engine===`advisory`?`advisory`:e.rule.check.engine===`youi`?e.rule.check.id:`custom check`}),(0,z.jsx)(`span`,{className:`ml-auto tabular`,children:e.flagged===null?``:e.flagged===0?`clean`:`${e.flagged} ${e.flagged===1?`place`:`places`}`})]})]})})}function Y(e){return e.severity===`error`?`Error: fails youiyoux check`:e.severity===`off`?`Off`:`Warning${e.rollout?`, becoming an error ${e.rollout.after?`after ${e.rollout.after}`:`later`}`:``}`}function X({row:e,live:t,onEdit:n}){let{rule:i}=e,a=t?.info.checks.find(e=>i.check.engine===`youi`?e.id===i.check.id:e.engine===i.check.engine)?.label;return(0,z.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,z.jsxs)(`header`,{className:`border-b border-line px-6 pt-5 pb-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg border border-line bg-raised text-ink-2`,children:(0,z.jsx)(p,{className:`size-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`text-title outline-none`,children:i.title}),(0,z.jsx)(N,{severity:i.severity}),i.rollout&&(0,z.jsxs)(P,{tone:`outline`,children:[`→ error `,i.rollout.after??`later`]})]}),(0,z.jsx)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:i.id})]}),t&&(0,z.jsxs)(O,{variant:e.draft?`outline`:`primary`,size:`sm`,onClick:n,children:[(0,z.jsx)(l,{}),` `,e.draft?`Open draft`:`Edit rule`]})]}),(0,z.jsx)(`p`,{className:`mt-3 max-w-2xl text-reading text-ink`,children:i.statement}),e.draft&&(0,z.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-small text-muted`,children:[(0,z.jsx)(r,{draft:e.draft}),` A draft of this rule is open (revision `,e.draft.revision,`).`]})]}),(0,z.jsxs)(`div`,{className:`space-y-8 p-6`,children:[(0,z.jsx)(F,{title:`Where it is broken`,count:e.flagged??void 0,children:(0,z.jsx)(Z,{row:e})}),(0,z.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-2`,children:[(0,z.jsx)(F,{title:`How it is checked`,children:(0,z.jsx)(I,{rows:[[`Check`,a??o(i)],[`Level`,Y(i)],[`Files`,(0,z.jsx)(`code`,{className:`font-mono text-mono-sm`,children:i.files.join(`, `)})],[`Followed by`,e.components.length?(0,z.jsx)(`span`,{className:`flex flex-wrap gap-x-2`,children:e.components.map(e=>(0,z.jsx)(y,{href:k(e,`rules`),className:`text-accent hover:underline`,children:U(e)},e))}):`No component yet`]]})}),(0,z.jsx)(F,{title:`Why`,children:(0,z.jsx)(`p`,{className:`text-body text-ink-2`,children:i.rationale||`No rationale recorded.`})})]}),(0,z.jsx)(F,{title:`For agents`,children:(0,z.jsx)(`blockquote`,{className:`rounded-md border-l-2 border-line-strong bg-sunken px-3 py-2 text-body text-ink-2`,children:i.agent})}),(i.examples.bad.length>0||i.examples.good.length>0)&&(0,z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,z.jsx)(F,{title:`Breaks the rule`,children:(0,z.jsx)(L,{code:i.examples.bad.join(`
2
2
  `),maxHeight:`sm`})}),(0,z.jsx)(F,{title:`Follows the rule`,children:(0,z.jsx)(L,{code:i.examples.good.join(`
3
3
  `),maxHeight:`sm`})})]})]})]})}function Z({row:e}){let t=a(e.rule);if(t.state!==`enforced`)return(0,z.jsxs)(`p`,{className:`text-body text-muted`,children:[c(t),`.`]});if(e.notRun)return(0,z.jsxs)(`p`,{className:`text-body text-muted`,children:[`It did not run on the latest scan (`,e.notRun,`), so where it is broken is unknown.`]});if(e.flagged===null)return(0,z.jsx)(`p`,{className:`text-body text-muted`,children:`No scan of a project yet.`});if(e.flagged===0)return(0,z.jsx)(`p`,{className:`text-body text-muted`,children:`Nothing breaks this rule.`});let n=e.places.slice(0,B);return(0,z.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-line`,children:[(0,z.jsx)(`ul`,{className:`max-h-[28rem] divide-y divide-line overflow-y-auto`,children:n.map(e=>(0,z.jsxs)(`li`,{className:`space-y-1 px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-mono-sm`,children:[e.project&&(0,z.jsx)(`span`,{className:`text-muted`,children:e.project}),(0,z.jsxs)(`span`,{className:`truncate text-ink-2`,children:[e.file,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]})]}),(0,z.jsx)(`p`,{className:`text-small text-ink-2`,children:e.message}),(0,z.jsx)(`code`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.text})]},`${e.project??``}:${e.file}:${e.line}:${e.column}:${e.text}`))}),e.flagged>n.length&&(0,z.jsxs)(`p`,{className:`border-t border-line bg-sunken px-3 py-2 text-small text-muted`,children:[`and `,e.flagged-n.length,` more; youiyoux check lists them all`]})]})}function Q({live:e}){return(0,z.jsxs)(w,{icon:p,title:`Rules`,children:[(0,z.jsx)(`p`,{children:`What each rule checks, how hard it bites, and every place the project breaks it. Pick one to see it. Edit opens a draft on the rule's own page: the form, Run preview, Approve, Send for review.`}),!e&&(0,z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,z.jsx)(`p`,{children:`To edit or add rules, start the rule editor and open the link it prints:`}),(0,z.jsx)(d,{})]})]})}function $({title:e,href:t}){return(0,z.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-6 text-small whitespace-nowrap text-muted max-sm:px-4`,"data-draft-breadcrumb":!0,children:[(0,z.jsx)(y,{href:`/rules`,className:`shrink-0 hover:text-ink`,children:`Rules`}),(0,z.jsx)(`span`,{"aria-hidden":!0,children:`/`}),t?(0,z.jsx)(y,{href:t,className:`min-w-0 truncate hover:text-ink`,children:e}):(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),(0,z.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,z.jsx)(`span`,{className:`shrink-0 text-ink-2`,children:`draft`}),(0,z.jsx)(y,{href:`/changes`,className:`ml-auto shrink-0 pl-2 hover:text-ink`,children:`All changes`})]})}function ee({id:e,live:t,onChanged:n}){let r=(0,R.useCallback)(()=>A.draft(e),[e]),{state:a,reload:o,set:s}=j(r,e),c=(0,R.useCallback)(e=>{s(e),n()},[s,n]);if(a.status===`loading`)return(0,z.jsx)(E,{});if(a.status===`error`)return(0,z.jsx)(f,{error:a.error,onRetry:o});let l=a.value;if(l.kind!==`rule`)return(0,z.jsx)(b,{to:`/changes/${l.id}`,replace:!0});let u=t.published.rules.some(e=>e.rule.id===l.ruleId);return(0,z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,z.jsx)($,{title:l.content.rule.title||`New rule`,href:u?`/rules/${U(l.ruleId)}`:null}),(0,z.jsx)(i,{draft:l,info:t.info,onUpdate:c})]})}export{$ as DraftBreadcrumb,W as RulesScreen};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./clsx-DB0hHKMi.js";import{ct as a}from"./main-cvOFSjox.js";var o={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};o.node;var s=r(o),c={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};c.node;var l=r(c),u={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};u.node;var d=r(u);function f(e){return e===`*`?`app-shell`:e===`(no screen)`?`unrouted`:e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`root`}function p(e,t,n){return`/screens/${encodeURIComponent(e)}/${f(t)}${n?`?select=${encodeURIComponent(n)}`:``}`}function m(e){return e===`*`?`App shell`:e===`(no screen)`?`Not on a screen`:e}var h={errors:0,warnings:0,lookalikes:0,unresolved:0,total:0};function g(e,t,n){let r=e.filter(e=>e.severity===`error`).length;return{errors:r,warnings:e.length-r,lookalikes:t.length,unresolved:n.length,total:e.length+t.length+n.length}}var _=(e,t)=>({errors:e.errors+t.errors,warnings:e.warnings+t.warnings,lookalikes:e.lookalikes+t.lookalikes,unresolved:e.unresolved+t.unresolved,total:e.total+t.total}),v=e=>e===`*`?0:1;function y(e){let t=new Map;for(let n of e.systems)for(let e of n.usage)e.screens&&t.set(e.project,e.screens);return t}var b=class{sites=0;elements=new Map;violations=[];lookalikes=[];unresolved=[];element(e){let t=this.elements.get(e);if(t)return t;let n={sites:[],lookalikes:[],unresolved:[]};return this.elements.set(e,n),n}};function x(e,t,n){let{project:r}=e,i=new Map,a=(t,n=0,a)=>{let o=i.get(t);i.set(t,{project:r,file:t,sites:(o?.sites??0)+n,reason:e.fileRoutes?.[t]?.routeReason??o?.reason??a??`This scan has no route information for this file. Scan the project again.`})},o=new Map,s=e=>{let t=o.get(e);if(t)return t;let n=new b;return o.set(e,n),n};for(let e of t){e.routes.length===0&&a(e.file,1,e.routeReason);for(let t of e.routes){let n=s(t);n.sites++,n.element(e.element).sites.push(e)}}let c={violations:[],lookalikes:[],unresolved:[]};for(let t of e.violations){let n={...t,project:r},i=e.fileRoutes?.[t.file]?.routes;if(!i?.length)c.violations.push(n),a(t.file);else for(let e of i)s(e).violations.push(n)}for(let t of e.lookalikes){let n={...t,project:r},i=e.fileRoutes?.[t.file]?.routes;if(!i?.length)c.lookalikes.push(n),a(t.file);else for(let e of i)s(e).lookalikes.push(n),s(e).element(t.resembles).lookalikes.push(n)}for(let t of e.unknowns){let n={...t,project:r},i=e.fileRoutes?.[t.file]?.routes;if(!i?.length)c.unresolved.push(n),a(t.file);else for(let e of i)s(e).unresolved.push(n),t.candidate&&s(e).element(t.candidate).unresolved.push(n)}return{screens:[...o].sort(([e],[t])=>v(e)-v(t)||e.localeCompare(t)).map(([e,t])=>({project:r,route:e,slug:f(e),sites:t.sites,elements:[...t.elements].map(([e,t])=>({id:e,...t})).sort((e,t)=>t.sites.length-e.sites.length||e.id.localeCompare(t.id)),violations:t.violations,lookalikes:t.lookalikes,unresolved:t.unresolved,issues:g(t.violations,t.lookalikes,t.unresolved),shot:n?.screens.find(t=>t.route===e)??null})),unattributed:g(c.violations,c.lookalikes,c.unresolved),unattributedFiles:[...i.values()].sort((e,t)=>e.file.localeCompare(t.file))}}function S(e,t){let n=y(t),r=new Map;for(let t of e.sitesByElement.values())for(let e of t){let t=r.get(e.project);t?t.push(e):r.set(e.project,[e])}let i=[...e.reports].sort((e,t)=>e.project.localeCompare(t.project)).map(e=>x(e,r.get(e.project)??[],n.get(e.project))),a=i.flatMap(e=>e.screens);return{screens:a,byHref:new Map(a.map(e=>[p(e.project,e.route),e])),unattributed:i.reduce((e,t)=>_(e,t.unattributed),h),unattributedFiles:i.flatMap(e=>e.unattributedFiles),shots:n}}function C(e,t){return e.screens.flatMap(e=>{if(e.route===`(no screen)`)return[];let n=e.elements.find(e=>e.id===t)?.sites.length??0;return n>0?[{screen:e,sites:n}]:[]}).sort((e,t)=>Number(e.screen.route===`*`)-Number(t.screen.route===`*`)||t.sites-e.sites)}var w=new WeakMap;function T(e,t){let n=w.get(e);if(n)return n;let r=S(e,t);return w.set(e,r),r}var E=e(t(),1),D=n(),O=new Set([`children`]),k=50;function A({items:e,render:t}){let[n,r]=(0,E.useState)(!1),i=n?e:e.slice(0,k);return(0,D.jsxs)(D.Fragment,{children:[i.map(t),e.length>i.length&&(0,D.jsx)(`li`,{className:`px-3 py-1.5`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`text-small text-accent hover:underline`,children:[`Show all `,e.length]})})]})}function j(e){return e?Object.entries(e.props).filter(([,e])=>e.type===`enum`).map(([e])=>e):[]}function M(e){return`literal`in e?String(e.literal):`{${e.dynamic}}`}function N({site:e,className:t}){let n=e.file.lastIndexOf(`/`);return(0,D.jsxs)(`span`,{className:i(`flex min-w-0 font-mono text-mono-sm`,t),title:`${e.file}:${e.line}:${e.column}`,children:[(0,D.jsx)(`span`,{className:`min-w-0 truncate text-faint max-lg:hidden`,children:e.file.slice(0,n+1)}),(0,D.jsxs)(`span`,{className:`shrink-0 text-ink-2`,children:[e.file.slice(n+1),(0,D.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]})]})}function P({name:e,value:t,fallback:n}){if(t===void 0)return(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-mono-sm text-faint`,title:`${e} not set: the default (${n??`none`}) applies`,children:[e,`=`,n??`–`]});let r=`literal`in t;return(0,D.jsxs)(`span`,{className:i(`max-w-48 shrink-0 truncate rounded-xs px-1 font-mono text-mono-sm`,r?`bg-neutral-soft text-ink-2`:`border border-dashed border-line-strong text-muted`),title:r?void 0:`Computed: ${t.dynamic}`,children:[e,`=`,r?String(t.literal):`{…}`]})}function F({site:e,choices:t,contract:n,aside:r,showAll:a=!1}){let[o,s]=(0,E.useState)(!1),c=(0,E.useId)(),u=Object.entries(e.props).filter(([e])=>!t.includes(e)&&!O.has(e)),d=u.length+ +!!e.spread,f=a||o;return(0,D.jsxs)(`li`,{className:`group px-3 py-1.5 hover:bg-raised`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,D.jsx)(N,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,D.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:t.map(t=>{let r=n?.props[t],i=r&&`default`in r&&r.default!==void 0?String(r.default):void 0;return(0,D.jsx)(P,{name:t,value:e.props[t],fallback:i},t)})}),r&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-faint max-md:hidden`,children:r}),d>0&&!a&&(0,D.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":c,onClick:()=>s(e=>!e),className:`inline-flex h-5 shrink-0 items-center gap-0.5 rounded-xs px-1 text-caption text-muted hover:bg-neutral-soft hover:text-ink`,title:o?`Hide other props`:`Show other props`,children:[(0,D.jsx)(l,{className:i(`size-3 transition-transform duration-100`,o&&`rotate-90`)}),`+`,d,(0,D.jsxs)(`span`,{className:`sr-only`,children:[o?`Hide`:`Show`,` other props`]})]})]}),f&&d>0&&(0,D.jsxs)(`dl`,{id:c,className:`mt-1.5 mb-0.5 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-0.5 border-l border-line pl-3 font-mono text-mono-sm`,children:[u.map(([e,t])=>(0,D.jsxs)(`div`,{className:`contents`,children:[(0,D.jsx)(`dt`,{className:`text-muted`,children:e}),(0,D.jsx)(`dd`,{className:i(`min-w-0 break-words whitespace-pre-wrap`,`literal`in t?`text-ink-2`:`text-muted`),children:M(t)})]},e)),e.spread&&(0,D.jsxs)(`div`,{className:`contents`,children:[(0,D.jsx)(`dt`,{className:`text-muted`,children:`{...}`}),(0,D.jsx)(`dd`,{className:`text-muted`,children:`spread props: the scanner can't see what they set`})]})]})]})}var I=16/10;function L(e,t,n){if(!e)return null;let r=t===`light`?`dark`:`light`,i=e[t]??e[r];return i?{file:i[n],scheme:e[t]?t:r}:null}function R({shot:e,scheme:t,size:n,label:r,ratio:o=I,whenMissing:s=`placeholder`,className:c}){let l=L(e,t,n),[u,f]=(0,E.useState)(null),p=!l||u===l.file;return!l&&s===`none`?null:(0,D.jsx)(`div`,{className:i(`relative overflow-hidden bg-sunken`,c),style:{aspectRatio:o},children:p?(0,D.jsx)(`div`,{className:`absolute inset-0 grid place-items-center p-4 text-center`,children:(0,D.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-muted`,children:[(0,D.jsx)(d,{"aria-hidden":!0,className:n===`full`?`size-5`:`size-4`}),(0,D.jsx)(`span`,{className:n===`full`?`text-body`:`text-small`,children:l?`Screenshot didn't load`:`No screenshot yet`}),n===`full`&&!l&&(0,D.jsx)(`span`,{className:`max-w-xs text-small text-faint`,children:`Capture it with youiyoux screens capture, from a demo or seeded copy of the app running in development.`})]})}):(0,D.jsx)(`img`,{src:a(l.file),alt:`${r}${l.scheme===t?``:` (${l.scheme} only)`}`,loading:n===`thumb`?`lazy`:`eager`,decoding:`async`,onError:()=>f(l.file),className:`absolute inset-0 size-full object-cover object-top`},l.file)})}export{F as a,p as c,l as d,s as f,N as i,T as l,L as n,j as o,A as r,m as s,R as t,C as u};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./clsx-DB0hHKMi.js";import{ct as a}from"./main-Djqho539.js";var o={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};o.node;var s=r(o),c={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};c.node;var l=r(c),u={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};u.node;var d=r(u);function f(e){return e===`*`?`app-shell`:e===`(no screen)`?`unrouted`:e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`root`}function p(e,t,n){return`/screens/${encodeURIComponent(e)}/${f(t)}${n?`?select=${encodeURIComponent(n)}`:``}`}function m(e){return e===`*`?`App shell`:e===`(no screen)`?`Not on a screen`:e}var h={errors:0,warnings:0,lookalikes:0,unresolved:0,total:0};function g(e,t,n){let r=e.filter(e=>e.severity===`error`).length;return{errors:r,warnings:e.length-r,lookalikes:t.length,unresolved:n.length,total:e.length+t.length+n.length}}var _=(e,t)=>({errors:e.errors+t.errors,warnings:e.warnings+t.warnings,lookalikes:e.lookalikes+t.lookalikes,unresolved:e.unresolved+t.unresolved,total:e.total+t.total}),v=e=>e===`*`?0:1;function y(e){let t=new Map;for(let n of e.systems)for(let e of n.usage)e.screens&&t.set(e.project,e.screens);return t}var b=class{sites=0;elements=new Map;violations=[];lookalikes=[];unresolved=[];element(e){let t=this.elements.get(e);if(t)return t;let n={sites:[],lookalikes:[],unresolved:[]};return this.elements.set(e,n),n}};function x(e,t,n){let{project:r}=e,i=new Map,a=(t,n=0,a)=>{let o=i.get(t);i.set(t,{project:r,file:t,sites:(o?.sites??0)+n,reason:e.fileRoutes?.[t]?.routeReason??o?.reason??a??`This scan has no route information for this file. Scan the project again.`})},o=new Map,s=e=>{let t=o.get(e);if(t)return t;let n=new b;return o.set(e,n),n};for(let e of t){e.routes.length===0&&a(e.file,1,e.routeReason);for(let t of e.routes){let n=s(t);n.sites++,n.element(e.element).sites.push(e)}}let c={violations:[],lookalikes:[],unresolved:[]};for(let t of e.violations){let n={...t,project:r},i=e.fileRoutes?.[t.file]?.routes;if(!i?.length)c.violations.push(n),a(t.file);else for(let e of i)s(e).violations.push(n)}for(let t of e.lookalikes){let n={...t,project:r},i=e.fileRoutes?.[t.file]?.routes;if(!i?.length)c.lookalikes.push(n),a(t.file);else for(let e of i)s(e).lookalikes.push(n),s(e).element(t.resembles).lookalikes.push(n)}for(let t of e.unknowns){let n={...t,project:r},i=e.fileRoutes?.[t.file]?.routes;if(!i?.length)c.unresolved.push(n),a(t.file);else for(let e of i)s(e).unresolved.push(n),t.candidate&&s(e).element(t.candidate).unresolved.push(n)}return{screens:[...o].sort(([e],[t])=>v(e)-v(t)||e.localeCompare(t)).map(([e,t])=>({project:r,route:e,slug:f(e),sites:t.sites,elements:[...t.elements].map(([e,t])=>({id:e,...t})).sort((e,t)=>t.sites.length-e.sites.length||e.id.localeCompare(t.id)),violations:t.violations,lookalikes:t.lookalikes,unresolved:t.unresolved,issues:g(t.violations,t.lookalikes,t.unresolved),shot:n?.screens.find(t=>t.route===e)??null})),unattributed:g(c.violations,c.lookalikes,c.unresolved),unattributedFiles:[...i.values()].sort((e,t)=>e.file.localeCompare(t.file))}}function S(e,t){let n=y(t),r=new Map;for(let t of e.sitesByElement.values())for(let e of t){let t=r.get(e.project);t?t.push(e):r.set(e.project,[e])}let i=[...e.reports].sort((e,t)=>e.project.localeCompare(t.project)).map(e=>x(e,r.get(e.project)??[],n.get(e.project))),a=i.flatMap(e=>e.screens);return{screens:a,byHref:new Map(a.map(e=>[p(e.project,e.route),e])),unattributed:i.reduce((e,t)=>_(e,t.unattributed),h),unattributedFiles:i.flatMap(e=>e.unattributedFiles),shots:n}}function C(e,t){return e.screens.flatMap(e=>{if(e.route===`(no screen)`)return[];let n=e.elements.find(e=>e.id===t)?.sites.length??0;return n>0?[{screen:e,sites:n}]:[]}).sort((e,t)=>Number(e.screen.route===`*`)-Number(t.screen.route===`*`)||t.sites-e.sites)}var w=new WeakMap;function T(e,t){let n=w.get(e);if(n)return n;let r=S(e,t);return w.set(e,r),r}var E=e(t(),1),D=n(),O=new Set([`children`]),k=50;function A({items:e,render:t}){let[n,r]=(0,E.useState)(!1),i=n?e:e.slice(0,k);return(0,D.jsxs)(D.Fragment,{children:[i.map(t),e.length>i.length&&(0,D.jsx)(`li`,{className:`px-3 py-1.5`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`text-small text-accent hover:underline`,children:[`Show all `,e.length]})})]})}function j(e){return e?Object.entries(e.props).filter(([,e])=>e.type===`enum`).map(([e])=>e):[]}function M(e){return`literal`in e?String(e.literal):`{${e.dynamic}}`}function N({site:e,className:t}){let n=e.file.lastIndexOf(`/`);return(0,D.jsxs)(`span`,{className:i(`flex min-w-0 font-mono text-mono-sm`,t),title:`${e.file}:${e.line}:${e.column}`,children:[(0,D.jsx)(`span`,{className:`min-w-0 truncate text-faint max-lg:hidden`,children:e.file.slice(0,n+1)}),(0,D.jsxs)(`span`,{className:`shrink-0 text-ink-2`,children:[e.file.slice(n+1),(0,D.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]})]})}function P({name:e,value:t,fallback:n}){if(t===void 0)return(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-mono-sm text-faint`,title:`${e} not set: the default (${n??`none`}) applies`,children:[e,`=`,n??`–`]});let r=`literal`in t;return(0,D.jsxs)(`span`,{className:i(`max-w-48 shrink-0 truncate rounded-xs px-1 font-mono text-mono-sm`,r?`bg-neutral-soft text-ink-2`:`border border-dashed border-line-strong text-muted`),title:r?void 0:`Computed: ${t.dynamic}`,children:[e,`=`,r?String(t.literal):`{…}`]})}function F({site:e,choices:t,contract:n,aside:r,showAll:a=!1}){let[o,s]=(0,E.useState)(!1),c=(0,E.useId)(),u=Object.entries(e.props).filter(([e])=>!t.includes(e)&&!O.has(e)),d=u.length+ +!!e.spread,f=a||o;return(0,D.jsxs)(`li`,{className:`group px-3 py-1.5 hover:bg-raised`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,D.jsx)(N,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,D.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:t.map(t=>{let r=n?.props[t],i=r&&`default`in r&&r.default!==void 0?String(r.default):void 0;return(0,D.jsx)(P,{name:t,value:e.props[t],fallback:i},t)})}),r&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-faint max-md:hidden`,children:r}),d>0&&!a&&(0,D.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":c,onClick:()=>s(e=>!e),className:`inline-flex h-5 shrink-0 items-center gap-0.5 rounded-xs px-1 text-caption text-muted hover:bg-neutral-soft hover:text-ink`,title:o?`Hide other props`:`Show other props`,children:[(0,D.jsx)(l,{className:i(`size-3 transition-transform duration-100`,o&&`rotate-90`)}),`+`,d,(0,D.jsxs)(`span`,{className:`sr-only`,children:[o?`Hide`:`Show`,` other props`]})]})]}),f&&d>0&&(0,D.jsxs)(`dl`,{id:c,className:`mt-1.5 mb-0.5 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-0.5 border-l border-line pl-3 font-mono text-mono-sm`,children:[u.map(([e,t])=>(0,D.jsxs)(`div`,{className:`contents`,children:[(0,D.jsx)(`dt`,{className:`text-muted`,children:e}),(0,D.jsx)(`dd`,{className:i(`min-w-0 break-words whitespace-pre-wrap`,`literal`in t?`text-ink-2`:`text-muted`),children:M(t)})]},e)),e.spread&&(0,D.jsxs)(`div`,{className:`contents`,children:[(0,D.jsx)(`dt`,{className:`text-muted`,children:`{...}`}),(0,D.jsx)(`dd`,{className:`text-muted`,children:`spread props: the scanner can't see what they set`})]})]})]})}var I=16/10;function L(e,t,n){if(!e)return null;let r=t===`light`?`dark`:`light`,i=e[t]??e[r];return i?{file:i[n],scheme:e[t]?t:r}:null}function R({shot:e,scheme:t,size:n,label:r,ratio:o=I,whenMissing:s=`placeholder`,className:c}){let l=L(e,t,n),[u,f]=(0,E.useState)(null),p=!l||u===l.file;return!l&&s===`none`?null:(0,D.jsx)(`div`,{className:i(`relative overflow-hidden bg-sunken`,c),style:{aspectRatio:o},children:p?(0,D.jsx)(`div`,{className:`absolute inset-0 grid place-items-center p-4 text-center`,children:(0,D.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-muted`,children:[(0,D.jsx)(d,{"aria-hidden":!0,className:n===`full`?`size-5`:`size-4`}),(0,D.jsx)(`span`,{className:n===`full`?`text-body`:`text-small`,children:l?`Screenshot didn't load`:`No screenshot yet`}),n===`full`&&!l&&(0,D.jsx)(`span`,{className:`max-w-xs text-small text-faint`,children:`Capture it with youiyoux screens capture, from a demo or seeded copy of the app running in development.`})]})}):(0,D.jsx)(`img`,{src:a(l.file),alt:`${r}${l.scheme===t?``:` (${l.scheme} only)`}`,loading:n===`thumb`?`lazy`:`eager`,decoding:`async`,onError:()=>f(l.file),className:`absolute inset-0 size-full object-cover object-top`},l.file)})}export{F as a,p as c,l as d,s as f,N as i,T as l,L as n,j as o,A as r,m as s,R as t,C as u};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{a as i,c as a,d as o,f as s,i as c,l,n as u,o as d,r as f,s as p,t as m}from"./ScreenImage-CyhKm_nj.js";import{t as h}from"./bot-B3gC9oUR.js";import{t as g}from"./KindIcon-BJ6bz-ny.js";import{t as _}from"./CopyButton-DE8drl4P.js";import{t as v}from"./circle-check-DkwBMT62.js";import{t as ee}from"./minus-BDifFhOo.js";import{i as y,r as b}from"./ServiceDown-S4ya0Cob.js";import{t as x}from"./triangle-alert-Dkdi9eDR.js";import{t as S}from"./x-MLbFVa4v.js";import{t as C}from"./clsx-DB0hHKMi.js";import{D as te,H as w,L as ne,R as re,U as ie,ct as T,dt as E,g as D,ht as ae,i as O,k as oe,m as se,mt as k,n as ce,o as A,pt as j,s as M,st as le,tt as N,ut as P}from"./main-cvOFSjox.js";import{t as F}from"./when-COrv5lkZ.js";import{n as I}from"./plural-BbGQPQKA.js";import{a as L,i as ue,n as R,r as de}from"./workflow-C53UBmRZ.js";import{r as z,t as B}from"./Badge-CUJUit4d.js";import{a as V}from"./Field-LwrJXoOs.js";import{n as H}from"./Section-BTnvUq_W.js";import{t as U}from"./Segmented-Dzi1x49S.js";import{n as W,t as G}from"./format-DxAYNTN_.js";import{t as K}from"./Disclosure-B1kTgPgk.js";var q={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};q.node;var J=r(q),Y={name:`maximize`,size:24,node:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]};Y.node;var fe=r(Y),pe={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};pe.node;var me=r(pe),he={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};he.node;var ge=r(he),_e={name:`monitor-x`,size:24,node:[[`path`,{d:`m14.5 12.5-5-5`,key:`1jahn5`}],[`path`,{d:`m9.5 12.5 5-5`,key:`1k2t7b`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};_e.node;var ve=r(_e),ye={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};ye.node;var be=r(ye),X=e(t(),1),Z=n();function xe(e){return[e.errors>0&&I(e.errors,`error`),e.warnings>0&&I(e.warnings,`warning`),e.lookalikes>0&&I(e.lookalikes,`lookalike`),e.unresolved>0&&I(e.unresolved,`unresolved site`)].filter(e=>!!e)}function Se({issues:e}){return e.total===0?(0,Z.jsxs)(B,{tone:`success`,children:[(0,Z.jsx)(v,{}),` No issues`]}):(0,Z.jsxs)(B,{tone:e.errors>0?`danger`:`warning`,title:xe(e).join(` · `),className:`tabular`,children:[(0,Z.jsx)(x,{}),` `,I(e.total,`issue`)]})}var Ce=e=>e.file&&e.line?`${e.file}:${e.line}`:null;function we(e,t,n=[]){let r=new Map;for(let e of t)e.kind===`render`&&le(r,`${e.file}:${e.line}`,e);let i=new Map(n.map(e=>[`${e.file}:${e.line}:${e.local}`,e.resembles]));return e.map(e=>{let t=Ce(e),n=(t?r.get(t)??[]:[]).find(t=>t.local===e.name||t.export===e.name||t.local.endsWith(`.${e.name}`))??null,a=!n&&t?i.get(`${t}:${e.name}`)??null:null;return{place:e,element:n?.element??null,site:n,lookalike:a,at:t}})}var Te=(e,t)=>t!==null&&(e.element===t||e.lookalike===t||e.at===t),Q=e=>e.element??e.lookalike,Ee=(e,t)=>Number(Q(t)!==null)-Number(Q(e)!==null)||t.place.depth-e.place.depth;function De(e,t,n,r=()=>!0){let i=null,a=1/0;for(let o of e){let{box:e}=o.place;if(t<e.x||n<e.y||t>e.x+e.width||n>e.y+e.height||!r(o))continue;let s=e.width*e.height;(s<a||s===a&&i!==null&&o.place.depth>i.place.depth)&&(i=o,a=s)}return i}function Oe(e){let[t,n]=(0,X.useState)(null);return(0,X.useEffect)(()=>{if(!e)return;let t=!1;return n({file:e,state:{status:`loading`}}),P(e).then(r=>!t&&n({file:e,state:{status:`ready`,value:r}}),r=>!t&&n({file:e,state:{status:`error`,message:r instanceof Error?r.message:String(r)}})),()=>{t=!0}},[e]),e&&t?.file===e?t.state:null}function ke({shot:e,scheme:t,label:n,places:r,placed:i,outline:a,select:o,pointed:s,nameOf:c,onSelect:l,pins:u=[],activePin:d=null,onPin:f}){let p=(0,X.useRef)(null),[h,g]=(0,X.useState)(null),{size:_}=r,v=a===`elements`?e=>Q(e)!==null:()=>!0,ee=a===`elements`?i.filter(v):[],y=i.filter(e=>Te(e,o)||s!==null&&Q(e)===s),b=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!o||b.current===o)return;let e=p.current?.querySelector(`[data-place-lit]`);e&&(b.current=o,e.scrollIntoView({block:`center`,behavior:`smooth`}))},[o,y.length]);let x=e=>{let t=p.current.getBoundingClientRect();return De(i,(e.clientX-t.left)/t.width*_.width,(e.clientY-t.top)/t.height*_.height,a===`elements`?v:void 0)},S=(e,t,n)=>(0,Z.jsx)(`div`,{"data-place":Q(e)??e.at??e.place.name,...e.lookalike?{"data-lookalike":``}:{},...t===`lit`?{"data-place-lit":``}:{},className:C(`pointer-events-none absolute rounded-[3px]`,t===`shown`&&(e.element?`outline-1 -outline-offset-1 outline-accent/50 outline-dashed`:`outline-1 -outline-offset-1 outline-warning/70 outline-dashed`),t===`hover`&&`bg-accent/8 outline-2 -outline-offset-1 outline-accent outline-solid`,t===`lit`&&`bg-accent/12 outline-2 -outline-offset-1 outline-accent outline-solid`),style:{left:G(e.place.box.x,_.width),top:G(e.place.box.y,_.height),width:G(e.place.box.width,_.width),height:G(e.place.box.height,_.height)}},n);return(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(m,{shot:e,scheme:t,size:`full`,label:n,ratio:_.width/_.height}),(0,Z.jsxs)(`div`,{ref:p,className:C(`absolute inset-0`,a!==`off`&&`cursor-crosshair`),"data-places-layer":!0,onPointerMove:e=>a!==`off`&&g(x(e)),onPointerLeave:()=>g(null),onClick:e=>a!==`off`&&l(x(e)),children:[ee.map((e,t)=>S(e,`shown`,`s${t}`)),y.map((e,t)=>S(e,`lit`,`l${t}`)),h&&!y.includes(h)&&S(h,`hover`,`hover`),h&&(0,Z.jsx)(`span`,{className:`pointer-events-none absolute z-10 max-w-[60%] -translate-y-full truncate rounded-xs bg-ink px-1.5 py-0.5 font-mono text-mono-sm text-canvas shadow-raise`,style:{left:G(h.place.box.x,_.width),top:G(h.place.box.y,_.height)},"data-place-label":!0,children:c(h)}),u.map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f?.(e.id)},onPointerMove:e=>e.stopPropagation(),"aria-label":`Request ${e.number} (${e.status})`,"aria-pressed":d===e.id,"data-pin":e.id,className:C(`absolute z-20 grid size-6 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full border-2 border-surface text-caption font-semibold tabular shadow-raise outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`,e.status===`closed`?`bg-neutral-soft text-muted`:e.status===`addressed`?`bg-success text-on-accent`:`bg-accent text-on-accent`,d===e.id&&`ring-2 ring-accent ring-offset-1 ring-offset-surface`),style:{left:G(e.box.x,_.width),top:G(e.box.y,_.height)},children:e.number},e.id))]})]})}var Ae={width:320,height:180};function je(e,t){let n=Math.min(t.width,Math.max(Ae.width,e.width+112)),r=Math.min(t.height,Math.max(Ae.height,e.height+112));return{x:Math.min(Math.max(0,e.x+e.width/2-n/2),t.width-n),y:Math.min(Math.max(0,e.y+e.height/2-r/2),t.height-r),width:n,height:r}}function Me({picture:e,label:t}){let n=de(e.url);if(!e.box||!e.page)return(0,Z.jsx)(`img`,{src:n,alt:t,className:`w-full rounded-md border border-line`});let r=je(e.box,e.page);return(0,Z.jsxs)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{aspectRatio:`${r.width} / ${r.height}`},"data-crop":!0,children:[(0,Z.jsx)(`img`,{src:n,alt:t,className:`absolute max-w-none`,style:{width:G(e.page.width,r.width),left:G(-r.x,r.width),top:G(-r.y,r.height)}}),(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`absolute rounded-[3px] outline-2 -outline-offset-1 outline-accent outline-solid`,style:{left:G(e.box.x-r.x,r.width),top:G(e.box.y-r.y,r.height),width:G(e.box.width,r.width),height:G(e.box.height,r.height)}})]})}function Ne({id:e,route:t,worked:n}){let[r,i]=(0,X.useState)(null);if((0,X.useEffect)(()=>{let t=!1;return L.compareRequest(e).then(e=>!t&&i({value:e}),e=>!t&&i({error:R(e)})),()=>{t=!0}},[e]),!r||`error`in r||!r.value.before&&!r.value.after)return null;let{before:a,after:o}=r.value,s=`youiyoux screens capture --base <the app in development> --route ${t}`;return(0,Z.jsxs)(`figure`,{className:`space-y-1.5`,"data-before-after":!0,children:[(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[{picture:a,label:`Before`,at:a?`filed ${F(a.at)}`:``},{picture:o,label:`Now`,at:o?`captured ${F(o.at)}`:``}].map(({picture:e,label:n,at:r})=>(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,"data-side":n.toLowerCase(),children:[(0,Z.jsxs)(`p`,{className:`flex items-baseline gap-1.5 text-caption`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-ink-2`,children:n}),(0,Z.jsx)(`span`,{className:`truncate text-faint`,children:r})]}),e?(0,Z.jsx)(Me,{picture:e,label:`${n}: the component on ${t}`}):(0,Z.jsx)(`p`,{className:`grid aspect-[16/9] place-items-center rounded-md border border-dashed border-line-strong p-2 text-center text-caption text-faint`,children:`No picture`})]},n))}),o&&n&&!o.sinceFiled&&(0,Z.jsxs)(`figcaption`,{className:`space-y-1 text-caption text-warning`,"data-stale":!0,children:[(0,Z.jsx)(`span`,{children:`Not captured since this was filed, so the work is not in it: capture the screen again.`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 rounded-sm bg-sunken px-1.5 py-0.5 text-ink-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm`,children:s}),(0,Z.jsx)(_,{value:s,label:`Copy the capture command`})]})]}),o&&!o.found&&o.sinceFiled&&(0,Z.jsx)(`figcaption`,{className:`text-caption text-muted`,children:`Its line is not on the new picture, so it is outlined where it was.`})]})}var Pe={open:`warning`,addressed:`accent`,closed:`outline`},Fe={open:`Open`,addressed:`Addressed`,closed:`Closed`};function Ie({error:e}){return(0,Z.jsxs)(`div`,{role:`alert`,className:`space-y-1.5 text-small text-danger`,"data-request-error":!0,children:[(0,Z.jsx)(`p`,{children:e.offline?`Requests are filed through the local service: start the hub on your project.`:e.message}),e.offline&&(0,Z.jsx)(b,{}),e.problems.length>0&&(0,Z.jsx)(`ul`,{className:`list-disc pl-4`,children:e.problems.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]})}function Le({target:e,elementName:t,onFiled:n,onCancel:r}){let[i,a]=(0,X.useState)(`change`),[o,s]=(0,X.useState)(`here`),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=t=>{t.preventDefault(),c.trim()&&(d(!0),p(null),L.fileRequest(i,c.trim(),{...e,scope:o}).then(e=>{l(``),n(e)},e=>p(R(e))).finally(()=>d(!1)))};return(0,Z.jsxs)(`form`,{onSubmit:m,className:`space-y-2.5 rounded-lg border border-line bg-surface p-3`,"data-request-composer":!0,"aria-label":`New request`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{label:`Kind`,value:i,onChange:a,options:[{value:`change`,label:`Change request`},{value:`comment`,label:`Comment`}]}),t&&(0,Z.jsx)(U,{label:`Applies to`,value:o,onChange:s,options:[{value:`here`,label:`This one`},{value:`element`,label:`Every ${t}`}]})]}),(0,Z.jsx)(V,{value:c,onChange:e=>l(e.target.value),rows:3,maxLength:4e3,placeholder:i===`change`?`What should change? An agent reads this with the component's file and line.`:`What do you notice?`,"aria-label":i===`change`?`What should change`:`Your comment`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&m(e)}}),f&&(0,Z.jsx)(Ie,{error:f}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Z.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),(0,Z.jsx)(M,{type:`submit`,variant:`primary`,size:`sm`,disabled:u||!c.trim(),"aria-busy":u||void 0,children:i===`change`?`File change request`:`Add comment`})]})]})}function Re({author:e}){let t=e.kind===`agent`?h:be;return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-small font-medium text-ink-2`,children:[(0,Z.jsx)(t,{"aria-hidden":!0,className:`size-3.5 text-muted`}),e.name]})}function ze({request:e,number:t,active:n,onChange:r,onPick:i}){let[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=e=>{c(!0),u(null),e().then(e=>{o(``),r(e)},e=>u(R(e))).finally(()=>c(!1))},{target:f}=e;return(0,Z.jsxs)(`li`,{className:C(`space-y-2 rounded-md border px-3 py-2.5`,n?`border-accent bg-accent-soft/40`:`border-line`),"data-request":e.id,"data-status":e.status,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:i,className:`flex w-full min-w-0 items-start gap-2 text-left`,"aria-label":`Show request ${t} on the screenshot`,children:[(0,Z.jsx)(`span`,{className:C(`grid size-5 shrink-0 place-items-center rounded-full text-caption font-medium tabular`,e.status===`closed`?`bg-neutral-soft text-muted`:e.status===`addressed`?`bg-success text-on-accent`:`bg-accent text-on-accent`),children:t}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(B,{tone:Pe[e.status],children:Fe[e.status]}),(0,Z.jsx)(`span`,{className:`text-caption text-muted`,children:e.kind===`change`?`Change request`:`Comment`}),(0,Z.jsxs)(`span`,{className:`text-caption text-faint`,children:[`· `,f.scope===`element`?`every ${f.name}`:f.name]})]}),(0,Z.jsx)(`span`,{className:`block text-small text-ink`,children:e.body}),(0,Z.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-faint`,children:f.file&&f.line?`${f.file}:${f.line}`:f.route})]})]}),(e.before||e.status!==`open`)&&(0,Z.jsx)(Ne,{id:e.id,route:f.route,worked:e.status!==`open`},e.updatedAt),(0,Z.jsxs)(`ol`,{className:`space-y-1.5 border-l border-line pl-3`,"aria-label":`Thread`,children:[(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 text-caption text-faint`,children:[(0,Z.jsx)(Re,{author:e.author}),` filed it `,F(e.createdAt)]}),e.thread.map((e,t)=>(0,Z.jsxs)(`li`,{className:`space-y-0.5`,"data-entry":e.author.kind,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-caption text-faint`,children:[(0,Z.jsx)(Re,{author:e.author}),e.status&&(0,Z.jsxs)(`span`,{children:[`marked it `,e.status]}),(0,Z.jsx)(`span`,{children:F(e.at)})]}),e.body&&(0,Z.jsx)(`p`,{className:`text-small text-ink-2 [overflow-wrap:anywhere]`,children:e.body})]},t))]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(V,{value:a,onChange:e=>o(e.target.value),rows:2,maxLength:4e3,placeholder:`Reply`,"aria-label":`Reply to request ${t}`}),l&&(0,Z.jsx)(Ie,{error:l}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e.status===`closed`?(0,Z.jsx)(M,{size:`sm`,variant:`ghost`,disabled:s,onClick:()=>d(()=>L.moveRequest(e.id,`open`,a)),children:`Reopen`}):(0,Z.jsx)(M,{size:`sm`,variant:e.status===`addressed`?`primary`:`ghost`,disabled:s,onClick:()=>d(()=>L.moveRequest(e.id,`closed`,a)),children:e.status===`addressed`?`Looks right: close`:`Close`}),(0,Z.jsxs)(M,{size:`sm`,variant:`outline`,disabled:s||!a.trim(),onClick:()=>d(()=>L.replyRequest(e.id,a)),children:[(0,Z.jsx)(ge,{}),` Reply`]})]})]})]})}function Be({summary:e,children:t,onPoint:n}){return(0,Z.jsxs)(`details`,{className:`group/details border-b border-line last:border-b-0`,onPointerEnter:n&&(()=>n(!0)),onPointerLeave:n&&(()=>n(!1)),children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 hover:bg-raised [&::-webkit-details-marker]:hidden`,children:[(0,Z.jsx)(o,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-faint transition-transform duration-100 group-open/details:rotate-90`}),e]}),(0,Z.jsx)(`ul`,{className:`pb-1.5`,children:t})]})}function Ve({model:e,element:t,scheme:n,picture:r}){let a=e.byId.get(t.id),o=e.components.get(t.id)?.contract,l=d(o),u=a?.name??t.id;return(0,Z.jsxs)(Be,{onPoint:r?.point,summary:(0,Z.jsxs)(Z.Fragment,{children:[a&&(0,Z.jsx)(g,{element:a,scheme:n}),(0,Z.jsx)(`span`,{className:`font-medium text-ink`,children:u}),t.sites.length>0&&(0,Z.jsx)(`span`,{className:`tabular text-small text-muted`,children:t.sites.length}),(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[r&&r.count>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),r.locate()},onFocus:()=>r.point(!0),onBlur:()=>r.point(!1),className:`inline-flex h-5 items-center gap-1 rounded-xs px-1 text-caption text-muted hover:bg-neutral-soft hover:text-ink`,"aria-label":`Show ${u} on the screenshot (${r.count})`,title:`Show on the screenshot`,"data-locate":t.id,children:[(0,Z.jsx)(J,{"aria-hidden":!0,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`tabular`,children:r.count})]}),t.lookalikes.length>0&&(0,Z.jsxs)(B,{tone:`warning`,className:`tabular`,title:`Local components named like this element that resolve elsewhere`,children:[t.lookalikes.length,` lookalike`,t.lookalikes.length===1?``:`s`]}),t.unresolved.length>0&&(0,Z.jsxs)(B,{tone:`outline`,className:`tabular`,title:`Sites the scanner could not resolve that might be this element`,children:[t.unresolved.length,` unresolved`]}),(0,Z.jsx)(E,{href:N(t.id,`usage`),className:`grid size-5 place-items-center rounded-xs text-muted hover:bg-neutral-soft hover:text-ink`,"aria-label":`${u}: usage everywhere`,title:`${u}: usage everywhere`,children:(0,Z.jsx)(s,{className:`size-3.5`})})]})]}),children:[(0,Z.jsx)(f,{items:t.sites,render:e=>(0,Z.jsx)(i,{site:e,choices:l,contract:o},`${e.fingerprint}:${e.line}:${e.column}`)}),t.lookalikes.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 px-3 py-1.5`,children:[(0,Z.jsx)(c,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 text-small text-muted`,children:[(0,Z.jsx)(B,{tone:`warning`,children:`lookalike`}),` `,(0,Z.jsxs)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:[`<`,e.local,`>`]}),` is `,(0,Z.jsx)(`code`,{title:e.resolved,className:`font-mono text-mono-sm`,children:e.resolved.split(`/`).pop()})]})]},`l:${e.file}:${e.line}:${e.column}`)),t.unresolved.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 px-3 py-1.5`,children:[(0,Z.jsx)(c,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 text-small text-muted`,children:[(0,Z.jsx)(B,{tone:`outline`,children:`unresolved`}),` `,e.detail]})]},`u:${e.file}:${e.line}:${e.column}`))]})}function He({violation:e}){return(0,Z.jsxs)(`li`,{className:`px-3 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(c,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,Z.jsx)(`code`,{className:`min-w-0 rounded-xs bg-neutral-soft px-1 font-mono text-mono-sm break-all text-ink-2`,children:e.text})]}),e.suggestion&&(0,Z.jsxs)(`p`,{className:`mt-0.5 text-small text-muted`,children:[`Use `,e.suggestion]})]})}function Ue({model:e,screen:t}){let n=new Map;for(let e of t.violations)n.set(e.rule,[...n.get(e.rule)??[],e]);let r=[...n].sort(([,e],[,t])=>t.length-e.length);return r.length===0?(0,Z.jsx)(`p`,{className:`rounded-md border border-line px-3 py-4 text-small text-muted`,children:`No rule is broken in this screen's files.`}):(0,Z.jsx)(`div`,{className:`rounded-md border border-line`,children:r.map(([t,n])=>{let r=e.rules.get(t);return(0,Z.jsxs)(Be,{summary:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{severity:n[0].severity}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-ink`,children:r?.title??t}),(0,Z.jsx)(`span`,{className:`ml-auto tabular text-small text-muted`,children:n.length})]}),children:[r&&(0,Z.jsxs)(`li`,{className:`px-3 pb-1.5 text-small text-muted`,children:[r.statement,` `,(0,Z.jsx)(E,{href:N(t),className:`text-accent hover:underline`,children:`Open the rule`})]}),(0,Z.jsx)(f,{items:n,render:e=>(0,Z.jsx)(He,{violation:e},`${e.file}:${e.line}:${e.column}`)})]},t)})})}function We(e,t){let[,n]=j(),r=e.screens,i=r.indexOf(t);return D({count:r.length,index:i,onMove:e=>{let t=r[e];if(!t)return;let i=a(t.project,t.route);oe(i),n(i)}}),{previous:r[i-1],next:r[i+1]}}function Ge({target:e,label:t,children:n}){return e?(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,asChild:!0,children:(0,Z.jsx)(E,{href:a(e.project,e.route),"aria-label":`${t}: ${p(e.route)}`,title:`${t} (${t.startsWith(`Next`)?`j`:`k`})`,children:n})}):(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,disabled:!0,"aria-label":t,children:n})}function Ke({placed:e,all:t,name:n,copies:r,onClear:i,onComment:a}){let{place:o,element:s,lookalike:c,at:l}=e;return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-line bg-surface px-3 py-2.5`,"data-selection":s??l??o.name,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-ink`,children:n}),(0,Z.jsx)(B,{tone:s?`accent`:c?`warning`:`outline`,children:s?`System element`:c?`Lookalike of ${r??c}`:`Component`}),t.length>1&&(0,Z.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[t.length,` on this screen`]})]}),(0,Z.jsxs)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:[l??`its line is unknown (a library's own part, or a production build)`,o.owner&&(0,Z.jsxs)(`span`,{className:`text-faint`,children:[` · in `,o.owner]})]})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(M,{size:`sm`,variant:`primary`,onClick:a,"data-comment":!0,children:[(0,Z.jsx)(me,{}),` Request`]}),l&&(0,Z.jsx)(_,{value:l,label:`Copy ${l}`}),(s??c)&&(0,Z.jsx)(M,{size:`sm`,variant:`outline`,asChild:!0,children:(0,Z.jsx)(E,{href:N(s??c,`usage`),children:c?`Open the element it copies`:`Open element`})}),(0,Z.jsx)(M,{size:`icon`,variant:`ghost`,onClick:i,"aria-label":`Clear the selection`,title:`Clear`,children:(0,Z.jsx)(S,{})})]})]})}function qe({model:e,screens:t,screen:n}){let{scheme:r}=se(),[i,a]=(0,X.useState)(r),{previous:s,next:c}=We(t,n),[l,d]=j(),f=new URLSearchParams(ae()),h=f.get(`select`),g=f.get(`request`),_=e=>{let t=new URLSearchParams,n={select:h,request:g,...e};n.select&&t.set(`select`,n.select),n.request&&t.set(`request`,n.request),d(`${l}${t.size?`?${t.toString()}`:``}`,{replace:!0})},v=e=>_({select:e,request:null}),[ee,y]=(0,X.useState)(!1),b=ue(L.requests,`requests`),x=Oe(n.shot?.places),S=x?.status===`ready`?x.value:null,w=(0,X.useMemo)(()=>{if(!S)return[];let e=t.screens.filter(e=>e.project===n.project);return we(S.places,e.flatMap(e=>e.elements.flatMap(e=>e.sites)),e.flatMap(e=>e.lookalikes))},[S,n,t]),ne=w.some(e=>Q(e)!==null),[re,ie]=(0,X.useState)(null),D=re??(ne?`elements`:`all`),[O,oe]=(0,X.useState)(null),k=t=>t.element?e.byId.get(t.element)?.name??t.element:t.place.name,A=w.filter(e=>Te(e,h)).sort(Ee),M=b.state.status===`ready`?b.state.value.requests:[],le=new Set(w.map(Q).filter(e=>e!==null)),N=M.filter(e=>e.target.route===n.route||e.target.scope===`element`&&e.target.element!==void 0&&le.has(e.target.element)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),P=e=>{if(b.state.status!==`ready`)return b.reload();let t=b.state.value.requests;b.set({...b.state.value,requests:t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[e,...t]})},F=(e,t)=>{let r=e.target.route===n.route&&e.target.box?e.target.box:w.find(t=>e.target.element&&Q(t)===e.target.element)?.place.box;return r?{id:e.id,number:t,box:{x:r.x,y:r.y},status:e.status}:null},I=N.map((e,t)=>F(e,t+1)).filter(e=>e!==null),R=e=>{let t=e.target;_({request:e.id,select:t.scope===`element`&&t.element?t.element:t.file&&t.line?`${t.file}:${t.line}`:t.element??null})},de=e=>({route:n.route,scope:`here`,name:e.place.name,...Q(e)?{element:Q(e)}:{},...e.lookalike?{lookalike:!0}:{},...e.place.file?{file:e.place.file}:{},...e.place.line?{line:e.place.line}:{},box:e.place.box,...S?{page:S.size}:{}}),z=e=>{if(S)return{count:w.filter(t=>Q(t)===e).length,locate:()=>v(e),point:t=>oe(t?e:null)}},B=t.shots.get(n.project),V=u(n.shot,i,`full`),W=B?B.viewport.width/B.viewport.height:void 0,G=p(n.route),K=n.elements.filter(e=>e.sites.length>0),q=n.elements.filter(e=>e.sites.length===0),J=xe(n.issues),Y=S?(0,Z.jsx)(ke,{shot:n.shot,scheme:i,label:`${n.project} ${G}`,places:S,placed:w,outline:D,select:h,pointed:O,nameOf:k,onSelect:e=>v(e?e.element??e.at:null),pins:I,activePin:g,onPin:e=>{let t=N.find(t=>t.id===e);t&&R(t)}}):(0,Z.jsx)(m,{shot:n.shot,scheme:i,size:`full`,label:`${n.project} ${G}`,...W?{ratio:W}:{}});return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(ce,{title:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(E,{href:`/screens`,className:`text-muted hover:text-ink`,children:`Screens`}),(0,Z.jsx)(`span`,{className:`text-faint`,children:`/`}),(0,Z.jsx)(`span`,{className:`font-mono text-mono`,children:n.route===`*`?`every screen`:n.route})]}),children:[S&&(0,Z.jsx)(U,{label:`Outline on the screenshot`,value:D,onChange:ie,options:[{value:`elements`,label:`Elements`},{value:`all`,label:`All`},{value:`off`,label:`Off`}],className:`max-sm:hidden`}),(0,Z.jsx)(U,{label:`Screenshot scheme`,value:i,onChange:a,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],className:`max-sm:hidden`}),(0,Z.jsx)(Ge,{target:s,label:`Previous screen`,children:(0,Z.jsx)(te,{})}),(0,Z.jsx)(Ge,{target:c,label:`Next screen`,children:(0,Z.jsx)(o,{})})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 animate-enter max-xl:flex-col max-xl:overflow-y-auto`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 xl:flex-1 xl:overflow-y-auto`,children:(0,Z.jsxs)(`figure`,{className:`space-y-2.5 p-6 max-sm:p-4`,children:[S&&(A[0]?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ke,{placed:A[0],all:A.filter(e=>e.place.name===A[0].place.name),name:k(A[0]),copies:A[0].lookalike?e.byId.get(A[0].lookalike)?.name??null:null,onClear:()=>v(null),onComment:()=>y(!0)}),ee&&(0,Z.jsx)(Le,{target:de(A[0]),elementName:Q(A[0])?e.byId.get(Q(A[0]))?.name??null:null,onCancel:()=>y(!1),onFiled:e=>{P(e),y(!1),_({request:e.id})}},A[0].at??A[0].place.name)]}):(0,Z.jsxs)(`p`,{className:`text-small text-muted`,"data-places-hint":!0,children:[`Point at the screenshot to name a component; click to pick it out. `,(0,Z.jsx)(`span`,{className:`tabular`,children:w.length}),` components placed: `,(0,Z.jsx)(`span`,{className:`tabular`,children:w.filter(e=>e.element).length}),` System elements, `,(0,Z.jsx)(`span`,{className:`tabular`,children:w.filter(e=>e.lookalike).length}),` lookalikes`,S.dev?`.`:`, without their lines: the capture was of a production build.`]})),(0,Z.jsx)(`div`,{className:C(`overflow-hidden rounded-lg border border-line shadow-raise`,!V&&`border-dashed shadow-none`),children:V&&!S?(0,Z.jsx)(`a`,{href:T(V.file),target:`_blank`,rel:`noreferrer`,title:`Open full size`,className:`block`,children:Y}):Y}),(0,Z.jsxs)(`figcaption`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted`,children:[n.shot&&(0,Z.jsxs)(`span`,{children:[`Captured at `,(0,Z.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:n.shot.path}),n.shot.note&&(0,Z.jsxs)(Z.Fragment,{children:[` · `,n.shot.note]})]}),B&&(0,Z.jsxs)(`span`,{className:`text-faint`,children:[B.source,`, `,B.capturedAt]}),V&&S&&(0,Z.jsx)(`a`,{href:T(V.file),target:`_blank`,rel:`noreferrer`,className:`text-accent hover:underline`,children:`Open full size`})]})]})}),(0,Z.jsxs)(`aside`,{"aria-label":`What ${G} is made of`,className:`space-y-6 border-line p-6 max-sm:p-4 xl:w-[440px] xl:shrink-0 xl:overflow-y-auto xl:border-l xl:pl-5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted`,children:[(0,Z.jsxs)(`span`,{className:`tabular`,children:[(0,Z.jsx)(`span`,{className:`text-heading text-ink`,children:K.length}),` elements · `,(0,Z.jsx)(`span`,{className:`text-ink-2`,children:n.sites}),` sites`]}),(0,Z.jsx)(Se,{issues:n.issues})]}),J.length>0&&(0,Z.jsxs)(`p`,{className:`tabular text-small text-muted`,children:[J.join(` · `),`, counted from the files that render on this screen.`]})]}),(N.length>0||b.state.status===`error`)&&(0,Z.jsx)(H,{title:`Requests`,count:N.filter(e=>e.status!==`closed`).length,children:b.state.status===`error`?(0,Z.jsx)(`p`,{className:`text-small text-muted`,"data-requests-offline":!0,children:b.state.error.offline?`Requests on this screen need the local service: open the hub with youiyoux ui --project.`:b.state.error.message}):(0,Z.jsx)(`ol`,{className:`space-y-2`,"aria-label":`Requests on this screen`,children:N.map((e,t)=>(0,Z.jsx)(ze,{request:e,number:t+1,active:g===e.id,onChange:P,onPick:()=>R(e)},e.id))})}),(0,Z.jsx)(H,{title:`Elements`,count:K.length,children:(0,Z.jsx)(`div`,{className:`rounded-md border border-line`,children:K.map(t=>(0,Z.jsx)(Ve,{model:e,element:t,scheme:r,picture:z(t.id)},t.id))})}),q.length>0&&(0,Z.jsx)(H,{title:`Only lookalikes or unresolved`,count:q.length,children:(0,Z.jsx)(`div`,{className:`rounded-md border border-line`,children:q.map(t=>(0,Z.jsx)(Ve,{model:e,element:t,scheme:r,picture:z(t.id)},t.id))})}),(0,Z.jsx)(H,{title:`Rule issues`,count:n.violations.length,children:(0,Z.jsx)(Ue,{model:e,screen:n})})]})]})]})}var Je=360,Ye=48,Xe=.1,Ze=.75,$=1.25,Qe=4,$e=e=>Math.min(3,Math.max(Xe,e));function et(e,t,n,r){let i=$e(e.scale*t),a=i/e.scale;return{scale:i,x:n-(n-e.x)*a,y:r-(r-e.y)*a}}function tt(e,t,n=32){let r=$e(Math.min(1,(t.width-2*n)/Math.max(1,e.width),(t.height-2*n)/Math.max(1,e.height)));return{scale:r,x:(t.width-e.width*r)/2,y:Math.max(n,(t.height-e.height*r)/2)}}function nt({screen:e,scheme:t,full:n,requests:r,onPin:i,onLoad:o}){let s=u(e.shot,t,n?`full`:`thumb`),c=r.filter(e=>e.status!==`closed`);return(0,Z.jsxs)(`article`,{className:`shrink-0 space-y-2`,style:{width:Je},"data-canvas-screen":`${e.project}:${e.route}`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(E,{href:a(e.project,e.route),className:`min-w-0 truncate font-mono text-mono text-ink hover:text-accent`,draggable:!1,children:e.route===`*`?`every screen`:p(e.route)}),c.length>0&&(0,Z.jsx)(`span`,{className:`rounded-full bg-accent px-1.5 text-caption font-medium text-on-accent tabular`,title:`${c.length} open or addressed requests`,children:c.length}),(0,Z.jsx)(`span`,{className:`ml-auto`,children:(0,Z.jsx)(Se,{issues:e.issues})})]}),(0,Z.jsxs)(E,{href:a(e.project,e.route),className:`relative block overflow-hidden rounded-md border border-line bg-surface shadow-raise`,draggable:!1,"aria-label":`Open ${e.project} ${p(e.route)}`,children:[s?(0,Z.jsx)(`img`,{src:T(s.file),alt:``,draggable:!1,onLoad:o,className:`block w-full select-none`}):(0,Z.jsx)(`span`,{className:`grid h-[200px] place-items-center p-4 text-center text-small text-faint`,children:`No screenshot yet`}),s&&r.map((t,n)=>t.target.box&&t.target.page?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),i(t)},"aria-label":`Request ${n+1} on ${p(e.route)} (${t.status}): ${t.body}`,title:t.body,"data-canvas-pin":t.id,className:C(`absolute grid size-6 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full border-2 border-surface text-caption font-semibold tabular shadow-raise`,t.status===`closed`?`bg-neutral-soft text-muted`:t.status===`addressed`?`bg-success text-on-accent`:`bg-accent text-on-accent`),style:{left:G(t.target.box.x,t.target.page.width),top:G(t.target.box.y,t.target.page.height)},children:n+1},t.id):null)]})]})}function rt({screens:e,scheme:t,requests:n}){let[,r]=j(),i=(0,X.useRef)(null),o=(0,X.useRef)(null),[s,c]=(0,X.useState)({x:0,y:0,scale:1}),l=(0,X.useRef)(null),u=[...new Set(e.screens.map(e=>e.project))],d=(0,X.useRef)(!1),f=(0,X.useCallback)(()=>{let e=i.current,t=o.current;e&&t&&c(tt({width:t.offsetWidth,height:t.offsetHeight},{width:e.clientWidth,height:e.clientHeight}))},[]);(0,X.useLayoutEffect)(f,[f,e]);let p=(0,X.useCallback)(()=>!d.current&&f(),[f]),m=(0,X.useCallback)((e,t)=>{let n=i.current;n&&(d.current=!0,c(r=>et(r,e,t?.x??n.clientWidth/2,t?.y??n.clientHeight/2)))},[]);(0,X.useEffect)(()=>{let e=e=>{if(!(e.target instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName))){if(e.key===`+`||e.key===`=`)m($);else if(e.key===`-`)m(1/$);else if(e.key===`0`)f();else return;e.preventDefault()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,f]),(0,X.useEffect)(()=>{let e=i.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();t.ctrlKey||t.metaKey?m(Math.exp(-t.deltaY*.002),{x:t.clientX-n.left,y:t.clientY-n.top}):(d.current=!0,c(e=>({...e,x:e.x-t.deltaX,y:e.y-t.deltaY})))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[m]);let h=e=>{e.button===0&&(l.current={x:e.clientX,y:e.clientY,view:s,moved:!1})},g=e=>{let t=l.current;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;!t.moved&&Math.hypot(n,r)<Qe||(t.moved||i.current?.setPointerCapture(e.pointerId),t.moved=!0,d.current=!0,c({...t.view,x:t.view.x+n,y:t.view.y+r}))},_=()=>{l.current?.moved&&window.addEventListener(`click`,e=>e.preventDefault(),{capture:!0,once:!0}),l.current=null},v=e=>n.filter(t=>t.target.route===e.route&&t.project===e.project).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-sunken`,"data-canvas":!0,children:[(0,Z.jsx)(`div`,{ref:i,className:C(`absolute inset-0 touch-none select-none`,l.current?.moved?`cursor-grabbing`:`cursor-grab`),onPointerDown:h,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onWheel:e=>e.stopPropagation(),"aria-label":`Every screen on one board: drag or scroll to pan, ⌘ or Ctrl and scroll to zoom`,role:`region`,children:(0,Z.jsx)(`div`,{ref:o,className:`absolute top-0 left-0 inline-flex origin-top-left flex-col p-8`,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${s.scale})`,gap:Ye*1.5},"data-board":!0,children:u.map(n=>(0,Z.jsxs)(`section`,{"aria-label":n,className:`space-y-4`,children:[(0,Z.jsx)(`h2`,{className:`text-heading`,children:n}),(0,Z.jsx)(`div`,{className:`flex flex-wrap items-start`,style:{gap:Ye,width:1584},children:e.screens.filter(e=>e.project===n).map(e=>(0,Z.jsx)(nt,{screen:e,scheme:t,full:s.scale>=Ze,requests:v(e),onPin:t=>r(`${a(e.project,e.route)}?request=${t.id}`),onLoad:p},e.route))})]},n))})}),(0,Z.jsxs)(`div`,{className:`absolute right-4 bottom-4 flex items-center gap-1 rounded-md border border-line bg-surface p-1 shadow-raise`,"data-canvas-controls":!0,children:[(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,onClick:()=>m(1/$),"aria-label":`Zoom out`,title:`Zoom out (−)`,children:(0,Z.jsx)(ee,{})}),(0,Z.jsxs)(`span`,{className:`w-12 text-center text-small text-muted tabular`,"aria-live":`polite`,"data-zoom":!0,children:[Math.round(s.scale*100),`%`]}),(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,onClick:()=>m($),"aria-label":`Zoom in`,title:`Zoom in (+)`,children:(0,Z.jsx)(y,{})}),(0,Z.jsxs)(M,{variant:`ghost`,size:`sm`,onClick:f,title:`Fit every screen (0)`,children:[(0,Z.jsx)(fe,{}),` Fit`]})]})]})}var it=3;function at(){let e=w(),t=ie();return e.status===`ready`?t.status===`ready`?(0,Z.jsx)(ot,{model:e.value,index:t.value}):(0,Z.jsx)(O,{state:t,onRetry:re,what:`the usage map`}):(0,Z.jsx)(O,{state:e,onRetry:ne,what:`the catalog`})}function ot({model:e,index:t}){let n=k(),r=l(t,e.manifest),i=n[`*`];if(!i)return(0,Z.jsx)(ct,{model:e,index:t,screens:r});let a=r.byHref.get(`/screens/${i}`);return a?(0,Z.jsx)(qe,{model:e,screens:r,screen:a},i):(0,Z.jsxs)(A,{icon:ve,title:`No such screen`,actions:(0,Z.jsx)(M,{asChild:!0,children:(0,Z.jsx)(E,{href:`/screens`,children:`All screens`})}),children:[`No scanned project has a screen at `,(0,Z.jsx)(`code`,{className:`font-mono text-mono-sm`,children:i}),`.`]})}function st(e){return e?`Screenshots from the ${e.source}, ${e.capturedAt}`:`No screenshots captured for this project yet: youiyoux screens capture --base <url> takes them, with every component placed`}function ct({model:e,index:t,screens:n}){let{scheme:r}=se(),[i,a]=(0,X.useState)(-1),o=(0,X.useRef)(null),s=()=>[...o.current?.querySelectorAll(`[data-screen-card]`)??[]];D({count:n.screens.length,index:i,onMove:e=>s()[e]?.focus()});let c=[...new Set(n.screens.map(e=>e.project))],[l,u]=j(),d=new URLSearchParams(ae()).get(`view`)===`canvas`,f=ue(L.requests,`requests`),p=(0,Z.jsx)(ce,{title:`Screens`,count:n.screens.length,children:(0,Z.jsx)(U,{label:`Layout`,value:d?`canvas`:`grid`,onChange:e=>u(e===`canvas`?`${l}?view=canvas`:l,{replace:!0}),options:[{value:`grid`,label:`Grid`},{value:`canvas`,label:`Canvas`}]})});return d?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[p,(0,Z.jsx)(rt,{screens:n,scheme:r,requests:f.state.status===`ready`?f.state.value.requests:[]})]}):(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[p,(0,Z.jsx)(`div`,{ref:o,"data-list-pane":!0,onFocus:e=>a(s().findIndex(t=>t===e.target)),className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-10 px-6 py-6 animate-enter max-sm:px-4`,children:[c.map(i=>{let a=t.reports.find(e=>e.project===i)?.commit,o=n.screens.filter(e=>e.project===i),s=o.some(e=>e.shot);return(0,Z.jsxs)(`section`,{"aria-labelledby":`screens-${i}`,className:`space-y-4`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`h2`,{id:`screens-${i}`,className:`text-heading`,children:i}),a&&(0,Z.jsxs)(`span`,{className:`font-mono text-mono-sm text-muted`,children:[`@`,W(a)]}),(0,Z.jsx)(`span`,{className:`text-small text-muted`,children:st(n.shots.get(i))})]}),(0,Z.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:o.map(t=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(lt,{model:e,screen:t,scheme:r,pictured:s})},t.route))})]},i)}),n.unattributedFiles.length>0&&(0,Z.jsxs)(K,{className:`max-w-2xl text-small text-muted`,summaryClassName:`min-h-11 rounded-sm py-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,summary:(0,Z.jsxs)(`span`,{children:[`Not on any screen · `,n.unattributedFiles.length,` `,n.unattributedFiles.length===1?`file`:`files`]}),children:[n.unattributed.total>0&&(0,Z.jsx)(`p`,{className:`mt-1`,children:xe(n.unattributed).join(`, `)}),(0,Z.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.unattributedFiles.map(({project:e,file:t,sites:n,reason:r})=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsxs)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:[e,`/`,t]}),n>0&&(0,Z.jsxs)(`span`,{className:`ml-2 inline-block`,children:[n,` `,n===1?`site`:`sites`]}),(0,Z.jsx)(`p`,{className:`break-words`,children:r})]},`${e}:${t}`))})]})]})})]})}function lt({model:e,screen:t,scheme:n,pictured:r}){let i=t.elements.filter(e=>e.sites.length>0),o=i.slice(0,it),s=i.length-o.length;return(0,Z.jsxs)(E,{href:a(t.project,t.route),"data-screen-card":!0,className:`group block h-full overflow-hidden rounded-lg border border-line bg-surface transition-colors duration-100 hover:border-line-strong hover:bg-raised`,children:[(0,Z.jsx)(m,{shot:t.shot,scheme:n,size:`thumb`,label:`${t.project} ${p(t.route)}`,whenMissing:r?`placeholder`:`none`,className:`border-b border-line`}),(0,Z.jsxs)(`div`,{className:`space-y-1 px-3.5 pt-2.5 pb-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-mono text-ink`,children:t.route===`*`?`every screen`:t.route}),t.route===`*`&&(0,Z.jsx)(B,{tone:`outline`,children:`app shell`}),(0,Z.jsx)(`span`,{className:`ml-auto`,children:(0,Z.jsx)(Se,{issues:t.issues})})]}),(0,Z.jsxs)(`p`,{className:`truncate text-small text-muted`,children:[(0,Z.jsxs)(`span`,{className:`tabular`,children:[i.length,` `,i.length===1?`element`:`elements`,` · `,t.sites,` `,t.sites===1?`site`:`sites`]}),o.length>0&&(0,Z.jsx)(`span`,{className:`text-faint`,children:` — `}),o.map((t,n)=>(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[n>0&&`, `,e.byId.get(t.id)?.name??t.id]},t.id)),s>0&&(0,Z.jsxs)(`span`,{children:[` +`,s]})]})]})]})}export{at as ScreensScreen};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{a as i,c as a,d as o,f as s,i as c,l,n as u,o as d,r as f,s as p,t as m}from"./ScreenImage-DUMSgBJL.js";import{t as h}from"./bot-B3gC9oUR.js";import{t as g}from"./KindIcon-BJ6bz-ny.js";import{t as _}from"./CopyButton-DE8drl4P.js";import{t as v}from"./circle-check-DkwBMT62.js";import{t as ee}from"./minus-BDifFhOo.js";import{i as y,r as b}from"./ServiceDown-BghtjpTn.js";import{t as x}from"./triangle-alert-Dkdi9eDR.js";import{t as S}from"./x-MLbFVa4v.js";import{t as C}from"./clsx-DB0hHKMi.js";import{D as te,H as w,L as ne,R as re,U as ie,ct as T,dt as E,g as D,ht as ae,i as O,k as oe,m as se,mt as k,n as ce,o as A,pt as j,s as M,st as le,tt as N,ut as P}from"./main-Djqho539.js";import{t as F}from"./when-COrv5lkZ.js";import{n as I}from"./plural-BbGQPQKA.js";import{a as L,i as ue,n as R,r as de}from"./workflow-Bv814-L8.js";import{r as z,t as B}from"./Badge-CUJUit4d.js";import{a as V}from"./Field-LwrJXoOs.js";import{n as H}from"./Section-BTnvUq_W.js";import{t as U}from"./Segmented-CTMaLPgh.js";import{n as W,t as G}from"./format-DxAYNTN_.js";import{t as K}from"./Disclosure-B1kTgPgk.js";var q={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};q.node;var J=r(q),Y={name:`maximize`,size:24,node:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]};Y.node;var fe=r(Y),pe={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};pe.node;var me=r(pe),he={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};he.node;var ge=r(he),_e={name:`monitor-x`,size:24,node:[[`path`,{d:`m14.5 12.5-5-5`,key:`1jahn5`}],[`path`,{d:`m9.5 12.5 5-5`,key:`1k2t7b`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}]]};_e.node;var ve=r(_e),ye={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};ye.node;var be=r(ye),X=e(t(),1),Z=n();function xe(e){return[e.errors>0&&I(e.errors,`error`),e.warnings>0&&I(e.warnings,`warning`),e.lookalikes>0&&I(e.lookalikes,`lookalike`),e.unresolved>0&&I(e.unresolved,`unresolved site`)].filter(e=>!!e)}function Se({issues:e}){return e.total===0?(0,Z.jsxs)(B,{tone:`success`,children:[(0,Z.jsx)(v,{}),` No issues`]}):(0,Z.jsxs)(B,{tone:e.errors>0?`danger`:`warning`,title:xe(e).join(` · `),className:`tabular`,children:[(0,Z.jsx)(x,{}),` `,I(e.total,`issue`)]})}var Ce=e=>e.file&&e.line?`${e.file}:${e.line}`:null;function we(e,t,n=[]){let r=new Map;for(let e of t)e.kind===`render`&&le(r,`${e.file}:${e.line}`,e);let i=new Map(n.map(e=>[`${e.file}:${e.line}:${e.local}`,e.resembles]));return e.map(e=>{let t=Ce(e),n=(t?r.get(t)??[]:[]).find(t=>t.local===e.name||t.export===e.name||t.local.endsWith(`.${e.name}`))??null,a=!n&&t?i.get(`${t}:${e.name}`)??null:null;return{place:e,element:n?.element??null,site:n,lookalike:a,at:t}})}var Te=(e,t)=>t!==null&&(e.element===t||e.lookalike===t||e.at===t),Q=e=>e.element??e.lookalike,Ee=(e,t)=>Number(Q(t)!==null)-Number(Q(e)!==null)||t.place.depth-e.place.depth;function De(e,t,n,r=()=>!0){let i=null,a=1/0;for(let o of e){let{box:e}=o.place;if(t<e.x||n<e.y||t>e.x+e.width||n>e.y+e.height||!r(o))continue;let s=e.width*e.height;(s<a||s===a&&i!==null&&o.place.depth>i.place.depth)&&(i=o,a=s)}return i}function Oe(e){let[t,n]=(0,X.useState)(null);return(0,X.useEffect)(()=>{if(!e)return;let t=!1;return n({file:e,state:{status:`loading`}}),P(e).then(r=>!t&&n({file:e,state:{status:`ready`,value:r}}),r=>!t&&n({file:e,state:{status:`error`,message:r instanceof Error?r.message:String(r)}})),()=>{t=!0}},[e]),e&&t?.file===e?t.state:null}function ke({shot:e,scheme:t,label:n,places:r,placed:i,outline:a,select:o,pointed:s,nameOf:c,onSelect:l,pins:u=[],activePin:d=null,onPin:f}){let p=(0,X.useRef)(null),[h,g]=(0,X.useState)(null),{size:_}=r,v=a===`elements`?e=>Q(e)!==null:()=>!0,ee=a===`elements`?i.filter(v):[],y=i.filter(e=>Te(e,o)||s!==null&&Q(e)===s),b=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!o||b.current===o)return;let e=p.current?.querySelector(`[data-place-lit]`);e&&(b.current=o,e.scrollIntoView({block:`center`,behavior:`smooth`}))},[o,y.length]);let x=e=>{let t=p.current.getBoundingClientRect();return De(i,(e.clientX-t.left)/t.width*_.width,(e.clientY-t.top)/t.height*_.height,a===`elements`?v:void 0)},S=(e,t,n)=>(0,Z.jsx)(`div`,{"data-place":Q(e)??e.at??e.place.name,...e.lookalike?{"data-lookalike":``}:{},...t===`lit`?{"data-place-lit":``}:{},className:C(`pointer-events-none absolute rounded-[3px]`,t===`shown`&&(e.element?`outline-1 -outline-offset-1 outline-accent/50 outline-dashed`:`outline-1 -outline-offset-1 outline-warning/70 outline-dashed`),t===`hover`&&`bg-accent/8 outline-2 -outline-offset-1 outline-accent outline-solid`,t===`lit`&&`bg-accent/12 outline-2 -outline-offset-1 outline-accent outline-solid`),style:{left:G(e.place.box.x,_.width),top:G(e.place.box.y,_.height),width:G(e.place.box.width,_.width),height:G(e.place.box.height,_.height)}},n);return(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(m,{shot:e,scheme:t,size:`full`,label:n,ratio:_.width/_.height}),(0,Z.jsxs)(`div`,{ref:p,className:C(`absolute inset-0`,a!==`off`&&`cursor-crosshair`),"data-places-layer":!0,onPointerMove:e=>a!==`off`&&g(x(e)),onPointerLeave:()=>g(null),onClick:e=>a!==`off`&&l(x(e)),children:[ee.map((e,t)=>S(e,`shown`,`s${t}`)),y.map((e,t)=>S(e,`lit`,`l${t}`)),h&&!y.includes(h)&&S(h,`hover`,`hover`),h&&(0,Z.jsx)(`span`,{className:`pointer-events-none absolute z-10 max-w-[60%] -translate-y-full truncate rounded-xs bg-ink px-1.5 py-0.5 font-mono text-mono-sm text-canvas shadow-raise`,style:{left:G(h.place.box.x,_.width),top:G(h.place.box.y,_.height)},"data-place-label":!0,children:c(h)}),u.map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f?.(e.id)},onPointerMove:e=>e.stopPropagation(),"aria-label":`Request ${e.number} (${e.status})`,"aria-pressed":d===e.id,"data-pin":e.id,className:C(`absolute z-20 grid size-6 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full border-2 border-surface text-caption font-semibold tabular shadow-raise outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`,e.status===`closed`?`bg-neutral-soft text-muted`:e.status===`addressed`?`bg-success text-on-accent`:`bg-accent text-on-accent`,d===e.id&&`ring-2 ring-accent ring-offset-1 ring-offset-surface`),style:{left:G(e.box.x,_.width),top:G(e.box.y,_.height)},children:e.number},e.id))]})]})}var Ae={width:320,height:180};function je(e,t){let n=Math.min(t.width,Math.max(Ae.width,e.width+112)),r=Math.min(t.height,Math.max(Ae.height,e.height+112));return{x:Math.min(Math.max(0,e.x+e.width/2-n/2),t.width-n),y:Math.min(Math.max(0,e.y+e.height/2-r/2),t.height-r),width:n,height:r}}function Me({picture:e,label:t}){let n=de(e.url);if(!e.box||!e.page)return(0,Z.jsx)(`img`,{src:n,alt:t,className:`w-full rounded-md border border-line`});let r=je(e.box,e.page);return(0,Z.jsxs)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{aspectRatio:`${r.width} / ${r.height}`},"data-crop":!0,children:[(0,Z.jsx)(`img`,{src:n,alt:t,className:`absolute max-w-none`,style:{width:G(e.page.width,r.width),left:G(-r.x,r.width),top:G(-r.y,r.height)}}),(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`absolute rounded-[3px] outline-2 -outline-offset-1 outline-accent outline-solid`,style:{left:G(e.box.x-r.x,r.width),top:G(e.box.y-r.y,r.height),width:G(e.box.width,r.width),height:G(e.box.height,r.height)}})]})}function Ne({id:e,route:t,worked:n}){let[r,i]=(0,X.useState)(null);if((0,X.useEffect)(()=>{let t=!1;return L.compareRequest(e).then(e=>!t&&i({value:e}),e=>!t&&i({error:R(e)})),()=>{t=!0}},[e]),!r||`error`in r||!r.value.before&&!r.value.after)return null;let{before:a,after:o}=r.value,s=`youiyoux screens capture --base <the app in development> --route ${t}`;return(0,Z.jsxs)(`figure`,{className:`space-y-1.5`,"data-before-after":!0,children:[(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[{picture:a,label:`Before`,at:a?`filed ${F(a.at)}`:``},{picture:o,label:`Now`,at:o?`captured ${F(o.at)}`:``}].map(({picture:e,label:n,at:r})=>(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,"data-side":n.toLowerCase(),children:[(0,Z.jsxs)(`p`,{className:`flex items-baseline gap-1.5 text-caption`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-ink-2`,children:n}),(0,Z.jsx)(`span`,{className:`truncate text-faint`,children:r})]}),e?(0,Z.jsx)(Me,{picture:e,label:`${n}: the component on ${t}`}):(0,Z.jsx)(`p`,{className:`grid aspect-[16/9] place-items-center rounded-md border border-dashed border-line-strong p-2 text-center text-caption text-faint`,children:`No picture`})]},n))}),o&&n&&!o.sinceFiled&&(0,Z.jsxs)(`figcaption`,{className:`space-y-1 text-caption text-warning`,"data-stale":!0,children:[(0,Z.jsx)(`span`,{children:`Not captured since this was filed, so the work is not in it: capture the screen again.`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 rounded-sm bg-sunken px-1.5 py-0.5 text-ink-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm`,children:s}),(0,Z.jsx)(_,{value:s,label:`Copy the capture command`})]})]}),o&&!o.found&&o.sinceFiled&&(0,Z.jsx)(`figcaption`,{className:`text-caption text-muted`,children:`Its line is not on the new picture, so it is outlined where it was.`})]})}var Pe={open:`warning`,addressed:`accent`,closed:`outline`},Fe={open:`Open`,addressed:`Addressed`,closed:`Closed`};function Ie({error:e}){return(0,Z.jsxs)(`div`,{role:`alert`,className:`space-y-1.5 text-small text-danger`,"data-request-error":!0,children:[(0,Z.jsx)(`p`,{children:e.offline?`Requests are filed through the local service: start the hub on your project.`:e.message}),e.offline&&(0,Z.jsx)(b,{}),e.problems.length>0&&(0,Z.jsx)(`ul`,{className:`list-disc pl-4`,children:e.problems.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]})}function Le({target:e,elementName:t,onFiled:n,onCancel:r}){let[i,a]=(0,X.useState)(`change`),[o,s]=(0,X.useState)(`here`),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=t=>{t.preventDefault(),c.trim()&&(d(!0),p(null),L.fileRequest(i,c.trim(),{...e,scope:o}).then(e=>{l(``),n(e)},e=>p(R(e))).finally(()=>d(!1)))};return(0,Z.jsxs)(`form`,{onSubmit:m,className:`space-y-2.5 rounded-lg border border-line bg-surface p-3`,"data-request-composer":!0,"aria-label":`New request`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{label:`Kind`,value:i,onChange:a,options:[{value:`change`,label:`Change request`},{value:`comment`,label:`Comment`}]}),t&&(0,Z.jsx)(U,{label:`Applies to`,value:o,onChange:s,options:[{value:`here`,label:`This one`},{value:`element`,label:`Every ${t}`}]})]}),(0,Z.jsx)(V,{value:c,onChange:e=>l(e.target.value),rows:3,maxLength:4e3,placeholder:i===`change`?`What should change? An agent reads this with the component's file and line.`:`What do you notice?`,"aria-label":i===`change`?`What should change`:`Your comment`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&m(e)}}),f&&(0,Z.jsx)(Ie,{error:f}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Z.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),(0,Z.jsx)(M,{type:`submit`,variant:`primary`,size:`sm`,disabled:u||!c.trim(),"aria-busy":u||void 0,children:i===`change`?`File change request`:`Add comment`})]})]})}function Re({author:e}){let t=e.kind===`agent`?h:be;return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-small font-medium text-ink-2`,children:[(0,Z.jsx)(t,{"aria-hidden":!0,className:`size-3.5 text-muted`}),e.name]})}function ze({request:e,number:t,active:n,onChange:r,onPick:i}){let[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=e=>{c(!0),u(null),e().then(e=>{o(``),r(e)},e=>u(R(e))).finally(()=>c(!1))},{target:f}=e;return(0,Z.jsxs)(`li`,{className:C(`space-y-2 rounded-md border px-3 py-2.5`,n?`border-accent bg-accent-soft/40`:`border-line`),"data-request":e.id,"data-status":e.status,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:i,className:`flex w-full min-w-0 items-start gap-2 text-left`,"aria-label":`Show request ${t} on the screenshot`,children:[(0,Z.jsx)(`span`,{className:C(`grid size-5 shrink-0 place-items-center rounded-full text-caption font-medium tabular`,e.status===`closed`?`bg-neutral-soft text-muted`:e.status===`addressed`?`bg-success text-on-accent`:`bg-accent text-on-accent`),children:t}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(B,{tone:Pe[e.status],children:Fe[e.status]}),(0,Z.jsx)(`span`,{className:`text-caption text-muted`,children:e.kind===`change`?`Change request`:`Comment`}),(0,Z.jsxs)(`span`,{className:`text-caption text-faint`,children:[`· `,f.scope===`element`?`every ${f.name}`:f.name]})]}),(0,Z.jsx)(`span`,{className:`block text-small text-ink`,children:e.body}),(0,Z.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-faint`,children:f.file&&f.line?`${f.file}:${f.line}`:f.route})]})]}),(e.before||e.status!==`open`)&&(0,Z.jsx)(Ne,{id:e.id,route:f.route,worked:e.status!==`open`},e.updatedAt),(0,Z.jsxs)(`ol`,{className:`space-y-1.5 border-l border-line pl-3`,"aria-label":`Thread`,children:[(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 text-caption text-faint`,children:[(0,Z.jsx)(Re,{author:e.author}),` filed it `,F(e.createdAt)]}),e.thread.map((e,t)=>(0,Z.jsxs)(`li`,{className:`space-y-0.5`,"data-entry":e.author.kind,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-caption text-faint`,children:[(0,Z.jsx)(Re,{author:e.author}),e.status&&(0,Z.jsxs)(`span`,{children:[`marked it `,e.status]}),(0,Z.jsx)(`span`,{children:F(e.at)})]}),e.body&&(0,Z.jsx)(`p`,{className:`text-small text-ink-2 [overflow-wrap:anywhere]`,children:e.body})]},t))]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(V,{value:a,onChange:e=>o(e.target.value),rows:2,maxLength:4e3,placeholder:`Reply`,"aria-label":`Reply to request ${t}`}),l&&(0,Z.jsx)(Ie,{error:l}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e.status===`closed`?(0,Z.jsx)(M,{size:`sm`,variant:`ghost`,disabled:s,onClick:()=>d(()=>L.moveRequest(e.id,`open`,a)),children:`Reopen`}):(0,Z.jsx)(M,{size:`sm`,variant:e.status===`addressed`?`primary`:`ghost`,disabled:s,onClick:()=>d(()=>L.moveRequest(e.id,`closed`,a)),children:e.status===`addressed`?`Looks right: close`:`Close`}),(0,Z.jsxs)(M,{size:`sm`,variant:`outline`,disabled:s||!a.trim(),onClick:()=>d(()=>L.replyRequest(e.id,a)),children:[(0,Z.jsx)(ge,{}),` Reply`]})]})]})]})}function Be({summary:e,children:t,onPoint:n}){return(0,Z.jsxs)(`details`,{className:`group/details border-b border-line last:border-b-0`,onPointerEnter:n&&(()=>n(!0)),onPointerLeave:n&&(()=>n(!1)),children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 hover:bg-raised [&::-webkit-details-marker]:hidden`,children:[(0,Z.jsx)(o,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-faint transition-transform duration-100 group-open/details:rotate-90`}),e]}),(0,Z.jsx)(`ul`,{className:`pb-1.5`,children:t})]})}function Ve({model:e,element:t,scheme:n,picture:r}){let a=e.byId.get(t.id),o=e.components.get(t.id)?.contract,l=d(o),u=a?.name??t.id;return(0,Z.jsxs)(Be,{onPoint:r?.point,summary:(0,Z.jsxs)(Z.Fragment,{children:[a&&(0,Z.jsx)(g,{element:a,scheme:n}),(0,Z.jsx)(`span`,{className:`font-medium text-ink`,children:u}),t.sites.length>0&&(0,Z.jsx)(`span`,{className:`tabular text-small text-muted`,children:t.sites.length}),(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[r&&r.count>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),r.locate()},onFocus:()=>r.point(!0),onBlur:()=>r.point(!1),className:`inline-flex h-5 items-center gap-1 rounded-xs px-1 text-caption text-muted hover:bg-neutral-soft hover:text-ink`,"aria-label":`Show ${u} on the screenshot (${r.count})`,title:`Show on the screenshot`,"data-locate":t.id,children:[(0,Z.jsx)(J,{"aria-hidden":!0,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`tabular`,children:r.count})]}),t.lookalikes.length>0&&(0,Z.jsxs)(B,{tone:`warning`,className:`tabular`,title:`Local components named like this element that resolve elsewhere`,children:[t.lookalikes.length,` lookalike`,t.lookalikes.length===1?``:`s`]}),t.unresolved.length>0&&(0,Z.jsxs)(B,{tone:`outline`,className:`tabular`,title:`Sites the scanner could not resolve that might be this element`,children:[t.unresolved.length,` unresolved`]}),(0,Z.jsx)(E,{href:N(t.id,`usage`),className:`grid size-5 place-items-center rounded-xs text-muted hover:bg-neutral-soft hover:text-ink`,"aria-label":`${u}: usage everywhere`,title:`${u}: usage everywhere`,children:(0,Z.jsx)(s,{className:`size-3.5`})})]})]}),children:[(0,Z.jsx)(f,{items:t.sites,render:e=>(0,Z.jsx)(i,{site:e,choices:l,contract:o},`${e.fingerprint}:${e.line}:${e.column}`)}),t.lookalikes.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 px-3 py-1.5`,children:[(0,Z.jsx)(c,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 text-small text-muted`,children:[(0,Z.jsx)(B,{tone:`warning`,children:`lookalike`}),` `,(0,Z.jsxs)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:[`<`,e.local,`>`]}),` is `,(0,Z.jsx)(`code`,{title:e.resolved,className:`font-mono text-mono-sm`,children:e.resolved.split(`/`).pop()})]})]},`l:${e.file}:${e.line}:${e.column}`)),t.unresolved.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 px-3 py-1.5`,children:[(0,Z.jsx)(c,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 text-small text-muted`,children:[(0,Z.jsx)(B,{tone:`outline`,children:`unresolved`}),` `,e.detail]})]},`u:${e.file}:${e.line}:${e.column}`))]})}function He({violation:e}){return(0,Z.jsxs)(`li`,{className:`px-3 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(c,{site:e,className:`w-[min(18rem,40%)] shrink-0`}),(0,Z.jsx)(`code`,{className:`min-w-0 rounded-xs bg-neutral-soft px-1 font-mono text-mono-sm break-all text-ink-2`,children:e.text})]}),e.suggestion&&(0,Z.jsxs)(`p`,{className:`mt-0.5 text-small text-muted`,children:[`Use `,e.suggestion]})]})}function Ue({model:e,screen:t}){let n=new Map;for(let e of t.violations)n.set(e.rule,[...n.get(e.rule)??[],e]);let r=[...n].sort(([,e],[,t])=>t.length-e.length);return r.length===0?(0,Z.jsx)(`p`,{className:`rounded-md border border-line px-3 py-4 text-small text-muted`,children:`No rule is broken in this screen's files.`}):(0,Z.jsx)(`div`,{className:`rounded-md border border-line`,children:r.map(([t,n])=>{let r=e.rules.get(t);return(0,Z.jsxs)(Be,{summary:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{severity:n[0].severity}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-ink`,children:r?.title??t}),(0,Z.jsx)(`span`,{className:`ml-auto tabular text-small text-muted`,children:n.length})]}),children:[r&&(0,Z.jsxs)(`li`,{className:`px-3 pb-1.5 text-small text-muted`,children:[r.statement,` `,(0,Z.jsx)(E,{href:N(t),className:`text-accent hover:underline`,children:`Open the rule`})]}),(0,Z.jsx)(f,{items:n,render:e=>(0,Z.jsx)(He,{violation:e},`${e.file}:${e.line}:${e.column}`)})]},t)})})}function We(e,t){let[,n]=j(),r=e.screens,i=r.indexOf(t);return D({count:r.length,index:i,onMove:e=>{let t=r[e];if(!t)return;let i=a(t.project,t.route);oe(i),n(i)}}),{previous:r[i-1],next:r[i+1]}}function Ge({target:e,label:t,children:n}){return e?(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,asChild:!0,children:(0,Z.jsx)(E,{href:a(e.project,e.route),"aria-label":`${t}: ${p(e.route)}`,title:`${t} (${t.startsWith(`Next`)?`j`:`k`})`,children:n})}):(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,disabled:!0,"aria-label":t,children:n})}function Ke({placed:e,all:t,name:n,copies:r,onClear:i,onComment:a}){let{place:o,element:s,lookalike:c,at:l}=e;return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-line bg-surface px-3 py-2.5`,"data-selection":s??l??o.name,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-ink`,children:n}),(0,Z.jsx)(B,{tone:s?`accent`:c?`warning`:`outline`,children:s?`System element`:c?`Lookalike of ${r??c}`:`Component`}),t.length>1&&(0,Z.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[t.length,` on this screen`]})]}),(0,Z.jsxs)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:[l??`its line is unknown (a library's own part, or a production build)`,o.owner&&(0,Z.jsxs)(`span`,{className:`text-faint`,children:[` · in `,o.owner]})]})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(M,{size:`sm`,variant:`primary`,onClick:a,"data-comment":!0,children:[(0,Z.jsx)(me,{}),` Request`]}),l&&(0,Z.jsx)(_,{value:l,label:`Copy ${l}`}),(s??c)&&(0,Z.jsx)(M,{size:`sm`,variant:`outline`,asChild:!0,children:(0,Z.jsx)(E,{href:N(s??c,`usage`),children:c?`Open the element it copies`:`Open element`})}),(0,Z.jsx)(M,{size:`icon`,variant:`ghost`,onClick:i,"aria-label":`Clear the selection`,title:`Clear`,children:(0,Z.jsx)(S,{})})]})]})}function qe({model:e,screens:t,screen:n}){let{scheme:r}=se(),[i,a]=(0,X.useState)(r),{previous:s,next:c}=We(t,n),[l,d]=j(),f=new URLSearchParams(ae()),h=f.get(`select`),g=f.get(`request`),_=e=>{let t=new URLSearchParams,n={select:h,request:g,...e};n.select&&t.set(`select`,n.select),n.request&&t.set(`request`,n.request),d(`${l}${t.size?`?${t.toString()}`:``}`,{replace:!0})},v=e=>_({select:e,request:null}),[ee,y]=(0,X.useState)(!1),b=ue(L.requests,`requests`),x=Oe(n.shot?.places),S=x?.status===`ready`?x.value:null,w=(0,X.useMemo)(()=>{if(!S)return[];let e=t.screens.filter(e=>e.project===n.project);return we(S.places,e.flatMap(e=>e.elements.flatMap(e=>e.sites)),e.flatMap(e=>e.lookalikes))},[S,n,t]),ne=w.some(e=>Q(e)!==null),[re,ie]=(0,X.useState)(null),D=re??(ne?`elements`:`all`),[O,oe]=(0,X.useState)(null),k=t=>t.element?e.byId.get(t.element)?.name??t.element:t.place.name,A=w.filter(e=>Te(e,h)).sort(Ee),M=b.state.status===`ready`?b.state.value.requests:[],le=new Set(w.map(Q).filter(e=>e!==null)),N=M.filter(e=>e.target.route===n.route||e.target.scope===`element`&&e.target.element!==void 0&&le.has(e.target.element)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),P=e=>{if(b.state.status!==`ready`)return b.reload();let t=b.state.value.requests;b.set({...b.state.value,requests:t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[e,...t]})},F=(e,t)=>{let r=e.target.route===n.route&&e.target.box?e.target.box:w.find(t=>e.target.element&&Q(t)===e.target.element)?.place.box;return r?{id:e.id,number:t,box:{x:r.x,y:r.y},status:e.status}:null},I=N.map((e,t)=>F(e,t+1)).filter(e=>e!==null),R=e=>{let t=e.target;_({request:e.id,select:t.scope===`element`&&t.element?t.element:t.file&&t.line?`${t.file}:${t.line}`:t.element??null})},de=e=>({route:n.route,scope:`here`,name:e.place.name,...Q(e)?{element:Q(e)}:{},...e.lookalike?{lookalike:!0}:{},...e.place.file?{file:e.place.file}:{},...e.place.line?{line:e.place.line}:{},box:e.place.box,...S?{page:S.size}:{}}),z=e=>{if(S)return{count:w.filter(t=>Q(t)===e).length,locate:()=>v(e),point:t=>oe(t?e:null)}},B=t.shots.get(n.project),V=u(n.shot,i,`full`),W=B?B.viewport.width/B.viewport.height:void 0,G=p(n.route),K=n.elements.filter(e=>e.sites.length>0),q=n.elements.filter(e=>e.sites.length===0),J=xe(n.issues),Y=S?(0,Z.jsx)(ke,{shot:n.shot,scheme:i,label:`${n.project} ${G}`,places:S,placed:w,outline:D,select:h,pointed:O,nameOf:k,onSelect:e=>v(e?e.element??e.at:null),pins:I,activePin:g,onPin:e=>{let t=N.find(t=>t.id===e);t&&R(t)}}):(0,Z.jsx)(m,{shot:n.shot,scheme:i,size:`full`,label:`${n.project} ${G}`,...W?{ratio:W}:{}});return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(ce,{title:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(E,{href:`/screens`,className:`text-muted hover:text-ink`,children:`Screens`}),(0,Z.jsx)(`span`,{className:`text-faint`,children:`/`}),(0,Z.jsx)(`span`,{className:`font-mono text-mono`,children:n.route===`*`?`every screen`:n.route})]}),children:[S&&(0,Z.jsx)(U,{label:`Outline on the screenshot`,value:D,onChange:ie,options:[{value:`elements`,label:`Elements`},{value:`all`,label:`All`},{value:`off`,label:`Off`}],className:`max-sm:hidden`}),(0,Z.jsx)(U,{label:`Screenshot scheme`,value:i,onChange:a,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],className:`max-sm:hidden`}),(0,Z.jsx)(Ge,{target:s,label:`Previous screen`,children:(0,Z.jsx)(te,{})}),(0,Z.jsx)(Ge,{target:c,label:`Next screen`,children:(0,Z.jsx)(o,{})})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 animate-enter max-xl:flex-col max-xl:overflow-y-auto`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 xl:flex-1 xl:overflow-y-auto`,children:(0,Z.jsxs)(`figure`,{className:`space-y-2.5 p-6 max-sm:p-4`,children:[S&&(A[0]?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ke,{placed:A[0],all:A.filter(e=>e.place.name===A[0].place.name),name:k(A[0]),copies:A[0].lookalike?e.byId.get(A[0].lookalike)?.name??null:null,onClear:()=>v(null),onComment:()=>y(!0)}),ee&&(0,Z.jsx)(Le,{target:de(A[0]),elementName:Q(A[0])?e.byId.get(Q(A[0]))?.name??null:null,onCancel:()=>y(!1),onFiled:e=>{P(e),y(!1),_({request:e.id})}},A[0].at??A[0].place.name)]}):(0,Z.jsxs)(`p`,{className:`text-small text-muted`,"data-places-hint":!0,children:[`Point at the screenshot to name a component; click to pick it out. `,(0,Z.jsx)(`span`,{className:`tabular`,children:w.length}),` components placed: `,(0,Z.jsx)(`span`,{className:`tabular`,children:w.filter(e=>e.element).length}),` System elements, `,(0,Z.jsx)(`span`,{className:`tabular`,children:w.filter(e=>e.lookalike).length}),` lookalikes`,S.dev?`.`:`, without their lines: the capture was of a production build.`]})),(0,Z.jsx)(`div`,{className:C(`overflow-hidden rounded-lg border border-line shadow-raise`,!V&&`border-dashed shadow-none`),children:V&&!S?(0,Z.jsx)(`a`,{href:T(V.file),target:`_blank`,rel:`noreferrer`,title:`Open full size`,className:`block`,children:Y}):Y}),(0,Z.jsxs)(`figcaption`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted`,children:[n.shot&&(0,Z.jsxs)(`span`,{children:[`Captured at `,(0,Z.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:n.shot.path}),n.shot.note&&(0,Z.jsxs)(Z.Fragment,{children:[` · `,n.shot.note]})]}),B&&(0,Z.jsxs)(`span`,{className:`text-faint`,children:[B.source,`, `,B.capturedAt]}),V&&S&&(0,Z.jsx)(`a`,{href:T(V.file),target:`_blank`,rel:`noreferrer`,className:`text-accent hover:underline`,children:`Open full size`})]})]})}),(0,Z.jsxs)(`aside`,{"aria-label":`What ${G} is made of`,className:`space-y-6 border-line p-6 max-sm:p-4 xl:w-[440px] xl:shrink-0 xl:overflow-y-auto xl:border-l xl:pl-5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted`,children:[(0,Z.jsxs)(`span`,{className:`tabular`,children:[(0,Z.jsx)(`span`,{className:`text-heading text-ink`,children:K.length}),` elements · `,(0,Z.jsx)(`span`,{className:`text-ink-2`,children:n.sites}),` sites`]}),(0,Z.jsx)(Se,{issues:n.issues})]}),J.length>0&&(0,Z.jsxs)(`p`,{className:`tabular text-small text-muted`,children:[J.join(` · `),`, counted from the files that render on this screen.`]})]}),(N.length>0||b.state.status===`error`)&&(0,Z.jsx)(H,{title:`Requests`,count:N.filter(e=>e.status!==`closed`).length,children:b.state.status===`error`?(0,Z.jsx)(`p`,{className:`text-small text-muted`,"data-requests-offline":!0,children:b.state.error.offline?`Requests on this screen need the local service: open the hub with youiyoux ui --project.`:b.state.error.message}):(0,Z.jsx)(`ol`,{className:`space-y-2`,"aria-label":`Requests on this screen`,children:N.map((e,t)=>(0,Z.jsx)(ze,{request:e,number:t+1,active:g===e.id,onChange:P,onPick:()=>R(e)},e.id))})}),(0,Z.jsx)(H,{title:`Elements`,count:K.length,children:(0,Z.jsx)(`div`,{className:`rounded-md border border-line`,children:K.map(t=>(0,Z.jsx)(Ve,{model:e,element:t,scheme:r,picture:z(t.id)},t.id))})}),q.length>0&&(0,Z.jsx)(H,{title:`Only lookalikes or unresolved`,count:q.length,children:(0,Z.jsx)(`div`,{className:`rounded-md border border-line`,children:q.map(t=>(0,Z.jsx)(Ve,{model:e,element:t,scheme:r,picture:z(t.id)},t.id))})}),(0,Z.jsx)(H,{title:`Rule issues`,count:n.violations.length,children:(0,Z.jsx)(Ue,{model:e,screen:n})})]})]})]})}var Je=360,Ye=48,Xe=.1,Ze=.75,$=1.25,Qe=4,$e=e=>Math.min(3,Math.max(Xe,e));function et(e,t,n,r){let i=$e(e.scale*t),a=i/e.scale;return{scale:i,x:n-(n-e.x)*a,y:r-(r-e.y)*a}}function tt(e,t,n=32){let r=$e(Math.min(1,(t.width-2*n)/Math.max(1,e.width),(t.height-2*n)/Math.max(1,e.height)));return{scale:r,x:(t.width-e.width*r)/2,y:Math.max(n,(t.height-e.height*r)/2)}}function nt({screen:e,scheme:t,full:n,requests:r,onPin:i,onLoad:o}){let s=u(e.shot,t,n?`full`:`thumb`),c=r.filter(e=>e.status!==`closed`);return(0,Z.jsxs)(`article`,{className:`shrink-0 space-y-2`,style:{width:Je},"data-canvas-screen":`${e.project}:${e.route}`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(E,{href:a(e.project,e.route),className:`min-w-0 truncate font-mono text-mono text-ink hover:text-accent`,draggable:!1,children:e.route===`*`?`every screen`:p(e.route)}),c.length>0&&(0,Z.jsx)(`span`,{className:`rounded-full bg-accent px-1.5 text-caption font-medium text-on-accent tabular`,title:`${c.length} open or addressed requests`,children:c.length}),(0,Z.jsx)(`span`,{className:`ml-auto`,children:(0,Z.jsx)(Se,{issues:e.issues})})]}),(0,Z.jsxs)(E,{href:a(e.project,e.route),className:`relative block overflow-hidden rounded-md border border-line bg-surface shadow-raise`,draggable:!1,"aria-label":`Open ${e.project} ${p(e.route)}`,children:[s?(0,Z.jsx)(`img`,{src:T(s.file),alt:``,draggable:!1,onLoad:o,className:`block w-full select-none`}):(0,Z.jsx)(`span`,{className:`grid h-[200px] place-items-center p-4 text-center text-small text-faint`,children:`No screenshot yet`}),s&&r.map((t,n)=>t.target.box&&t.target.page?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),i(t)},"aria-label":`Request ${n+1} on ${p(e.route)} (${t.status}): ${t.body}`,title:t.body,"data-canvas-pin":t.id,className:C(`absolute grid size-6 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full border-2 border-surface text-caption font-semibold tabular shadow-raise`,t.status===`closed`?`bg-neutral-soft text-muted`:t.status===`addressed`?`bg-success text-on-accent`:`bg-accent text-on-accent`),style:{left:G(t.target.box.x,t.target.page.width),top:G(t.target.box.y,t.target.page.height)},children:n+1},t.id):null)]})]})}function rt({screens:e,scheme:t,requests:n}){let[,r]=j(),i=(0,X.useRef)(null),o=(0,X.useRef)(null),[s,c]=(0,X.useState)({x:0,y:0,scale:1}),l=(0,X.useRef)(null),u=[...new Set(e.screens.map(e=>e.project))],d=(0,X.useRef)(!1),f=(0,X.useCallback)(()=>{let e=i.current,t=o.current;e&&t&&c(tt({width:t.offsetWidth,height:t.offsetHeight},{width:e.clientWidth,height:e.clientHeight}))},[]);(0,X.useLayoutEffect)(f,[f,e]);let p=(0,X.useCallback)(()=>!d.current&&f(),[f]),m=(0,X.useCallback)((e,t)=>{let n=i.current;n&&(d.current=!0,c(r=>et(r,e,t?.x??n.clientWidth/2,t?.y??n.clientHeight/2)))},[]);(0,X.useEffect)(()=>{let e=e=>{if(!(e.target instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName))){if(e.key===`+`||e.key===`=`)m($);else if(e.key===`-`)m(1/$);else if(e.key===`0`)f();else return;e.preventDefault()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,f]),(0,X.useEffect)(()=>{let e=i.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect();t.ctrlKey||t.metaKey?m(Math.exp(-t.deltaY*.002),{x:t.clientX-n.left,y:t.clientY-n.top}):(d.current=!0,c(e=>({...e,x:e.x-t.deltaX,y:e.y-t.deltaY})))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[m]);let h=e=>{e.button===0&&(l.current={x:e.clientX,y:e.clientY,view:s,moved:!1})},g=e=>{let t=l.current;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;!t.moved&&Math.hypot(n,r)<Qe||(t.moved||i.current?.setPointerCapture(e.pointerId),t.moved=!0,d.current=!0,c({...t.view,x:t.view.x+n,y:t.view.y+r}))},_=()=>{l.current?.moved&&window.addEventListener(`click`,e=>e.preventDefault(),{capture:!0,once:!0}),l.current=null},v=e=>n.filter(t=>t.target.route===e.route&&t.project===e.project).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-sunken`,"data-canvas":!0,children:[(0,Z.jsx)(`div`,{ref:i,className:C(`absolute inset-0 touch-none select-none`,l.current?.moved?`cursor-grabbing`:`cursor-grab`),onPointerDown:h,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onWheel:e=>e.stopPropagation(),"aria-label":`Every screen on one board: drag or scroll to pan, ⌘ or Ctrl and scroll to zoom`,role:`region`,children:(0,Z.jsx)(`div`,{ref:o,className:`absolute top-0 left-0 inline-flex origin-top-left flex-col p-8`,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${s.scale})`,gap:Ye*1.5},"data-board":!0,children:u.map(n=>(0,Z.jsxs)(`section`,{"aria-label":n,className:`space-y-4`,children:[(0,Z.jsx)(`h2`,{className:`text-heading`,children:n}),(0,Z.jsx)(`div`,{className:`flex flex-wrap items-start`,style:{gap:Ye,width:1584},children:e.screens.filter(e=>e.project===n).map(e=>(0,Z.jsx)(nt,{screen:e,scheme:t,full:s.scale>=Ze,requests:v(e),onPin:t=>r(`${a(e.project,e.route)}?request=${t.id}`),onLoad:p},e.route))})]},n))})}),(0,Z.jsxs)(`div`,{className:`absolute right-4 bottom-4 flex items-center gap-1 rounded-md border border-line bg-surface p-1 shadow-raise`,"data-canvas-controls":!0,children:[(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,onClick:()=>m(1/$),"aria-label":`Zoom out`,title:`Zoom out (−)`,children:(0,Z.jsx)(ee,{})}),(0,Z.jsxs)(`span`,{className:`w-12 text-center text-small text-muted tabular`,"aria-live":`polite`,"data-zoom":!0,children:[Math.round(s.scale*100),`%`]}),(0,Z.jsx)(M,{variant:`ghost`,size:`icon`,onClick:()=>m($),"aria-label":`Zoom in`,title:`Zoom in (+)`,children:(0,Z.jsx)(y,{})}),(0,Z.jsxs)(M,{variant:`ghost`,size:`sm`,onClick:f,title:`Fit every screen (0)`,children:[(0,Z.jsx)(fe,{}),` Fit`]})]})]})}var it=3;function at(){let e=w(),t=ie();return e.status===`ready`?t.status===`ready`?(0,Z.jsx)(ot,{model:e.value,index:t.value}):(0,Z.jsx)(O,{state:t,onRetry:re,what:`the usage map`}):(0,Z.jsx)(O,{state:e,onRetry:ne,what:`the catalog`})}function ot({model:e,index:t}){let n=k(),r=l(t,e.manifest),i=n[`*`];if(!i)return(0,Z.jsx)(ct,{model:e,index:t,screens:r});let a=r.byHref.get(`/screens/${i}`);return a?(0,Z.jsx)(qe,{model:e,screens:r,screen:a},i):(0,Z.jsxs)(A,{icon:ve,title:`No such screen`,actions:(0,Z.jsx)(M,{asChild:!0,children:(0,Z.jsx)(E,{href:`/screens`,children:`All screens`})}),children:[`No scanned project has a screen at `,(0,Z.jsx)(`code`,{className:`font-mono text-mono-sm`,children:i}),`.`]})}function st(e){return e?`Screenshots from the ${e.source}, ${e.capturedAt}`:`No screenshots captured for this project yet: youiyoux screens capture --base <url> takes them, with every component placed`}function ct({model:e,index:t,screens:n}){let{scheme:r}=se(),[i,a]=(0,X.useState)(-1),o=(0,X.useRef)(null),s=()=>[...o.current?.querySelectorAll(`[data-screen-card]`)??[]];D({count:n.screens.length,index:i,onMove:e=>s()[e]?.focus()});let c=[...new Set(n.screens.map(e=>e.project))],[l,u]=j(),d=new URLSearchParams(ae()).get(`view`)===`canvas`,f=ue(L.requests,`requests`),p=(0,Z.jsx)(ce,{title:`Screens`,count:n.screens.length,children:(0,Z.jsx)(U,{label:`Layout`,value:d?`canvas`:`grid`,onChange:e=>u(e===`canvas`?`${l}?view=canvas`:l,{replace:!0}),options:[{value:`grid`,label:`Grid`},{value:`canvas`,label:`Canvas`}]})});return d?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[p,(0,Z.jsx)(rt,{screens:n,scheme:r,requests:f.state.status===`ready`?f.state.value.requests:[]})]}):(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[p,(0,Z.jsx)(`div`,{ref:o,"data-list-pane":!0,onFocus:e=>a(s().findIndex(t=>t===e.target)),className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-10 px-6 py-6 animate-enter max-sm:px-4`,children:[c.map(i=>{let a=t.reports.find(e=>e.project===i)?.commit,o=n.screens.filter(e=>e.project===i),s=o.some(e=>e.shot);return(0,Z.jsxs)(`section`,{"aria-labelledby":`screens-${i}`,className:`space-y-4`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`h2`,{id:`screens-${i}`,className:`text-heading`,children:i}),a&&(0,Z.jsxs)(`span`,{className:`font-mono text-mono-sm text-muted`,children:[`@`,W(a)]}),(0,Z.jsx)(`span`,{className:`text-small text-muted`,children:st(n.shots.get(i))})]}),(0,Z.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:o.map(t=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(lt,{model:e,screen:t,scheme:r,pictured:s})},t.route))})]},i)}),n.unattributedFiles.length>0&&(0,Z.jsxs)(K,{className:`max-w-2xl text-small text-muted`,summaryClassName:`min-h-11 rounded-sm py-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,summary:(0,Z.jsxs)(`span`,{children:[`Not on any screen · `,n.unattributedFiles.length,` `,n.unattributedFiles.length===1?`file`:`files`]}),children:[n.unattributed.total>0&&(0,Z.jsx)(`p`,{className:`mt-1`,children:xe(n.unattributed).join(`, `)}),(0,Z.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.unattributedFiles.map(({project:e,file:t,sites:n,reason:r})=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsxs)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:[e,`/`,t]}),n>0&&(0,Z.jsxs)(`span`,{className:`ml-2 inline-block`,children:[n,` `,n===1?`site`:`sites`]}),(0,Z.jsx)(`p`,{className:`break-words`,children:r})]},`${e}:${t}`))})]})]})})]})}function lt({model:e,screen:t,scheme:n,pictured:r}){let i=t.elements.filter(e=>e.sites.length>0),o=i.slice(0,it),s=i.length-o.length;return(0,Z.jsxs)(E,{href:a(t.project,t.route),"data-screen-card":!0,className:`group block h-full overflow-hidden rounded-lg border border-line bg-surface transition-colors duration-100 hover:border-line-strong hover:bg-raised`,children:[(0,Z.jsx)(m,{shot:t.shot,scheme:n,size:`thumb`,label:`${t.project} ${p(t.route)}`,whenMissing:r?`placeholder`:`none`,className:`border-b border-line`}),(0,Z.jsxs)(`div`,{className:`space-y-1 px-3.5 pt-2.5 pb-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-mono text-ink`,children:t.route===`*`?`every screen`:t.route}),t.route===`*`&&(0,Z.jsx)(B,{tone:`outline`,children:`app shell`}),(0,Z.jsx)(`span`,{className:`ml-auto`,children:(0,Z.jsx)(Se,{issues:t.issues})})]}),(0,Z.jsxs)(`p`,{className:`truncate text-small text-muted`,children:[(0,Z.jsxs)(`span`,{className:`tabular`,children:[i.length,` `,i.length===1?`element`:`elements`,` · `,t.sites,` `,t.sites===1?`site`:`sites`]}),o.length>0&&(0,Z.jsx)(`span`,{className:`text-faint`,children:` — `}),o.map((t,n)=>(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[n>0&&`, `,e.byId.get(t.id)?.name??t.id]},t.id)),s>0&&(0,Z.jsxs)(`span`,{children:[` +`,s]})]})]})]})}export{at as ScreensScreen};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./x-MLbFVa4v.js";import{t as n}from"./clsx-DB0hHKMi.js";import{d as r,x as i}from"./main-cvOFSjox.js";var a=e();function o({value:e,onChange:o,placeholder:s,label:c,touch:l=!1,className:u}){return(0,a.jsxs)(`div`,{className:n(`relative flex items-center`,u),children:[(0,a.jsx)(i,{"aria-hidden":!0,className:`pointer-events-none absolute left-2 size-3.5 text-muted`}),(0,a.jsx)(`input`,{"data-pane-search":!0,type:`search`,"aria-label":c,value:e,placeholder:s,spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(e?o(``):t.currentTarget.blur())},className:n(`h-7 w-full rounded-md border border-line bg-surface pr-8 pl-7 text-body text-ink transition-colors duration-100 placeholder:text-muted hover:border-line-strong focus:border-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus focus-visible:outline-solid [&::-webkit-search-cancel-button]:appearance-none`,l&&`max-md:h-11`)}),e?(0,a.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>o(``),className:n(`absolute right-1.5 grid size-5 place-items-center rounded-xs text-muted hover:bg-raised hover:text-ink`,l&&`max-md:right-0 max-md:size-11`),children:(0,a.jsx)(t,{className:`size-3`})}):(0,a.jsx)(r,{"aria-hidden":!0,className:`pointer-events-none absolute right-1.5`,children:`/`})]})}export{o as t};
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./x-MLbFVa4v.js";import{t as n}from"./clsx-DB0hHKMi.js";import{d as r,x as i}from"./main-Djqho539.js";var a=e();function o({value:e,onChange:o,placeholder:s,label:c,touch:l=!1,className:u}){return(0,a.jsxs)(`div`,{className:n(`relative flex items-center`,u),children:[(0,a.jsx)(i,{"aria-hidden":!0,className:`pointer-events-none absolute left-2 size-3.5 text-muted`}),(0,a.jsx)(`input`,{"data-pane-search":!0,type:`search`,"aria-label":c,value:e,placeholder:s,spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(e?o(``):t.currentTarget.blur())},className:n(`h-7 w-full rounded-md border border-line bg-surface pr-8 pl-7 text-body text-ink transition-colors duration-100 placeholder:text-muted hover:border-line-strong focus:border-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus focus-visible:outline-solid [&::-webkit-search-cancel-button]:appearance-none`,l&&`max-md:h-11`)}),e?(0,a.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>o(``),className:n(`absolute right-1.5 grid size-5 place-items-center rounded-xs text-muted hover:bg-raised hover:text-ink`,l&&`max-md:right-0 max-md:size-11`),children:(0,a.jsx)(t,{className:`size-3`})}):(0,a.jsx)(r,{"aria-hidden":!0,className:`pointer-events-none absolute right-1.5`,children:`/`})]})}export{o as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./clsx-DB0hHKMi.js";var n=e();function r({value:e,options:r,onChange:i,label:a,wrap:o=!1,touch:s=!1,className:c}){return(0,n.jsx)(`div`,{role:`radiogroup`,"aria-label":a,onKeyDown:t=>{let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0;if(!n)return;t.preventDefault();let a=r[(r.findIndex(t=>t.value===e)+n+r.length)%r.length];a&&(i(a.value),t.currentTarget.querySelector(`[data-value="${a.value}"]`)?.focus())},className:t(o?`flex flex-wrap items-center gap-0.5`:t(`inline-flex h-7 items-center gap-0.5`,s&&`max-md:h-12`),`rounded-md bg-raised p-0.5`,c),children:r.map(r=>{let a=r.value===e;return(0,n.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":a,tabIndex:a?0:-1,"data-value":r.value,onClick:()=>i(r.value),className:t(`inline-flex h-6 items-center gap-1.5 rounded-sm px-2 text-small font-medium transition-colors duration-100`,s&&`max-md:h-11 max-md:px-3`,a?`bg-surface text-ink shadow-raise`:`text-muted hover:text-ink`),children:[r.label,r.count!==void 0&&(0,n.jsx)(`span`,{className:t(`tabular text-caption`,a?`text-muted`:`text-faint`),children:r.count})]},r.value)})})}export{r as t};
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./clsx-DB0hHKMi.js";var n=e();function r({value:e,options:r,onChange:i,label:a,wrap:o=!1,touch:s=!1,className:c}){return(0,n.jsx)(`div`,{role:`radiogroup`,"aria-label":a,onKeyDown:t=>{let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0;if(!n)return;t.preventDefault();let a=r[(r.findIndex(t=>t.value===e)+n+r.length)%r.length];a&&(i(a.value),t.currentTarget.querySelector(`[data-value="${a.value}"]`)?.focus())},className:t(o?`flex flex-wrap items-center gap-0.5`:t(`inline-flex h-7 items-center gap-0.5`,s&&`max-md:h-12`),`rounded-md bg-raised p-0.5`,c),children:r.map(r=>{let a=r.value===e;return(0,n.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":a,tabIndex:a?0:-1,"data-value":r.value,onClick:()=>i(r.value),className:t(`inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-sm px-2 text-small font-medium transition-colors duration-100`,s&&`max-md:h-11 max-md:px-3`,a?`bg-surface text-ink shadow-raise`:`text-muted hover:text-ink`),children:[r.label,r.count!==void 0&&(0,n.jsx)(`span`,{className:t(`tabular text-caption`,a?`text-muted`:`text-faint`),children:r.count})]},r.value)})})}export{r as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./createLucideIcon-CGDJWtKO.js";import{t as n}from"./CopyButton-DE8drl4P.js";import{C as r,T as i,o as a,s as o}from"./main-cvOFSjox.js";var s={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};s.node;var c=t(s),l=e(),u=`pnpm youiyoux ui --project <project> [--design <design repo>] [--config <youi.project.json>]`;function d(){return(0,l.jsxs)(`p`,{className:`flex min-w-0 max-w-full items-start gap-1 rounded-md bg-sunken px-2 py-1`,children:[(0,l.jsx)(`code`,{className:`min-w-0 flex-1 self-center font-mono text-mono-sm text-ink-2 [overflow-wrap:anywhere]`,children:u}),(0,l.jsx)(n,{value:u,label:`Copy command`})]})}function f({error:e,onRetry:t}){return(0,l.jsxs)(`section`,{"data-service-down":!0,"aria-labelledby":`service-down`,className:`space-y-3 rounded-md border border-line px-4 py-3.5`,children:[(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,l.jsx)(i,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),(0,l.jsx)(`h2`,{id:`service-down`,className:`text-heading`,children:e.offline?`Start the rule editor to see changes`:`The rule editor had a problem`}),(0,l.jsxs)(o,{size:`sm`,onClick:t,className:`ml-auto`,children:[(0,l.jsx)(r,{}),` Try again`]})]}),e.offline?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`max-w-2xl text-body text-ink-2`,children:`Drafts, previews and approvals live in the local workflow service. From the YouIyouX checkout, run this and open the link it prints:`}),(0,l.jsx)(d,{})]}):(0,l.jsx)(`p`,{className:`text-body text-ink-2`,children:e.message})]})}function p({error:e,onRetry:t}){return(0,l.jsx)(a,{icon:i,title:e.offline?`Start the rule editor`:`The rule editor had a problem`,actions:(0,l.jsxs)(o,{onClick:t,children:[(0,l.jsx)(r,{}),` Try again`]}),children:e.offline?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{children:`Drafts, previews and approvals live in the local workflow service. From the YouIyouX checkout, run this and open the link it prints:`}),(0,l.jsx)(`div`,{className:`mt-2`,children:(0,l.jsx)(d,{})})]}):(0,l.jsx)(`p`,{children:e.message})})}export{c as i,f as n,d as r,p as t};
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./createLucideIcon-CGDJWtKO.js";import{t as n}from"./CopyButton-DE8drl4P.js";import{C as r,T as i,o as a,s as o}from"./main-Djqho539.js";var s={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};s.node;var c=t(s),l=e(),u=`pnpm youiyoux ui --project <project> [--design <design repo>] [--config <youi.project.json>]`;function d(){return(0,l.jsxs)(`p`,{className:`flex min-w-0 max-w-full items-start gap-1 rounded-md bg-sunken px-2 py-1`,children:[(0,l.jsx)(`code`,{className:`min-w-0 flex-1 self-center font-mono text-mono-sm text-ink-2 [overflow-wrap:anywhere]`,children:u}),(0,l.jsx)(n,{value:u,label:`Copy command`})]})}function f({error:e,onRetry:t}){return(0,l.jsxs)(`section`,{"data-service-down":!0,"aria-labelledby":`service-down`,className:`space-y-3 rounded-md border border-line px-4 py-3.5`,children:[(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,l.jsx)(i,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),(0,l.jsx)(`h2`,{id:`service-down`,className:`text-heading`,children:e.offline?`Start the rule editor to see changes`:`The rule editor had a problem`}),(0,l.jsxs)(o,{size:`sm`,onClick:t,className:`ml-auto`,children:[(0,l.jsx)(r,{}),` Try again`]})]}),e.offline?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`max-w-2xl text-body text-ink-2`,children:`Drafts, previews and approvals live in the local workflow service. From the YouIyouX checkout, run this and open the link it prints:`}),(0,l.jsx)(d,{})]}):(0,l.jsx)(`p`,{className:`text-body text-ink-2`,children:e.message})]})}function p({error:e,onRetry:t}){return(0,l.jsx)(a,{icon:i,title:e.offline?`Start the rule editor`:`The rule editor had a problem`,actions:(0,l.jsxs)(o,{onClick:t,children:[(0,l.jsx)(r,{}),` Try again`]}),children:e.offline?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{children:`Drafts, previews and approvals live in the local workflow service. From the YouIyouX checkout, run this and open the link it prints:`}),(0,l.jsx)(`div`,{className:`mt-2`,children:(0,l.jsx)(d,{})})]}):(0,l.jsx)(`p`,{children:e.message})})}export{c as i,f as n,d as r,p as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{a as r,i,n as a,o,r as s}from"./CandidatePanel-DfntneYT.js";import{ht as c}from"./main-cvOFSjox.js";import{i as l,r as u}from"./Specimens-D_9hjlJH.js";var d=e(t(),1),f=n(),p=240;function m({id:e,reason:t}){return(0,f.jsx)(`p`,{className:`p-6 text-small text-muted`,"data-capture":e,"data-capture-state":`failed`,"data-capture-reason":t,children:t})}function h(){let e=new URLSearchParams(c()),t=e.get(`id`),n=e.get(`project`),p=r(t,n),h=o(t??``),[g,_]=(0,d.useState)(null);if(!t)return(0,f.jsx)(m,{id:``,reason:`No candidate named: add ?id=<lib: id>.`});if(p===null)return(0,f.jsxs)(`p`,{className:`p-6 text-small text-faint`,"data-capture":t,"data-capture-state":`drawing`,children:[`Fetching `,t,`…`]});if(p.status===`error`)return(0,f.jsx)(m,{id:t,reason:p.message});let{answer:v}=p,y=v.error??g;return y?(0,f.jsx)(m,{id:t,reason:y}):(0,f.jsx)(u.Provider,{value:null,children:(0,f.jsxs)(`div`,{className:`flex flex-wrap content-start items-start gap-6 p-6`,"data-capture":t,"data-capture-state":h?`ready`:`drawing`,"data-capture-project":v.project,"data-capture-sha":v.entry.provenance?.sha256??``,children:[(0,f.jsx)(s,{answer:v,onFail:_}),h&&[`light`,`dark`].map(e=>(0,f.jsx)(`div`,{"data-capture-stage":e,className:`rounded-md`,style:{width:240,background:a[e]},children:(0,f.jsx)(l,{tile:i(v,h,e),scheme:e,size:`stage`,as:`div`,caption:!1,backdrop:a[e],onBlank:()=>_(`It draws nothing visible on its own (it may need content, a provider or a parent)`)})},e))]})})}export{p as STAGE_WIDTH,h as SpecimenCapture};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{a as r,i,n as a,o,r as s}from"./CandidatePanel-BbE2xCN2.js";import{ht as c}from"./main-Djqho539.js";import{i as l,r as u}from"./Specimens-D5ehj5-O.js";var d=e(t(),1),f=n(),p=240;function m({id:e,reason:t}){return(0,f.jsx)(`p`,{className:`p-6 text-small text-muted`,"data-capture":e,"data-capture-state":`failed`,"data-capture-reason":t,children:t})}function h(){let e=new URLSearchParams(c()),t=e.get(`id`),n=e.get(`project`),p=r(t,n),h=o(t??``),[g,_]=(0,d.useState)(null);if(!t)return(0,f.jsx)(m,{id:``,reason:`No candidate named: add ?id=<lib: id>.`});if(p===null)return(0,f.jsxs)(`p`,{className:`p-6 text-small text-faint`,"data-capture":t,"data-capture-state":`drawing`,children:[`Fetching `,t,`…`]});if(p.status===`error`)return(0,f.jsx)(m,{id:t,reason:p.message});let{answer:v}=p,y=v.error??g;return y?(0,f.jsx)(m,{id:t,reason:y}):(0,f.jsx)(u.Provider,{value:null,children:(0,f.jsxs)(`div`,{className:`flex flex-wrap content-start items-start gap-6 p-6`,"data-capture":t,"data-capture-state":h?`ready`:`drawing`,"data-capture-project":v.project,"data-capture-sha":v.entry.provenance?.sha256??``,children:[(0,f.jsx)(s,{answer:v,onFail:_}),h&&[`light`,`dark`].map(e=>(0,f.jsx)(`div`,{"data-capture-stage":e,className:`rounded-md`,style:{width:240,background:a[e]},children:(0,f.jsx)(l,{tile:i(v,h,e),scheme:e,size:`stage`,as:`div`,caption:!1,backdrop:a[e],onBlank:()=>_(`It draws nothing visible on its own (it may need content, a provider or a parent)`)})},e))]})})}export{p as STAGE_WIDTH,h as SpecimenCapture};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/try-live-Iys3nCBG.js","assets/react-DB-4Zxce.js","assets/jsx-runtime-D6zNwnaE.js"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-DB-4Zxce.js";import{n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./x-MLbFVa4v.js";import{t as a}from"./clsx-DB0hHKMi.js";import{st as o}from"./main-cvOFSjox.js";import{n as s,r as c,t as l}from"./inventory-BI8QBdar.js";import{t as u}from"./esm-NPpg23M8.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-C8tf4g8c.js";var v=e(t(),1),y={type:null,lib:null,project:null,near:!1,q:``};function b(e,t){let n=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),r=n.get(`type`),i=n.get(`project`);return{type:r&&l.includes(r)?r:null,lib:n.get(`lib`)||null,project:i&&t.projects.some(e=>e.id===i)?i:null,near:n.get(`near`)===`1`,q:(n.get(`q`)??``).trim()}}function x(e){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.lib&&t.set(`lib`,e.lib),e.project&&t.set(`project`,e.project),e.near&&t.set(`near`,`1`),e.q.trim()&&t.set(`q`,e.q.trim());let n=t.toString();return n?`?${n}`:``}function S(e){return[e.type,e.lib,e.project,e.near||null,e.q||null].filter(e=>e!==null).length}function C(e,t){return e.roles.filter(e=>!t.type||e.role===t.type).flatMap(e=>Object.entries(e.chunks).filter(([e])=>!t.project||e===t.project).map(([,e])=>e))}var w={id:`plain`,label:`Plain elements`,short:`plain`},T=`radix`,E=new Set([`@radix-ui/react-slot`,`@radix-ui/react-compose-refs`,`@radix-ui/react-primitive`]),D={button:`button`,"link-as-button":`button`,input:`input`,card:`card`,badge:`badge`,dialog:`dialog`,tabs:`tabs`},O=e=>e.slice(e.lastIndexOf(`/`)+1),k=e=>e.toLowerCase().replace(/\.[a-z]+$/,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),ee=class{kits;shadcnName;radixName;radixFiles=new Map;detectRadix;constructor(e,t=null){this.kits=new Map((e?.kits??[]).map(e=>[e.id,e]));let n=e=>t?.libraries.find(t=>t.id===e)?.name;this.shadcnName=n(`shadcn`)??`shadcn-style`,this.radixName=n(`radix`)??`Radix`;for(let t of e?.primitives??[]){if(!t.package.startsWith(`@radix-ui/`)||E.has(t.package))continue;let e=this.radixFiles.get(t.project)??new Set;for(let n of t.sites)e.add(n.file);this.radixFiles.set(t.project,e)}this.detectRadix=new Set((t?.elements??[]).filter(e=>e.library===T||e.also.includes(T)).map(e=>e.type))}primary(e){if(e===null)return w;let t=this.kits.get(e),n=t?.path??e.slice(e.indexOf(`:`)+1);if(!(t?t.kind===`class-kit`:/\.(?:s?css|less)$/.test(n)))return{id:`shadcn`,label:this.shadcnName,short:this.shadcnName};let r=t?.prefix?.replace(/-$/,``);return r?{id:`css-${k(r)}`,label:`.${r}-* CSS kit`,short:`CSS kit`}:{id:`css-${k(O(n))}`,label:`${O(n)} CSS kit`,short:`CSS kit`}}of(e,t,n){let r=this.primary(e.kit);return this.isRadix(e,t,n,r)?[r,this.radix()]:[r]}radix(){return{id:T,label:this.radixName,short:this.radixName}}isRadix(e,t,n,r){if(e.kit===null||r.id!==`shadcn`)return!1;let i=this.kits.get(e.kit)?.members.find(t=>t.name===e.tag);if(i&&this.radixFiles.get(t)?.has(i.file))return!0;let a=D[n];return a!==void 0&&this.detectRadix.has(a)}},te=(e,t)=>l.indexOf(e.role)-l.indexOf(t.role)||Number(e.id.split(`-`).at(-1))-Number(t.id.split(`-`).at(-1));function ne(e,t){let n=new Map,r=new Map,i=new Map;for(let a of e){for(let e of a.families)n.set(e.id,e);for(let e of a.looks){if(e.family===null)continue;let n=r.get(e.family)??[];n.push({...e,project:a.project}),r.set(e.family,n);let o=i.get(e.family)??new Map;t.of(e,a.project,a.role).forEach((e,t)=>{let n=o.get(e.id)??{group:e,looks:0,primary:!1};n.looks++,n.primary||=t===0,o.set(e.id,n)}),i.set(e.family,o)}}let a=[...n.values()].sort(te).map(e=>{let n=[...i.get(e.id)?.values()??[]],a=(e.sides.length>0?e.sides.map(e=>e.kit):[null]).map(e=>t.primary(e));return{family:e,primary:n.filter(e=>e.primary).sort((e,t)=>t.looks-e.looks)[0]?.group??a[0],libs:re(n.length>0?n.map(e=>e.group):a),looks:r.get(e.id)??[],uses:e.looks,projects:e.projects.length,stories:e.stories??0,authored:e.authored===!0}}),o=ae(a.map(e=>({id:e.family.id,family:e.family,kit:e.primary})));return a.map(e=>({...e,name:o.get(e.family.id)}))}function re(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);return[...t.values()]}var ie=e=>e===null?null:`${e}px`;function ae(e){let t=[({family:{shape:e}})=>e.paddingX===null&&e.paddingY===null?null:`padding ${e.paddingY??`?`}/${e.paddingX??`?`}`,({family:{shape:e}})=>e.fontSize===null?null:`${ie(e.fontSize)} text`,({family:{shape:e}})=>e.fontWeight===null?null:`weight ${e.fontWeight}`,({kit:e})=>e.label===e.short?null:e.label,({family:e})=>e.projects.join(` + `)],n=new Map(e.map(e=>[e.id,`${c(e.family)} · ${e.kit.short}`])),r=()=>{let t=new Map;for(let r of e)o(t,n.get(r.id),r);return[...t.values()].filter(e=>e.length>1)};for(let e of r()){let r=t.find(t=>new Set(e.map(t)).size>1);for(let t of e){let e=r?.(t);n.set(t.id,e?`${n.get(t.id)} · ${e}`:n.get(t.id))}}for(let e of r())for(let t of e)n.set(t.id,`${n.get(t.id)} · ${t.id}`);return n}function oe(e,t){if(t.type&&e.family.role!==t.type||t.project&&!e.family.projects.includes(t.project)||t.lib&&!e.libs.some(e=>e.id===t.lib)||t.near&&!e.family.nearDuplicate)return!1;let n=t.q.trim().toLowerCase();if(n){let t=[...e.looks.map(e=>`${e.project}:${e.file}`),...e.family.examples.map(e=>`${e.project}:${e.file}`)];if(![e.name,e.family.id,...t].some(e=>e.toLowerCase().includes(n)))return!1}return!0}function se(e,t){return e.filter(e=>oe(e,t))}var ce=e=>e.lib!==null||e.near||e.q.trim()!==``;function le(e,t,n,r,i){let a=t=>C(e,t).every(r),o=e=>se(t,e).length,c=(t,n)=>e.roles.filter(e=>!t||e.role===t).reduce((e,t)=>e+(n?t.cells[n]?.families??0:t.families),0),l=e=>ce(n)?a(e)?o(e):null:c(e.type,e.project),u=e.roles.map(e=>({value:e.role,label:s[e.role],count:l({...n,type:e.role})})),d=e.projects.map(e=>({value:e.id,label:e.id,count:l({...n,project:e.id})})),f=a(n),p=new Map;for(let e of t)for(let t of e.libs)p.has(t.id)||p.set(t.id,t);return n.lib&&!p.has(n.lib)&&p.set(n.lib,n.lib===T?i.radix():{id:n.lib,label:n.lib,short:n.lib}),{types:u,projects:d,libs:[...p.values()].sort(de).map(e=>({value:e.id,label:e.label,count:f?o({...n,lib:e.id}):null})),near:f?o({...n,near:!0}):null,all:{type:l({...n,type:null}),project:l({...n,project:null}),lib:f?o({...n,lib:null}):null}}}var ue=[`shadcn`,T];function de(e,t){let n=e=>ue.includes(e.id)?ue.indexOf(e.id):e.id===w.id?99:2;return n(e)-n(t)||e.label.localeCompare(t.label)}function fe(e){let t=new Map;for(let n of e){let e=t.get(n.primary.id)??{group:n.primary,families:[]};e.families.push(n),t.set(n.primary.id,e)}return[...t.values()].sort((e,t)=>de(e.group,t.group))}var pe=[[`height`,`height`],[`paddingX`,`padding`],[`paddingY`,`padding`],[`radius`,`radius`],[`fontSize`,`fontSize`],[`fontWeight`,`fontWeight`]];function me(e,t,n){return pe.every(([r,i])=>{let a=e[r],o=t[r];return a===null||o===null||Math.abs(a-o)<=n[i]})}function he(e,t){let n=[];for(let r of[...e].sort((e,t)=>t.uses-e.uses)){let e=n.find(e=>e[0].family.role===r.family.role&&e.every(e=>me(e.family.shape,r.family.shape,t)));e?e.push(r):n.push([r])}return{families:e.length,estimate:n.length,folds:n.filter(e=>e.length>1).map(e=>e.map(e=>e.family.id))}}function ge(e,t=3){return e.filter(e=>e.family.nearDuplicate).sort((e,t)=>t.uses-e.uses||t.family.sides.length-e.family.sides.length).slice(0,t)}function _e(e){let t=[...e.sides].sort((e,t)=>t.looks-e.looks);return t.length>=2?[t[0],t[1]]:null}function ve(e,t,n){let r=t.filter(t=>t.project===e.project&&t.kit===e.kit),i=new Map;for(let e of r){let t=JSON.stringify(e.shape),n=i.get(t)??{shape:e.shape,n:0};n.n++,i.set(t,n)}return[...i.values()].sort((e,t)=>t.n-e.n)[0]?.shape??n}var A=(e,t=`px`)=>e===null?`?`:e===9999&&t===`px`?`pill`:`${e}${t}`;function ye(e,t){let n=e=>`${A(e.paddingY)} ${A(e.paddingX)}`;return[[`Height`,A(e.shape.height),A(t.shape.height)],[`Padding`,n(e.shape),n(t.shape)],[`Radius`,A(e.shape.radius),A(t.shape.radius)],[`Font size`,A(e.shape.fontSize),A(t.shape.fontSize)],[`Weight`,A(e.shape.fontWeight,``),A(t.shape.fontWeight,``)],[`Uses`,String(e.uses),String(t.uses)],[`Projects`,e.projects.join(`, `),t.projects.join(`, `)]].map(([e,t,n])=>({label:e,a:t,b:n,differs:t!==n}))}function be(e){let t=`${e.stories} ${e.stories===1?`story`:`stories`}`;return e.authored?`Only in Storybook · ${t}`:`${e.uses} ${e.uses===1?`use`:`uses`} · ${e.projects} ${e.projects===1?`project`:`projects`}${e.stories>0?` · ${t}`:``}`}function xe(e){let t=new Map;for(let n of[...e.family.examples,...e.family.sides.flatMap(e=>e.examples)])t.has(`${n.project}:${n.file}`)||t.set(`${n.project}:${n.file}`,n.routes);return e.looks.filter(e=>!e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column).map(e=>({key:e.id,project:e.project,place:`${e.file}:${e.line}`,routes:t.get(`${e.project}:${e.file}`)??[]}))}function Se(e){return e.looks.filter(e=>e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line).map(e=>({key:e.id,project:e.project,story:`${e.story.title} / ${e.story.name}`,place:`${e.file}:${e.line}`}))}var Ce=.11,we=1/3;function Te({distance:e,height:t,velocity:n}){return e<=0?!1:n>Ce||e>t*we}function Ee(e,t,n){return n<=0?50:Math.round(Math.min(100,Math.max(0,(e-t)/n*100))*10)/10}function De(e){return`inset(0 0 0 ${e}%)`}var j=r(),M=`(min-width: 768px)`;function N(){return(0,v.useSyncExternalStore)(e=>{if(typeof matchMedia!=`function`)return()=>{};let t=matchMedia(M);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof matchMedia!=`function`||matchMedia(M).matches)}var Oe=80;function ke({open:e,onOpenChange:t,variant:n,title:r,description:o,children:s,footer:c,testId:l}){let u=(0,v.useRef)(null),y=(0,v.useRef)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),w=n===`sheet`,T=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>{e&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&(T.current=document.activeElement)},[e]);let E=e=>{!w||e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button, a, input`)||(e.currentTarget.setPointerCapture?.(e.pointerId),y.current={id:e.pointerId,startY:e.clientY,samples:[{y:e.clientY,t:e.timeStamp}]},C(!1))},D=e=>{let t=y.current;t&&t.id===e.pointerId&&(t.samples=[...t.samples.filter(t=>e.timeStamp-t.t<=Oe),{y:e.clientY,t:e.timeStamp}],x(Math.max(0,e.clientY-t.startY)))},O=e=>{let n=y.current;if(!n||n.id!==e.pointerId)return;y.current=null;let r=n.samples[0],i=e.timeStamp-r.t,a=i>0?(e.clientY-r.y)/i:0;Te({distance:Math.max(0,e.clientY-n.startY),height:u.current?.offsetHeight??0,velocity:a})?t(!1):(C(!0),x(0))};return(0,j.jsx)(_,{open:e,onOpenChange:e=>(x(0),t(e)),children:(0,j.jsxs)(m,{children:[(0,j.jsx)(d,{className:`inv-scrim fixed inset-0 z-50 bg-scrim`}),(0,j.jsxs)(h,{ref:u,"data-variant":n,"data-testid":l,className:a(`inv-drawer fixed z-50 flex flex-col border-line bg-surface shadow-popover outline-none`,w?`inset-x-0 bottom-0 max-h-[88dvh] rounded-t-xl border-t`:`inset-y-0 right-0 w-[min(560px,100vw)] border-l`,S&&`inv-settle`),style:b>0||S?{transform:`translate3d(0, ${b}px, 0)`}:void 0,onTransitionEnd:()=>C(!1),onCloseAutoFocus:e=>{let t=T.current;T.current=null,t?.isConnected&&(e.preventDefault(),t.focus())},children:[(0,j.jsxs)(`div`,{className:a(`shrink-0 border-b border-line`,w&&`touch-none select-none`),onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,"data-testid":w?`sheet-handle`:void 0,children:[w&&(0,j.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-9 rounded-full bg-line-strong`}),(0,j.jsxs)(`header`,{className:`flex min-h-12 items-start gap-3 px-5 py-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,j.jsx)(g,{className:`text-heading text-ink`,children:r}),o?(0,j.jsx)(f,{className:`text-small text-muted`,children:o}):(0,j.jsx)(f,{className:`sr-only`,children:`Details`})]}),(0,j.jsx)(p,{"aria-label":`Close`,className:`inv-press grid size-7 shrink-0 place-items-center rounded-md text-muted max-md:-my-2 max-md:-mr-2 max-md:size-11`,children:(0,j.jsx)(i,{className:`size-4`})})]})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s}),c&&(0,j.jsx)(`div`,{className:`shrink-0 border-t border-line px-5 py-3`,children:c})]})]})})}var Ae=1280,P=88,je=150,F=10,I=136,Me=128,Ne=48,L=3.5,R=(0,v.createContext)(null);function z(e,t=`600px`,n=`1800px`){let r=(0,v.useContext)(R),[i,a]=(0,v.useState)(()=>typeof IntersectionObserver>`u`);return(0,v.useEffect)(()=>{let i=e.current;if(!i||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&a(!0),{root:r,rootMargin:t}),s=new IntersectionObserver(e=>e.every(e=>!e.isIntersecting)&&a(!1),{root:r,rootMargin:n});return o.observe(i),s.observe(i),()=>{o.disconnect(),s.disconnect()}},[e,r,t,n]),i}function B(e){let t=(0,v.useContext)(R),[n,r]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let n=e.current;if(!n||typeof IntersectionObserver>`u`)return;let i=new IntersectionObserver(e=>r(e.some(e=>e.isIntersecting)),{root:t,rootMargin:`0px`});return i.observe(n),()=>i.disconnect()},[e,t]),n}var V=new class{limit;active=new Set;waiting=[];constructor(e=6){this.limit=e}get rendering(){return this.active.size}request(e,t){this.active.has(e)||this.waiting.some(t=>t.id===e)||(this.active.size<this.limit?(this.active.add(e),t()):this.waiting.push({id:e,grant:t}))}release(e){for(this.active.delete(e),this.waiting=this.waiting.filter(t=>t.id!==e);this.active.size<this.limit&&this.waiting.length>0;){let e=this.waiting.shift();this.active.add(e.id),e.grant()}}};function Pe(e){let[t,n]=(0,v.useState)(`waiting`),r=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e)return;let t={};return r.current=t,V.request(t,()=>{r.current===t&&n(e=>e===`waiting`?`rendering`:e)}),()=>{r.current===t&&(r.current=null),V.release(t),n(`waiting`)}},[e]);let i=(0,v.useCallback)(()=>{let e=r.current;e!==null&&(V.release(e),n(e=>e===`rendering`?`done`:e))},[]);return{granted:e&&t!==`waiting`,rendering:e&&t===`rendering`,done:i}}var H=new class{limit;entries=new Map;clock=0;constructor(e=48){this.limit=e}get mounted(){return[...this.entries.values()].filter(e=>e.mounted).length}join(e,t,n){this.entries.set(e,{visible:t,touched:++this.clock,mounted:!1,set:n}),this.settle()}see(e,t){let n=this.entries.get(e);n&&n.visible!==t&&(n.visible=t,t&&(n.touched=++this.clock),this.settle())}leave(e){this.entries.delete(e)&&this.settle()}settle(){let e=[...this.entries.values()].sort((e,t)=>Number(t.visible)-Number(e.visible)||Number(t.mounted)-Number(e.mounted)||e.touched-t.touched),t=new Set(e.slice(0,this.limit));for(let n of e)n.mounted&&!t.has(n)&&(n.mounted=!1,n.set(!1));for(let e of t)e.mounted||(e.mounted=!0,e.set(!0))}};function U(e,t){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!e)return;let t={};return i.current=t,H.join(t,!1,e=>{i.current===t&&r(e)}),()=>{i.current===t&&(i.current=null),H.leave(t),r(!1)}},[e]),(0,v.useEffect)(()=>{i.current&&H.see(i.current,t)},[t,e]),e&&n}var W=e=>e.specimen!==null&&e.css!==null,G=e=>`Storybook · ${e.title} / ${e.name}`;function Fe(e){try{let t=new URL(e,typeof document>`u`?void 0:document.baseURI);return t.protocol===`http:`||t.protocol===`https:`?t.origin:t.protocol}catch{return`'self'`}}function Ie(e){let t=Fe(e);return`default-src 'none'; script-src ${t}; style-src ${t} 'unsafe-inline'; font-src ${t} data:; img-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'`}function K(e,t){let n=e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`);return`<!doctype html><html lang="en"${t===`dark`?` class="dark"`:``} data-theme="${t}" style="color-scheme:${t}"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Ie(e).replace(/"/g,`&quot;`)}"><link rel="stylesheet" href="${n}">`}function Le(e,t,n){return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-block;margin:32px">${e}</div></body></html>`}var q=[{id:`default`,label:`Default`,className:null},{id:`hover`,label:`Hover`,className:`youi-state-hover`},{id:`focus`,label:`Focus`,className:`youi-state-focus`},{id:`pressed`,label:`Pressed`,className:`youi-state-active`},{id:`disabled`,label:`Disabled`,className:`youi-state-disabled`}],Re=`button, input, select, textarea, fieldset, optgroup, option`,ze=`${Re}, a, [role], [tabindex]`;function Be(e){if(typeof document>`u`)return e;let t=document.createElement(`template`);t.innerHTML=e;let n=t.content;for(let e of[...n.children,...n.querySelectorAll(ze)])e.matches(Re)&&e.setAttribute(`disabled`,``),e.setAttribute(`aria-disabled`,`true`),e.setAttribute(`data-disabled`,``);return t.innerHTML}function Ve(e,t,n){let r=q.map(t=>`<div class="youi-state-cell${t.className?` ${t.className}`:``}" data-youi-state="${t.id}" style="display:flex;align-items:center;justify-content:center;padding:16px;contain:layout">${t.id===`disabled`?Be(e):e}</div>`).join(``);return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;align-items:center;margin:32px">${r}</div></body></html>`}function He(e,t=!1){let n=e.getElementById(`youi-specimen`);if(!n)return null;if(t){let e=n.getBoundingClientRect();return e.width>0&&e.height>0?{x:e.left,y:e.top,width:e.width,height:e.height}:null}let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e of[n,...n.querySelectorAll(`*`)]){let t=e.getBoundingClientRect();t.width!==0&&t.height!==0&&(r=Math.min(r,t.left),i=Math.min(i,t.top),a=Math.max(a,t.right),o=Math.max(o,t.bottom))}return Number.isFinite(r)?{x:r,y:i,width:a-r,height:o-i}:null}var J=(e,t,n)=>Math.min(1,(t-20)/e.width,(n-20)/e.height);function Ue(e,t,n){let r=t||I,i=J(e,r,n),a=r/2-(e.x+e.width/2)*i,o=n/2-(e.y+e.height/2)*i;return`translate(${a.toFixed(1)}px, ${o.toFixed(1)}px) scale(${i.toFixed(4)})`}function We({srcDoc:e,scheme:t,near:n,height:r,onBlank:i,strip:o,onBackground:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),u=Pe(n),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(void 0);(0,v.useLayoutEffect)(()=>f(null),[e]);let h=()=>{let e=l.current?.contentDocument,t=c.current,n=e?He(e,o!==void 0):null;if(!t||!n){f(`translate(${F}px, ${F}px)`),u.done(),e&&!n&&e.documentElement.getBoundingClientRect().width>0&&i?.();return}let a=e.defaultView,d=[e.body,e.documentElement].map(e=>a?.getComputedStyle(e).backgroundColor).find(e=>e&&e!==`transparent`&&e!==`rgba(0, 0, 0, 0)`);m(d),s?.(d);let p=t.clientWidth||I;f(Ue(n,p,r));let h=J(n,p,r);o?.({x:p/2-n.width/2*h,width:n.width*h}),u.done()};return(0,j.jsx)(`div`,{ref:c,className:`absolute inset-0`,style:{background:p},children:u.granted&&(0,j.jsx)(`iframe`,{ref:l,title:`Specimen`,"aria-hidden":!0,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:e,onLoad:()=>{let e=l.current?.contentDocument?.fonts;e?e.ready.then(h,h):h()},"data-rendering":u.rendering||void 0,"data-placed":d!==null||void 0,className:a(`pointer-events-none absolute left-0 top-0 origin-top-left border-0 bg-transparent`,d===null&&`opacity-0`),style:{width:1280,height:480,transform:d??void 0,colorScheme:t}})})}function Y({shape:e,caption:t=`shape only`,tileHeight:n=P}){let r=e.height??(e.fontSize===null?32:Math.round(e.fontSize*1.5+2*(e.paddingY??0))),i=Math.min(1,(n-20-14)/r);return(0,j.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1`,"data-testid":`shape-box`,children:[(0,j.jsx)(`span`,{className:`inline-flex items-center border border-dashed border-line-strong text-faint`,style:{height:r*i,paddingInline:(e.paddingX??12)*i,borderRadius:Math.min(e.radius??0,9999),fontSize:(e.fontSize??14)*i,fontWeight:e.fontWeight??void 0},children:`Aa`}),(0,j.jsx)(`span`,{className:`text-caption text-faint`,children:t})]})}var Ge=(0,v.lazy)(()=>n(()=>import(`./try-live-Iys3nCBG.js`).then(e=>e.r).then(e=>({default:e.LiveFrame})),__vite__mapDeps([0,1,2]))),X=null;function Ke(e,t){let n=X;X={id:e,end:t},n&&n.id!==e&&n.end()}function qe(e){X?.id===e&&(X=null)}function Je(e,t){let[n,r]=(0,v.useState)({status:`static`,failure:null}),i=(0,v.useRef)({}),a=(0,v.useRef)(null),o=n.status!==`static`,s=(0,v.useCallback)((e=null)=>{qe(i.current),r({status:`static`,failure:e})},[]),c=()=>{Ke(i.current,()=>r({status:`static`,failure:null})),r({status:`loading`})},l=(0,v.useCallback)(()=>r(e=>e.status===`loading`?{status:`live`}:e),[]);return(0,v.useEffect)(()=>{o&&!e&&s()},[o,e,s]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{if(e.key!==`Escape`)return;let n=t.current?.contains(e.target)??!1;n&&(e.stopPropagation(),e.preventDefault()),s(),n&&a.current?.focus()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,s,t]),(0,v.useEffect)(()=>()=>qe(i.current),[]),{state:n,start:c,ready:l,end:s,button:a}}function Z({tile:e,scheme:t,size:n=`small`,as:r=`li`,caption:i=!0,onBlank:a,tryIt:o=!1,backdrop:s}){let c=(0,v.useRef)(null),l=z(c),u=B(c),d=W(e),f=U(d&&l,u),p=n===`stage`?je:n===`large`?136:P,m=o&&d&&e.specimen.kind===`component`&&(!!e.specimenId||!!e.script),{state:h,start:g,ready:_,end:y,button:b}=Je(l,c),[x,S]=(0,v.useState)(void 0),C=d?f?(0,j.jsx)(We,{srcDoc:Le(e.specimen.html,e.css,t),scheme:t,near:l,height:p,onBlank:a,onBackground:m?S:void 0}):l?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:p}):null:(0,j.jsx)(Y,{shape:e.shape,tileHeight:p}),w=e.story?`${e.project} ${G(e.story)}`:`${e.project} ${e.place}`;return(0,j.jsxs)(r,{ref:c,className:`min-w-0 space-y-1`,"data-tile":e.key,"data-story":e.story?.id,"data-kind":d?e.specimen.kind:`shape`,"data-frame":d&&l?f?`mounted`:`waiting`:void 0,"data-live":h.status===`static`?void 0:h.status,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:p,background:s},children:m&&h.status!==`static`?(0,j.jsx)(v.Suspense,{fallback:C,children:(0,j.jsx)(Ge,{project:e.project,specimen:e.specimenId??``,script:e.script??null,html:e.specimen.html,css:e.css,scheme:t,height:p,background:x,fallback:C,onReady:_,onEnd:()=>(y(),b.current?.focus()),onFail:e=>y(e)})}):C}),m&&(0,j.jsx)(`div`,{className:`flex justify-end max-md:pt-1`,"data-try-bar":``,children:(0,j.jsx)(`button`,{ref:b,type:`button`,onClick:()=>h.status===`static`?g():(y(),b.current?.focus()),"aria-label":h.status===`static`?`Try ${w} live`:`Done trying ${w}`,"aria-busy":h.status===`loading`||void 0,className:`z-10 inline-flex h-6 items-center rounded-sm border border-line bg-surface/90 px-2 text-caption font-medium text-ink-2 shadow-raise outline-none hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus focus-visible:outline-solid max-md:h-11 max-md:px-3 md:absolute md:top-1 md:right-1`,"data-try":h.status===`static`?`start`:`done`,children:h.status===`static`?`Try it`:`Done`})})]}),h.status===`static`&&h.failure&&(0,j.jsx)(`p`,{role:`status`,className:`text-caption text-danger`,"data-try-failure":``,children:h.failure}),i&&(e.story?(0,j.jsx)($,{story:e.story,place:e.place}):(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-ink-2`,children:e.project}),e.count>1&&(0,j.jsxs)(`span`,{className:`shrink-0 tabular`,children:[`×`,e.count]}),(0,j.jsx)(`span`,{className:`truncate font-mono`,title:e.place,children:e.place})]}))]})}function Ye({tiles:e,...t}){let[n,r]=(0,v.useState)(()=>new Set),i=e=>`${e.css}\n${e.specimen?.html}`,a=e.findIndex((t,r)=>r===e.length-1||!n.has(i(t))),o=e[a];if(!o)return null;let s=a===e.length-1;return(0,j.jsx)(Z,{...t,tile:o,onBlank:s?void 0:()=>r(e=>new Set(e).add(i(o)))},a)}var Q=112;function Xe({tile:e,scheme:t,label:n}){let r=(0,v.useRef)(null),i=z(r),o=B(r),s=W(e),c=U(s&&i,o),[l,u]=(0,v.useState)(null),d=s&&c?Ve(e.specimen.html,e.css,t):null;return(0,v.useLayoutEffect)(()=>u(null),[d]),(0,j.jsxs)(`div`,{ref:r,role:`group`,"aria-label":`${n}, in each state`,className:`min-w-0 space-y-1`,"data-strip":e.key,"data-frame":s&&i?c?`mounted`:`waiting`:void 0,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:Q},children:s?d?(0,j.jsx)(We,{srcDoc:d,scheme:t,near:i,height:Q,strip:u}):i?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:Q}):null:(0,j.jsx)(Y,{shape:e.shape,caption:`no specimen: no states to show`,tileHeight:Q})}),s&&(0,j.jsx)(`ol`,{"aria-label":`States`,className:a(`relative h-4 text-caption text-muted`,!l&&`grid grid-cols-5 text-center`),children:q.map((e,t)=>(0,j.jsx)(`li`,{"data-state":e.id,className:a(l&&`absolute top-0 -translate-x-1/2 whitespace-nowrap`),style:l?{left:l.x+(t+.5)*l.width/q.length}:void 0,children:e.label},e.id))})]})}function $({story:e,place:t}){return(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,title:t,"aria-label":G(e),children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-accent`,children:`Storybook`}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-faint`,children:`·`}),(0,j.jsxs)(`span`,{className:`line-clamp-2 min-w-0 break-words`,children:[e.title,` / `,e.name]})]})}function Ze({tiles:e,scheme:t,tryIt:n=!1}){return e.length>100?(0,j.jsx)(Qe,{tiles:e,scheme:t,tryIt:n}):(0,j.jsx)(`ul`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${I}px, 1fr))`},"aria-label":`Specimens`,children:e.map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))})}function Qe({tiles:e,scheme:t,tryIt:n}){let r=(0,v.useRef)(null),[i,a]=(0,v.useState)(0);(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e||(a(e.clientWidth),typeof ResizeObserver>`u`))return;let t=new ResizeObserver(()=>a(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let o=Math.max(1,Math.floor((i||544)/I)),s=Math.ceil(e.length/o),c=N(),l=Me+(n&&!c?Ne:0),d=u({count:s,getScrollElement:()=>r.current,estimateSize:()=>l,overscan:2,initialRect:{width:o*I,height:l*L}});return(0,v.useLayoutEffect)(()=>d.measure(),[d,l]),(0,j.jsx)(R.Provider,{value:r.current,children:(0,j.jsx)(`div`,{ref:r,className:`overflow-y-auto rounded-md border border-line p-2`,style:{height:l*L},"data-testid":`virtual-tiles`,children:(0,j.jsx)(`div`,{className:`relative`,style:{height:d.getTotalSize()},children:d.getVirtualItems().map(r=>(0,j.jsx)(`ul`,{className:`absolute inset-x-0 grid gap-2`,style:{top:r.start,height:l,gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},"aria-label":`Specimens, row ${r.index+1} of ${s}`,children:e.slice(r.index*o,(r.index+1)*o).map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))},r.key))})})})}export{Ee as A,le as C,C as D,fe as E,ge as M,xe as N,b as O,be as P,ne as S,x as T,S as _,Xe as a,_e as b,K as c,G as d,z as f,y as g,ee as h,Z as i,Se as j,ve as k,Ue as l,N as m,Ye as n,$ as o,ke as p,R as r,Ze as s,Ae as t,W as u,ye as v,se as w,he as x,De as y};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/try-live-Dxsjf62v.js","assets/react-DB-4Zxce.js","assets/jsx-runtime-D6zNwnaE.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-DB-4Zxce.js";import{n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./x-MLbFVa4v.js";import{t as a}from"./clsx-DB0hHKMi.js";import{st as o}from"./main-Djqho539.js";import{n as s,r as c,t as l}from"./inventory-BI8QBdar.js";import{t as u}from"./esm-NPpg23M8.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-CL3qgCbi.js";var v=e(t(),1),y={type:null,lib:null,project:null,near:!1,q:``};function b(e,t){let n=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),r=n.get(`type`),i=n.get(`project`);return{type:r&&l.includes(r)?r:null,lib:n.get(`lib`)||null,project:i&&t.projects.some(e=>e.id===i)?i:null,near:n.get(`near`)===`1`,q:(n.get(`q`)??``).trim()}}function x(e){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.lib&&t.set(`lib`,e.lib),e.project&&t.set(`project`,e.project),e.near&&t.set(`near`,`1`),e.q.trim()&&t.set(`q`,e.q.trim());let n=t.toString();return n?`?${n}`:``}function S(e){return[e.type,e.lib,e.project,e.near||null,e.q||null].filter(e=>e!==null).length}function C(e,t){return e.roles.filter(e=>!t.type||e.role===t.type).flatMap(e=>Object.entries(e.chunks).filter(([e])=>!t.project||e===t.project).map(([,e])=>e))}var w={id:`plain`,label:`Plain elements`,short:`plain`},T=`radix`,E=new Set([`@radix-ui/react-slot`,`@radix-ui/react-compose-refs`,`@radix-ui/react-primitive`]),D={button:`button`,"link-as-button":`button`,input:`input`,card:`card`,badge:`badge`,dialog:`dialog`,tabs:`tabs`},O=e=>e.slice(e.lastIndexOf(`/`)+1),k=e=>e.toLowerCase().replace(/\.[a-z]+$/,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),ee=class{kits;shadcnName;radixName;radixFiles=new Map;detectRadix;constructor(e,t=null){this.kits=new Map((e?.kits??[]).map(e=>[e.id,e]));let n=e=>t?.libraries.find(t=>t.id===e)?.name;this.shadcnName=n(`shadcn`)??`shadcn-style`,this.radixName=n(`radix`)??`Radix`;for(let t of e?.primitives??[]){if(!t.package.startsWith(`@radix-ui/`)||E.has(t.package))continue;let e=this.radixFiles.get(t.project)??new Set;for(let n of t.sites)e.add(n.file);this.radixFiles.set(t.project,e)}this.detectRadix=new Set((t?.elements??[]).filter(e=>e.library===T||e.also.includes(T)).map(e=>e.type))}primary(e){if(e===null)return w;let t=this.kits.get(e),n=t?.path??e.slice(e.indexOf(`:`)+1);if(!(t?t.kind===`class-kit`:/\.(?:s?css|less)$/.test(n)))return{id:`shadcn`,label:this.shadcnName,short:this.shadcnName};let r=t?.prefix?.replace(/-$/,``);return r?{id:`css-${k(r)}`,label:`.${r}-* CSS kit`,short:`CSS kit`}:{id:`css-${k(O(n))}`,label:`${O(n)} CSS kit`,short:`CSS kit`}}of(e,t,n){let r=this.primary(e.kit);return this.isRadix(e,t,n,r)?[r,this.radix()]:[r]}radix(){return{id:T,label:this.radixName,short:this.radixName}}isRadix(e,t,n,r){if(e.kit===null||r.id!==`shadcn`)return!1;let i=this.kits.get(e.kit)?.members.find(t=>t.name===e.tag);if(i&&this.radixFiles.get(t)?.has(i.file))return!0;let a=D[n];return a!==void 0&&this.detectRadix.has(a)}},te=(e,t)=>l.indexOf(e.role)-l.indexOf(t.role)||Number(e.id.split(`-`).at(-1))-Number(t.id.split(`-`).at(-1));function ne(e,t){let n=new Map,r=new Map,i=new Map;for(let a of e){for(let e of a.families)n.set(e.id,e);for(let e of a.looks){if(e.family===null)continue;let n=r.get(e.family)??[];n.push({...e,project:a.project}),r.set(e.family,n);let o=i.get(e.family)??new Map;t.of(e,a.project,a.role).forEach((e,t)=>{let n=o.get(e.id)??{group:e,looks:0,primary:!1};n.looks++,n.primary||=t===0,o.set(e.id,n)}),i.set(e.family,o)}}let a=[...n.values()].sort(te).map(e=>{let n=[...i.get(e.id)?.values()??[]],a=(e.sides.length>0?e.sides.map(e=>e.kit):[null]).map(e=>t.primary(e));return{family:e,primary:n.filter(e=>e.primary).sort((e,t)=>t.looks-e.looks)[0]?.group??a[0],libs:re(n.length>0?n.map(e=>e.group):a),looks:r.get(e.id)??[],uses:e.looks,projects:e.projects.length,stories:e.stories??0,authored:e.authored===!0}}),o=ae(a.map(e=>({id:e.family.id,family:e.family,kit:e.primary})));return a.map(e=>({...e,name:o.get(e.family.id)}))}function re(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);return[...t.values()]}var ie=e=>e===null?null:`${e}px`;function ae(e){let t=[({family:{shape:e}})=>e.paddingX===null&&e.paddingY===null?null:`padding ${e.paddingY??`?`}/${e.paddingX??`?`}`,({family:{shape:e}})=>e.fontSize===null?null:`${ie(e.fontSize)} text`,({family:{shape:e}})=>e.fontWeight===null?null:`weight ${e.fontWeight}`,({kit:e})=>e.label===e.short?null:e.label,({family:e})=>e.projects.join(` + `)],n=new Map(e.map(e=>[e.id,`${c(e.family)} · ${e.kit.short}`])),r=()=>{let t=new Map;for(let r of e)o(t,n.get(r.id),r);return[...t.values()].filter(e=>e.length>1)};for(let e of r()){let r=t.find(t=>new Set(e.map(t)).size>1);for(let t of e){let e=r?.(t);n.set(t.id,e?`${n.get(t.id)} · ${e}`:n.get(t.id))}}for(let e of r())for(let t of e)n.set(t.id,`${n.get(t.id)} · ${t.id}`);return n}function oe(e,t){if(t.type&&e.family.role!==t.type||t.project&&!e.family.projects.includes(t.project)||t.lib&&!e.libs.some(e=>e.id===t.lib)||t.near&&!e.family.nearDuplicate)return!1;let n=t.q.trim().toLowerCase();if(n){let t=[...e.looks.map(e=>`${e.project}:${e.file}`),...e.family.examples.map(e=>`${e.project}:${e.file}`)];if(![e.name,e.family.id,...t].some(e=>e.toLowerCase().includes(n)))return!1}return!0}function se(e,t){return e.filter(e=>oe(e,t))}var ce=e=>e.lib!==null||e.near||e.q.trim()!==``;function le(e,t,n,r,i){let a=t=>C(e,t).every(r),o=e=>se(t,e).length,c=(t,n)=>e.roles.filter(e=>!t||e.role===t).reduce((e,t)=>e+(n?t.cells[n]?.families??0:t.families),0),l=e=>ce(n)?a(e)?o(e):null:c(e.type,e.project),u=e.roles.map(e=>({value:e.role,label:s[e.role],count:l({...n,type:e.role})})),d=e.projects.map(e=>({value:e.id,label:e.id,count:l({...n,project:e.id})})),f=a(n),p=new Map;for(let e of t)for(let t of e.libs)p.has(t.id)||p.set(t.id,t);return n.lib&&!p.has(n.lib)&&p.set(n.lib,n.lib===T?i.radix():{id:n.lib,label:n.lib,short:n.lib}),{types:u,projects:d,libs:[...p.values()].sort(de).map(e=>({value:e.id,label:e.label,count:f?o({...n,lib:e.id}):null})),near:f?o({...n,near:!0}):null,all:{type:l({...n,type:null}),project:l({...n,project:null}),lib:f?o({...n,lib:null}):null}}}var ue=[`shadcn`,T];function de(e,t){let n=e=>ue.includes(e.id)?ue.indexOf(e.id):e.id===w.id?99:2;return n(e)-n(t)||e.label.localeCompare(t.label)}function fe(e){let t=new Map;for(let n of e){let e=t.get(n.primary.id)??{group:n.primary,families:[]};e.families.push(n),t.set(n.primary.id,e)}return[...t.values()].sort((e,t)=>de(e.group,t.group))}var pe=[[`height`,`height`],[`paddingX`,`padding`],[`paddingY`,`padding`],[`radius`,`radius`],[`fontSize`,`fontSize`],[`fontWeight`,`fontWeight`]];function me(e,t,n){return pe.every(([r,i])=>{let a=e[r],o=t[r];return a===null||o===null||Math.abs(a-o)<=n[i]})}function he(e,t){let n=[];for(let r of[...e].sort((e,t)=>t.uses-e.uses)){let e=n.find(e=>e[0].family.role===r.family.role&&e.every(e=>me(e.family.shape,r.family.shape,t)));e?e.push(r):n.push([r])}return{families:e.length,estimate:n.length,folds:n.filter(e=>e.length>1).map(e=>e.map(e=>e.family.id))}}function ge(e,t=3){return e.filter(e=>e.family.nearDuplicate).sort((e,t)=>t.uses-e.uses||t.family.sides.length-e.family.sides.length).slice(0,t)}function _e(e){let t=[...e.sides].sort((e,t)=>t.looks-e.looks);return t.length>=2?[t[0],t[1]]:null}function ve(e,t,n){let r=t.filter(t=>t.project===e.project&&t.kit===e.kit),i=new Map;for(let e of r){let t=JSON.stringify(e.shape),n=i.get(t)??{shape:e.shape,n:0};n.n++,i.set(t,n)}return[...i.values()].sort((e,t)=>t.n-e.n)[0]?.shape??n}var A=(e,t=`px`)=>e===null?`?`:e===9999&&t===`px`?`pill`:`${e}${t}`;function ye(e,t){let n=e=>`${A(e.paddingY)} ${A(e.paddingX)}`;return[[`Height`,A(e.shape.height),A(t.shape.height)],[`Padding`,n(e.shape),n(t.shape)],[`Radius`,A(e.shape.radius),A(t.shape.radius)],[`Font size`,A(e.shape.fontSize),A(t.shape.fontSize)],[`Weight`,A(e.shape.fontWeight,``),A(t.shape.fontWeight,``)],[`Uses`,String(e.uses),String(t.uses)],[`Projects`,e.projects.join(`, `),t.projects.join(`, `)]].map(([e,t,n])=>({label:e,a:t,b:n,differs:t!==n}))}function be(e){let t=`${e.stories} ${e.stories===1?`story`:`stories`}`;return e.authored?`Only in Storybook · ${t}`:`${e.uses} ${e.uses===1?`use`:`uses`} · ${e.projects} ${e.projects===1?`project`:`projects`}${e.stories>0?` · ${t}`:``}`}function xe(e){let t=new Map;for(let n of[...e.family.examples,...e.family.sides.flatMap(e=>e.examples)])t.has(`${n.project}:${n.file}`)||t.set(`${n.project}:${n.file}`,n.routes);return e.looks.filter(e=>!e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column).map(e=>({key:e.id,project:e.project,place:`${e.file}:${e.line}`,routes:t.get(`${e.project}:${e.file}`)??[]}))}function Se(e){return e.looks.filter(e=>e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line).map(e=>({key:e.id,project:e.project,story:`${e.story.title} / ${e.story.name}`,place:`${e.file}:${e.line}`}))}var Ce=.11,we=1/3;function Te({distance:e,height:t,velocity:n}){return e<=0?!1:n>Ce||e>t*we}function Ee(e,t,n){return n<=0?50:Math.round(Math.min(100,Math.max(0,(e-t)/n*100))*10)/10}function De(e){return`inset(0 0 0 ${e}%)`}var j=r(),M=`(min-width: 768px)`;function N(){return(0,v.useSyncExternalStore)(e=>{if(typeof matchMedia!=`function`)return()=>{};let t=matchMedia(M);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof matchMedia!=`function`||matchMedia(M).matches)}var Oe=80;function ke({open:e,onOpenChange:t,variant:n,title:r,description:o,children:s,footer:c,testId:l}){let u=(0,v.useRef)(null),y=(0,v.useRef)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),w=n===`sheet`,T=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>{e&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&(T.current=document.activeElement)},[e]);let E=e=>{!w||e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button, a, input`)||(e.currentTarget.setPointerCapture?.(e.pointerId),y.current={id:e.pointerId,startY:e.clientY,samples:[{y:e.clientY,t:e.timeStamp}]},C(!1))},D=e=>{let t=y.current;t&&t.id===e.pointerId&&(t.samples=[...t.samples.filter(t=>e.timeStamp-t.t<=Oe),{y:e.clientY,t:e.timeStamp}],x(Math.max(0,e.clientY-t.startY)))},O=e=>{let n=y.current;if(!n||n.id!==e.pointerId)return;y.current=null;let r=n.samples[0],i=e.timeStamp-r.t,a=i>0?(e.clientY-r.y)/i:0;Te({distance:Math.max(0,e.clientY-n.startY),height:u.current?.offsetHeight??0,velocity:a})?t(!1):(C(!0),x(0))};return(0,j.jsx)(_,{open:e,onOpenChange:e=>(x(0),t(e)),children:(0,j.jsxs)(m,{children:[(0,j.jsx)(d,{className:`inv-scrim fixed inset-0 z-50 bg-scrim`}),(0,j.jsxs)(h,{ref:u,"data-variant":n,"data-testid":l,className:a(`inv-drawer fixed z-50 flex flex-col border-line bg-surface shadow-popover outline-none`,w?`inset-x-0 bottom-0 max-h-[88dvh] rounded-t-xl border-t`:`inset-y-0 right-0 w-[min(560px,100vw)] border-l`,S&&`inv-settle`),style:b>0||S?{transform:`translate3d(0, ${b}px, 0)`}:void 0,onTransitionEnd:()=>C(!1),onCloseAutoFocus:e=>{let t=T.current;T.current=null,t?.isConnected&&(e.preventDefault(),t.focus())},children:[(0,j.jsxs)(`div`,{className:a(`shrink-0 border-b border-line`,w&&`touch-none select-none`),onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,"data-testid":w?`sheet-handle`:void 0,children:[w&&(0,j.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-9 rounded-full bg-line-strong`}),(0,j.jsxs)(`header`,{className:`flex min-h-12 items-start gap-3 px-5 py-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,j.jsx)(g,{className:`text-heading text-ink`,children:r}),o?(0,j.jsx)(f,{className:`text-small text-muted`,children:o}):(0,j.jsx)(f,{className:`sr-only`,children:`Details`})]}),(0,j.jsx)(p,{"aria-label":`Close`,className:`inv-press grid size-7 shrink-0 place-items-center rounded-md text-muted max-md:-my-2 max-md:-mr-2 max-md:size-11`,children:(0,j.jsx)(i,{className:`size-4`})})]})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s}),c&&(0,j.jsx)(`div`,{className:`shrink-0 border-t border-line px-5 py-3`,children:c})]})]})})}var Ae=1280,P=88,je=150,F=10,I=136,Me=128,Ne=48,L=3.5,R=(0,v.createContext)(null);function z(e,t=`600px`,n=`1800px`){let r=(0,v.useContext)(R),[i,a]=(0,v.useState)(()=>typeof IntersectionObserver>`u`);return(0,v.useEffect)(()=>{let i=e.current;if(!i||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&a(!0),{root:r,rootMargin:t}),s=new IntersectionObserver(e=>e.every(e=>!e.isIntersecting)&&a(!1),{root:r,rootMargin:n});return o.observe(i),s.observe(i),()=>{o.disconnect(),s.disconnect()}},[e,r,t,n]),i}function B(e){let t=(0,v.useContext)(R),[n,r]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let n=e.current;if(!n||typeof IntersectionObserver>`u`)return;let i=new IntersectionObserver(e=>r(e.some(e=>e.isIntersecting)),{root:t,rootMargin:`0px`});return i.observe(n),()=>i.disconnect()},[e,t]),n}var V=new class{limit;active=new Set;waiting=[];constructor(e=6){this.limit=e}get rendering(){return this.active.size}request(e,t){this.active.has(e)||this.waiting.some(t=>t.id===e)||(this.active.size<this.limit?(this.active.add(e),t()):this.waiting.push({id:e,grant:t}))}release(e){for(this.active.delete(e),this.waiting=this.waiting.filter(t=>t.id!==e);this.active.size<this.limit&&this.waiting.length>0;){let e=this.waiting.shift();this.active.add(e.id),e.grant()}}};function Pe(e){let[t,n]=(0,v.useState)(`waiting`),r=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e)return;let t={};return r.current=t,V.request(t,()=>{r.current===t&&n(e=>e===`waiting`?`rendering`:e)}),()=>{r.current===t&&(r.current=null),V.release(t),n(`waiting`)}},[e]);let i=(0,v.useCallback)(()=>{let e=r.current;e!==null&&(V.release(e),n(e=>e===`rendering`?`done`:e))},[]);return{granted:e&&t!==`waiting`,rendering:e&&t===`rendering`,done:i}}var H=new class{limit;entries=new Map;clock=0;constructor(e=48){this.limit=e}get mounted(){return[...this.entries.values()].filter(e=>e.mounted).length}join(e,t,n){this.entries.set(e,{visible:t,touched:++this.clock,mounted:!1,set:n}),this.settle()}see(e,t){let n=this.entries.get(e);n&&n.visible!==t&&(n.visible=t,t&&(n.touched=++this.clock),this.settle())}leave(e){this.entries.delete(e)&&this.settle()}settle(){let e=[...this.entries.values()].sort((e,t)=>Number(t.visible)-Number(e.visible)||Number(t.mounted)-Number(e.mounted)||e.touched-t.touched),t=new Set(e.slice(0,this.limit));for(let n of e)n.mounted&&!t.has(n)&&(n.mounted=!1,n.set(!1));for(let e of t)e.mounted||(e.mounted=!0,e.set(!0))}};function U(e,t){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!e)return;let t={};return i.current=t,H.join(t,!1,e=>{i.current===t&&r(e)}),()=>{i.current===t&&(i.current=null),H.leave(t),r(!1)}},[e]),(0,v.useEffect)(()=>{i.current&&H.see(i.current,t)},[t,e]),e&&n}var W=e=>e.specimen!==null&&e.css!==null,G=e=>`Storybook · ${e.title} / ${e.name}`;function Fe(e){try{let t=new URL(e,typeof document>`u`?void 0:document.baseURI);return t.protocol===`http:`||t.protocol===`https:`?t.origin:t.protocol}catch{return`'self'`}}function Ie(e){let t=Fe(e);return`default-src 'none'; script-src ${t}; style-src ${t} 'unsafe-inline'; font-src ${t} data:; img-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'`}function K(e,t){let n=e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`);return`<!doctype html><html lang="en"${t===`dark`?` class="dark"`:``} data-theme="${t}" style="color-scheme:${t}"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Ie(e).replace(/"/g,`&quot;`)}"><link rel="stylesheet" href="${n}">`}function Le(e,t,n){return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-block;margin:32px">${e}</div></body></html>`}var q=[{id:`default`,label:`Default`,className:null},{id:`hover`,label:`Hover`,className:`youi-state-hover`},{id:`focus`,label:`Focus`,className:`youi-state-focus`},{id:`pressed`,label:`Pressed`,className:`youi-state-active`},{id:`disabled`,label:`Disabled`,className:`youi-state-disabled`}],Re=`button, input, select, textarea, fieldset, optgroup, option`,ze=`${Re}, a, [role], [tabindex]`;function Be(e){if(typeof document>`u`)return e;let t=document.createElement(`template`);t.innerHTML=e;let n=t.content;for(let e of[...n.children,...n.querySelectorAll(ze)])e.matches(Re)&&e.setAttribute(`disabled`,``),e.setAttribute(`aria-disabled`,`true`),e.setAttribute(`data-disabled`,``);return t.innerHTML}function Ve(e,t,n){let r=q.map(t=>`<div class="youi-state-cell${t.className?` ${t.className}`:``}" data-youi-state="${t.id}" style="display:flex;align-items:center;justify-content:center;padding:16px;contain:layout">${t.id===`disabled`?Be(e):e}</div>`).join(``);return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;align-items:center;margin:32px">${r}</div></body></html>`}function He(e,t=!1){let n=e.getElementById(`youi-specimen`);if(!n)return null;if(t){let e=n.getBoundingClientRect();return e.width>0&&e.height>0?{x:e.left,y:e.top,width:e.width,height:e.height}:null}let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e of[n,...n.querySelectorAll(`*`)]){let t=e.getBoundingClientRect();t.width!==0&&t.height!==0&&(r=Math.min(r,t.left),i=Math.min(i,t.top),a=Math.max(a,t.right),o=Math.max(o,t.bottom))}return Number.isFinite(r)?{x:r,y:i,width:a-r,height:o-i}:null}var J=(e,t,n)=>Math.min(1,(t-20)/e.width,(n-20)/e.height);function Ue(e,t,n){let r=t||I,i=J(e,r,n),a=r/2-(e.x+e.width/2)*i,o=n/2-(e.y+e.height/2)*i;return`translate(${a.toFixed(1)}px, ${o.toFixed(1)}px) scale(${i.toFixed(4)})`}function We({srcDoc:e,scheme:t,near:n,height:r,onBlank:i,strip:o,onBackground:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),u=Pe(n),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(void 0);(0,v.useLayoutEffect)(()=>f(null),[e]);let h=()=>{let e=l.current?.contentDocument,t=c.current,n=e?He(e,o!==void 0):null;if(!t||!n){f(`translate(${F}px, ${F}px)`),u.done(),e&&!n&&e.documentElement.getBoundingClientRect().width>0&&i?.();return}let a=e.defaultView,d=[e.body,e.documentElement].map(e=>a?.getComputedStyle(e).backgroundColor).find(e=>e&&e!==`transparent`&&e!==`rgba(0, 0, 0, 0)`);m(d),s?.(d);let p=t.clientWidth||I;f(Ue(n,p,r));let h=J(n,p,r);o?.({x:p/2-n.width/2*h,width:n.width*h}),u.done()};return(0,j.jsx)(`div`,{ref:c,className:`absolute inset-0`,style:{background:p},children:u.granted&&(0,j.jsx)(`iframe`,{ref:l,title:`Specimen`,"aria-hidden":!0,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:e,onLoad:()=>{let e=l.current?.contentDocument?.fonts;e?e.ready.then(h,h):h()},"data-rendering":u.rendering||void 0,"data-placed":d!==null||void 0,className:a(`pointer-events-none absolute left-0 top-0 origin-top-left border-0 bg-transparent`,d===null&&`opacity-0`),style:{width:1280,height:480,transform:d??void 0,colorScheme:t}})})}function Y({shape:e,caption:t=`shape only`,tileHeight:n=P}){let r=e.height??(e.fontSize===null?32:Math.round(e.fontSize*1.5+2*(e.paddingY??0))),i=Math.min(1,(n-20-14)/r);return(0,j.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1`,"data-testid":`shape-box`,children:[(0,j.jsx)(`span`,{className:`inline-flex items-center border border-dashed border-line-strong text-faint`,style:{height:r*i,paddingInline:(e.paddingX??12)*i,borderRadius:Math.min(e.radius??0,9999),fontSize:(e.fontSize??14)*i,fontWeight:e.fontWeight??void 0},children:`Aa`}),(0,j.jsx)(`span`,{className:`text-caption text-faint`,children:t})]})}var Ge=(0,v.lazy)(()=>n(()=>import(`./try-live-Dxsjf62v.js`).then(e=>e.r).then(e=>({default:e.LiveFrame})),__vite__mapDeps([0,1,2]))),X=null;function Ke(e,t){let n=X;X={id:e,end:t},n&&n.id!==e&&n.end()}function qe(e){X?.id===e&&(X=null)}function Je(e,t){let[n,r]=(0,v.useState)({status:`static`,failure:null}),i=(0,v.useRef)({}),a=(0,v.useRef)(null),o=n.status!==`static`,s=(0,v.useCallback)((e=null)=>{qe(i.current),r({status:`static`,failure:e})},[]),c=()=>{Ke(i.current,()=>r({status:`static`,failure:null})),r({status:`loading`})},l=(0,v.useCallback)(()=>r(e=>e.status===`loading`?{status:`live`}:e),[]);return(0,v.useEffect)(()=>{o&&!e&&s()},[o,e,s]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{if(e.key!==`Escape`)return;let n=t.current?.contains(e.target)??!1;n&&(e.stopPropagation(),e.preventDefault()),s(),n&&a.current?.focus()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,s,t]),(0,v.useEffect)(()=>()=>qe(i.current),[]),{state:n,start:c,ready:l,end:s,button:a}}function Z({tile:e,scheme:t,size:n=`small`,as:r=`li`,caption:i=!0,onBlank:a,tryIt:o=!1,backdrop:s}){let c=(0,v.useRef)(null),l=z(c),u=B(c),d=W(e),f=U(d&&l,u),p=n===`stage`?je:n===`large`?136:P,m=o&&d&&e.specimen.kind===`component`&&(!!e.specimenId||!!e.script),{state:h,start:g,ready:_,end:y,button:b}=Je(l,c),[x,S]=(0,v.useState)(void 0),C=d?f?(0,j.jsx)(We,{srcDoc:Le(e.specimen.html,e.css,t),scheme:t,near:l,height:p,onBlank:a,onBackground:m?S:void 0}):l?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:p}):null:(0,j.jsx)(Y,{shape:e.shape,tileHeight:p}),w=e.story?`${e.project} ${G(e.story)}`:`${e.project} ${e.place}`;return(0,j.jsxs)(r,{ref:c,className:`min-w-0 space-y-1`,"data-tile":e.key,"data-story":e.story?.id,"data-kind":d?e.specimen.kind:`shape`,"data-frame":d&&l?f?`mounted`:`waiting`:void 0,"data-live":h.status===`static`?void 0:h.status,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:p,background:s},children:m&&h.status!==`static`?(0,j.jsx)(v.Suspense,{fallback:C,children:(0,j.jsx)(Ge,{project:e.project,specimen:e.specimenId??``,script:e.script??null,html:e.specimen.html,css:e.css,scheme:t,height:p,background:x,fallback:C,onReady:_,onEnd:()=>(y(),b.current?.focus()),onFail:e=>y(e)})}):C}),m&&(0,j.jsx)(`div`,{className:`flex justify-end max-md:pt-1`,"data-try-bar":``,children:(0,j.jsx)(`button`,{ref:b,type:`button`,onClick:()=>h.status===`static`?g():(y(),b.current?.focus()),"aria-label":h.status===`static`?`Try ${w} live`:`Done trying ${w}`,"aria-busy":h.status===`loading`||void 0,className:`z-10 inline-flex h-6 items-center rounded-sm border border-line bg-surface/90 px-2 text-caption font-medium text-ink-2 shadow-raise outline-none hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus focus-visible:outline-solid max-md:h-11 max-md:px-3 md:absolute md:top-1 md:right-1`,"data-try":h.status===`static`?`start`:`done`,children:h.status===`static`?`Try it`:`Done`})})]}),h.status===`static`&&h.failure&&(0,j.jsx)(`p`,{role:`status`,className:`text-caption text-danger`,"data-try-failure":``,children:h.failure}),i&&(e.story?(0,j.jsx)($,{story:e.story,place:e.place}):(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-ink-2`,children:e.project}),e.count>1&&(0,j.jsxs)(`span`,{className:`shrink-0 tabular`,children:[`×`,e.count]}),(0,j.jsx)(`span`,{className:`truncate font-mono`,title:e.place,children:e.place})]}))]})}function Ye({tiles:e,...t}){let[n,r]=(0,v.useState)(()=>new Set),i=e=>`${e.css}\n${e.specimen?.html}`,a=e.findIndex((t,r)=>r===e.length-1||!n.has(i(t))),o=e[a];if(!o)return null;let s=a===e.length-1;return(0,j.jsx)(Z,{...t,tile:o,onBlank:s?void 0:()=>r(e=>new Set(e).add(i(o)))},a)}var Q=112;function Xe({tile:e,scheme:t,label:n}){let r=(0,v.useRef)(null),i=z(r),o=B(r),s=W(e),c=U(s&&i,o),[l,u]=(0,v.useState)(null),d=s&&c?Ve(e.specimen.html,e.css,t):null;return(0,v.useLayoutEffect)(()=>u(null),[d]),(0,j.jsxs)(`div`,{ref:r,role:`group`,"aria-label":`${n}, in each state`,className:`min-w-0 space-y-1`,"data-strip":e.key,"data-frame":s&&i?c?`mounted`:`waiting`:void 0,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:Q},children:s?d?(0,j.jsx)(We,{srcDoc:d,scheme:t,near:i,height:Q,strip:u}):i?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:Q}):null:(0,j.jsx)(Y,{shape:e.shape,caption:`no specimen: no states to show`,tileHeight:Q})}),s&&(0,j.jsx)(`ol`,{"aria-label":`States`,className:a(`relative h-4 text-caption text-muted`,!l&&`grid grid-cols-5 text-center`),children:q.map((e,t)=>(0,j.jsx)(`li`,{"data-state":e.id,className:a(l&&`absolute top-0 -translate-x-1/2 whitespace-nowrap`),style:l?{left:l.x+(t+.5)*l.width/q.length}:void 0,children:e.label},e.id))})]})}function $({story:e,place:t}){return(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,title:t,"aria-label":G(e),children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-accent`,children:`Storybook`}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-faint`,children:`·`}),(0,j.jsxs)(`span`,{className:`line-clamp-2 min-w-0 break-words`,children:[e.title,` / `,e.name]})]})}function Ze({tiles:e,scheme:t,tryIt:n=!1}){return e.length>100?(0,j.jsx)(Qe,{tiles:e,scheme:t,tryIt:n}):(0,j.jsx)(`ul`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${I}px, 1fr))`},"aria-label":`Specimens`,children:e.map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))})}function Qe({tiles:e,scheme:t,tryIt:n}){let r=(0,v.useRef)(null),[i,a]=(0,v.useState)(0);(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e||(a(e.clientWidth),typeof ResizeObserver>`u`))return;let t=new ResizeObserver(()=>a(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let o=Math.max(1,Math.floor((i||544)/I)),s=Math.ceil(e.length/o),c=N(),l=Me+(n&&!c?Ne:0),d=u({count:s,getScrollElement:()=>r.current,estimateSize:()=>l,overscan:2,initialRect:{width:o*I,height:l*L}});return(0,v.useLayoutEffect)(()=>d.measure(),[d,l]),(0,j.jsx)(R.Provider,{value:r.current,children:(0,j.jsx)(`div`,{ref:r,className:`overflow-y-auto rounded-md border border-line p-2`,style:{height:l*L},"data-testid":`virtual-tiles`,children:(0,j.jsx)(`div`,{className:`relative`,style:{height:d.getTotalSize()},children:d.getVirtualItems().map(r=>(0,j.jsx)(`ul`,{className:`absolute inset-x-0 grid gap-2`,style:{top:r.start,height:l,gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},"aria-label":`Specimens, row ${r.index+1} of ${s}`,children:e.slice(r.index*o,(r.index+1)*o).map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))},r.key))})})})}export{Ee as A,le as C,C as D,fe as E,ge as M,xe as N,b as O,be as P,ne as S,x as T,S as _,Xe as a,_e as b,K as c,G as d,z as f,y as g,ee as h,Z as i,Se as j,ve as k,Ue as l,N as m,Ye as n,$ as o,ke as p,R as r,Ze as s,Ae as t,W as u,ye as v,se as w,he as x,De as y};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./download-BQI-Si9R.js";import{t as a}from"./layers-DfzdK_wG.js";import{t as o}from"./x-MLbFVa4v.js";import{t as s}from"./clsx-DB0hHKMi.js";import{P as c,ct as l,i as u,n as d,o as f,s as p,z as m}from"./main-cvOFSjox.js";import{t as h}from"./Badge-CUJUit4d.js";import{n as g,r as _}from"./Section-BTnvUq_W.js";import{t as v}from"./CodeBlock-CsiGFgvI.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./dist-C8tf4g8c.js";var E={name:`file-search`,size:24,node:[[`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`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};E.node;var D=r(E),O={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};O.node;var k=r(O),A={name:`library-big`,size:24,node:[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]};A.node;var j=r(A);function M(e){let t=e.toLowerCase().replace(/^www\./,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t?/^[a-z]/.test(t)?t:`site-${t}`:`site`}function N(e){return e.toLowerCase().replace(/[^a-z0-9.]+/g,`-`).replace(/^-+|-+$/g,``)||`item`}var P=e=>e.charAt(0).toUpperCase()+e.slice(1);function F(e,t,n=new Date().toISOString()){let r=e.target.name,i=e.libraries.find(e=>e.id===t.library)??{id:t.library,name:t.library},a=t.page??e.pages.find(e=>e.status===`ok`)?.url??(e.target.kind===`site`?e.target.inputs[0]:void 0),o=`Seen on ${r}, likely ${i.name}`;return{schema:`youi.library/v1`,id:`lib:${M(r)}/component/${N(`${i.id}-${t.type}`)}`,name:`${i.name} ${P(t.type)}`,kind:`component`,stage:`library`,summary:o.length>200?`${o.slice(0,199)}…`:o,source:{name:r,...a&&/^https?:\/\//.test(a)?{url:a}:{},ingestedAt:n},categories:[t.type,`detected:${t.confidence}`],swapsWith:[]}}var I=e(t(),1),L=n(),R={high:`success`,medium:`warning`,low:`neutral`};function z({confidence:e}){return(0,L.jsxs)(h,{tone:R[e],children:[e[0].toUpperCase()+e.slice(1),` confidence`]})}var B={package:`package.json`,lockfile:`lockfile`,"components-json":`components.json`,import:`import`,"data-slot":`data-slot`,"class-prefix":`class`,"css-var":`CSS variable`,"id-prefix":`id`,"style-tag":`style tag`,"radix-colors":`Radix Colors`,tailwind:`Tailwind`};function V({evidence:e}){return(0,L.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[104px_minmax(0,1fr)] gap-x-3 text-small max-sm:grid-cols-1`,children:[(0,L.jsxs)(`span`,{className:s(`font-mono text-mono-sm`,e.strength===`support`?`text-muted`:`text-ink-2`),children:[B[e.kind],e.strength===`support`&&(0,L.jsx)(`span`,{className:`sr-only`,children:` (supporting only)`})]}),(0,L.jsxs)(`span`,{className:`min-w-0 space-y-0.5`,children:[(0,L.jsxs)(`span`,{className:s(`block`,e.strength===`support`?`text-muted`:`text-ink`),children:[e.detail,e.count>1&&(0,L.jsxs)(`span`,{className:`tabular text-muted`,children:[` ×`,e.count]}),e.strength===`support`&&(0,L.jsx)(`span`,{className:`text-muted`,children:` · supports, never decides`})]}),e.samples.length>0&&(0,L.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.samples.join(` `)}),e.where.length>0&&(0,L.jsxs)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:[e.where.slice(0,3).join(` `),e.where.length>3?` +${e.where.length-3}`:``]})]})]},`${e.kind}:${e.detail}`))})}function H({library:e,report:t}){let n=t.elements.filter(t=>t.library===e.id).map(e=>e.type);return(0,L.jsxs)(`article`,{"aria-label":e.name,className:`space-y-3 rounded-lg border border-line p-4`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`text-heading`,children:e.name}),(0,L.jsx)(z,{confidence:e.confidence}),(0,L.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[`score `,e.score.toFixed(2)]}),t.target.kind===`site`&&e.pages.length>0&&(0,L.jsxs)(`span`,{className:`ml-auto text-small text-muted max-sm:ml-0 max-sm:w-full`,children:[`seen on `,e.pages.length,` of `,t.pages.length,` pages`]})]}),(0,L.jsx)(V,{evidence:e.evidence}),n.length>0&&(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[`Elements: `,n.join(`, `)]})]})}function U(e,t){let n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0)}function W({report:e,element:t,onClose:n}){let[r]=(0,I.useState)(()=>F(e,t)),a=`${JSON.stringify(r,null,2)}\n`,[s,c]=r.id.slice(4).split(`/component/`),l=`library/${s}/${c}.library.json`;return(0,L.jsx)(T,{open:!0,onOpenChange:e=>!e&&n(),children:(0,L.jsxs)(S,{children:[(0,L.jsx)(y,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,L.jsxs)(C,{className:`fixed inset-x-0 top-[10vh] z-50 mx-auto w-[min(560px,calc(100vw-24px))] rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,L.jsxs)(`header`,{className:`flex h-12 items-center border-b border-line px-5`,children:[(0,L.jsx)(w,{className:`text-heading`,children:`Draft Library item`}),(0,L.jsx)(x,{"aria-label":`Close`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted hover:bg-raised hover:text-ink`,children:(0,L.jsx)(o,{className:`size-4`})})]}),(0,L.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,L.jsxs)(b,{className:`text-small text-ink-2`,children:[r.summary,`. A draft only: nothing is written. Save it as `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:l}),` in the design repo; it lands in the Library, never the System, until a person adopts it.`]}),(0,L.jsx)(v,{code:a,title:l,maxHeight:`sm`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(p,{variant:`primary`,onClick:()=>U(`${c}.library.json`,a),children:[(0,L.jsx)(i,{}),` Download`]}),(0,L.jsx)(x,{asChild:!0,children:(0,L.jsx)(p,{children:`Close`})})]})]})]})]})})}function G({element:e,report:t,onDraft:n}){let r=t.libraries.find(t=>t.id===e.library),i=`${r?.name??e.library} ${e.type}`;return(0,L.jsxs)(`article`,{"aria-label":i,className:`flex flex-col overflow-hidden rounded-lg border border-line`,children:[(0,L.jsx)(`div`,{className:`grid h-36 place-items-center border-b border-line bg-sunken p-3`,children:e.screenshot?(0,L.jsx)(`img`,{src:l(e.screenshot),alt:`Screenshot: ${i}`,loading:`lazy`,className:`max-h-full max-w-full rounded-xs object-contain shadow-raise`}):(0,L.jsx)(`span`,{className:`text-small text-muted`,children:t.target.kind===`repo`?`Found in the code: no screenshot`:`No screenshot taken`})}),(0,L.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,L.jsx)(`h3`,{className:`text-heading capitalize`,children:e.type}),(0,L.jsx)(`span`,{className:`text-small text-ink-2`,children:r?.name??e.library}),(0,L.jsx)(z,{confidence:e.confidence})]}),(0,L.jsxs)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,title:e.evidence[0]?.detail,children:[e.evidence[0]?.detail,` `,e.count>1&&`×${e.count}`]}),e.also.length>0&&(0,L.jsxs)(`p`,{className:`text-caption text-muted`,children:[`Also matched: `,e.also.map(e=>t.libraries.find(t=>t.id===e)?.name??e).join(`, `)]}),(0,L.jsx)(`div`,{className:`mt-auto pt-1`,children:(0,L.jsxs)(p,{size:`sm`,onClick:n,children:[(0,L.jsx)(j,{}),` Add to Library`]})})]})]})}function K({report:e}){return(0,L.jsxs)(`section`,{"aria-label":`Coverage`,className:`flex items-start gap-3 rounded-lg border border-dashed border-line-strong p-4`,children:[(0,L.jsx)(k,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.coverage}),e.pages.length>0&&(0,L.jsx)(`ul`,{className:`space-y-0.5`,children:e.pages.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 text-small`,children:[(0,L.jsx)(h,{tone:e.status===`ok`?`neutral`:`danger`,children:e.status===`ok`?`Crawled`:`Failed`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-mono-sm text-ink-2`,children:e.url}),e.exposed>0&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[e.exposed,` opened`]}),e.error&&(0,L.jsx)(`span`,{className:`text-danger`,children:e.error})]},e.url))})]})]})}function q({report:e}){let[t,n]=(0,I.useState)(null);return(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-8 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[e.target.kind===`site`?`Website`:`Repo`,` · detected `,new Date(e.generatedAt).toLocaleString(),` · `,e.detector]}),(0,L.jsx)(`h2`,{className:`text-title`,children:e.target.name})]}),(0,L.jsx)(K,{report:e}),(0,L.jsx)(g,{title:`Libraries`,count:e.libraries.length,children:e.libraries.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No UI library found on what was crawled.`}):(0,L.jsx)(`div`,{className:`space-y-3`,children:e.libraries.map(t=>(0,L.jsx)(H,{library:t,report:e},t.id))})}),(0,L.jsx)(g,{title:`Elements`,count:e.elements.length,children:e.elements.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No element types matched.`}):(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.elements.map(t=>(0,L.jsx)(G,{element:t,report:e,onDraft:()=>n(t)},t.type))})}),e.unused.length>0&&(0,L.jsx)(g,{title:`Declared, never imported`,count:e.unused.length,aside:(0,L.jsx)(`span`,{className:`text-small text-muted`,children:`Not counted in any verdict`}),children:(0,L.jsx)(_,{head:[`Package`,`Declared`,`In`,`Library`],children:e.unused.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-ink`,children:e.package}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.version}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.declaredIn}),(0,L.jsx)(`td`,{className:`text-small text-ink-2`,children:e.library??``})]},e.package))})}),e.fonts.length>0&&(0,L.jsx)(g,{title:`Fonts`,count:e.fonts.length,children:(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.fonts.map(e=>`${e.family}${e.usedBy.length?` (${e.usedBy.slice(0,3).join(`, `)})`:``}`).join(` · `)})}),e.notes.length>0&&(0,L.jsx)(g,{title:`Not counted`,children:(0,L.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-small text-muted`,children:e.notes.map(e=>(0,L.jsx)(`li`,{children:e},e))})}),t&&(0,L.jsx)(W,{report:e,element:t,onClose:()=>n(null)})]})}function J(){return(0,L.jsx)(f,{icon:D,title:`No stack detected yet`,children:(0,L.jsxs)(`p`,{children:[`Run `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux detect <repo-path|url…>`}),` to find which UI libraries a repo or website uses, then open the hub with`,` `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux ui --detect .youi/detect/detect.json`}),`.`]})})}function Y(){let e=m(),t=e.status===`ready`?e.value:null;return(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(d,{title:`Stack`,count:t?.libraries.length,children:(0,L.jsxs)(h,{tone:`outline`,children:[(0,L.jsx)(a,{}),` Detected, not adopted`]})}),(0,L.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.status===`ready`?t?(0,L.jsx)(q,{report:t}):(0,L.jsx)(J,{}):(0,L.jsx)(u,{state:e,onRetry:c,what:`the detect report`})})]})}export{z as ConfidenceBadge,W as DraftDialog,J as StackEmpty,q as StackReport,Y as StackScreen};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./download-BQI-Si9R.js";import{t as a}from"./layers-DfzdK_wG.js";import{t as o}from"./x-MLbFVa4v.js";import{t as s}from"./clsx-DB0hHKMi.js";import{P as c,ct as l,i as u,n as d,o as f,s as p,z as m}from"./main-Djqho539.js";import{t as h}from"./Badge-CUJUit4d.js";import{n as g,r as _}from"./Section-BTnvUq_W.js";import{t as v}from"./CodeBlock-CsiGFgvI.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./dist-CL3qgCbi.js";var E={name:`file-search`,size:24,node:[[`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`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};E.node;var D=r(E),O={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};O.node;var k=r(O),A={name:`library-big`,size:24,node:[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]};A.node;var j=r(A);function M(e){let t=e.toLowerCase().replace(/^www\./,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t?/^[a-z]/.test(t)?t:`site-${t}`:`site`}function N(e){return e.toLowerCase().replace(/[^a-z0-9.]+/g,`-`).replace(/^-+|-+$/g,``)||`item`}var P=e=>e.charAt(0).toUpperCase()+e.slice(1);function F(e,t,n=new Date().toISOString()){let r=e.target.name,i=e.libraries.find(e=>e.id===t.library)??{id:t.library,name:t.library},a=t.page??e.pages.find(e=>e.status===`ok`)?.url??(e.target.kind===`site`?e.target.inputs[0]:void 0),o=`Seen on ${r}, likely ${i.name}`;return{schema:`youi.library/v1`,id:`lib:${M(r)}/component/${N(`${i.id}-${t.type}`)}`,name:`${i.name} ${P(t.type)}`,kind:`component`,stage:`library`,summary:o.length>200?`${o.slice(0,199)}…`:o,source:{name:r,...a&&/^https?:\/\//.test(a)?{url:a}:{},ingestedAt:n},categories:[t.type,`detected:${t.confidence}`],swapsWith:[]}}var I=e(t(),1),L=n(),R={high:`success`,medium:`warning`,low:`neutral`};function z({confidence:e}){return(0,L.jsxs)(h,{tone:R[e],children:[e[0].toUpperCase()+e.slice(1),` confidence`]})}var B={package:`package.json`,lockfile:`lockfile`,"components-json":`components.json`,import:`import`,"data-slot":`data-slot`,"class-prefix":`class`,"css-var":`CSS variable`,"id-prefix":`id`,"style-tag":`style tag`,"radix-colors":`Radix Colors`,tailwind:`Tailwind`};function V({evidence:e}){return(0,L.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[104px_minmax(0,1fr)] gap-x-3 text-small max-sm:grid-cols-1`,children:[(0,L.jsxs)(`span`,{className:s(`font-mono text-mono-sm`,e.strength===`support`?`text-muted`:`text-ink-2`),children:[B[e.kind],e.strength===`support`&&(0,L.jsx)(`span`,{className:`sr-only`,children:` (supporting only)`})]}),(0,L.jsxs)(`span`,{className:`min-w-0 space-y-0.5`,children:[(0,L.jsxs)(`span`,{className:s(`block`,e.strength===`support`?`text-muted`:`text-ink`),children:[e.detail,e.count>1&&(0,L.jsxs)(`span`,{className:`tabular text-muted`,children:[` ×`,e.count]}),e.strength===`support`&&(0,L.jsx)(`span`,{className:`text-muted`,children:` · supports, never decides`})]}),e.samples.length>0&&(0,L.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.samples.join(` `)}),e.where.length>0&&(0,L.jsxs)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:[e.where.slice(0,3).join(` `),e.where.length>3?` +${e.where.length-3}`:``]})]})]},`${e.kind}:${e.detail}`))})}function H({library:e,report:t}){let n=t.elements.filter(t=>t.library===e.id).map(e=>e.type);return(0,L.jsxs)(`article`,{"aria-label":e.name,className:`space-y-3 rounded-lg border border-line p-4`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`text-heading`,children:e.name}),(0,L.jsx)(z,{confidence:e.confidence}),(0,L.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[`score `,e.score.toFixed(2)]}),t.target.kind===`site`&&e.pages.length>0&&(0,L.jsxs)(`span`,{className:`ml-auto text-small text-muted max-sm:ml-0 max-sm:w-full`,children:[`seen on `,e.pages.length,` of `,t.pages.length,` pages`]})]}),(0,L.jsx)(V,{evidence:e.evidence}),n.length>0&&(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[`Elements: `,n.join(`, `)]})]})}function U(e,t){let n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0)}function W({report:e,element:t,onClose:n}){let[r]=(0,I.useState)(()=>F(e,t)),a=`${JSON.stringify(r,null,2)}\n`,[s,c]=r.id.slice(4).split(`/component/`),l=`library/${s}/${c}.library.json`;return(0,L.jsx)(T,{open:!0,onOpenChange:e=>!e&&n(),children:(0,L.jsxs)(S,{children:[(0,L.jsx)(y,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,L.jsxs)(C,{className:`fixed inset-x-0 top-[10vh] z-50 mx-auto w-[min(560px,calc(100vw-24px))] rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,L.jsxs)(`header`,{className:`flex h-12 items-center border-b border-line px-5`,children:[(0,L.jsx)(w,{className:`text-heading`,children:`Draft Library item`}),(0,L.jsx)(x,{"aria-label":`Close`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted hover:bg-raised hover:text-ink`,children:(0,L.jsx)(o,{className:`size-4`})})]}),(0,L.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,L.jsxs)(b,{className:`text-small text-ink-2`,children:[r.summary,`. A draft only: nothing is written. Save it as `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:l}),` in the design repo; it lands in the Library, never the System, until a person adopts it.`]}),(0,L.jsx)(v,{code:a,title:l,maxHeight:`sm`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(p,{variant:`primary`,onClick:()=>U(`${c}.library.json`,a),children:[(0,L.jsx)(i,{}),` Download`]}),(0,L.jsx)(x,{asChild:!0,children:(0,L.jsx)(p,{children:`Close`})})]})]})]})]})})}function G({element:e,report:t,onDraft:n}){let r=t.libraries.find(t=>t.id===e.library),i=`${r?.name??e.library} ${e.type}`;return(0,L.jsxs)(`article`,{"aria-label":i,className:`flex flex-col overflow-hidden rounded-lg border border-line`,children:[(0,L.jsx)(`div`,{className:`grid h-36 place-items-center border-b border-line bg-sunken p-3`,children:e.screenshot?(0,L.jsx)(`img`,{src:l(e.screenshot),alt:`Screenshot: ${i}`,loading:`lazy`,className:`max-h-full max-w-full rounded-xs object-contain shadow-raise`}):(0,L.jsx)(`span`,{className:`text-small text-muted`,children:t.target.kind===`repo`?`Found in the code: no screenshot`:`No screenshot taken`})}),(0,L.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,L.jsx)(`h3`,{className:`text-heading capitalize`,children:e.type}),(0,L.jsx)(`span`,{className:`text-small text-ink-2`,children:r?.name??e.library}),(0,L.jsx)(z,{confidence:e.confidence})]}),(0,L.jsxs)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,title:e.evidence[0]?.detail,children:[e.evidence[0]?.detail,` `,e.count>1&&`×${e.count}`]}),e.also.length>0&&(0,L.jsxs)(`p`,{className:`text-caption text-muted`,children:[`Also matched: `,e.also.map(e=>t.libraries.find(t=>t.id===e)?.name??e).join(`, `)]}),(0,L.jsx)(`div`,{className:`mt-auto pt-1`,children:(0,L.jsxs)(p,{size:`sm`,onClick:n,children:[(0,L.jsx)(j,{}),` Add to Library`]})})]})]})}function K({report:e}){return(0,L.jsxs)(`section`,{"aria-label":`Coverage`,className:`flex items-start gap-3 rounded-lg border border-dashed border-line-strong p-4`,children:[(0,L.jsx)(k,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.coverage}),e.pages.length>0&&(0,L.jsx)(`ul`,{className:`space-y-0.5`,children:e.pages.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 text-small`,children:[(0,L.jsx)(h,{tone:e.status===`ok`?`neutral`:`danger`,children:e.status===`ok`?`Crawled`:`Failed`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-mono-sm text-ink-2`,children:e.url}),e.exposed>0&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[e.exposed,` opened`]}),e.error&&(0,L.jsx)(`span`,{className:`text-danger`,children:e.error})]},e.url))})]})]})}function q({report:e}){let[t,n]=(0,I.useState)(null);return(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-8 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[e.target.kind===`site`?`Website`:`Repo`,` · detected `,new Date(e.generatedAt).toLocaleString(),` · `,e.detector]}),(0,L.jsx)(`h2`,{className:`text-title`,children:e.target.name})]}),(0,L.jsx)(K,{report:e}),(0,L.jsx)(g,{title:`Libraries`,count:e.libraries.length,children:e.libraries.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No UI library found on what was crawled.`}):(0,L.jsx)(`div`,{className:`space-y-3`,children:e.libraries.map(t=>(0,L.jsx)(H,{library:t,report:e},t.id))})}),(0,L.jsx)(g,{title:`Elements`,count:e.elements.length,children:e.elements.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No element types matched.`}):(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.elements.map(t=>(0,L.jsx)(G,{element:t,report:e,onDraft:()=>n(t)},t.type))})}),e.unused.length>0&&(0,L.jsx)(g,{title:`Declared, never imported`,count:e.unused.length,aside:(0,L.jsx)(`span`,{className:`text-small text-muted`,children:`Not counted in any verdict`}),children:(0,L.jsx)(_,{head:[`Package`,`Declared`,`In`,`Library`],children:e.unused.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-ink`,children:e.package}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.version}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.declaredIn}),(0,L.jsx)(`td`,{className:`text-small text-ink-2`,children:e.library??``})]},e.package))})}),e.fonts.length>0&&(0,L.jsx)(g,{title:`Fonts`,count:e.fonts.length,children:(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.fonts.map(e=>`${e.family}${e.usedBy.length?` (${e.usedBy.slice(0,3).join(`, `)})`:``}`).join(` · `)})}),e.notes.length>0&&(0,L.jsx)(g,{title:`Not counted`,children:(0,L.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-small text-muted`,children:e.notes.map(e=>(0,L.jsx)(`li`,{children:e},e))})}),t&&(0,L.jsx)(W,{report:e,element:t,onClose:()=>n(null)})]})}function J(){return(0,L.jsx)(f,{icon:D,title:`No stack detected yet`,children:(0,L.jsxs)(`p`,{children:[`Run `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux detect <repo-path|url…>`}),` to find which UI libraries a repo or website uses, then open the hub with`,` `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux ui --detect .youi/detect/detect.json`}),`.`]})})}function Y(){let e=m(),t=e.status===`ready`?e.value:null;return(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(d,{title:`Stack`,count:t?.libraries.length,children:(0,L.jsxs)(h,{tone:`outline`,children:[(0,L.jsx)(a,{}),` Detected, not adopted`]})}),(0,L.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.status===`ready`?t?(0,L.jsx)(q,{report:t}):(0,L.jsx)(J,{}):(0,L.jsx)(u,{state:e,onRetry:c,what:`the detect report`})})]})}export{z as ConfidenceBadge,W as DraftDialog,J as StackEmpty,q as StackReport,Y as StackScreen};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./createLucideIcon-CGDJWtKO.js";import{t as n}from"./compass-BkKOZPYe.js";import{t as r}from"./layers-DfzdK_wG.js";import{t as i}from"./monitor-X_lELkcU.js";import{T as a,dt as o,n as s,o as c,s as l}from"./main-cvOFSjox.js";import{t as u}from"./Badge-CUJUit4d.js";var d={name:`clipboard-check`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]};d.node;var f=t(d),p={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};p.node;var m=t(p),h={name:`replace`,size:24,node:[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]};h.node;var g=t(h),_=e();function v({title:e,icon:t,intro:n,stages:r}){return(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,_.jsx)(s,{title:e,children:(0,_.jsx)(u,{tone:`outline`,children:`Next`})}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 px-8 py-12 animate-enter`,children:[(0,_.jsxs)(`div`,{className:`space-y-3`,children:[(0,_.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-line bg-raised text-muted`,children:(0,_.jsx)(t,{className:`size-4`})}),(0,_.jsx)(`p`,{className:`max-w-xl text-reading text-ink-2`,children:n})]}),(0,_.jsx)(`ol`,{className:`grid gap-3 md:grid-cols-3`,children:r.map((e,t)=>(0,_.jsxs)(`li`,{className:`space-y-2 rounded-lg border border-line p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-small text-muted`,children:[(0,_.jsx)(e.icon,{className:`size-3.5`}),` Step `,t+1]}),(0,_.jsx)(`h3`,{className:`text-heading`,children:e.title}),(0,_.jsx)(`p`,{className:`text-small text-muted`,children:e.body})]},e.title))})]})})]})}function y(){return(0,_.jsx)(v,{title:`Sources`,icon:a,intro:`Sources feed the Library: other design systems, UI kits and references. None are connected yet; each one will add its elements to the Library, where they are browsed and proposed but never built with.`,stages:[{icon:a,title:`Connect`,body:`Point at a source; its elements are ingested with where they came from and when.`},{icon:r,title:`Categorize`,body:`Each element is filed by category and linked to the System elements it could replace.`},{icon:g,title:`Propose a swap`,body:`Request adoption; a person approves it into the System before anything is built with it.`}]})}function b(){return(0,_.jsx)(v,{title:`Access`,icon:m,intro:`This hub runs locally with no accounts yet. Access arrives with the server: who can read or edit each system, who approves changes, and what agents may do.`,stages:[{icon:m,title:`Roles`,body:`Viewer or editor per system or element, with approver as a separate grant. Agents can propose but never approve.`},{icon:f,title:`Audit`,body:`Every grant, approval and rollout recorded, with “view as this person” to check what someone sees.`},{icon:i,title:`Projects`,body:"Per-project tokens for `youiyoux sync`, scoped to the systems that project uses."}]})}function x(){return(0,_.jsx)(c,{icon:n,title:`Nothing here`,actions:(0,_.jsx)(l,{asChild:!0,children:(0,_.jsx)(o,{href:`/`,children:`Go home`})}),children:`This address isn't a page in YouIyouX. Press ⌘K to jump to an element or screen.`})}export{b as AccessScreen,x as NotFoundScreen,y as SourcesScreen};
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./createLucideIcon-CGDJWtKO.js";import{t as n}from"./compass-BkKOZPYe.js";import{t as r}from"./layers-DfzdK_wG.js";import{t as i}from"./monitor-X_lELkcU.js";import{T as a,dt as o,n as s,o as c,s as l}from"./main-Djqho539.js";import{t as u}from"./Badge-CUJUit4d.js";var d={name:`clipboard-check`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]};d.node;var f=t(d),p={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};p.node;var m=t(p),h={name:`replace`,size:24,node:[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]};h.node;var g=t(h),_=e();function v({title:e,icon:t,intro:n,stages:r}){return(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,_.jsx)(s,{title:e,children:(0,_.jsx)(u,{tone:`outline`,children:`Next`})}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 px-8 py-12 animate-enter`,children:[(0,_.jsxs)(`div`,{className:`space-y-3`,children:[(0,_.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-line bg-raised text-muted`,children:(0,_.jsx)(t,{className:`size-4`})}),(0,_.jsx)(`p`,{className:`max-w-xl text-reading text-ink-2`,children:n})]}),(0,_.jsx)(`ol`,{className:`grid gap-3 md:grid-cols-3`,children:r.map((e,t)=>(0,_.jsxs)(`li`,{className:`space-y-2 rounded-lg border border-line p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-small text-muted`,children:[(0,_.jsx)(e.icon,{className:`size-3.5`}),` Step `,t+1]}),(0,_.jsx)(`h3`,{className:`text-heading`,children:e.title}),(0,_.jsx)(`p`,{className:`text-small text-muted`,children:e.body})]},e.title))})]})})]})}function y(){return(0,_.jsx)(v,{title:`Sources`,icon:a,intro:`Sources feed the Library: other design systems, UI kits and references. None are connected yet; each one will add its elements to the Library, where they are browsed and proposed but never built with.`,stages:[{icon:a,title:`Connect`,body:`Point at a source; its elements are ingested with where they came from and when.`},{icon:r,title:`Categorize`,body:`Each element is filed by category and linked to the System elements it could replace.`},{icon:g,title:`Propose a swap`,body:`Request adoption; a person approves it into the System before anything is built with it.`}]})}function b(){return(0,_.jsx)(v,{title:`Access`,icon:m,intro:`This hub runs locally with no accounts yet. Access arrives with the server: who can read or edit each system, who approves changes, and what agents may do.`,stages:[{icon:m,title:`Roles`,body:`Viewer or editor per system or element, with approver as a separate grant. Agents can propose but never approve.`},{icon:f,title:`Audit`,body:`Every grant, approval and rollout recorded, with “view as this person” to check what someone sees.`},{icon:i,title:`Projects`,body:"Per-project tokens for `youiyoux sync`, scoped to the systems that project uses."}]})}function x(){return(0,_.jsx)(c,{icon:n,title:`Nothing here`,actions:(0,_.jsx)(l,{asChild:!0,children:(0,_.jsx)(o,{href:`/`,children:`Go home`})}),children:`This address isn't a page in YouIyouX. Press ⌘K to jump to an element or screen.`})}export{b as AccessScreen,x as NotFoundScreen,y as SourcesScreen};