youiyoux 0.1.10 → 0.1.13

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 (72) hide show
  1. package/dist/chunks/{chunk-HDJ2TOWZ.js → chunk-5I2VHSEN.js} +1 -1
  2. package/dist/chunks/{chunk-T3KNPVQG.js → chunk-DX2NKY2M.js} +4 -4
  3. package/dist/chunks/{chunk-75DBKEAH.js → chunk-EV62TUDV.js} +1119 -619
  4. package/dist/chunks/{chunk-3RP664IP.js → chunk-N5Z5A637.js} +2 -2
  5. package/dist/chunks/{chunk-DWYDHVLZ.js → chunk-NF4OJYKC.js} +106 -66
  6. package/dist/chunks/{chunk-X2YYMHR4.js → chunk-PCLXMWZ2.js} +3 -3
  7. package/dist/chunks/{chunk-OCZJ3JGH.js → chunk-PWGZRP3C.js} +3 -3
  8. package/dist/chunks/{chunk-FLBRX6Y3.js → chunk-XOXF2ILO.js} +1 -1
  9. package/dist/chunks/{chunk-6GITMASZ.js → chunk-ZOQW6LNH.js} +56 -900
  10. package/dist/chunks/chunk-ZWVWENSB.js +899 -0
  11. package/dist/chunks/{src-XTNHB65M.js → src-4QOHR5GC.js} +3 -3
  12. package/dist/chunks/src-624TVB6T.js +55 -0
  13. package/dist/chunks/{src-DPFJ4S2N.js → src-E6ZPFKPR.js} +3 -2
  14. package/dist/chunks/{src-75ODGHE3.js → src-HVYMF4S2.js} +9 -7
  15. package/dist/chunks/{src-BYNWPNRT.js → src-IKDQ2BZO.js} +7 -1
  16. package/dist/chunks/{src-ZG7JU6YJ.js → src-PBM76LFQ.js} +2 -2
  17. package/dist/chunks/{src-6SNQVIZS.js → src-R7JGKOYI.js} +4 -4
  18. package/dist/chunks/{src-PURAHRCR.js → src-YC64NNQ3.js} +2 -2
  19. package/dist/hub/assets/{CandidatePanel-ZzbsyZo3.js → CandidatePanel-DfntneYT.js} +1 -1
  20. package/dist/hub/assets/{CatalogScreen-DDYlvOHy.js → CatalogScreen-kpFYZqX3.js} +1 -1
  21. package/dist/hub/assets/{ChangesScreen-C8_EyHgJ.js → ChangesScreen-Chu-Ui1B.js} +1 -1
  22. package/dist/hub/assets/{CheatSheet-DfcPiXdS.js → CheatSheet-B1dXTYTW.js} +1 -1
  23. package/dist/hub/assets/{CommandPalette-DfFkDTVg.js → CommandPalette-LBZHJ659.js} +1 -1
  24. package/dist/hub/assets/{DiscoverScreen-D6NTgEgk.js → DiscoverScreen-Yd3gVUG4.js} +2 -2
  25. package/dist/hub/assets/DraftEditor-QH9Sa_Uc.js +5 -0
  26. package/dist/hub/assets/{GapsScreen-CqedCj4z.js → GapsScreen-DPYGlNnA.js} +1 -1
  27. package/dist/hub/assets/{HomeScreen-CIj1QTkw.js → HomeScreen-BCPPk7mz.js} +1 -1
  28. package/dist/hub/assets/{InventoryScreen-CyvFXa2_.js → InventoryScreen-SleB733C.js} +1 -1
  29. package/dist/hub/assets/{LibraryScreen-C4WU0f42.js → LibraryScreen-BVXhOVPU.js} +1 -1
  30. package/dist/hub/assets/{Opened-CeRWkA7c.js → Opened-CJyMbxqV.js} +1 -1
  31. package/dist/hub/assets/OrgApp-Dxs_7CxZ.js +1 -0
  32. package/dist/hub/assets/{Preview-CgW-FMB7.js → Preview-DWFP0BIe.js} +1 -1
  33. package/dist/hub/assets/{RuleDetail-BDhZ1gCd.js → RuleDetail-C2fTlLJL.js} +3 -3
  34. package/dist/hub/assets/{RulesScreen-D3rSo_z2.js → RulesScreen-BABeAGJg.js} +3 -3
  35. package/dist/hub/assets/{ScreenImage-DLeA3nRh.js → ScreenImage-CyhKm_nj.js} +1 -1
  36. package/dist/hub/assets/ScreensScreen-8Ih8byGy.js +1 -0
  37. package/dist/hub/assets/{SearchField-DtEgq9-Q.js → SearchField-hF-6-YDM.js} +1 -1
  38. package/dist/hub/assets/{ServiceDown-Bn6AcA3J.js → ServiceDown-S4ya0Cob.js} +1 -1
  39. package/dist/hub/assets/{SpecimenCapture-p6YErF5y.js → SpecimenCapture-e_pgT4Sp.js} +1 -1
  40. package/dist/hub/assets/{Specimens-DuaE0WeO.js → Specimens-D_9hjlJH.js} +2 -2
  41. package/dist/hub/assets/{StackScreen-DHDulDng.js → StackScreen-J2FQilLW.js} +1 -1
  42. package/dist/hub/assets/{StubScreens-CmhVNX_Z.js → StubScreens-DAkMph3i.js} +1 -1
  43. package/dist/hub/assets/StyleScreen-C5WytSZU.js +1 -0
  44. package/dist/hub/assets/{Tabs-Cbh9BCKW.js → Tabs-DU-fFRDV.js} +1 -1
  45. package/dist/hub/assets/{TokenDetail-BICobLK1.js → TokenDetail-CDY1xxb9.js} +1 -1
  46. package/dist/hub/assets/{TokensScreen-CyTHn55q.js → TokensScreen-Sx4aICWk.js} +1 -1
  47. package/dist/hub/assets/{WorkspaceScreen-uPWqfklh.js → WorkspaceScreen-CzZ16fPZ.js} +1 -1
  48. package/dist/hub/assets/{client-BXHiuV_w.js → client-Bdgr12LP.js} +1 -1
  49. package/dist/hub/assets/{discover-CFhyKler.js → discover-va2KFuK_.js} +1 -1
  50. package/dist/hub/assets/{dist-DYNYuTjI.js → dist-C8tf4g8c.js} +1 -1
  51. package/dist/hub/assets/{dist-VmEpVQjP.js → dist-CC_p8DIj.js} +1 -1
  52. package/dist/hub/assets/{dist-C6iTWL0b.js → dist-YTWqg5sS.js} +1 -1
  53. package/dist/hub/assets/{family-tiles-B8_onXUi.js → family-tiles-qaK1-_c8.js} +1 -1
  54. package/dist/hub/assets/main-cvOFSjox.js +2 -0
  55. package/dist/hub/assets/main-pNY4iNRo.css +2 -0
  56. package/dist/hub/assets/{try-live-CX04d2L2.js → try-live-Iys3nCBG.js} +1 -1
  57. package/dist/hub/assets/when-COrv5lkZ.js +1 -0
  58. package/dist/hub/assets/{workflow-DbBdiOmA.js → workflow-C53UBmRZ.js} +1 -1
  59. package/dist/hub/index.html +2 -2
  60. package/dist/hub-previews.js +6 -5
  61. package/dist/hub-server.js +3 -3
  62. package/dist/hub-snapshot.js +1 -1
  63. package/dist/schema/youi.org.schema.json +438 -0
  64. package/dist/schema/youi.record.schema.json +338 -0
  65. package/dist/youi.js +7 -6
  66. package/dist/youiyoux.js +7 -6
  67. package/package.json +4 -4
  68. package/dist/hub/assets/DraftEditor-CUNGYbg0.js +0 -5
  69. package/dist/hub/assets/ScreensScreen-bGuFIyWj.js +0 -1
  70. package/dist/hub/assets/StyleScreen-LwTqfGID.js +0 -1
  71. package/dist/hub/assets/main-7snyIdoi.css +0 -2
  72. package/dist/hub/assets/main-CfbpuT4Y.js +0 -2
@@ -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,i as a,o,r as s,t as c}from"./CandidatePanel-ZzbsyZo3.js";import{t as l}from"./x-MLbFVa4v.js";import{t as u}from"./clsx-DB0hHKMi.js";import{V as d,s as f}from"./main-CfbpuT4Y.js";import{n as p}from"./inventory-BI8QBdar.js";import{useParts as m}from"./inventory-source-lZYzcA8O.js";import{t as h}from"./Segmented-Dzi1x49S.js";import{s as g}from"./discover-CFhyKler.js";import{A as _,S as v,h as y,i as b,m as x,n as S,p as C,r as w,y as T}from"./Specimens-DuaE0WeO.js";import{n as E,t as D}from"./family-tiles-B8_onXUi.js";var O={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};O.node;var k=r(O),A=e(t(),1),j=n(),M=5,N=e=>e==null?`?`:e===9999?`pill`:`${e}px`;function P(e,t,n){let r=e.shape,i=t.fit.unthemed.filter(e=>/--color-|fixed colours/.test(e)).length;return[[`Role`,p[e.role],n??`not given`],[`Radius`,N(r.radius),N(t.fit.radius)],[`Type size`,N(r.fontSize),N(t.fit.type.item)],[`Padding`,r.paddingY===null&&r.paddingX===null?`?`:`${N(r.paddingY)} ${N(r.paddingX)}`,`not measured`],[`Colours`,`your tokens`,i===0?`your tokens`:`some not in your theme`],[`Licence`,`yours`,t.license===`unknown`?`licence unknown`:t.license],[`Source`,e.projects.join(`, `),t.entry.source.ref??t.name]].map(([e,t,n])=>({label:e,a:t,b:n,differs:t!==n}))}function F({family:e,familyName:t,familyTiles:n,answer:r,scheme:i,role:s}){let c=o(r.id),[l,d]=(0,A.useState)(`overlay`),[f,p]=(0,A.useState)(50),m=(0,A.useRef)(null),g=(0,A.useRef)(null),v=a(r,c,i,`${r.id}:compare`),y=P(e,r,s),x=t,C=r.entry.source.ref??r.name,w=e=>{let t=m.current?.getBoundingClientRect();t&&p(_(e,t.left,t.width))},E=e=>{(e.pointerType!==`mouse`||e.button===0)&&(e.currentTarget.setPointerCapture?.(e.pointerId),g.current=e.pointerId,w(e.clientX))},D=e=>{g.current===e.pointerId&&w(e.clientX)},O=e=>{g.current===e.pointerId&&(g.current=null)};return(0,j.jsxs)(`article`,{"aria-labelledby":`pinned-${r.id}`,className:`min-w-0 space-y-3 rounded-lg border border-line bg-surface p-4`,"data-pinned-compare":r.id,children:[(0,j.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,j.jsxs)(`h3`,{id:`pinned-${r.id}`,className:`min-w-0 truncate text-heading text-ink`,children:[x,` `,(0,j.jsx)(`span`,{className:`text-muted`,children:`vs`}),` `,C]}),(0,j.jsx)(h,{className:`ml-auto`,label:`Compare as`,touch:!0,value:l,onChange:d,options:[{value:`overlay`,label:`Overlay`},{value:`side`,label:`Side by side`}]})]}),l===`overlay`?(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsxs)(`div`,{className:`mx-auto flex max-w-80 justify-between gap-3 text-caption text-muted`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:`← yours`}),(0,j.jsxs)(`span`,{className:`truncate`,children:[C,` →`]})]}),(0,j.jsxs)(`div`,{ref:m,className:`relative mx-auto max-w-80 touch-none select-none overflow-hidden rounded-md`,style:{height:136},onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,"data-testid":`pinned-stage`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`bottom`,children:(0,j.jsx)(S,{tiles:n,scheme:i,size:`large`,as:`div`,caption:!1})}),(0,j.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`top`,style:{clipPath:T(f)},children:(0,j.jsx)(b,{tile:v,scheme:i,size:`large`,as:`div`,caption:!1})}),(0,j.jsxs)(`div`,{role:`slider`,tabIndex:0,"aria-label":`Wipe between ${x} and ${C}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f,"aria-valuetext":`${Math.round(f)}% from the left`,onKeyDown:e=>{let t={ArrowLeft:f-M,ArrowDown:f-M,ArrowRight:f+M,ArrowUp:f+M,PageDown:f-50,PageUp:f+50,Home:0,End:100}[e.key];t!==void 0&&(e.preventDefault(),p(Math.min(100,Math.max(0,t))))},className:`absolute inset-y-0 w-6 -translate-x-1/2 cursor-ew-resize rounded-md outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus focus-visible:outline-solid focus-visible:[&>span]:bg-focus max-md:w-11`,style:{left:`${f}%`},children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent`}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-1/2 left-1/2 size-4 -translate-1/2 rounded-full border-2 border-surface bg-accent shadow-raise`})]})]})]}):(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,"data-testid":`pinned-side-by-side`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,j.jsx)(`p`,{className:`truncate text-caption text-muted`,children:`Yours`}),(0,j.jsx)(S,{tiles:n,scheme:i,size:`large`,as:`div`,caption:!1})]}),(0,j.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,j.jsx)(`p`,{className:`truncate text-caption text-muted`,children:C}),(0,j.jsx)(b,{tile:v,scheme:i,size:`large`,as:`div`,caption:!1})]})]}),(0,j.jsxs)(`table`,{className:`w-full border-collapse text-left text-small`,"aria-label":`Attributes`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`border-b border-line text-muted`,children:[(0,j.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:`Attribute`}),(0,j.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:`Yours`}),(0,j.jsx)(`th`,{scope:`col`,className:`h-8 font-medium`,children:C})]})}),(0,j.jsx)(`tbody`,{children:y.map(e=>(0,j.jsxs)(`tr`,{"data-differs":e.differs||void 0,className:u(`border-b border-line last:border-0`,e.differs&&`bg-warning-soft`),children:[(0,j.jsxs)(`th`,{scope:`row`,className:u(`py-1.5 pr-3 font-normal`,e.differs?`text-warning`:`text-muted`),children:[e.label,e.differs&&(0,j.jsx)(`span`,{className:`sr-only`,children:` (differs)`})]}),(0,j.jsx)(`td`,{className:`tabular py-1.5 pr-3 text-ink`,children:e.a}),(0,j.jsx)(`td`,{className:`tabular py-1.5 text-ink`,children:e.b})]},e.label))})]})]})}var I={index:{roles:[],projects:[],extras:``},get:()=>({status:`idle`}),load:()=>void 0,subscribe:()=>()=>void 0,cssUrl:e=>e};function L(e,t,n){let r=(n.status===`ready`?n.value:null)??I,i=r.index.roles.find(t=>t.role===e.replace(/-\d+$/,``)),a=(0,A.useMemo)(()=>i?Object.values(i.chunks):[],[i]),o=m(r,a,a.length>0),s=(0,A.useMemo)(()=>i?[r.index.extras]:[],[i,r]),[c]=m(r,s,s.length>0),l=o.length>0&&o.every(e=>e.status===`ready`),u=o.map(e=>e.status).join(`|`),d=(0,A.useMemo)(()=>l?o.map(e=>e.value):[],[u,a]),f=c?.status===`ready`?c.value:null;return(0,A.useMemo)(()=>{let a=d.flatMap(e=>e.families).find(t=>t.id===e)??null;return(n.status===`ready`||n.status===`error`)&&(r===I||!i||l&&!a)?{pinned:null,missing:!0}:a?{pinned:{family:a,name:f?v(d,new y(f,null)).find(t=>t.family.id===e)?.name??a.id:a.id,tiles:E(D(a,d,r,t),a,`pinned:${a.id}`)},missing:!1}:{pinned:null,missing:!1}},[d,f,e,n.status,l,i,t,r])}function R({id:e,opened:t,scheme:n,role:r,inventory:i,scroller:a,onClear:o,onProject:s}){let c=d(),{pinned:u,missing:p}=L(e,n,i??c),m=u?.family.projects[0]??null;return(0,A.useEffect)(()=>s(m),[m,s]),(0,j.jsxs)(w.Provider,{value:a,children:[(0,j.jsxs)(`section`,{"aria-label":`Pinned family`,className:`flex flex-wrap items-center gap-4 rounded-lg border border-line bg-raised p-3`,"data-pinned":e,children:[(0,j.jsx)(`div`,{className:`w-44 shrink-0 max-sm:w-full`,children:u?(0,j.jsx)(S,{tiles:u.tiles,scheme:n,as:`div`,caption:!1}):null}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,j.jsxs)(`p`,{className:`flex items-center gap-1.5 text-small font-medium text-ink`,children:[(0,j.jsx)(k,{"aria-hidden":!0,className:`size-3.5 text-muted`}),` Finding alternatives for `,u?u.name:e]}),(0,j.jsx)(`p`,{className:`text-small text-muted`,children:p?`The inventory has no family ${e}.`:u?`${u.family.looks} ${u.family.looks===1?`use`:`uses`} in ${u.family.projects.join(`, `)}. Open a candidate to compare it beside this one, with the slider.`:`Loading the family…`})]}),(0,j.jsxs)(f,{variant:`ghost`,size:`sm`,onClick:o,className:`max-md:h-11`,children:[(0,j.jsx)(l,{}),` Unpin`]})]}),u&&t.length>0&&(0,j.jsxs)(`section`,{"aria-labelledby":`discover-compare`,className:`mt-6 space-y-3`,children:[(0,j.jsxs)(`h2`,{id:`discover-compare`,className:`text-heading`,children:[`Beside your `,u.name]}),(0,j.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:t.map(e=>(0,j.jsx)(z,{id:e,project:m,pinned:u,scheme:n,role:r},e))})]})]})}function z({id:e,project:t,pinned:n,scheme:r,role:a}){let o=i(e,t);return o===null?(0,j.jsxs)(`p`,{className:`rounded-lg border border-line p-4 text-small text-faint`,children:[`Fetching `,e,`…`]}):o.status===`error`||o.answer.error?(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-line-strong p-4 text-small text-muted`,children:o.status===`error`?o.message:o.answer.error}):(0,j.jsx)(F,{family:n.family,familyName:n.name,familyTiles:n.tiles,answer:o.answer,scheme:r,role:a?p[a]??a:null})}function B({id:e,project:t,onFail:n}){let r=i(e,t);return r?.status!==`ready`||r.answer.error?null:(0,j.jsx)(s,{answer:r.answer,onFail:t=>n(e,t)})}function V({openHit:e,opened:t,project:n,scheme:r,family:a,onClose:o}){let s=x(),[l,u]=(0,A.useState)({}),d=(0,A.useCallback)((e,t)=>u(n=>n[e]?n:{...n,[e]:t}),[]),f=i(e?e.id:null,n);return(0,j.jsxs)(j.Fragment,{children:[t.map(e=>(0,j.jsx)(B,{id:e,project:n,onFail:d},e)),(0,j.jsx)(C,{open:e!==null,onOpenChange:e=>!e&&o(),variant:s?`drawer`:`sheet`,testId:`candidate-drawer`,title:e?e.title??e.name:``,description:e?`${g(e)} · ${e.kind}`:void 0,children:(0,j.jsx)(w.Provider,{value:null,children:e&&(0,j.jsx)(c,{hit:e,state:f,scheme:r,family:a,failure:l[e.id]??null})})})]})}export{V as CandidateLayer,R as PinnedSection};
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,i as a,o,r as s,t as c}from"./CandidatePanel-DfntneYT.js";import{t as l}from"./x-MLbFVa4v.js";import{t as u}from"./clsx-DB0hHKMi.js";import{V as d,s as f}from"./main-cvOFSjox.js";import{n as p}from"./inventory-BI8QBdar.js";import{useParts as m}from"./inventory-source-lZYzcA8O.js";import{t as h}from"./Segmented-Dzi1x49S.js";import{s as g}from"./discover-va2KFuK_.js";import{A as _,S as v,h as y,i as b,m as x,n as S,p as C,r as w,y as T}from"./Specimens-D_9hjlJH.js";import{n as E,t as D}from"./family-tiles-qaK1-_c8.js";var O={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};O.node;var k=r(O),A=e(t(),1),j=n(),M=5,N=e=>e==null?`?`:e===9999?`pill`:`${e}px`;function P(e,t,n){let r=e.shape,i=t.fit.unthemed.filter(e=>/--color-|fixed colours/.test(e)).length;return[[`Role`,p[e.role],n??`not given`],[`Radius`,N(r.radius),N(t.fit.radius)],[`Type size`,N(r.fontSize),N(t.fit.type.item)],[`Padding`,r.paddingY===null&&r.paddingX===null?`?`:`${N(r.paddingY)} ${N(r.paddingX)}`,`not measured`],[`Colours`,`your tokens`,i===0?`your tokens`:`some not in your theme`],[`Licence`,`yours`,t.license===`unknown`?`licence unknown`:t.license],[`Source`,e.projects.join(`, `),t.entry.source.ref??t.name]].map(([e,t,n])=>({label:e,a:t,b:n,differs:t!==n}))}function F({family:e,familyName:t,familyTiles:n,answer:r,scheme:i,role:s}){let c=o(r.id),[l,d]=(0,A.useState)(`overlay`),[f,p]=(0,A.useState)(50),m=(0,A.useRef)(null),g=(0,A.useRef)(null),v=a(r,c,i,`${r.id}:compare`),y=P(e,r,s),x=t,C=r.entry.source.ref??r.name,w=e=>{let t=m.current?.getBoundingClientRect();t&&p(_(e,t.left,t.width))},E=e=>{(e.pointerType!==`mouse`||e.button===0)&&(e.currentTarget.setPointerCapture?.(e.pointerId),g.current=e.pointerId,w(e.clientX))},D=e=>{g.current===e.pointerId&&w(e.clientX)},O=e=>{g.current===e.pointerId&&(g.current=null)};return(0,j.jsxs)(`article`,{"aria-labelledby":`pinned-${r.id}`,className:`min-w-0 space-y-3 rounded-lg border border-line bg-surface p-4`,"data-pinned-compare":r.id,children:[(0,j.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,j.jsxs)(`h3`,{id:`pinned-${r.id}`,className:`min-w-0 truncate text-heading text-ink`,children:[x,` `,(0,j.jsx)(`span`,{className:`text-muted`,children:`vs`}),` `,C]}),(0,j.jsx)(h,{className:`ml-auto`,label:`Compare as`,touch:!0,value:l,onChange:d,options:[{value:`overlay`,label:`Overlay`},{value:`side`,label:`Side by side`}]})]}),l===`overlay`?(0,j.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,j.jsxs)(`div`,{className:`mx-auto flex max-w-80 justify-between gap-3 text-caption text-muted`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:`← yours`}),(0,j.jsxs)(`span`,{className:`truncate`,children:[C,` →`]})]}),(0,j.jsxs)(`div`,{ref:m,className:`relative mx-auto max-w-80 touch-none select-none overflow-hidden rounded-md`,style:{height:136},onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,"data-testid":`pinned-stage`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`bottom`,children:(0,j.jsx)(S,{tiles:n,scheme:i,size:`large`,as:`div`,caption:!1})}),(0,j.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`top`,style:{clipPath:T(f)},children:(0,j.jsx)(b,{tile:v,scheme:i,size:`large`,as:`div`,caption:!1})}),(0,j.jsxs)(`div`,{role:`slider`,tabIndex:0,"aria-label":`Wipe between ${x} and ${C}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f,"aria-valuetext":`${Math.round(f)}% from the left`,onKeyDown:e=>{let t={ArrowLeft:f-M,ArrowDown:f-M,ArrowRight:f+M,ArrowUp:f+M,PageDown:f-50,PageUp:f+50,Home:0,End:100}[e.key];t!==void 0&&(e.preventDefault(),p(Math.min(100,Math.max(0,t))))},className:`absolute inset-y-0 w-6 -translate-x-1/2 cursor-ew-resize rounded-md outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus focus-visible:outline-solid focus-visible:[&>span]:bg-focus max-md:w-11`,style:{left:`${f}%`},children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent`}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-1/2 left-1/2 size-4 -translate-1/2 rounded-full border-2 border-surface bg-accent shadow-raise`})]})]})]}):(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,"data-testid":`pinned-side-by-side`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,j.jsx)(`p`,{className:`truncate text-caption text-muted`,children:`Yours`}),(0,j.jsx)(S,{tiles:n,scheme:i,size:`large`,as:`div`,caption:!1})]}),(0,j.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,j.jsx)(`p`,{className:`truncate text-caption text-muted`,children:C}),(0,j.jsx)(b,{tile:v,scheme:i,size:`large`,as:`div`,caption:!1})]})]}),(0,j.jsxs)(`table`,{className:`w-full border-collapse text-left text-small`,"aria-label":`Attributes`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`border-b border-line text-muted`,children:[(0,j.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:`Attribute`}),(0,j.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:`Yours`}),(0,j.jsx)(`th`,{scope:`col`,className:`h-8 font-medium`,children:C})]})}),(0,j.jsx)(`tbody`,{children:y.map(e=>(0,j.jsxs)(`tr`,{"data-differs":e.differs||void 0,className:u(`border-b border-line last:border-0`,e.differs&&`bg-warning-soft`),children:[(0,j.jsxs)(`th`,{scope:`row`,className:u(`py-1.5 pr-3 font-normal`,e.differs?`text-warning`:`text-muted`),children:[e.label,e.differs&&(0,j.jsx)(`span`,{className:`sr-only`,children:` (differs)`})]}),(0,j.jsx)(`td`,{className:`tabular py-1.5 pr-3 text-ink`,children:e.a}),(0,j.jsx)(`td`,{className:`tabular py-1.5 text-ink`,children:e.b})]},e.label))})]})]})}var I={index:{roles:[],projects:[],extras:``},get:()=>({status:`idle`}),load:()=>void 0,subscribe:()=>()=>void 0,cssUrl:e=>e};function L(e,t,n){let r=(n.status===`ready`?n.value:null)??I,i=r.index.roles.find(t=>t.role===e.replace(/-\d+$/,``)),a=(0,A.useMemo)(()=>i?Object.values(i.chunks):[],[i]),o=m(r,a,a.length>0),s=(0,A.useMemo)(()=>i?[r.index.extras]:[],[i,r]),[c]=m(r,s,s.length>0),l=o.length>0&&o.every(e=>e.status===`ready`),u=o.map(e=>e.status).join(`|`),d=(0,A.useMemo)(()=>l?o.map(e=>e.value):[],[u,a]),f=c?.status===`ready`?c.value:null;return(0,A.useMemo)(()=>{let a=d.flatMap(e=>e.families).find(t=>t.id===e)??null;return(n.status===`ready`||n.status===`error`)&&(r===I||!i||l&&!a)?{pinned:null,missing:!0}:a?{pinned:{family:a,name:f?v(d,new y(f,null)).find(t=>t.family.id===e)?.name??a.id:a.id,tiles:E(D(a,d,r,t),a,`pinned:${a.id}`)},missing:!1}:{pinned:null,missing:!1}},[d,f,e,n.status,l,i,t,r])}function R({id:e,opened:t,scheme:n,role:r,inventory:i,scroller:a,onClear:o,onProject:s}){let c=d(),{pinned:u,missing:p}=L(e,n,i??c),m=u?.family.projects[0]??null;return(0,A.useEffect)(()=>s(m),[m,s]),(0,j.jsxs)(w.Provider,{value:a,children:[(0,j.jsxs)(`section`,{"aria-label":`Pinned family`,className:`flex flex-wrap items-center gap-4 rounded-lg border border-line bg-raised p-3`,"data-pinned":e,children:[(0,j.jsx)(`div`,{className:`w-44 shrink-0 max-sm:w-full`,children:u?(0,j.jsx)(S,{tiles:u.tiles,scheme:n,as:`div`,caption:!1}):null}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,j.jsxs)(`p`,{className:`flex items-center gap-1.5 text-small font-medium text-ink`,children:[(0,j.jsx)(k,{"aria-hidden":!0,className:`size-3.5 text-muted`}),` Finding alternatives for `,u?u.name:e]}),(0,j.jsx)(`p`,{className:`text-small text-muted`,children:p?`The inventory has no family ${e}.`:u?`${u.family.looks} ${u.family.looks===1?`use`:`uses`} in ${u.family.projects.join(`, `)}. Open a candidate to compare it beside this one, with the slider.`:`Loading the family…`})]}),(0,j.jsxs)(f,{variant:`ghost`,size:`sm`,onClick:o,className:`max-md:h-11`,children:[(0,j.jsx)(l,{}),` Unpin`]})]}),u&&t.length>0&&(0,j.jsxs)(`section`,{"aria-labelledby":`discover-compare`,className:`mt-6 space-y-3`,children:[(0,j.jsxs)(`h2`,{id:`discover-compare`,className:`text-heading`,children:[`Beside your `,u.name]}),(0,j.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:t.map(e=>(0,j.jsx)(z,{id:e,project:m,pinned:u,scheme:n,role:r},e))})]})]})}function z({id:e,project:t,pinned:n,scheme:r,role:a}){let o=i(e,t);return o===null?(0,j.jsxs)(`p`,{className:`rounded-lg border border-line p-4 text-small text-faint`,children:[`Fetching `,e,`…`]}):o.status===`error`||o.answer.error?(0,j.jsx)(`p`,{className:`rounded-lg border border-dashed border-line-strong p-4 text-small text-muted`,children:o.status===`error`?o.message:o.answer.error}):(0,j.jsx)(F,{family:n.family,familyName:n.name,familyTiles:n.tiles,answer:o.answer,scheme:r,role:a?p[a]??a:null})}function B({id:e,project:t,onFail:n}){let r=i(e,t);return r?.status!==`ready`||r.answer.error?null:(0,j.jsx)(s,{answer:r.answer,onFail:t=>n(e,t)})}function V({openHit:e,opened:t,project:n,scheme:r,family:a,onClose:o}){let s=x(),[l,u]=(0,A.useState)({}),d=(0,A.useCallback)((e,t)=>u(n=>n[e]?n:{...n,[e]:t}),[]),f=i(e?e.id:null,n);return(0,j.jsxs)(j.Fragment,{children:[t.map(e=>(0,j.jsx)(B,{id:e,project:n,onFail:d},e)),(0,j.jsx)(C,{open:e!==null,onOpenChange:e=>!e&&o(),variant:s?`drawer`:`sheet`,testId:`candidate-drawer`,title:e?e.title??e.name:``,description:e?`${g(e)} · ${e.kind}`:void 0,children:(0,j.jsx)(w.Provider,{value:null,children:e&&(0,j.jsx)(c,{hit:e,state:f,scheme:r,family:a,failure:l[e.id]??null})})})]})}export{V as CandidateLayer,R as PinnedSection};
@@ -0,0 +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{n as i,o as a,r as o,s}from"./main-cvOFSjox.js";import{t as c}from"./when-COrv5lkZ.js";import{n as l,t as u}from"./plural-BbGQPQKA.js";import{t as d}from"./Badge-CUJUit4d.js";import{Facts as f,Next as p,t as m}from"./WorkspaceScreen-CzZ16fPZ.js";import{o as h,r as g}from"./Field-LwrJXoOs.js";var _={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};_.node;var v=r(_),y={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};y.node;var b=r(y),x=e(t(),1),S=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function C(e,t,n){let r=await fetch(t,{method:e,credentials:`same-origin`,headers:n===void 0?{}:{"content-type":`application/json`},...n===void 0?{}:{body:JSON.stringify(n)}}),i=await r.json().catch(()=>({}));if(!r.ok)throw new S(r.status,typeof i.error==`string`?i.error:`the hub answered ${r.status}`);return i}var w={view:e=>C(`GET`,e),signIn:e=>C(`POST`,`/api/session`,{key:e}),signOut:()=>C(`DELETE`,`/api/session`)},T=n(),E=`font-mono text-mono-sm`,D=e=>`error`in e;function O(e,t,n){return t===null?`var(--color-line-strong)`:t===e.latest?`var(--color-accent)`:`color-mix(in srgb, var(--color-accent) ${n<=1?55:25}%, var(--color-surface))`}function k({system:e}){let t=e.versions.reduce((e,t)=>e+t.products.length,0),n=e.versions.find(t=>t.version===e.latest)?.products.length??0;return(0,T.jsxs)(`section`,{className:`space-y-3`,"aria-label":`${e.name} adoption`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,T.jsx)(`h3`,{className:`text-body font-medium text-ink`,children:e.name}),(0,T.jsx)(`span`,{className:`${E} text-muted`,children:e.id}),(0,T.jsxs)(`span`,{className:`tabular text-small text-ink-2`,children:[n,` of `,l(t,`product`),` on the newest, `,(0,T.jsxs)(`span`,{className:`${E} text-ink`,children:[`v`,e.latest]})]})]}),(0,T.jsx)(`div`,{className:`flex h-2 overflow-hidden rounded-full bg-raised`,role:`img`,"aria-label":e.versions.map(e=>`${e.version?`v${e.version}`:`never synced`}: ${e.products.length}`).join(`, `),children:e.versions.map((n,r)=>(0,T.jsx)(`span`,{className:`h-full border-r border-surface last:border-r-0`,style:{width:`${n.products.length/t*100}%`,background:O(e,n.version,r)}},n.version??`never`))}),(0,T.jsx)(`ul`,{className:`space-y-1`,children:e.versions.map((t,n)=>(0,T.jsxs)(`li`,{className:`grid grid-cols-[auto_6rem_3rem_minmax(0,1fr)] items-baseline gap-3 text-small max-sm:grid-cols-[auto_5rem_2.5rem_minmax(0,1fr)]`,children:[(0,T.jsx)(`span`,{className:`size-2 translate-y-[-1px] rounded-full`,style:{background:O(e,t.version,n)},"aria-hidden":!0}),(0,T.jsx)(`span`,{className:t.version?`${E} text-ink`:`text-muted`,children:t.version?`v${t.version}`:`never synced`}),(0,T.jsx)(`span`,{className:`tabular text-ink-2`,children:t.products.length}),(0,T.jsx)(`span`,{className:`truncate text-muted`,children:t.products.map(e=>`${e.repo} · ${e.id}`).join(`, `)})]},t.version??`never`))})]})}function A({entry:e,latest:t}){if(D(e))return(0,T.jsxs)(`li`,{className:`space-y-2 px-4 py-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`${E} text-ink`,children:e.root}),(0,T.jsx)(d,{tone:`danger`,children:`Could not be read`})]}),(0,T.jsx)(`p`,{className:`text-small text-ink-2`,children:e.error}),(0,T.jsx)(p,{next:e.next})]});let n=t.get(e.system.id),r=e.lock?.systemVersion??null;return(0,T.jsxs)(`li`,{className:`space-y-2 px-4 py-3`,"data-product":e.id,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,T.jsx)(`span`,{className:`text-body font-medium text-ink`,children:e.id}),e.root!==`.`&&e.root!==e.id&&(0,T.jsx)(`span`,{className:`${E} text-muted`,children:e.root}),r!==null&&r!==n&&(0,T.jsxs)(d,{tone:`warning`,children:[`Synced v`,r,`; v`,n,` is out`]})]}),(0,T.jsx)(f,{status:e}),(0,T.jsx)(p,{next:e.next})]})}function j({repo:e,latest:t}){return(0,T.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line`,"aria-label":e.repo,children:[(0,T.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1 border-b border-line bg-raised px-4 py-2`,children:[(0,T.jsx)(`h3`,{className:`${E} text-ink`,children:e.repo}),(0,T.jsxs)(`span`,{className:`text-small text-muted`,children:[e.commit&&(0,T.jsx)(`span`,{className:E,children:e.commit.slice(0,7)}),e.ref&&(0,T.jsxs)(T.Fragment,{children:[` on `,e.ref]}),` · recorded `,c(e.generatedAt)]})]}),(0,T.jsx)(`ul`,{className:`divide-y divide-line`,children:e.products.map(e=>(0,T.jsx)(A,{entry:e,latest:t},D(e)?e.root:e.id))})]})}function M({view:e}){let{totals:t}=e,n=t.products-t.unreadable;return(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(`p`,{className:`max-w-3xl text-title text-ink-2`,children:[(0,T.jsx)(`span`,{className:`tabular text-ink`,children:l(t.products,`product`)}),` in `,(0,T.jsx)(`span`,{className:`tabular text-ink`,children:l(t.repos,`repository`,`repositories`)}),` follow `,(0,T.jsx)(`span`,{className:`tabular text-ink`,children:l(e.systems.length,`System`)}),`.`,` `,n>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`tabular text-ink`,children:t.behind}),` `,t.behind===1?`is`:`are`,` behind `,u(t.behind,`its`,`their`),` System's newest release, and `,(0,T.jsx)(`span`,{className:`tabular ${t.failing>0?`text-danger`:`text-ink`}`,children:t.failing}),` `,t.failing===1?`fails its`:`fail their`,` check.`]}),t.unreadable>0&&(0,T.jsxs)(`span`,{className:`text-danger`,children:[` `,l(t.unreadable,`product`),` could not be read.`]})]}),(0,T.jsxs)(`p`,{className:`text-small text-muted`,children:[`As CI last recorded each repository (youiyoux record). Read `,c(e.generatedAt),`.`]})]})}function N({onSignedIn:e}){let[t,n]=(0,x.useState)(``),[r,i]=(0,x.useState)(),[a,o]=(0,x.useState)(!1);return(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 max-sm:p-4`,children:(0,T.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),o(!0),i(void 0),w.signIn(t).then(()=>e(),e=>{i(e instanceof Error?e.message:String(e)),o(!1)})},className:`w-full max-w-sm space-y-4 animate-enter`,children:[(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(`h2`,{className:`text-heading`,children:`Sign in to the hub`}),(0,T.jsx)(`p`,{className:`text-small text-muted`,children:`Where each product stands with its design system, as CI records it. Whoever runs this hub has its view key.`})]}),(0,T.jsx)(g,{label:`View key`,error:r,children:(e,i)=>(0,T.jsx)(h,{id:e,type:`password`,autoComplete:`current-password`,value:t,onChange:e=>n(e.target.value),"aria-describedby":i,"aria-invalid":r?!0:void 0,required:!0,autoFocus:!0})}),(0,T.jsx)(s,{type:`submit`,variant:`primary`,disabled:a||t.length===0,className:`w-full`,children:a?`Signing in…`:`Sign in`})]})})}function P(){return(0,T.jsx)(a,{icon:v,title:`No records yet`,children:(0,T.jsxs)(`p`,{children:[`In each repository, `,(0,T.jsx)(`span`,{className:`${E} text-ink`,children:`youiyoux hooks install --record`}),` writes a workflow that sends its record here on every push to the default branch. Set `,(0,T.jsx)(`span`,{className:`${E} text-ink`,children:`YOUIYOUX_HUB_URL`}),` and `,(0,T.jsx)(`span`,{className:`${E} text-ink`,children:`YOUIYOUX_HUB_TOKEN`}),` as its secrets.`]})})}function F({api:e}){let[t,n]=(0,x.useState)({state:`loading`}),r=(0,x.useCallback)(()=>{w.view(e).then(e=>n({state:`ready`,view:e}),e=>n(e instanceof S&&e.status===401?{state:`signed-out`}:{state:`failed`,message:e instanceof Error?e.message:String(e)}))},[e]);(0,x.useEffect)(r,[r]);let a=()=>void w.signOut().finally(()=>n({state:`signed-out`})),c=t.state===`ready`?t.view:null,l=new Map(c?.systems.map(e=>[e.id,e.latest])??[]);return(0,T.jsx)(`div`,{className:`flex h-dvh overflow-hidden bg-canvas`,children:(0,T.jsx)(`main`,{className:`flex min-w-0 flex-1 p-1.5 max-md:p-0`,children:(0,T.jsxs)(`div`,{className:`relative flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-line bg-surface max-md:rounded-none max-md:border-0`,children:[(0,T.jsx)(i,{title:`Organisation`,count:c?.totals.repos,children:c&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(s,{size:`sm`,variant:`ghost`,onClick:r,children:[(0,T.jsx)(m,{}),` Read again`]}),(0,T.jsxs)(s,{size:`sm`,variant:`ghost`,onClick:a,children:[(0,T.jsx)(b,{}),` Sign out`]})]})}),(0,T.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:t.state===`loading`?(0,T.jsx)(o,{}):t.state===`signed-out`?(0,T.jsx)(N,{onSignedIn:r}):t.state===`failed`?(0,T.jsx)(`p`,{role:`alert`,className:`px-8 py-8 text-small text-danger`,children:t.message}):t.view.repos.length===0?(0,T.jsx)(P,{}):(0,T.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-10 px-8 py-10 animate-enter max-md:px-4 max-md:py-6`,children:[(0,T.jsx)(M,{view:t.view}),t.view.systems.length>0&&(0,T.jsxs)(`div`,{className:`space-y-6`,children:[(0,T.jsx)(`h2`,{className:`text-heading`,children:`Adoption by version`}),t.view.systems.map(e=>(0,T.jsx)(k,{system:e},e.id))]}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsx)(`h2`,{className:`text-heading`,children:`Repositories`}),t.view.repos.map(e=>(0,T.jsx)(j,{repo:e,latest:l},e.repo))]})]})})]})})})}export{F as OrgApp};
@@ -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"./mouse-pointer-click-CVJ6hWg8.js";import{t as i}from"./clsx-DB0hHKMi.js";import{dt as a,m as o}from"./main-CfbpuT4Y.js";import{t as s}from"./Segmented-Dzi1x49S.js";var c=n();function l({value:e,href:t,clean:n}){let r=`tabular font-semibold underline decoration-line-strong decoration-2 underline-offset-[0.2em] ${n?`text-success`:`text-ink`}`;return t?(0,c.jsx)(a,{href:t,className:`${r} hover:decoration-accent`,children:e}):(0,c.jsx)(`span`,{className:r,children:e})}var u=e(t(),1),d=`/`,f=120,p=1600,m=240,h=(e,t)=>`${d}previews/${e}.${t}.webp`,g=(e,t)=>`${d}preview.html?c=${encodeURIComponent(e)}&scheme=${t}`;function _(){if(document.querySelector(`link[data-preview-prefetch]`))return;let e=Object.assign(document.createElement(`link`),{rel:`prefetch`,href:`${d}preview.html`});e.dataset.previewPrefetch=``,document.head.append(e)}function v({name:e,scheme:t,width:n}){let r=(0,u.useRef)(null),[a,o]=(0,u.useState)(m),s=(0,u.useRef)(t);s.current=t;let[l]=(0,u.useState)(()=>g(e,t));return(0,u.useEffect)(()=>{let e=e=>{if(e.origin!==location.origin||e.source!==r.current?.contentWindow)return;let t=e.data;t.type===`yx-preview-size`&&typeof t.height==`number`&&o(Math.min(p,Math.max(f,Math.ceil(t.height)))),t.type===`yx-preview-ready`&&r.current?.contentWindow?.postMessage({type:`yx-preview-scheme`,scheme:s.current},location.origin)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,u.useEffect)(()=>{r.current?.contentWindow?.postMessage({type:`yx-preview-scheme`,scheme:t},location.origin)},[t]),(0,c.jsx)(`div`,{className:i(`mx-auto transition-[width] duration-200 ease-out`,n===`phone`?`w-[390px] max-w-full border-x border-line`:`w-full`),children:(0,c.jsx)(`iframe`,{ref:r,src:l,title:`${e} live preview`,className:`block w-full border-0`,style:{height:a}})})}function y({name:e,contract:t,paper:n}){let{scheme:i}=o(),[a,l]=(0,u.useState)(i),[d,f]=(0,u.useState)(`desk`),[p,m]=(0,u.useState)(!1),[g,y]=(0,u.useState)(!1),b=!p&&!g&&d===`desk`;return(0,c.jsxs)(`div`,{className:`space-y-3`,children:[(0,c.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,c.jsx)(s,{label:`Colour scheme`,value:a,onChange:l,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}]}),(0,c.jsx)(s,{label:`Width`,value:d,onChange:f,options:[{value:`desk`,label:`Desk`},{value:`phone`,label:`Phone`}]}),(0,c.jsx)(`span`,{className:`ml-auto text-small text-muted`,children:b?`Snapshot. Click to interact.`:`Live: the owned component in its system's tokens.`})]}),(0,c.jsx)(`div`,{className:`grid min-h-64 place-items-center overflow-hidden rounded-lg border border-line`,style:{background:n[a]},children:b?(0,c.jsxs)(`button`,{type:`button`,onClick:()=>m(!0),onPointerEnter:_,onFocus:_,"aria-label":`Interact with the live ${t.name} preview`,className:`group relative block w-full cursor-pointer`,children:[(0,c.jsx)(`img`,{src:h(e,a),srcSet:`${h(e,a)} 2x`,alt:`${t.name} in ${a} scheme`,decoding:`async`,onError:()=>y(!0),className:`block h-auto max-w-full`}),(0,c.jsx)(`span`,{className:`absolute inset-0 grid place-items-center transition-colors duration-150 group-hover:bg-scrim/5`,children:(0,c.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-line bg-surface px-2.5 py-1 text-small font-medium text-ink opacity-0 shadow-popover transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,children:[(0,c.jsx)(r,{className:`size-3.5`}),` Click to interact`]})})]}):(0,c.jsx)(v,{name:e,scheme:a,width:d})})]})}export{h as n,l as r,y as t};
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"./mouse-pointer-click-CVJ6hWg8.js";import{t as i}from"./clsx-DB0hHKMi.js";import{dt as a,m as o}from"./main-cvOFSjox.js";import{t as s}from"./Segmented-Dzi1x49S.js";var c=n();function l({value:e,href:t,clean:n}){let r=`tabular font-semibold underline decoration-line-strong decoration-2 underline-offset-[0.2em] ${n?`text-success`:`text-ink`}`;return t?(0,c.jsx)(a,{href:t,className:`${r} hover:decoration-accent`,children:e}):(0,c.jsx)(`span`,{className:r,children:e})}var u=e(t(),1),d=`/`,f=120,p=1600,m=240,h=(e,t)=>`${d}previews/${e}.${t}.webp`,g=(e,t)=>`${d}preview.html?c=${encodeURIComponent(e)}&scheme=${t}`;function _(){if(document.querySelector(`link[data-preview-prefetch]`))return;let e=Object.assign(document.createElement(`link`),{rel:`prefetch`,href:`${d}preview.html`});e.dataset.previewPrefetch=``,document.head.append(e)}function v({name:e,scheme:t,width:n}){let r=(0,u.useRef)(null),[a,o]=(0,u.useState)(m),s=(0,u.useRef)(t);s.current=t;let[l]=(0,u.useState)(()=>g(e,t));return(0,u.useEffect)(()=>{let e=e=>{if(e.origin!==location.origin||e.source!==r.current?.contentWindow)return;let t=e.data;t.type===`yx-preview-size`&&typeof t.height==`number`&&o(Math.min(p,Math.max(f,Math.ceil(t.height)))),t.type===`yx-preview-ready`&&r.current?.contentWindow?.postMessage({type:`yx-preview-scheme`,scheme:s.current},location.origin)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,u.useEffect)(()=>{r.current?.contentWindow?.postMessage({type:`yx-preview-scheme`,scheme:t},location.origin)},[t]),(0,c.jsx)(`div`,{className:i(`mx-auto transition-[width] duration-200 ease-out`,n===`phone`?`w-[390px] max-w-full border-x border-line`:`w-full`),children:(0,c.jsx)(`iframe`,{ref:r,src:l,title:`${e} live preview`,className:`block w-full border-0`,style:{height:a}})})}function y({name:e,contract:t,paper:n}){let{scheme:i}=o(),[a,l]=(0,u.useState)(i),[d,f]=(0,u.useState)(`desk`),[p,m]=(0,u.useState)(!1),[g,y]=(0,u.useState)(!1),b=!p&&!g&&d===`desk`;return(0,c.jsxs)(`div`,{className:`space-y-3`,children:[(0,c.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,c.jsx)(s,{label:`Colour scheme`,value:a,onChange:l,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}]}),(0,c.jsx)(s,{label:`Width`,value:d,onChange:f,options:[{value:`desk`,label:`Desk`},{value:`phone`,label:`Phone`}]}),(0,c.jsx)(`span`,{className:`ml-auto text-small text-muted`,children:b?`Snapshot. Click to interact.`:`Live: the owned component in its system's tokens.`})]}),(0,c.jsx)(`div`,{className:`grid min-h-64 place-items-center overflow-hidden rounded-lg border border-line`,style:{background:n[a]},children:b?(0,c.jsxs)(`button`,{type:`button`,onClick:()=>m(!0),onPointerEnter:_,onFocus:_,"aria-label":`Interact with the live ${t.name} preview`,className:`group relative block w-full cursor-pointer`,children:[(0,c.jsx)(`img`,{src:h(e,a),srcSet:`${h(e,a)} 2x`,alt:`${t.name} in ${a} scheme`,decoding:`async`,onError:()=>y(!0),className:`block h-auto max-w-full`}),(0,c.jsx)(`span`,{className:`absolute inset-0 grid place-items-center transition-colors duration-150 group-hover:bg-scrim/5`,children:(0,c.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-line bg-surface px-2.5 py-1 text-small font-medium text-ink opacity-0 shadow-popover transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,children:[(0,c.jsx)(r,{className:`size-3.5`}),` Click to interact`]})})]}):(0,c.jsx)(v,{name:e,scheme:a,width:d})})]})}export{h as n,l as r,y as t};
@@ -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{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./CopyButton-DE8drl4P.js";import{t as a}from"./shield-check-0ka0kQct.js";import{R as o,U as s,dt as c,i as l,pt as u,s as d,tt as f}from"./main-CfbpuT4Y.js";import{r as p,t as m}from"./Badge-CUJUit4d.js";import{n as h,t as g}from"./Section-BTnvUq_W.js";import{t as _}from"./CodeBlock-CsiGFgvI.js";import{a as v,n as y}from"./workflow-DbBdiOmA.js";var b={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};b.node;var x=r(b),S=e(t(),1),C=n();function w(e,t){return e.severity===`off`?{state:`off`}:e.check.engine===`advisory`?{state:`advisory`}:t?{state:`unsupported`,reason:t}:{state:`enforced`,by:e.check.engine===`youi`?`youi:${e.check.id}`:`ast-grep:${e.check.language}`}}function T(e){switch(e.state){case`enforced`:return e.by.startsWith(`youi:`)?`Checked by youiyoux check (${e.by.slice(5)})`:`Checked by youiyoux check (ast-grep, ${e.by.slice(9)})`;case`advisory`:return`Advisory: shown to people and agents, not checked`;case`off`:return`Off: not checked and not shown to agents`;case`unsupported`:return`Not checked: ${e.reason}`}}function E(e){return e.execution?e.execution:e.severity!==`off`&&e.check.engine===`ast-grep`?{state:`unsupported`,reason:`not verified: this snapshot predates compiled rule checks (run pnpm data)`}:w(e)}function D(e){return T(E(e))}function O({model:e,contract:t}){let n=s();return(0,C.jsx)(`div`,{className:`p-6`,children:(0,C.jsx)(h,{title:`Rules this component follows`,count:t.rules.length,children:(0,C.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:t.rules.map(t=>{let r=e.rules.get(t);if(!r)return null;let i=n.status===`ready`?n.value.violationsByRule.get(t)?.length??0:null;return(0,C.jsxs)(`li`,{className:`space-y-1.5 p-4`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(p,{severity:r.severity}),(0,C.jsx)(c,{href:f(t),className:`font-medium text-ink hover:underline`,children:r.title}),i!==null&&i>0&&(0,C.jsxs)(m,{tone:`outline`,className:`ml-auto tabular`,children:[i,` `,i===1?`violation`:`violations`,` in projects`]}),(0,C.jsx)(c,{href:`/rules/${t.slice(t.indexOf(`/rule/`)+6)}`,className:`${i?``:`ml-auto `}text-small text-accent hover:underline`,children:`Edit rule`})]}),(0,C.jsx)(`p`,{className:`text-body text-ink-2`,children:r.statement}),(0,C.jsx)(`p`,{className:`text-small text-muted`,children:D(r)})]},t)})})})})}var k=new Set([`draft`,`previewed`,`approved`]);function A({ruleId:e}){let[,t]=u(),[n,r]=(0,S.useState)(null),i=async()=>{r(null);try{let{drafts:n}=await v.drafts(),r=n.find(t=>t.kind===`rule`&&t.ruleId===e&&k.has(t.status));t(`/rules/draft/${(r??await v.edit(e)).id}`)}catch(e){r(y(e))}};return(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,C.jsxs)(d,{size:`sm`,onClick:()=>void i(),children:[(0,C.jsx)(x,{}),` Edit rule`]}),n&&(0,C.jsx)(`span`,{className:`text-small text-muted`,children:n.offline?`Start the rule editor first; Rules shows how.`:n.message})]})}var j=40,M={enforced:`Enforced`,advisory:`Advisory`,off:`Off`,unsupported:`Not checked`};function N(e,t){return e.flatMap(e=>{let n=e.checks??[],r=n.find(e=>e.rule===t.id);return r?r.state===`ran`?[]:[`${e.project}: ${r.reason??r.state}`]:n.length===0&&t.check.engine===`youi`?[]:[`${e.project}: this scan did not run it`]})}function P({rule:e}){let t=s(),n=(0,S.useMemo)(()=>t.status===`ready`?t.value.violationsByRule.get(e.id)??[]:[],[t,e.id]);if(E(e).state!==`enforced`)return(0,C.jsx)(`p`,{className:`text-body text-muted`,children:`Not checked, so no project is measured against it.`});if(t.status!==`ready`)return(0,C.jsx)(l,{state:t,onRetry:o,what:`the usage map`});let r=N(t.value.reports,e),i=r.length>0&&(0,C.jsx)(`ul`,{className:`space-y-1 text-small text-ink-2`,children:r.map(e=>(0,C.jsxs)(`li`,{children:[`Not checked in `,e]},e))});return n.length===0?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`p`,{className:`text-body text-muted`,children:r.length===t.value.reports.length?`No scanned project ran this rule yet.`:`No project that ran this rule breaks it.`}),i]}):(0,C.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-line`,children:[(0,C.jsx)(`ul`,{className:`divide-y divide-line`,children:n.slice(0,j).map(e=>(0,C.jsxs)(`li`,{className:`space-y-1 px-3 py-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-mono-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted`,children:e.project}),(0,C.jsxs)(`span`,{className:`truncate text-ink-2`,children:[e.file,(0,C.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]})]}),(0,C.jsx)(`p`,{className:`text-small text-ink-2`,children:e.message}),(0,C.jsx)(`code`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.text})]},`${e.project}:${e.file}:${e.line}:${e.column}`))}),n.length>j&&(0,C.jsxs)(`p`,{className:`border-t border-line bg-sunken px-3 py-2 text-small text-muted`,children:[`and `,n.length-j,` more`]}),i&&(0,C.jsx)(`div`,{className:`border-t border-line px-3 py-2`,children:i})]})}function F({model:e,rule:t}){let n=e.ruleComponents.get(t.id)??[];return(0,C.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,C.jsxs)(`header`,{className:`border-b border-line px-6 pt-5 pb-5`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg border border-line bg-raised text-ink-2`,children:(0,C.jsx)(a,{className:`size-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`text-title outline-none`,children:t.title}),(0,C.jsx)(p,{severity:t.severity}),(0,C.jsx)(m,{tone:`outline`,children:M[E(t).state]})]}),(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-mono-sm text-muted`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:t.id}),(0,C.jsx)(i,{value:t.id,label:`Copy rule id`})]})]})]}),(0,C.jsx)(`p`,{className:`mt-3 max-w-2xl text-reading text-ink`,children:t.statement}),(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(A,{ruleId:t.id})})]}),(0,C.jsxs)(`div`,{className:`space-y-8 p-6`,children:[(0,C.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-2`,children:[(0,C.jsx)(h,{title:`Why`,children:(0,C.jsx)(`p`,{className:`text-body text-ink-2`,children:t.rationale||`No rationale recorded.`})}),(0,C.jsx)(h,{title:`Enforcement`,children:(0,C.jsx)(g,{rows:[[`Check`,D(t)],[`Files`,(0,C.jsx)(`code`,{className:`font-mono text-mono-sm`,children:t.files.join(`, `)})],[`Declared by`,n.length?(0,C.jsx)(`span`,{className:`flex flex-wrap gap-x-2`,children:n.map(t=>(0,C.jsx)(c,{href:f(t,`rules`),className:`text-accent hover:underline`,children:e.byId.get(t)?.name??t},t))}):`No component yet`]]})})]}),(0,C.jsx)(h,{title:`For agents`,children:(0,C.jsx)(`blockquote`,{className:`rounded-md border-l-2 border-line-strong bg-sunken px-3 py-2 text-body text-ink-2`,children:t.agent})}),(t.examples.bad.length>0||t.examples.good.length>0)&&(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsx)(h,{title:`Breaks the rule`,children:(0,C.jsx)(_,{code:t.examples.bad.join(`
2
- `),maxHeight:`sm`})}),(0,C.jsx)(h,{title:`Follows the rule`,children:(0,C.jsx)(_,{code:t.examples.good.join(`
3
- `),maxHeight:`sm`})})]}),(0,C.jsx)(h,{title:`In projects`,children:(0,C.jsx)(P,{rule:t})})]})]})}export{E as a,D as i,N as n,T as o,O as r,x as s,F as t};
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"./CopyButton-DE8drl4P.js";import{t as a}from"./shield-check-0ka0kQct.js";import{R as o,U as s,dt as c,i as l,pt as u,s as d,tt as f}from"./main-cvOFSjox.js";import{a as p,n as m}from"./workflow-C53UBmRZ.js";import{r as h,t as g}from"./Badge-CUJUit4d.js";import{n as _,t as v}from"./Section-BTnvUq_W.js";import{t as y}from"./CodeBlock-CsiGFgvI.js";var b={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};b.node;var x=r(b),S=e(t(),1),C=n();function w(e,t){return e.severity===`off`?{state:`off`}:e.check.engine===`advisory`?{state:`advisory`}:t?{state:`unsupported`,reason:t}:{state:`enforced`,by:e.check.engine===`youi`?`youi:${e.check.id}`:`ast-grep:${e.check.language}`}}function T(e){switch(e.state){case`enforced`:return e.by.startsWith(`youi:`)?`Checked by youiyoux check (${e.by.slice(5)})`:`Checked by youiyoux check (ast-grep, ${e.by.slice(9)})`;case`advisory`:return`Advisory: shown to people and agents, not checked`;case`off`:return`Off: not checked and not shown to agents`;case`unsupported`:return`Not checked: ${e.reason}`}}function E(e){return e.execution?e.execution:e.severity!==`off`&&e.check.engine===`ast-grep`?{state:`unsupported`,reason:`not verified: this snapshot predates compiled rule checks (run pnpm data)`}:w(e)}function D(e){return T(E(e))}function O({model:e,contract:t}){let n=s();return(0,C.jsx)(`div`,{className:`p-6`,children:(0,C.jsx)(_,{title:`Rules this component follows`,count:t.rules.length,children:(0,C.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:t.rules.map(t=>{let r=e.rules.get(t);if(!r)return null;let i=n.status===`ready`?n.value.violationsByRule.get(t)?.length??0:null;return(0,C.jsxs)(`li`,{className:`space-y-1.5 p-4`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(h,{severity:r.severity}),(0,C.jsx)(c,{href:f(t),className:`font-medium text-ink hover:underline`,children:r.title}),i!==null&&i>0&&(0,C.jsxs)(g,{tone:`outline`,className:`ml-auto tabular`,children:[i,` `,i===1?`violation`:`violations`,` in projects`]}),(0,C.jsx)(c,{href:`/rules/${t.slice(t.indexOf(`/rule/`)+6)}`,className:`${i?``:`ml-auto `}text-small text-accent hover:underline`,children:`Edit rule`})]}),(0,C.jsx)(`p`,{className:`text-body text-ink-2`,children:r.statement}),(0,C.jsx)(`p`,{className:`text-small text-muted`,children:D(r)})]},t)})})})})}var k=new Set([`draft`,`previewed`,`approved`]);function A({ruleId:e}){let[,t]=u(),[n,r]=(0,S.useState)(null),i=async()=>{r(null);try{let{drafts:n}=await p.drafts(),r=n.find(t=>t.kind===`rule`&&t.ruleId===e&&k.has(t.status));t(`/rules/draft/${(r??await p.edit(e)).id}`)}catch(e){r(m(e))}};return(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,C.jsxs)(d,{size:`sm`,onClick:()=>void i(),children:[(0,C.jsx)(x,{}),` Edit rule`]}),n&&(0,C.jsx)(`span`,{className:`text-small text-muted`,children:n.offline?`Start the rule editor first; Rules shows how.`:n.message})]})}var j=40,M={enforced:`Enforced`,advisory:`Advisory`,off:`Off`,unsupported:`Not checked`};function N(e,t){return e.flatMap(e=>{let n=e.checks??[],r=n.find(e=>e.rule===t.id);return r?r.state===`ran`?[]:[`${e.project}: ${r.reason??r.state}`]:n.length===0&&t.check.engine===`youi`?[]:[`${e.project}: this scan did not run it`]})}function P({rule:e}){let t=s(),n=(0,S.useMemo)(()=>t.status===`ready`?t.value.violationsByRule.get(e.id)??[]:[],[t,e.id]);if(E(e).state!==`enforced`)return(0,C.jsx)(`p`,{className:`text-body text-muted`,children:`Not checked, so no project is measured against it.`});if(t.status!==`ready`)return(0,C.jsx)(l,{state:t,onRetry:o,what:`the usage map`});let r=N(t.value.reports,e),i=r.length>0&&(0,C.jsx)(`ul`,{className:`space-y-1 text-small text-ink-2`,children:r.map(e=>(0,C.jsxs)(`li`,{children:[`Not checked in `,e]},e))});return n.length===0?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`p`,{className:`text-body text-muted`,children:r.length===t.value.reports.length?`No scanned project ran this rule yet.`:`No project that ran this rule breaks it.`}),i]}):(0,C.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-line`,children:[(0,C.jsx)(`ul`,{className:`divide-y divide-line`,children:n.slice(0,j).map(e=>(0,C.jsxs)(`li`,{className:`space-y-1 px-3 py-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-mono-sm`,children:[(0,C.jsx)(`span`,{className:`text-muted`,children:e.project}),(0,C.jsxs)(`span`,{className:`truncate text-ink-2`,children:[e.file,(0,C.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]})]}),(0,C.jsx)(`p`,{className:`text-small text-ink-2`,children:e.message}),(0,C.jsx)(`code`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.text})]},`${e.project}:${e.file}:${e.line}:${e.column}`))}),n.length>j&&(0,C.jsxs)(`p`,{className:`border-t border-line bg-sunken px-3 py-2 text-small text-muted`,children:[`and `,n.length-j,` more`]}),i&&(0,C.jsx)(`div`,{className:`border-t border-line px-3 py-2`,children:i})]})}function F({model:e,rule:t}){let n=e.ruleComponents.get(t.id)??[];return(0,C.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,C.jsxs)(`header`,{className:`border-b border-line px-6 pt-5 pb-5`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg border border-line bg-raised text-ink-2`,children:(0,C.jsx)(a,{className:`size-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`text-title outline-none`,children:t.title}),(0,C.jsx)(h,{severity:t.severity}),(0,C.jsx)(g,{tone:`outline`,children:M[E(t).state]})]}),(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-mono-sm text-muted`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:t.id}),(0,C.jsx)(i,{value:t.id,label:`Copy rule id`})]})]})]}),(0,C.jsx)(`p`,{className:`mt-3 max-w-2xl text-reading text-ink`,children:t.statement}),(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(A,{ruleId:t.id})})]}),(0,C.jsxs)(`div`,{className:`space-y-8 p-6`,children:[(0,C.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-2`,children:[(0,C.jsx)(_,{title:`Why`,children:(0,C.jsx)(`p`,{className:`text-body text-ink-2`,children:t.rationale||`No rationale recorded.`})}),(0,C.jsx)(_,{title:`Enforcement`,children:(0,C.jsx)(v,{rows:[[`Check`,D(t)],[`Files`,(0,C.jsx)(`code`,{className:`font-mono text-mono-sm`,children:t.files.join(`, `)})],[`Declared by`,n.length?(0,C.jsx)(`span`,{className:`flex flex-wrap gap-x-2`,children:n.map(t=>(0,C.jsx)(c,{href:f(t,`rules`),className:`text-accent hover:underline`,children:e.byId.get(t)?.name??t},t))}):`No component yet`]]})})]}),(0,C.jsx)(_,{title:`For agents`,children:(0,C.jsx)(`blockquote`,{className:`rounded-md border-l-2 border-line-strong bg-sunken px-3 py-2 text-body text-ink-2`,children:t.agent})}),(t.examples.bad.length>0||t.examples.good.length>0)&&(0,C.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,C.jsx)(_,{title:`Breaks the rule`,children:(0,C.jsx)(y,{code:t.examples.bad.join(`
2
+ `),maxHeight:`sm`})}),(0,C.jsx)(_,{title:`Follows the rule`,children:(0,C.jsx)(y,{code:t.examples.good.join(`
3
+ `),maxHeight:`sm`})})]}),(0,C.jsx)(_,{title:`In projects`,children:(0,C.jsx)(P,{rule:t})})]})]})}export{E as a,D as i,N as n,T as o,O as r,x as s,F as t};
@@ -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-CUNGYbg0.js";import{a,i as o,n as s,o as c,s as l}from"./RuleDetail-BDhZ1gCd.js";import{i as u,r as d,t as f}from"./ServiceDown-Bn6AcA3J.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-CfbpuT4Y.js";import{r as A,t as j}from"./Badge-CUJUit4d.js";import{n as M,t as N}from"./Section-BTnvUq_W.js";import{t as P}from"./CodeBlock-CsiGFgvI.js";import{a as F,i as I,n as L}from"./workflow-DbBdiOmA.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([F.info(),F.rules(),F.drafts()]);return{info:e,published:t,drafts:n}}var U=e=>D(e)?.name??e;function W(){let[e,t]=(S()[`*`]??``).split(`/`),n=I(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(L(e).message)}},l=e=>{e.draft?i(`/rules/draft/${e.draft.id}`):c(()=>F.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(F.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)(A,{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)(A,{severity:i.severity}),i.rollout&&(0,z.jsxs)(j,{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)(M,{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)(M,{title:`How it is checked`,children:(0,z.jsx)(N,{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)(M,{title:`Why`,children:(0,z.jsx)(`p`,{className:`text-body text-ink-2`,children:i.rationale||`No rationale recorded.`})})]}),(0,z.jsx)(M,{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)(M,{title:`Breaks the rule`,children:(0,z.jsx)(P,{code:i.examples.bad.join(`
2
- `),maxHeight:`sm`})}),(0,z.jsx)(M,{title:`Follows the rule`,children:(0,z.jsx)(P,{code:i.examples.good.join(`
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)(()=>F.draft(e),[e]),{state:a,reload:o,set:s}=I(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
+ 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(`
2
+ `),maxHeight:`sm`})}),(0,z.jsx)(F,{title:`Follows the rule`,children:(0,z.jsx)(L,{code:i.examples.good.join(`
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-CfbpuT4Y.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-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};
@@ -0,0 +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 +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-CfbpuT4Y.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-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 +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-CfbpuT4Y.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-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 +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-ZzbsyZo3.js";import{ht as c}from"./main-CfbpuT4Y.js";import{i as l,r as u}from"./Specimens-DuaE0WeO.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-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,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/try-live-CX04d2L2.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-CfbpuT4Y.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-DYNYuTjI.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-CX04d2L2.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-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};