@wcag-checkr/ci 1.0.21 → 1.0.23

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/site-report-renderer-Cdd4E5RB.js","assets/scheduled-audit-runner-DO-z335b.js","assets/preload-helper-D7HrI6pR.js","assets/crash-reporter-DAZnNefT.js","assets/diff-CECbooHD.js","assets/ai-usage-log-HdIilbbf.js"])))=>i.map(i=>d[i]);
2
- import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as c,j as e,C as we,c as Ee,R as Ae}from"./styles-clWOl0K-.js";import{u as f,a as oe,c as Ne,R as Ie,C as Ue,M as ze,l as ne,b as Pe,d as De,e as Le,i as _e,P as We,f as Ge,s as Fe,w as Me,r as $e,g as Oe,h as He,j as Be,p as Ve,k as qe,A as Ke,m as Ye,E as Qe,n as Ze}from"./ErrorBoundary-CzV_1Ln4.js";import{s as S,r as Xe,i as Je}from"./crash-reporter-DAZnNefT.js";import{B as ie,t as et,u as tt}from"./ai-usage-log-HdIilbbf.js";import{c as rt,C as at,a as nt,d as it,l as je,g as Se,s as st,b as ot,e as lt,f as ct,h as ue,i as dt,j as ut}from"./scheduled-audit-runner-DO-z335b.js";import{_ as re}from"./preload-helper-D7HrI6pR.js";import{copyAiFixerPrompt as pt}from"./copy-ai-fixer-prompt-CL_yFzec.js";import{w as pe,h as ve,r as ge}from"./tier-config-client-D1GMRTQW.js";import{w as he,r as me}from"./rubric-config-client-Ck8nJHda.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./diff-CECbooHD.js";import"./design-system-audit-DpxJrxnb.js";function fe({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:o,onAuditThisPage:s,reviewEnabled:l,onToggleReview:n}){const[i,g]=c.useState(t),[y,h]=c.useState(25),[p,b]=c.useState(""),[k,j]=c.useState(""),[w,m]=c.useState(!1),[E,P]=c.useState(ie),[x,F]=c.useState(ie[0].id),[O,U]=c.useState(null),[W,R]=c.useState(!0);c.useEffect(()=>{t&&!i&&g(t)},[t]),c.useEffect(()=>{let u=!1;return Promise.all([S({type:"SETTINGS_GET",key:"matrixPresets"}),S({type:"SETTINGS_GET",key:"activePresetId"})]).then(([T,L])=>{if(u)return;const d=Array.isArray(T.data)?T.data:null;P(d&&d.length>0?d:ie),typeof L.data=="string"&&F(L.data)}),()=>{u=!0}},[]),c.useEffect(()=>{let u=!1;return S({type:"SETTINGS_GET",key:"crawlRememberSettings"}).then(async T=>{if(u)return;const d=T.data!==!1;if(R(d),!d)return;const[C,B,M]=await Promise.all([S({type:"SETTINGS_GET",key:"crawlMaxPages"}),S({type:"SETTINGS_GET",key:"crawlIncludeRegex"}),S({type:"SETTINGS_GET",key:"crawlExcludeRegex"})]);if(u)return;const $=C.data;typeof $=="number"&&$>=1&&h(Math.min(200,$));const Z=B.data,X=M.data;typeof Z=="string"&&Z&&b(Z),typeof X=="string"&&X&&j(X),(typeof Z=="string"&&Z||typeof X=="string"&&X)&&m(!0)}),()=>{u=!0}},[]);function Q(u){h(u),W&&S({type:"SETTINGS_SET",key:"crawlMaxPages",value:u})}function v(u){b(u),W&&S({type:"SETTINGS_SET",key:"crawlIncludeRegex",value:u})}function z(u){j(u),W&&S({type:"SETTINGS_SET",key:"crawlExcludeRegex",value:u})}function A(u){R(u),S({type:"SETTINGS_SET",key:"crawlRememberSettings",value:u}),u&&(S({type:"SETTINGS_SET",key:"crawlMaxPages",value:y}),S({type:"SETTINGS_SET",key:"crawlIncludeRegex",value:p.trim()}),S({type:"SETTINGS_SET",key:"crawlExcludeRegex",value:k.trim()}))}function N(u){const T=E.find(L=>L.id===u);T&&(F(u),S({type:"SETTINGS_SET",key:"activePresetId",value:u}),S({type:"SETTINGS_SET",key:"stateMatrix",value:T.matrix}))}function H(){U(null);for(const[u,T]of[["Include",p.trim()],["Exclude",k.trim()]])if(T)try{new RegExp(T)}catch(L){return U(`${u} regex invalid: ${L instanceof Error?L.message:String(L)}`),!1}return!0}function D(){const u=i.trim();if(!u)return null;let T;try{T=new URL(u)}catch{return"Start URL must be a full URL starting with http:// or https://."}return T.protocol!=="http:"&&T.protocol!=="https:"?`Start URL must use http:// or https:// — ${T.protocol} can't be crawled.`:null}const I=D(),q=!!i.trim()&&!I;function V(u){if(!H()||!q)return;const T={startUrl:i.trim(),maxPages:y,includeRegex:p.trim(),excludeRegex:k.trim()};u&&o?o(T):r(T)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsxs(J,{label:"Start URL",children:[e.jsx("input",{type:"url",value:i,onChange:u=>g(u.target.value),placeholder:"https://yoursite.com",disabled:a,"aria-invalid":!!I,className:"v2-mono",style:ee}),I&&e.jsx("p",{role:"alert",style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-critical)",lineHeight:1.4},children:I})]}),e.jsx(J,{label:"Max pages",hint:"1–200. Each page runs the full pipeline you configured.",children:e.jsx("input",{type:"number",min:1,max:200,value:y,onChange:u=>Q(Math.min(200,Math.max(1,parseInt(u.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...ee,maxWidth:100}})}),e.jsx(J,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:x,onChange:u=>N(u.target.value),disabled:a,style:ee,children:E.map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))})}),e.jsx("button",{type:"button",onClick:()=>m(u=>!u),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:w?"− hide advanced filters":"+ show URL filters (include / exclude)"}),w&&e.jsxs(e.Fragment,{children:[e.jsx(J,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:p,onChange:u=>v(u.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:ee})}),e.jsx(J,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:k,onChange:u=>z(u.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:ee})})]}),O&&e.jsx("p",{role:"alert",style:{color:"var(--v2-critical)",fontSize:12,margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)"},children:O}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",fontSize:12,lineHeight:1.4,color:"var(--v2-ink-secondary)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:W,disabled:a,onChange:u=>A(u.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:"Remember these settings."})," ","Keep max pages + the include/exclude filters for next time (the audit-depth preset is always remembered)."]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",fontSize:12,lineHeight:1.4,color:"var(--v2-ink-secondary)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l,disabled:a,onChange:u=>n(u.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:"Review pages before auditing."})," ","List every page that would be crawled, then remove any you don't want before the audit runs."]})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:a||!q,onClick:()=>V(!1),children:a?"Crawling…":l?"Find pages to audit":"Crawl whole site"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!q,onClick:()=>V(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),s&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a,onClick:s,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function vt(){var h;const t=f(p=>p.siteCrawlProgress),a=f(p=>p.siteCrawlStatus),r=f(p=>p.progress),o=f(p=>p.aiProgress),[s,l]=c.useState(!1);function n(){l(!0),S({type:"CANCEL_SITE_CRAWL"})}if(a!=="running")return null;const i=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,g=r?Math.min(100,Math.max(0,r.current/Math.max(1,r.total)*100)):0,y=r!=null&&r.currentState?[r.currentState.pseudoState,r.currentState.theme&&r.currentState.theme!=="light"?r.currentState.theme:null,r.currentState.direction&&r.currentState.direction!=="ltr"?r.currentState.direction:null,(h=r.currentState.breakpoint)!=null&&h.id&&r.currentState.breakpoint.id!=="desktop"?r.currentState.breakpoint.id:null].filter(Boolean).join(" · "):"";return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"crawling…"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:t?`${t.current} / ${t.total}`:"…"})]}),e.jsx("div",{role:"progressbar","aria-valuenow":(t==null?void 0:t.current)??0,"aria-valuemin":0,"aria-valuemax":(t==null?void 0:t.total)??1,"aria-label":"Crawl progress",style:{height:8,background:"var(--v2-bg-elev-2)",borderRadius:4,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${i}%`,background:"var(--v2-action)",transition:"width 240ms ease"}})}),(t==null?void 0:t.url)&&e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:4},children:"current page"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:t.url})]}),(t==null?void 0:t.lastViolations)!==void 0&&t.lastViolations>0&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:["last page: ",t.lastViolations," axe violation",t.lastViolations===1?"":"s"]}),r&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",paddingTop:"var(--v2-pad-3)",borderTop:"1px solid var(--v2-border)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-tertiary)"},children:"this page · auditing"}),e.jsxs("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",fontVariantNumeric:"tabular-nums"},children:[r.current," / ",r.total]})]}),e.jsx("div",{role:"progressbar","aria-valuenow":r.current,"aria-valuemin":0,"aria-valuemax":r.total,"aria-label":"Current page audit progress",style:{height:4,background:"var(--v2-bg-elev-2)",borderRadius:2,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${g}%`,background:"var(--v2-ink-tertiary)",transition:"width 240ms ease"}})}),y&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)"},children:["state: ",y]}),o&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-needs-review)",fontVariantNumeric:"tabular-nums"},children:["AI: ",o.current," / ",o.total," · ",o.currentCheckLabel,o.candidatesTotal&&o.candidatesTotal>0?` (${o.candidatesDone??0}/${o.candidatesTotal})`:""]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:n,disabled:s,children:s?"Cancelling…":"Cancel crawl"}),s&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up current page audit — final cancel can take up to a few seconds."})]})]})}function gt(){const t=f(s=>s.crawlDiscoveryStatus),a=f(s=>s.crawlDiscoveryFound),r=f(s=>s.crawlDiscoveryLastUrl);function o(){S({type:"CANCEL_CRAWL_DISCOVERY"}),f.getState().resetCrawlDiscovery()}return t!=="discovering"?null:e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"finding pages…"}),e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:[a," page",a===1?"":"s"," found"]}),r&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:r}),e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:"Loading each page to read its links — no audit yet. You'll prune the list before anything is audited."}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,children:"Cancel"})})]})}function ht({onAudit:t}){const a=f(n=>n.crawlDiscoveryStatus),r=f(n=>n.crawlDiscoveryUrls),[o,s]=c.useState(new Set);c.useEffect(()=>{a==="reviewing"&&s(new Set(r))},[a,r]);function l(){S({type:"CANCEL_CRAWL_DISCOVERY"}),f.getState().resetCrawlDiscovery()}return a!=="reviewing"?null:e.jsxs("div",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"review pages to audit"}),e.jsxs("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.4},children:["Found ",e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:r.length})," page",r.length===1?"":"s",". Uncheck any you don't want, then audit the rest. ",e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:o.size})," selected."]}),r.length===0?e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-tertiary)"},children:"No pages discovered from this URL. Check the start URL + filters and try again."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",onClick:()=>s(new Set(r)),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-action)",fontSize:11},children:"select all"}),e.jsx("button",{type:"button",onClick:()=>s(new Set),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-action)",fontSize:11},children:"select none"})]}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,maxHeight:300,overflowY:"auto",border:"1px solid var(--v2-border)",borderRadius:4},children:r.map(n=>e.jsx("li",{style:{borderBottom:"1px solid var(--v2-border)"},children:e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",padding:"6px 10px",fontSize:11,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:o.has(n),onChange:i=>s(g=>{const y=new Set(g);return i.target.checked?y.add(n):y.delete(n),y}),style:{marginTop:2}}),e.jsx("span",{className:"v2-mono",style:{wordBreak:"break-all",color:"var(--v2-ink-secondary)"},children:n})]})},n))})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:o.size===0,onClick:()=>t(r.filter(n=>o.has(n))),children:["Audit ",o.size," page",o.size===1?"":"s"]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:l,children:"Cancel"})]})]})}function mt(){const t=f(h=>h.status),a=f(h=>h.progress),r=f(h=>h.aiProgress),[o,s]=c.useState(!1);if(t!=="running")return null;const l=a?a.current>=a.total:!1,n=a?l?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",i=a?l?"reading order · tab order · typography · CSS vars · AI candidates":ft(a.currentState):"Loading axe + DOM analyzers",g=a?l?100:a.current/Math.max(1,a.total)*100:0;function y(){s(!0),S({type:"CANCEL_AUDIT"})}return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-4)"},children:[e.jsx(xe,{label:n,detail:i,pct:g,valuenow:a?Math.min(a.current,a.total):0,valuemax:a?a.total:1,ariaLabel:a?l?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${a.current} of ${a.total} states`:"Audit starting",fillColor:"var(--v2-action)"}),r&&e.jsx(xe,{label:`AI augmentation… ${r.current} / ${r.total}`,detail:r.candidatesTotal&&r.candidatesTotal>0?`${r.currentCheckLabel} (${r.candidatesDone??0}/${r.candidatesTotal})`:r.currentCheckLabel,pct:r.current/Math.max(1,r.total)*100,valuenow:r.current,valuemax:r.total,ariaLabel:`AI augmentation: ${r.current} of ${r.total} checks. ${r.currentCheckLabel}`,fillColor:"var(--v2-needs-review)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:y,disabled:o,children:o?"Cancelling…":"Cancel audit"}),o&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up — final cancel can take up to a few seconds."})]})]})}function xe({label:t,detail:a,pct:r,valuenow:o,valuemax:s,ariaLabel:l,fillColor:n}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:e.jsx("span",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:t})}),e.jsx("div",{role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":s,"aria-label":l,style:{height:6,background:"var(--v2-bg-elev-2)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${r}%`,background:n,transition:"width 240ms ease"}})}),a&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:a})]})}function ft(t){if(!t)return"";const a=[t.pseudoState];return t.theme&&t.theme!=="light"&&a.push(t.theme),t.direction&&t.direction!=="ltr"&&a.push(t.direction),a.join(" · ")}function J({label:t,hint:a,children:r}){return e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-secondary)"},children:t}),r,a&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:a})]})}const ee={fontFamily:"var(--v2-body)",fontSize:12,padding:"8px 10px",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,outline:"none"};function xt({sealed:t}){const[a,r]=c.useState(!1),o=JSON.stringify({claim:t.claim,hash:t.hash,receipt:t.receipt},null,2),s=new Date(t.claim.auditedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),l=()=>{navigator.clipboard.writeText(o).then(()=>{r(!0),setTimeout(()=>r(!1),2500)})};return e.jsxs("div",{role:"group","aria-label":"Wall of Fame badge",style:{marginTop:"var(--v2-pad-5)",padding:"var(--v2-pad-4)",border:"1px solid var(--v2-verified, #15803d)",borderRadius:6,background:"var(--v2-verified-bg, rgba(21,128,61,0.06))",maxWidth:640},children:[e.jsx("p",{style:{margin:0,fontWeight:600,fontSize:13,color:"var(--v2-ink-primary)"},children:"🏆 You earned a Wall of Fame badge"}),e.jsxs("p",{style:{margin:"var(--v2-pad-2) 0 0",fontSize:12,color:"var(--v2-ink-secondary)"},children:["WCAG ",t.claim.wcagLevel," · grade ",t.claim.grade," · ",t.claim.pageCount," page",t.claim.pageCount===1?"":"s"," · audited ",s]}),e.jsxs("p",{style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,lineHeight:1.5,color:"var(--v2-ink-tertiary)"},children:["Submit this signed attestation at ",e.jsx("strong",{children:"accessibilitywatch.org"})," to claim a public, dated, verifiable badge for ",e.jsx("strong",{children:t.claim.domain}),". They verify the signature and confirm you control the domain before it goes live."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:l,children:a?"Copied ✓":"Copy attestation"}),e.jsx("span",{role:"status","aria-live":"polite",style:{fontSize:11,color:"var(--v2-verified, #15803d)"},children:a?"Attestation copied to clipboard.":""})]})]})}function yt(t){const[a,r]=c.useState(null);return c.useEffect(()=>{if(!t){r(null);return}let o=!1;const s=()=>Xe({type:"SITE_CLAIM_GET_REQUEST",domain:t}).then(n=>{o||r(n.claim)}).catch(()=>{o||r(null)});s();const l=n=>{typeof n=="object"&&n!==null&&n.type==="SITE_CLAIM_SEALED_EVENT"&&n.domain===t&&s()};return chrome.runtime.onMessage.addListener(l),()=>{o=!0,chrome.runtime.onMessage.removeListener(l)}},[t]),a}function ye({open:t,gaps:a,onRunFull:r,onQuickCheck:o,onCancel:s}){return t?e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Audit settings are below WCAG 2.1 AA conformance",style:{position:"fixed",inset:0,background:"rgba(2,6,23,0.7)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:s,children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{background:"#0f172a",border:"1px solid #334155",borderRadius:10,maxWidth:460,width:"100%",padding:20,color:"#e2e8f0"},children:[e.jsx("h2",{style:{margin:"0 0 8px",fontSize:16},children:"Your settings aren’t a Full 2.1 AA audit"}),e.jsxs("p",{style:{margin:"0 0 10px",fontSize:13,color:"#cbd5e1",lineHeight:1.5},children:["A grade only means WCAG 2.1 AA if the audit exercised the states and checks the AA criteria live in. With your current settings, this run is a ",e.jsx("strong",{children:"quick check"}),", not a conformance result."]}),e.jsx("ul",{style:{margin:"0 0 14px",paddingLeft:18,fontSize:12,color:"#fca5a5",lineHeight:1.6},children:a.map((l,n)=>e.jsx("li",{children:l},n))}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:r,style:{background:"#2563eb",color:"#fff",border:"none",borderRadius:6,padding:"10px 12px",fontSize:13,fontWeight:600,cursor:"pointer"},children:"Run the Full 2.1 AA audit (applies the preset, then crawls)"}),e.jsx("button",{onClick:o,style:{background:"#1e293b",color:"#cbd5e1",border:"1px solid #334155",borderRadius:6,padding:"10px 12px",fontSize:13,cursor:"pointer"},children:"Quick check with current settings — not a conformance result"}),e.jsx("button",{onClick:s,style:{background:"none",color:"#64748b",border:"none",fontSize:12,padding:"4px",cursor:"pointer"},children:"Cancel"})]}),e.jsx("p",{style:{margin:"12px 0 0",fontSize:11,color:"#64748b",lineHeight:1.5},children:"Either way, the grade and every export are stamped with the exact settings used — a quick check can’t be mistaken for a conformance result. (Owner mode isn’t affected; it only flags demand-letter bait.)"})]})}):null}function bt(){const[t,a]=c.useState([]),[r,o]=c.useState(!1),s=c.useRef(null),l=c.useRef(!1),n=c.useCallback(async()=>{try{const p=await chrome.storage.local.get(["stateMatrix","runsPerState","aiConfig"]),b=p.aiConfig??{},k=rt({stateMatrix:p.stateMatrix,runsPerState:typeof p.runsPerState=="number"?p.runsPerState:1,aiEnabled:!!b.enabled&&!!b.apiKey});return a(k),k}catch{return a([]),[]}},[]);c.useEffect(()=>{n()},[n]);const i=c.useCallback(async p=>{if((await n()).length===0||l.current){p();return}s.current=p,o(!0)},[n]),g=c.useCallback(async()=>{try{const k=(await chrome.storage.local.get("aiConfig")).aiConfig??{};await chrome.storage.local.set({stateMatrix:nt,runsPerState:at,aiConfig:{...k,enabled:!0}})}catch{}l.current=!0,o(!1);const p=s.current;s.current=null,p==null||p()},[]),y=c.useCallback(()=>{l.current=!0,o(!1);const p=s.current;s.current=null,p==null||p()},[]),h=c.useCallback(()=>{o(!1),s.current=null},[]);return{gaps:t,gateOpen:r,requestCrawl:i,runFull:g,quickCheck:y,cancel:h}}function kt(){const{report:t,resolvedFails:a}=oe(),r=f(d=>d.siteCrawlReport),o=f(d=>d.siteCrawlStatus),s=f(d=>d.siteCrawlError),l=f(d=>d.status),n=o==="running",g=n||l==="running"&&!n,y=!!t&&!r,h=!y&&(t==null?void 0:t.siteGrade)==="A"&&t.startUrl?it(t.startUrl):null,p=yt(h),[b,k]=c.useState(null);c.useEffect(()=>{let d=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(C=>{var M;if(d)return;const B=((M=C[0])==null?void 0:M.url)??null;k(B&&/^https?:\/\//i.test(B)?B:null)}),()=>{d=!0}},[]);const[j,w]=c.useState(!1),m=f(d=>d.crawlDiscoveryStatus),[E,P]=c.useState(!0),x=bt(),[F,O]=c.useState("");c.useEffect(()=>{S({type:"SETTINGS_GET",key:"crawlReviewEnabled"}).then(d=>{const C=d.data;typeof C=="boolean"&&P(C)})},[]);function U(d){P(d),S({type:"SETTINGS_SET",key:"crawlReviewEnabled",value:d})}function W(d,C=!1){if(d.startUrl){if(C){R(d,!0);return}x.requestCrawl(()=>R(d,!1))}}function R(d,C=!1){if(E&&!C){O(d.startUrl),f.getState().setSiteCrawlError(null),f.getState().setCrawlDiscoveryStatus("discovering"),Pe({type:"START_CRAWL_DISCOVERY",startUrl:d.startUrl,maxPages:d.maxPages,...d.includeRegex?{includeRegex:d.includeRegex}:{},...d.excludeRegex?{excludeRegex:d.excludeRegex}:{}});return}f.getState().setSiteCrawlStatus("running"),f.getState().setSiteCrawlReport(null),f.getState().setSiteCrawlError(null),ne({type:"START_SITE_CRAWL",startUrl:d.startUrl,maxPages:d.maxPages,...d.includeRegex?{includeRegex:d.includeRegex}:{},...d.excludeRegex?{excludeRegex:d.excludeRegex}:{},...C?{verifyFixesOnly:!0}:{}})}function Q(d){d.length!==0&&(f.getState().setSiteCrawlStatus("running"),f.getState().setSiteCrawlReport(null),f.getState().setSiteCrawlError(null),f.getState().resetCrawlDiscovery(),ne({type:"START_SITE_CRAWL",startUrl:F,urls:d}))}function v(){ne({type:"START_AUDIT",mode:"full-page"}),f.getState().startNewScan()}const[z,A]=c.useState(!1),[N,H]=c.useState(null),[D,I]=c.useState(null);async function q(){A(!0),H(null),I(null);const d=(t==null?void 0:t.siteGrade)??"A";try{const C=await S({type:"REGRADE_SITE_CRAWL"});if((C==null?void 0:C.ok)===!0)setTimeout(()=>{var $;const M=(($=f.getState().siteCrawlReport)==null?void 0:$.siteGrade)??d;I({prevGrade:d,nextGrade:M,at:Date.now()})},0);else{const M=(C==null?void 0:C.reason)??"Regrade failed.";H(M)}}catch(C){H(C instanceof Error?C.message:String(C))}finally{A(!1)}}if(c.useEffect(()=>{if(!D)return;const d=setTimeout(()=>I(null),6e3);return()=>clearTimeout(d)},[D]),g)return e.jsx("section",{"aria-label":"Audit in progress",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:n?e.jsx(vt,{}):e.jsx(mt,{})});if(m==="discovering"||m==="reviewing")return e.jsx("section",{"aria-label":"Choose pages to audit",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:m==="discovering"?e.jsx(gt,{}):e.jsx(ht,{onAudit:Q})});if(!t)return e.jsxs("section",{"aria-label":"No audit yet",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:[e.jsx("p",{className:"v2-eyebrow",style:{marginBottom:"var(--v2-pad-2)"},children:"new audit"}),e.jsx("h1",{className:"v2-display",style:{fontSize:28,fontWeight:500,letterSpacing:"-0.02em",color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:"Configure your crawl."}),s&&e.jsxs("div",{role:"alert",style:{marginBottom:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)",color:"var(--v2-critical)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600,marginRight:6},children:"Last crawl failed:"}),s]}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,marginBottom:"var(--v2-pad-5)",maxWidth:520},children:"The crawler follows internal links from the start URL, same-origin only. Each page runs your full audit pipeline (axe + DOM analyzers + AI walkthroughs). Findings appear below as a single unified list."}),e.jsx(fe,{initialUrl:b??"",isRunning:g,onCrawl:d=>W(d,!1),onAuditThisPage:v,reviewEnabled:E,onToggleReview:U}),e.jsx(ye,{open:x.gateOpen,gaps:x.gaps,onRunFull:x.runFull,onQuickCheck:x.quickCheck,onCancel:x.cancel})]});const V=a.length,u=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+V,T=(t.walkthroughAcknowledgements??[]).length,L=t.totalNeedsReview;return e.jsxs("section",{"aria-label":"Audit summary",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"var(--v2-pad-6)"},children:[e.jsx(jt,{grade:t.siteGrade}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:y?"page grade · single-page audit":`site grade · ${t.pagesAudited} page${t.pagesAudited===1?"":"s"}`}),e.jsxs("p",{style:{margin:0,fontSize:11,lineHeight:1.4,color:"var(--v2-ink-tertiary)"},children:["Your ",e.jsx("strong",{children:"combined grade"})," — severity (your most serious finding) and breadth (how many of the 9 areas have issues) together, with a legal floor so a serious issue can't be averaged away. The Dev view shows the same letter."]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-5)"},children:[e.jsx("h1",{className:"v2-display",style:{fontSize:22,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0,lineHeight:1.25},children:(()=>{var B,M;if(((B=t.spotCheckGate)==null?void 0:B.status)==="pending"){const $=t.spotCheckGate;return`On track for A — answer ${$.unanswered.length} more content-meaning spot-check${$.unanswered.length===1?"":"s"} below to finalize your grade (${$.answered}/${$.total} done).`}const d=u+L,C=((M=t.blockingCriteria)==null?void 0:M.length)??0;return d===0&&C===0?"All clear — nothing open.":d===0&&C>0?`Visible findings clear — ${C} criteri${C===1?"on":"a"} still need${C===1?"s":""} your judgment.`:`${d} finding${d===1?"":"s"} to address.`})()}),e.jsx(St,{openCount:u,reviewCount:L,verifiedCount:T,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:V}),b&&!wt(b,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",b]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[y?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:v,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>w(d=>!d),"aria-expanded":j,title:"Open crawl setup to audit the whole site instead",children:j?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:q,disabled:z,title:"Re-aggregate this audit against your latest verdicts + acks. No re-crawl. Use this after marking criteria in the Coverage gaps panel.",children:z?"Regrading…":"Regrade"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>W({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options) — full audit re-run, use when page code changed`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:v,title:"Single-page audit of the active tab (no crawl)",children:"Just this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>W({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>w(d=>!d),"aria-expanded":j,children:j?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>void Ne(),title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx(Ie,{})}),N&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:N}),D&&!N&&e.jsx("p",{role:"status",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-verified)"},children:D.prevGrade===D.nextGrade?`Regraded — grade unchanged at ${D.nextGrade}. Any verdict changes you made were already in this report.`:`Regraded — grade ${D.prevGrade} → ${D.nextGrade}.`})]}),(p==null?void 0:p.receipt)&&e.jsx(xt,{sealed:p}),e.jsx(Ue,{}),e.jsx(ze,{}),j&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-5)",paddingTop:"var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)",maxWidth:640},children:[e.jsx(fe,{initialUrl:t.startUrl,isRunning:g,onCrawl:d=>W(d,!1),onVerifyFixes:d=>W(d,!0),onAuditThisPage:v,reviewEnabled:E,onToggleReview:U}),e.jsx(ye,{open:x.gateOpen,gaps:x.gaps,onRunFull:x.runFull,onQuickCheck:x.quickCheck,onCancel:x.cancel})]})]})}function wt(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function jt({grade:t}){if(t==="pending")return e.jsx("div",{"aria-label":"Grade pending — spot-checks outstanding",role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:40,lineHeight:1.05,fontWeight:600,color:"var(--v2-ink-secondary, #94a3b8)",letterSpacing:"-0.02em",textAlign:"center"},children:"Pending"})});const a={A:"var(--v2-grade-a)",B:"var(--v2-grade-b)",C:"var(--v2-grade-c)",D:"var(--v2-grade-d)",F:"var(--v2-grade-f)"};return e.jsx("div",{"aria-label":`Grade ${t}`,role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:132,lineHeight:1,fontWeight:500,color:a[t],letterSpacing:"-0.04em",fontVariationSettings:'"opsz" 144'},children:t})})}function St({openCount:t,reviewCount:a,verifiedCount:r,axeCount:o,walkthroughCount:s,autoCount:l}){return e.jsxs("dl",{style:{display:"flex",gap:"var(--v2-pad-4)",flexWrap:"wrap",margin:0,color:"var(--v2-ink-secondary)",fontSize:12},children:[e.jsx(K,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(K,{term:"review",value:a,tone:a>0?"review":"neutral"}),e.jsx(K,{term:"verified",value:r,tone:r>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(K,{term:"axe",value:o,tone:"neutral"}),e.jsx(K,{term:"walkthrough",value:s,tone:"neutral"}),l>0&&e.jsx(K,{term:"auto-contrast",value:l,tone:"neutral"})]})}function K({term:t,value:a,tone:r}){const o={attention:"var(--v2-critical)",review:"var(--v2-needs-review)",positive:"var(--v2-verified)",neutral:"var(--v2-ink-secondary)"};return e.jsxs("div",{style:{display:"inline-flex",alignItems:"baseline",gap:6},children:[e.jsx("dt",{className:"v2-eyebrow",style:{display:"inline",margin:0,color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("dd",{className:"v2-mono",style:{margin:0,fontWeight:600,fontSize:13,color:o[r],fontVariantNumeric:"tabular-nums"},children:a})]})}const Ct=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function be(t){return Ct.has(t)}async function ke(t){var o,s;const a=f.getState();if(a.componentId&&((o=a.results[0])==null?void 0:o.pageUrl)===t)return a.componentId;const r=await je();return((s=r==null?void 0:r.find(l=>l.url===t))==null?void 0:s.componentId)??null}async function Rt(t,a){var i;const r=f.getState(),o=[],s=new Set,l=(g,y)=>{const h=`${g}::${y}`;s.has(h)||(s.add(h),o.push({componentId:g,matchKey:y}))};if(r.componentId&&r.results.length>0){const g=(i=r.results[0])==null?void 0:i.pageUrl,y=a.find(h=>h.url===g);if(y)for(const h of r.results)for(const p of h.violations)p.ruleId===t&&p.target.selector===y.selector&&l(r.componentId,p.matchKey)}const n=await je()??[];for(const g of a){const y=n.find(h=>h.url===g.url);if(y)for(const h of y.results)for(const p of h.violations)p.ruleId===t&&p.target.selector===g.selector&&l(y.componentId,p.matchKey)}return o}function Tt({row:t}){return e.jsxs("details",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,overflow:"hidden"},children:[e.jsxs("summary",{style:{cursor:"pointer",padding:"var(--v2-pad-3) var(--v2-pad-4)",listStyle:"none",display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-3)"},children:[e.jsx(Et,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(At,{row:t}),e.jsx(Nt,{row:t})]}),e.jsx(It,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Ut,{row:t})})]})}function Et({row:t}){if(t.kind==="walkthrough-ack")return e.jsx("span",{className:"v2-chip v2-chip-verified","aria-label":"Status: human verified",children:"verified"});if(t.kind==="needs-review")return e.jsx("span",{className:"v2-chip v2-chip-review","aria-label":"Status: needs human review",children:"review"});if(t.kind==="auto-contrast")return e.jsx("span",{className:"v2-chip v2-chip-serious","aria-label":"Severity: serious, auto-resolved by pixel sampler",title:"Empirical pixel-contrast measurement, not an axe-confirmed violation. Human verification recommended.",children:"auto · serious"});if(t.kind==="walkthrough-fail")return e.jsx("span",{className:t.verdict==="fail"?"v2-chip v2-chip-serious":"v2-chip v2-chip-moderate","aria-label":`Severity: ${t.verdict}`,children:t.verdict});const a={critical:"v2-chip-critical",serious:"v2-chip-serious",moderate:"v2-chip-moderate",minor:"v2-chip-minor"};return e.jsx("span",{className:`v2-chip ${a[t.impact]}`,"aria-label":`Severity: ${t.impact}`,children:t.impact})}function At({row:t}){const a=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="needs-review"||t.kind==="axe"||t.kind==="auto-contrast"?t.criterion:null,r=t.kind==="walkthrough-fail"?t.verdict==="uncertain"?"AI could not decide this criterion — needs your manual verification.":"AI walkthrough fail on this criterion.":t.kind==="walkthrough-ack"?"Human-verified by an auditor.":t.kind==="needs-review"?t.description:t.kind==="auto-contrast"?"Empirical contrast measurement fell below threshold.":t.description;return e.jsxs("p",{style:{margin:0,marginBottom:4,color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,lineHeight:1.4},children:[a&&e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)",marginRight:8},children:["WCAG ",a]}),r]})}function Nt({row:t}){const a=t.kind==="axe"||t.kind==="needs-review"?t.pages.length:1,r=t.kind==="axe"||t.kind==="needs-review"||t.kind==="auto-contrast"?t.selector:null,o=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="auto-contrast"?t.pageUrl:null;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[r&&e.jsx("code",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",background:"var(--v2-bg-elev-2)",padding:"2px 6px",borderRadius:2,wordBreak:"break-all"},children:r}),o&&e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:o}),a>1&&e.jsxs("span",{className:"v2-eyebrow",style:{marginLeft:"auto"},children:["on ",a," pages"]})]})}function It(){return e.jsx("span",{"aria-hidden":"true",style:{color:"var(--v2-ink-tertiary)",fontFamily:"var(--v2-mono)",fontSize:12,marginLeft:8,marginTop:2},children:"⏵"})}function Ut({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Pt,{row:t}):t.kind==="walkthrough-ack"?e.jsx(Dt,{row:t}):t.kind==="needs-review"?e.jsx(Lt,{row:t}):t.kind==="auto-contrast"?e.jsx(zt,{row:t}):e.jsx(_t,{row:t})}function zt({row:t}){const[a,r]=c.useState(!1),[o,s]=c.useState(!1),[l,n]=c.useState(""),[i,g]=c.useState(!1),[y,h]=c.useState(!1),[p,b]=c.useState(null),k=Se(t.ruleId);async function j(){if(g(!0),b(null),!l.trim()){b("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),g(!1);return}try{const m=(await ot(t.pageUrl)).find(P=>P.ruleId===t.ruleId&&P.selector===t.selector),E={pageUrl:t.pageUrl,ruleId:t.ruleId,selector:t.selector,verdict:"pass",reasoning:`Human override: ${l.trim()}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/site-report-renderer-Bw9jYmSg.js","assets/scheduled-audit-runner-Dek_J9pU.js","assets/preload-helper-D7HrI6pR.js","assets/crash-reporter-DAZnNefT.js","assets/diff-CECbooHD.js","assets/ai-usage-log-DVzy9AU1.js"])))=>i.map(i=>d[i]);
2
+ import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as c,j as e,C as je,t as Ae,u as Ne,c as Ie,R as Ue}from"./styles-Dg6rHpW6.js";import{u as f,a as oe,R as ue,c as ze,C as Pe,M as De,l as ne,b as Le,d as _e,e as We,i as Ge,P as Fe,f as Me,s as $e,w as Oe,r as He,g as Be,h as Ve,j as qe,p as Ke,k as Ye,A as Qe,m as Ze,E as Xe,n as Je}from"./ErrorBoundary-CAo1EDqF.js";import{s as S,r as et,i as tt}from"./crash-reporter-DAZnNefT.js";import{B as ie}from"./ai-usage-log-DVzy9AU1.js";import{c as rt,C as at,a as nt,d as it,l as Se,g as Ce,s as st,b as ot,e as lt,f as ct,h as pe,i as dt,j as ut}from"./scheduled-audit-runner-Dek_J9pU.js";import{_ as re}from"./preload-helper-D7HrI6pR.js";import{copyAiFixerPrompt as pt}from"./copy-ai-fixer-prompt-CoTMEYa8.js";import{w as ve,h as ge,r as he}from"./tier-config-client-CimEdyEg.js";import{w as me,r as fe}from"./rubric-config-client-DhPZ3tGE.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./diff-CECbooHD.js";import"./design-system-audit-DpxJrxnb.js";function xe({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:o,onAuditThisPage:s,reviewEnabled:l,onToggleReview:n}){const[i,g]=c.useState(t),[y,h]=c.useState(25),[p,b]=c.useState(""),[k,j]=c.useState(""),[w,m]=c.useState(!1),[E,P]=c.useState(ie),[x,F]=c.useState(ie[0].id),[O,U]=c.useState(null),[W,R]=c.useState(!0);c.useEffect(()=>{t&&!i&&g(t)},[t]),c.useEffect(()=>{let u=!1;return Promise.all([S({type:"SETTINGS_GET",key:"matrixPresets"}),S({type:"SETTINGS_GET",key:"activePresetId"})]).then(([T,L])=>{if(u)return;const d=Array.isArray(T.data)?T.data:null;P(d&&d.length>0?d:ie),typeof L.data=="string"&&F(L.data)}),()=>{u=!0}},[]),c.useEffect(()=>{let u=!1;return S({type:"SETTINGS_GET",key:"crawlRememberSettings"}).then(async T=>{if(u)return;const d=T.data!==!1;if(R(d),!d)return;const[C,B,M]=await Promise.all([S({type:"SETTINGS_GET",key:"crawlMaxPages"}),S({type:"SETTINGS_GET",key:"crawlIncludeRegex"}),S({type:"SETTINGS_GET",key:"crawlExcludeRegex"})]);if(u)return;const $=C.data;typeof $=="number"&&$>=1&&h(Math.min(200,$));const Z=B.data,X=M.data;typeof Z=="string"&&Z&&b(Z),typeof X=="string"&&X&&j(X),(typeof Z=="string"&&Z||typeof X=="string"&&X)&&m(!0)}),()=>{u=!0}},[]);function Q(u){h(u),W&&S({type:"SETTINGS_SET",key:"crawlMaxPages",value:u})}function v(u){b(u),W&&S({type:"SETTINGS_SET",key:"crawlIncludeRegex",value:u})}function z(u){j(u),W&&S({type:"SETTINGS_SET",key:"crawlExcludeRegex",value:u})}function A(u){R(u),S({type:"SETTINGS_SET",key:"crawlRememberSettings",value:u}),u&&(S({type:"SETTINGS_SET",key:"crawlMaxPages",value:y}),S({type:"SETTINGS_SET",key:"crawlIncludeRegex",value:p.trim()}),S({type:"SETTINGS_SET",key:"crawlExcludeRegex",value:k.trim()}))}function N(u){const T=E.find(L=>L.id===u);T&&(F(u),S({type:"SETTINGS_SET",key:"activePresetId",value:u}),S({type:"SETTINGS_SET",key:"stateMatrix",value:T.matrix}))}function H(){U(null);for(const[u,T]of[["Include",p.trim()],["Exclude",k.trim()]])if(T)try{new RegExp(T)}catch(L){return U(`${u} regex invalid: ${L instanceof Error?L.message:String(L)}`),!1}return!0}function D(){const u=i.trim();if(!u)return null;let T;try{T=new URL(u)}catch{return"Start URL must be a full URL starting with http:// or https://."}return T.protocol!=="http:"&&T.protocol!=="https:"?`Start URL must use http:// or https:// — ${T.protocol} can't be crawled.`:null}const I=D(),q=!!i.trim()&&!I;function V(u){if(!H()||!q)return;const T={startUrl:i.trim(),maxPages:y,includeRegex:p.trim(),excludeRegex:k.trim()};u&&o?o(T):r(T)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsxs(J,{label:"Start URL",children:[e.jsx("input",{type:"url",value:i,onChange:u=>g(u.target.value),placeholder:"https://yoursite.com",disabled:a,"aria-invalid":!!I,className:"v2-mono",style:ee}),I&&e.jsx("p",{role:"alert",style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-critical)",lineHeight:1.4},children:I})]}),e.jsx(J,{label:"Max pages",hint:"1–200. Each page runs the full pipeline you configured.",children:e.jsx("input",{type:"number",min:1,max:200,value:y,onChange:u=>Q(Math.min(200,Math.max(1,parseInt(u.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...ee,maxWidth:100}})}),e.jsx(J,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:x,onChange:u=>N(u.target.value),disabled:a,style:ee,children:E.map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))})}),e.jsx("button",{type:"button",onClick:()=>m(u=>!u),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:w?"− hide advanced filters":"+ show URL filters (include / exclude)"}),w&&e.jsxs(e.Fragment,{children:[e.jsx(J,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:p,onChange:u=>v(u.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:ee})}),e.jsx(J,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:k,onChange:u=>z(u.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:ee})})]}),O&&e.jsx("p",{role:"alert",style:{color:"var(--v2-critical)",fontSize:12,margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)"},children:O}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",fontSize:12,lineHeight:1.4,color:"var(--v2-ink-secondary)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:W,disabled:a,onChange:u=>A(u.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:"Remember these settings."})," ","Keep max pages + the include/exclude filters for next time (the audit-depth preset is always remembered)."]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",fontSize:12,lineHeight:1.4,color:"var(--v2-ink-secondary)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l,disabled:a,onChange:u=>n(u.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:"Review pages before auditing."})," ","List every page that would be crawled, then remove any you don't want before the audit runs."]})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:a||!q,onClick:()=>V(!1),children:a?"Crawling…":l?"Find pages to audit":"Crawl whole site"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!q,onClick:()=>V(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),s&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a,onClick:s,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function vt(){var h;const t=f(p=>p.siteCrawlProgress),a=f(p=>p.siteCrawlStatus),r=f(p=>p.progress),o=f(p=>p.aiProgress),[s,l]=c.useState(!1);function n(){l(!0),S({type:"CANCEL_SITE_CRAWL"})}if(a!=="running")return null;const i=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,g=r?Math.min(100,Math.max(0,r.current/Math.max(1,r.total)*100)):0,y=r!=null&&r.currentState?[r.currentState.pseudoState,r.currentState.theme&&r.currentState.theme!=="light"?r.currentState.theme:null,r.currentState.direction&&r.currentState.direction!=="ltr"?r.currentState.direction:null,(h=r.currentState.breakpoint)!=null&&h.id&&r.currentState.breakpoint.id!=="desktop"?r.currentState.breakpoint.id:null].filter(Boolean).join(" · "):"";return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"crawling…"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:t?`${t.current} / ${t.total}`:"…"})]}),e.jsx("div",{role:"progressbar","aria-valuenow":(t==null?void 0:t.current)??0,"aria-valuemin":0,"aria-valuemax":(t==null?void 0:t.total)??1,"aria-label":"Crawl progress",style:{height:8,background:"var(--v2-bg-elev-2)",borderRadius:4,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${i}%`,background:"var(--v2-action)",transition:"width 240ms ease"}})}),(t==null?void 0:t.url)&&e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:4},children:"current page"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:t.url})]}),(t==null?void 0:t.lastViolations)!==void 0&&t.lastViolations>0&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:["last page: ",t.lastViolations," axe violation",t.lastViolations===1?"":"s"]}),r&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",paddingTop:"var(--v2-pad-3)",borderTop:"1px solid var(--v2-border)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-tertiary)"},children:"this page · auditing"}),e.jsxs("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",fontVariantNumeric:"tabular-nums"},children:[r.current," / ",r.total]})]}),e.jsx("div",{role:"progressbar","aria-valuenow":r.current,"aria-valuemin":0,"aria-valuemax":r.total,"aria-label":"Current page audit progress",style:{height:4,background:"var(--v2-bg-elev-2)",borderRadius:2,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${g}%`,background:"var(--v2-ink-tertiary)",transition:"width 240ms ease"}})}),y&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)"},children:["state: ",y]}),o&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-needs-review)",fontVariantNumeric:"tabular-nums"},children:["AI: ",o.current," / ",o.total," · ",o.currentCheckLabel,o.candidatesTotal&&o.candidatesTotal>0?` (${o.candidatesDone??0}/${o.candidatesTotal})`:""]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:n,disabled:s,children:s?"Cancelling…":"Cancel crawl"}),s&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up current page audit — final cancel can take up to a few seconds."})]})]})}function gt(){const t=f(s=>s.crawlDiscoveryStatus),a=f(s=>s.crawlDiscoveryFound),r=f(s=>s.crawlDiscoveryLastUrl);function o(){S({type:"CANCEL_CRAWL_DISCOVERY"}),f.getState().resetCrawlDiscovery()}return t!=="discovering"?null:e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"finding pages…"}),e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:[a," page",a===1?"":"s"," found"]}),r&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:r}),e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:"Loading each page to read its links — no audit yet. You'll prune the list before anything is audited."}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,children:"Cancel"})})]})}function ht({onAudit:t}){const a=f(n=>n.crawlDiscoveryStatus),r=f(n=>n.crawlDiscoveryUrls),[o,s]=c.useState(new Set);c.useEffect(()=>{a==="reviewing"&&s(new Set(r))},[a,r]);function l(){S({type:"CANCEL_CRAWL_DISCOVERY"}),f.getState().resetCrawlDiscovery()}return a!=="reviewing"?null:e.jsxs("div",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"review pages to audit"}),e.jsxs("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.4},children:["Found ",e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:r.length})," page",r.length===1?"":"s",". Uncheck any you don't want, then audit the rest. ",e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:o.size})," selected."]}),r.length===0?e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-tertiary)"},children:"No pages discovered from this URL. Check the start URL + filters and try again."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",onClick:()=>s(new Set(r)),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-action)",fontSize:11},children:"select all"}),e.jsx("button",{type:"button",onClick:()=>s(new Set),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-action)",fontSize:11},children:"select none"})]}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,maxHeight:300,overflowY:"auto",border:"1px solid var(--v2-border)",borderRadius:4},children:r.map(n=>e.jsx("li",{style:{borderBottom:"1px solid var(--v2-border)"},children:e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",padding:"6px 10px",fontSize:11,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:o.has(n),onChange:i=>s(g=>{const y=new Set(g);return i.target.checked?y.add(n):y.delete(n),y}),style:{marginTop:2}}),e.jsx("span",{className:"v2-mono",style:{wordBreak:"break-all",color:"var(--v2-ink-secondary)"},children:n})]})},n))})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:o.size===0,onClick:()=>t(r.filter(n=>o.has(n))),children:["Audit ",o.size," page",o.size===1?"":"s"]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:l,children:"Cancel"})]})]})}function mt(){const t=f(h=>h.status),a=f(h=>h.progress),r=f(h=>h.aiProgress),[o,s]=c.useState(!1);if(t!=="running")return null;const l=a?a.current>=a.total:!1,n=a?l?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",i=a?l?"reading order · tab order · typography · CSS vars · AI candidates":ft(a.currentState):"Loading axe + DOM analyzers",g=a?l?100:a.current/Math.max(1,a.total)*100:0;function y(){s(!0),S({type:"CANCEL_AUDIT"})}return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-4)"},children:[e.jsx(ye,{label:n,detail:i,pct:g,valuenow:a?Math.min(a.current,a.total):0,valuemax:a?a.total:1,ariaLabel:a?l?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${a.current} of ${a.total} states`:"Audit starting",fillColor:"var(--v2-action)"}),r&&e.jsx(ye,{label:`AI augmentation… ${r.current} / ${r.total}`,detail:r.candidatesTotal&&r.candidatesTotal>0?`${r.currentCheckLabel} (${r.candidatesDone??0}/${r.candidatesTotal})`:r.currentCheckLabel,pct:r.current/Math.max(1,r.total)*100,valuenow:r.current,valuemax:r.total,ariaLabel:`AI augmentation: ${r.current} of ${r.total} checks. ${r.currentCheckLabel}`,fillColor:"var(--v2-needs-review)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:y,disabled:o,children:o?"Cancelling…":"Cancel audit"}),o&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up — final cancel can take up to a few seconds."})]})]})}function ye({label:t,detail:a,pct:r,valuenow:o,valuemax:s,ariaLabel:l,fillColor:n}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:e.jsx("span",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:t})}),e.jsx("div",{role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":s,"aria-label":l,style:{height:6,background:"var(--v2-bg-elev-2)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${r}%`,background:n,transition:"width 240ms ease"}})}),a&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:a})]})}function ft(t){if(!t)return"";const a=[t.pseudoState];return t.theme&&t.theme!=="light"&&a.push(t.theme),t.direction&&t.direction!=="ltr"&&a.push(t.direction),a.join(" · ")}function J({label:t,hint:a,children:r}){return e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-secondary)"},children:t}),r,a&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:a})]})}const ee={fontFamily:"var(--v2-body)",fontSize:12,padding:"8px 10px",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,outline:"none"};function xt({sealed:t}){const[a,r]=c.useState(!1),o=JSON.stringify({claim:t.claim,hash:t.hash,receipt:t.receipt},null,2),s=new Date(t.claim.auditedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),l=()=>{navigator.clipboard.writeText(o).then(()=>{r(!0),setTimeout(()=>r(!1),2500)})};return e.jsxs("div",{role:"group","aria-label":"Wall of Fame badge",style:{marginTop:"var(--v2-pad-5)",padding:"var(--v2-pad-4)",border:"1px solid var(--v2-verified, #15803d)",borderRadius:6,background:"var(--v2-verified-bg, rgba(21,128,61,0.06))",maxWidth:640},children:[e.jsx("p",{style:{margin:0,fontWeight:600,fontSize:13,color:"var(--v2-ink-primary)"},children:"🏆 You earned a Wall of Fame badge"}),e.jsxs("p",{style:{margin:"var(--v2-pad-2) 0 0",fontSize:12,color:"var(--v2-ink-secondary)"},children:["WCAG ",t.claim.wcagLevel," · grade ",t.claim.grade," · ",t.claim.pageCount," page",t.claim.pageCount===1?"":"s"," · audited ",s]}),e.jsxs("p",{style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,lineHeight:1.5,color:"var(--v2-ink-tertiary)"},children:["Submit this signed attestation at ",e.jsx("strong",{children:"accessibilitywatch.org"})," to claim a public, dated, verifiable badge for ",e.jsx("strong",{children:t.claim.domain}),". They verify the signature and confirm you control the domain before it goes live."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:l,children:a?"Copied ✓":"Copy attestation"}),e.jsx("span",{role:"status","aria-live":"polite",style:{fontSize:11,color:"var(--v2-verified, #15803d)"},children:a?"Attestation copied to clipboard.":""})]})]})}function yt(t){const[a,r]=c.useState(null);return c.useEffect(()=>{if(!t){r(null);return}let o=!1;const s=()=>et({type:"SITE_CLAIM_GET_REQUEST",domain:t}).then(n=>{o||r(n.claim)}).catch(()=>{o||r(null)});s();const l=n=>{typeof n=="object"&&n!==null&&n.type==="SITE_CLAIM_SEALED_EVENT"&&n.domain===t&&s()};return chrome.runtime.onMessage.addListener(l),()=>{o=!0,chrome.runtime.onMessage.removeListener(l)}},[t]),a}function be({open:t,gaps:a,onRunFull:r,onQuickCheck:o,onCancel:s}){return t?e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Audit settings are below WCAG 2.1 AA conformance",style:{position:"fixed",inset:0,background:"rgba(2,6,23,0.7)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:s,children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{background:"#0f172a",border:"1px solid #334155",borderRadius:10,maxWidth:460,width:"100%",padding:20,color:"#e2e8f0"},children:[e.jsx("h2",{style:{margin:"0 0 8px",fontSize:16},children:"Your settings aren’t a Full 2.1 AA audit"}),e.jsxs("p",{style:{margin:"0 0 10px",fontSize:13,color:"#cbd5e1",lineHeight:1.5},children:["A grade only means WCAG 2.1 AA if the audit exercised the states and checks the AA criteria live in. With your current settings, this run is a ",e.jsx("strong",{children:"quick check"}),", not a conformance result."]}),e.jsx("ul",{style:{margin:"0 0 14px",paddingLeft:18,fontSize:12,color:"#fca5a5",lineHeight:1.6},children:a.map((l,n)=>e.jsx("li",{children:l},n))}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:r,style:{background:"#2563eb",color:"#fff",border:"none",borderRadius:6,padding:"10px 12px",fontSize:13,fontWeight:600,cursor:"pointer"},children:"Run the Full 2.1 AA audit (applies the preset, then crawls)"}),e.jsx("button",{onClick:o,style:{background:"#1e293b",color:"#cbd5e1",border:"1px solid #334155",borderRadius:6,padding:"10px 12px",fontSize:13,cursor:"pointer"},children:"Quick check with current settings — not a conformance result"}),e.jsx("button",{onClick:s,style:{background:"none",color:"#64748b",border:"none",fontSize:12,padding:"4px",cursor:"pointer"},children:"Cancel"})]}),e.jsx("p",{style:{margin:"12px 0 0",fontSize:11,color:"#64748b",lineHeight:1.5},children:"Either way, the grade and every export are stamped with the exact settings used — a quick check can’t be mistaken for a conformance result. (Owner mode isn’t affected; it only flags demand-letter bait.)"})]})}):null}function bt(){const[t,a]=c.useState([]),[r,o]=c.useState(!1),s=c.useRef(null),l=c.useRef(!1),n=c.useCallback(async()=>{try{const p=await chrome.storage.local.get(["stateMatrix","runsPerState","aiConfig"]),b=p.aiConfig??{},k=rt({stateMatrix:p.stateMatrix,runsPerState:typeof p.runsPerState=="number"?p.runsPerState:1,aiEnabled:!!b.enabled&&!!b.apiKey});return a(k),k}catch{return a([]),[]}},[]);c.useEffect(()=>{n()},[n]);const i=c.useCallback(async p=>{if((await n()).length===0||l.current){p();return}s.current=p,o(!0)},[n]),g=c.useCallback(async()=>{try{const k=(await chrome.storage.local.get("aiConfig")).aiConfig??{};await chrome.storage.local.set({stateMatrix:nt,runsPerState:at,aiConfig:{...k,enabled:!0}})}catch{}l.current=!0,o(!1);const p=s.current;s.current=null,p==null||p()},[]),y=c.useCallback(()=>{l.current=!0,o(!1);const p=s.current;s.current=null,p==null||p()},[]),h=c.useCallback(()=>{o(!1),s.current=null},[]);return{gaps:t,gateOpen:r,requestCrawl:i,runFull:g,quickCheck:y,cancel:h}}function kt(){const{report:t,resolvedFails:a}=oe(),r=f(d=>d.siteCrawlReport),o=f(d=>d.siteCrawlStatus),s=f(d=>d.siteCrawlError),l=f(d=>d.status),n=o==="running",g=n||l==="running"&&!n,y=!!t&&!r,h=!y&&(t==null?void 0:t.siteGrade)==="A"&&t.startUrl?it(t.startUrl):null,p=yt(h),[b,k]=c.useState(null);c.useEffect(()=>{let d=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(C=>{var M;if(d)return;const B=((M=C[0])==null?void 0:M.url)??null;k(B&&/^https?:\/\//i.test(B)?B:null)}),()=>{d=!0}},[]);const[j,w]=c.useState(!1),m=f(d=>d.crawlDiscoveryStatus),[E,P]=c.useState(!0),x=bt(),[F,O]=c.useState("");c.useEffect(()=>{S({type:"SETTINGS_GET",key:"crawlReviewEnabled"}).then(d=>{const C=d.data;typeof C=="boolean"&&P(C)})},[]);function U(d){P(d),S({type:"SETTINGS_SET",key:"crawlReviewEnabled",value:d})}function W(d,C=!1){if(d.startUrl){if(C){R(d,!0);return}x.requestCrawl(()=>R(d,!1))}}function R(d,C=!1){if(E&&!C){O(d.startUrl),f.getState().setSiteCrawlError(null),f.getState().setCrawlDiscoveryStatus("discovering"),Le({type:"START_CRAWL_DISCOVERY",startUrl:d.startUrl,maxPages:d.maxPages,...d.includeRegex?{includeRegex:d.includeRegex}:{},...d.excludeRegex?{excludeRegex:d.excludeRegex}:{}});return}f.getState().setSiteCrawlStatus("running"),f.getState().setSiteCrawlReport(null),f.getState().setSiteCrawlError(null),ne({type:"START_SITE_CRAWL",startUrl:d.startUrl,maxPages:d.maxPages,...d.includeRegex?{includeRegex:d.includeRegex}:{},...d.excludeRegex?{excludeRegex:d.excludeRegex}:{},...C?{verifyFixesOnly:!0}:{}})}function Q(d){d.length!==0&&(f.getState().setSiteCrawlStatus("running"),f.getState().setSiteCrawlReport(null),f.getState().setSiteCrawlError(null),f.getState().resetCrawlDiscovery(),ne({type:"START_SITE_CRAWL",startUrl:F,urls:d}))}function v(){ne({type:"START_AUDIT",mode:"full-page"}),f.getState().startNewScan()}const[z,A]=c.useState(!1),[N,H]=c.useState(null),[D,I]=c.useState(null);async function q(){A(!0),H(null),I(null);const d=(t==null?void 0:t.siteGrade)??"A";try{const C=await S({type:"REGRADE_SITE_CRAWL"});if((C==null?void 0:C.ok)===!0)setTimeout(()=>{var $;const M=(($=f.getState().siteCrawlReport)==null?void 0:$.siteGrade)??d;I({prevGrade:d,nextGrade:M,at:Date.now()})},0);else{const M=(C==null?void 0:C.reason)??"Regrade failed.";H(M)}}catch(C){H(C instanceof Error?C.message:String(C))}finally{A(!1)}}if(c.useEffect(()=>{if(!D)return;const d=setTimeout(()=>I(null),6e3);return()=>clearTimeout(d)},[D]),g)return e.jsx("section",{"aria-label":"Audit in progress",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:n?e.jsx(vt,{}):e.jsx(mt,{})});if(m==="discovering"||m==="reviewing")return e.jsx("section",{"aria-label":"Choose pages to audit",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:m==="discovering"?e.jsx(gt,{}):e.jsx(ht,{onAudit:Q})});if(!t)return e.jsxs("section",{"aria-label":"No audit yet",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:[e.jsx("p",{className:"v2-eyebrow",style:{marginBottom:"var(--v2-pad-2)"},children:"new audit"}),e.jsx("h1",{className:"v2-display",style:{fontSize:28,fontWeight:500,letterSpacing:"-0.02em",color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:"Configure your crawl."}),s&&e.jsxs("div",{role:"alert",style:{marginBottom:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)",color:"var(--v2-critical)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600,marginRight:6},children:"Last crawl failed:"}),s]}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,marginBottom:"var(--v2-pad-5)",maxWidth:520},children:"The crawler follows internal links from the start URL, same-origin only. Each page runs your full audit pipeline (axe + DOM analyzers + AI walkthroughs). Findings appear below as a single unified list."}),e.jsx(xe,{initialUrl:b??"",isRunning:g,onCrawl:d=>W(d,!1),onAuditThisPage:v,reviewEnabled:E,onToggleReview:U}),e.jsx("div",{style:{marginTop:"var(--v2-pad-3)"},children:e.jsx(ue,{})}),e.jsx(be,{open:x.gateOpen,gaps:x.gaps,onRunFull:x.runFull,onQuickCheck:x.quickCheck,onCancel:x.cancel})]});const V=a.length,u=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+V,T=(t.walkthroughAcknowledgements??[]).length,L=t.totalNeedsReview;return e.jsxs("section",{"aria-label":"Audit summary",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"var(--v2-pad-6)"},children:[e.jsx(jt,{grade:t.siteGrade}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:y?"page grade · single-page audit":`site grade · ${t.pagesAudited} page${t.pagesAudited===1?"":"s"}`}),e.jsxs("p",{style:{margin:0,fontSize:11,lineHeight:1.4,color:"var(--v2-ink-tertiary)"},children:["Your ",e.jsx("strong",{children:"combined grade"})," — severity (your most serious finding) and breadth (how many of the 9 areas have issues) together, with a legal floor so a serious issue can't be averaged away. The Dev view shows the same letter."]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-5)"},children:[e.jsx("h1",{className:"v2-display",style:{fontSize:22,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0,lineHeight:1.25},children:(()=>{var B,M;if(((B=t.spotCheckGate)==null?void 0:B.status)==="pending"){const $=t.spotCheckGate;return`On track for A — answer ${$.unanswered.length} more content-meaning spot-check${$.unanswered.length===1?"":"s"} below to finalize your grade (${$.answered}/${$.total} done).`}const d=u+L,C=((M=t.blockingCriteria)==null?void 0:M.length)??0;return d===0&&C===0?"All clear — nothing open.":d===0&&C>0?`Visible findings clear — ${C} criteri${C===1?"on":"a"} still need${C===1?"s":""} your judgment.`:`${d} finding${d===1?"":"s"} to address.`})()}),e.jsx(St,{openCount:u,reviewCount:L,verifiedCount:T,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:V}),b&&!wt(b,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",b]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[y?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:v,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>w(d=>!d),"aria-expanded":j,title:"Open crawl setup to audit the whole site instead",children:j?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:q,disabled:z,title:"Re-aggregate this audit against your latest verdicts + acks. No re-crawl. Use this after marking criteria in the Coverage gaps panel.",children:z?"Regrading…":"Regrade"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>W({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options) — full audit re-run, use when page code changed`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:v,title:"Single-page audit of the active tab (no crawl)",children:"Just this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>W({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>w(d=>!d),"aria-expanded":j,children:j?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>void ze(),title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx(ue,{})}),N&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:N}),D&&!N&&e.jsx("p",{role:"status",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-verified)"},children:D.prevGrade===D.nextGrade?`Regraded — grade unchanged at ${D.nextGrade}. Any verdict changes you made were already in this report.`:`Regraded — grade ${D.prevGrade} → ${D.nextGrade}.`})]}),(p==null?void 0:p.receipt)&&e.jsx(xt,{sealed:p}),e.jsx(Pe,{}),e.jsx(De,{}),j&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-5)",paddingTop:"var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)",maxWidth:640},children:[e.jsx(xe,{initialUrl:t.startUrl,isRunning:g,onCrawl:d=>W(d,!1),onVerifyFixes:d=>W(d,!0),onAuditThisPage:v,reviewEnabled:E,onToggleReview:U}),e.jsx(be,{open:x.gateOpen,gaps:x.gaps,onRunFull:x.runFull,onQuickCheck:x.quickCheck,onCancel:x.cancel})]})]})}function wt(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function jt({grade:t}){if(t==="pending")return e.jsx("div",{"aria-label":"Grade pending — spot-checks outstanding",role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:40,lineHeight:1.05,fontWeight:600,color:"var(--v2-ink-secondary, #94a3b8)",letterSpacing:"-0.02em",textAlign:"center"},children:"Pending"})});const a={A:"var(--v2-grade-a)",B:"var(--v2-grade-b)",C:"var(--v2-grade-c)",D:"var(--v2-grade-d)",F:"var(--v2-grade-f)"};return e.jsx("div",{"aria-label":`Grade ${t}`,role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:132,lineHeight:1,fontWeight:500,color:a[t],letterSpacing:"-0.04em",fontVariationSettings:'"opsz" 144'},children:t})})}function St({openCount:t,reviewCount:a,verifiedCount:r,axeCount:o,walkthroughCount:s,autoCount:l}){return e.jsxs("dl",{style:{display:"flex",gap:"var(--v2-pad-4)",flexWrap:"wrap",margin:0,color:"var(--v2-ink-secondary)",fontSize:12},children:[e.jsx(K,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(K,{term:"review",value:a,tone:a>0?"review":"neutral"}),e.jsx(K,{term:"verified",value:r,tone:r>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(K,{term:"axe",value:o,tone:"neutral"}),e.jsx(K,{term:"walkthrough",value:s,tone:"neutral"}),l>0&&e.jsx(K,{term:"auto-contrast",value:l,tone:"neutral"})]})}function K({term:t,value:a,tone:r}){const o={attention:"var(--v2-critical)",review:"var(--v2-needs-review)",positive:"var(--v2-verified)",neutral:"var(--v2-ink-secondary)"};return e.jsxs("div",{style:{display:"inline-flex",alignItems:"baseline",gap:6},children:[e.jsx("dt",{className:"v2-eyebrow",style:{display:"inline",margin:0,color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("dd",{className:"v2-mono",style:{margin:0,fontWeight:600,fontSize:13,color:o[r],fontVariantNumeric:"tabular-nums"},children:a})]})}const Ct=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function ke(t){return Ct.has(t)}async function we(t){var o,s;const a=f.getState();if(a.componentId&&((o=a.results[0])==null?void 0:o.pageUrl)===t)return a.componentId;const r=await Se();return((s=r==null?void 0:r.find(l=>l.url===t))==null?void 0:s.componentId)??null}async function Rt(t,a){var i;const r=f.getState(),o=[],s=new Set,l=(g,y)=>{const h=`${g}::${y}`;s.has(h)||(s.add(h),o.push({componentId:g,matchKey:y}))};if(r.componentId&&r.results.length>0){const g=(i=r.results[0])==null?void 0:i.pageUrl,y=a.find(h=>h.url===g);if(y)for(const h of r.results)for(const p of h.violations)p.ruleId===t&&p.target.selector===y.selector&&l(r.componentId,p.matchKey)}const n=await Se()??[];for(const g of a){const y=n.find(h=>h.url===g.url);if(y)for(const h of y.results)for(const p of h.violations)p.ruleId===t&&p.target.selector===g.selector&&l(y.componentId,p.matchKey)}return o}function Tt({row:t}){return e.jsxs("details",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,overflow:"hidden"},children:[e.jsxs("summary",{style:{cursor:"pointer",padding:"var(--v2-pad-3) var(--v2-pad-4)",listStyle:"none",display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-3)"},children:[e.jsx(Et,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(At,{row:t}),e.jsx(Nt,{row:t})]}),e.jsx(It,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Ut,{row:t})})]})}function Et({row:t}){if(t.kind==="walkthrough-ack")return e.jsx("span",{className:"v2-chip v2-chip-verified","aria-label":"Status: human verified",children:"verified"});if(t.kind==="needs-review")return e.jsx("span",{className:"v2-chip v2-chip-review","aria-label":"Status: needs human review",children:"review"});if(t.kind==="auto-contrast")return e.jsx("span",{className:"v2-chip v2-chip-serious","aria-label":"Severity: serious, auto-resolved by pixel sampler",title:"Empirical pixel-contrast measurement, not an axe-confirmed violation. Human verification recommended.",children:"auto · serious"});if(t.kind==="walkthrough-fail")return e.jsx("span",{className:t.verdict==="fail"?"v2-chip v2-chip-serious":"v2-chip v2-chip-moderate","aria-label":`Severity: ${t.verdict}`,children:t.verdict});const a={critical:"v2-chip-critical",serious:"v2-chip-serious",moderate:"v2-chip-moderate",minor:"v2-chip-minor"};return e.jsx("span",{className:`v2-chip ${a[t.impact]}`,"aria-label":`Severity: ${t.impact}`,children:t.impact})}function At({row:t}){const a=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="needs-review"||t.kind==="axe"||t.kind==="auto-contrast"?t.criterion:null,r=t.kind==="walkthrough-fail"?t.verdict==="uncertain"?"AI could not decide this criterion — needs your manual verification.":"AI walkthrough fail on this criterion.":t.kind==="walkthrough-ack"?"Human-verified by an auditor.":t.kind==="needs-review"?t.description:t.kind==="auto-contrast"?"Empirical contrast measurement fell below threshold.":t.description;return e.jsxs("p",{style:{margin:0,marginBottom:4,color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,lineHeight:1.4},children:[a&&e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)",marginRight:8},children:["WCAG ",a]}),r]})}function Nt({row:t}){const a=t.kind==="axe"||t.kind==="needs-review"?t.pages.length:1,r=t.kind==="axe"||t.kind==="needs-review"||t.kind==="auto-contrast"?t.selector:null,o=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="auto-contrast"?t.pageUrl:null;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[r&&e.jsx("code",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",background:"var(--v2-bg-elev-2)",padding:"2px 6px",borderRadius:2,wordBreak:"break-all"},children:r}),o&&e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:o}),a>1&&e.jsxs("span",{className:"v2-eyebrow",style:{marginLeft:"auto"},children:["on ",a," pages"]})]})}function It(){return e.jsx("span",{"aria-hidden":"true",style:{color:"var(--v2-ink-tertiary)",fontFamily:"var(--v2-mono)",fontSize:12,marginLeft:8,marginTop:2},children:"⏵"})}function Ut({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Pt,{row:t}):t.kind==="walkthrough-ack"?e.jsx(Dt,{row:t}):t.kind==="needs-review"?e.jsx(Lt,{row:t}):t.kind==="auto-contrast"?e.jsx(zt,{row:t}):e.jsx(_t,{row:t})}function zt({row:t}){const[a,r]=c.useState(!1),[o,s]=c.useState(!1),[l,n]=c.useState(""),[i,g]=c.useState(!1),[y,h]=c.useState(!1),[p,b]=c.useState(null),k=Ce(t.ruleId);async function j(){if(g(!0),b(null),!l.trim()){b("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),g(!1);return}try{const m=(await ot(t.pageUrl)).find(P=>P.ruleId===t.ruleId&&P.selector===t.selector),E={pageUrl:t.pageUrl,ruleId:t.ruleId,selector:t.selector,verdict:"pass",reasoning:`Human override: ${l.trim()}
3
3
 
4
- (Original empirical reasoning: ${t.reasoning})`,resolvedAt:new Date().toISOString(),costUsd:0,wcagCriterion:t.criterion,inputHash:m==null?void 0:m.inputHash};await lt(E),h(!0),r(!1)}catch(w){b(w instanceof Error?w.message:String(w))}finally{g(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"Empirical measurement",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.reasoning})}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-3)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5,fontStyle:"italic"},children:"This finding came from a pixel-level screenshot diff of text against the rendered background, not from axe-core. Treat as a strong hint for human review, not a confirmed violation — gradients, translucent overlays, and animated backdrops can fool the sampler."}),y?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[k&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>s(w=>!w),"aria-expanded":o,children:o?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(w=>!w),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),o&&k&&e.jsx(Re,{summary:k.summary,snippet:k.snippet}),a&&e.jsx(le,{note:l,setNote:n,busy:i,err:p,onConfirm:j,hint:"Why the empirical measurement is wrong, or why this is acceptable. Overrides the resolution to pass.",placeholder:"e.g., Text sits over a video poster image; static screenshot misreads the rendered background. Production poster passes 7:1."}),p&&!a&&e.jsx(ae,{message:p})]})]})}function Pt({row:t}){const[a,r]=c.useState(!1),[o,s]=c.useState(""),[l,n]=c.useState(!1),[i,g]=c.useState(!1),[y,h]=c.useState(!1),[p,b]=c.useState(null),[k,j]=c.useState(null),w=be(t.criterion),m=De();async function E(){if(n(!0),j(null),!o.trim()){j("Note is required — explain how you manually verified this."),n(!1);return}try{const x=await ke(t.pageUrl);if(!x){j("Could not find this page in the audit data. Re-run the audit and try again.");return}await st({componentId:x,criterionId:t.criterion,pageUrl:t.pageUrl,note:o.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),g(!0),r(!1)}catch(x){j(x instanceof Error?x.message:String(x))}finally{n(!1)}}async function P(){var x;h(!0),b(null),j(null);try{const O=(x=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:x.id;if(!O){j("Open the audited page in your active tab to re-run.");return}const U=await ke(t.pageUrl);if(!U){j("Could not find this page in the audit data.");return}if(!be(t.criterion)){j(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const R=await S({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:O,componentId:U,pageUrl:t.pageUrl});if(!R.ok){j(R.error??"Re-run failed.");return}b(`Re-run verdict: ${R.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(F){j(F instanceof Error?F.message:String(F))}finally{h(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"AI reasoning",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),i?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[w&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:P,disabled:y||!m,title:m?void 0:"AI walkthroughs need an Anthropic API key. Add one in Settings → AI.",children:y?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(x=>!x),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),p&&e.jsx("p",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:11,lineHeight:1.5},children:p}),a&&e.jsx(le,{note:o,setNote:s,busy:l,err:k,onConfirm:E,hint:"Explain what you checked. This goes into the forensic record.",placeholder:"e.g., Verified — focus indicator visible on every interactive control under :focus-visible; tested with keyboard nav."}),k&&!a&&e.jsx(ae,{message:k})]})]})}function Dt({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"What the human verified",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),e.jsxs("p",{style:{color:"var(--v2-ink-tertiary)",fontSize:11,margin:0,marginTop:"var(--v2-pad-2)"},children:["Original AI verdict: ",e.jsx("strong",{children:t.verdict}),". Now treated as pass for conformance."]})]})}function Lt({row:t}){return e.jsx(Ce,{row:t,kind:"needs-review"})}function _t({row:t}){return e.jsx(Ce,{row:t,kind:"axe"})}function Ce({row:t,kind:a}){const[r,o]=c.useState(!1),[s,l]=c.useState(""),[n,i]=c.useState(!1),[g,y]=c.useState(!1),[h,p]=c.useState(!1),[b,k]=c.useState(null),j=Se(t.ruleId);async function w(){if(i(!0),k(null),!s.trim()){k(a==="needs-review"?"Note is required — explain your review judgment.":"Note is required — explain why this isn't actually an issue in your context."),i(!1);return}try{const m=await Rt(t.ruleId,t.pages);if(m.length===0){k("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const E of m)await ct({componentId:E.componentId,matchKey:E.matchKey,ruleId:t.ruleId,note:s.trim()});y(!0),o(!1)}catch(m){k(m instanceof Error?m.message:String(m))}finally{i(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[a==="needs-review"&&t.failureSummary&&e.jsx(te,{label:"AI assessment",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.failureSummary})}),e.jsx(te,{label:"Affected",children:e.jsxs("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:4},children:[t.pages.slice(0,8).map(m=>e.jsx("li",{children:e.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textDecorationColor:"var(--v2-ink-faint)",textUnderlineOffset:2},children:m.url})},m.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),g?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[a==="axe"&&j&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>p(m=>!m),"aria-expanded":h,children:h?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(m=>!m),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),h&&j&&e.jsx(Re,{summary:j.summary,snippet:j.snippet}),r&&e.jsx(le,{note:s,setNote:l,busy:n,err:b,onConfirm:w,hint:a==="needs-review"?"Your review judgment. Goes into the forensic record.":"Why this isn't actually an issue in your context. Goes into the forensic record.",placeholder:a==="needs-review"?"e.g., Verified — image is a portrait of the named founder; alt text correctly identifies subject and role.":'e.g., This element is decorative; aria-hidden + role="presentation" applied via design system.',confirmLabel:`Confirm — acknowledge on ${t.pages.length} page${t.pages.length===1?"":"s"}`}),b&&!r&&e.jsx(ae,{message:b})]})]})}function le({note:t,setNote:a,busy:r,err:o,onConfirm:s,hint:l,placeholder:n,confirmLabel:i="Confirm acknowledgement"}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border-strong)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:"verification note · required"}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)"},children:l}),e.jsx("textarea",{value:t,onChange:g=>a(g.target.value),placeholder:n,rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,lineHeight:1.5,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,resize:"vertical",minHeight:70},autoFocus:!0}),o&&e.jsx(ae,{message:o}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:s,disabled:r||!t.trim(),children:r?"Saving…":i})})]})}function Re({summary:t,snippet:a}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-verified)",borderRadius:4,background:"rgba(15, 143, 94, 0.06)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6,color:"var(--v2-verified)"},children:"how to fix"}),e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t}),a&&e.jsx("pre",{className:"v2-mono",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:3,fontSize:11,color:"var(--v2-ink-primary)",overflowX:"auto",whiteSpace:"pre"},children:e.jsx("code",{children:a})})]})}function ce(){return e.jsxs("div",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600},children:"✓ Acknowledged."})," ","The ack is saved. Re-audit or re-crawl to see this finding drop out of the list."]})}function ae({message:t}){return e.jsx("p",{role:"alert",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",background:"rgba(207, 44, 44, 0.06)",borderRadius:4,color:"var(--v2-critical)",fontSize:11,lineHeight:1.4},children:t})}function te({label:t,children:a}){return e.jsxs("div",{style:{marginBottom:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:t}),a]})}function de({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function Wt(){const{report:t,resolvedFails:a}=oe(),[r,o]=c.useState("open"),s=c.useMemo(()=>t?Mt(t.pages,t.findingGroups??[],a):[],[t,a]),l=c.useMemo(()=>r==="all"?s:s.filter(i=>r==="verified"?i.kind==="walkthrough-ack":r==="review"?i.kind==="needs-review"||i.kind==="walkthrough-fail"&&i.verdict==="uncertain":r==="open"?i.kind==="axe"||i.kind==="walkthrough-fail"&&i.verdict==="fail"||i.kind==="auto-contrast":!0),[s,r]);if(!t)return null;const n={all:s.length,open:s.filter(i=>i.kind==="axe"||i.kind==="walkthrough-fail"&&i.verdict==="fail"||i.kind==="auto-contrast").length,review:s.filter(i=>i.kind==="needs-review"||i.kind==="walkthrough-fail"&&i.verdict==="uncertain").length,verified:s.filter(i=>i.kind==="walkthrough-ack").length};return e.jsxs("section",{"aria-labelledby":"findings-heading",style:{padding:"var(--v2-pad-5) var(--v2-pad-5) var(--v2-pad-7)"},children:[e.jsxs("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)",marginBottom:"var(--v2-pad-4)",flexWrap:"wrap"},children:[e.jsx("h2",{id:"findings-heading",className:"v2-display",style:{fontSize:20,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0},children:"Findings"}),e.jsx(Gt,{filter:r,setFilter:o,counts:n})]}),l.length===0?e.jsx(Ft,{filter:r}):e.jsx("ul",{"aria-label":`${r} findings, ${l.length} items`,style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:l.map((i,g)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(g,12)*30}ms both`},children:e.jsx(Tt,{row:i})},i.key))})]})}function Gt({filter:t,setFilter:a,counts:r}){const o=[{id:"open",label:"Open"},{id:"review",label:"Review"},{id:"verified",label:"Verified"},{id:"all",label:"All"}];return e.jsx("div",{role:"tablist","aria-label":"Filter findings",style:{display:"inline-flex",gap:4,background:"var(--v2-bg-elev)",padding:3,borderRadius:6,border:"1px solid var(--v2-border)"},children:o.map(s=>{const l=t===s.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>a(s.id),style:{fontFamily:"var(--v2-body)",fontSize:11,padding:"5px 10px",borderRadius:4,border:"none",cursor:"pointer",background:l?"var(--v2-bg-elev-2)":"transparent",color:l?"var(--v2-ink-primary)":"var(--v2-ink-secondary)",fontWeight:l?600:500,transition:"background 120ms ease, color 120ms ease",display:"inline-flex",alignItems:"baseline",gap:5},children:[s.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:r[s.id]})]},s.id)})})}function Ft({filter:t}){const r={open:{headline:"Nothing open.",sub:"No axe violations or AI walkthrough failures across the audited pages. Switch to All to see everything, or to Verified for a record of acknowledged items."},review:{headline:"No items awaiting review.",sub:"AI walkthroughs returned definitive verdicts (or human verifications) for every criterion that needed judgment."},verified:{headline:"No human verifications recorded.",sub:"When you mark a walkthrough finding as manually verified, it appears here with your note + timestamp."},all:{headline:"Nothing to show.",sub:"No audit data yet — run a scan to begin."}}[t];return e.jsxs("div",{role:"status","aria-live":"polite",style:{padding:"var(--v2-pad-6) var(--v2-pad-4)",textAlign:"center",border:"1px dashed var(--v2-border)",borderRadius:6},children:[e.jsx("p",{className:"v2-display",style:{fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:r.headline}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,maxWidth:440,marginInline:"auto"},children:r.sub})]})}function Mt(t,a,r=[]){const o=[];for(const n of a)n.needsReview?o.push({kind:"needs-review",key:`nr::${n.ruleId}::${n.representativeSelector}`,criterion:n.wcagCriterion,ruleId:n.ruleId,description:n.axeDescription,selector:n.representativeSelector,failureSummary:n.failureSummary,pages:n.pages,group:n}):o.push({kind:"axe",key:`axe::${n.ruleId}::${n.representativeSelector}`,criterion:n.wcagCriterion,ruleId:n.ruleId,impact:n.impact,description:n.axeDescription,selector:n.representativeSelector,pages:n.pages,isShared:n.isShared});const s=new Set;for(const n of t){for(const i of n.walkthroughFindings??[]){const g=`wt-fail::${i.criterionId}::${i.pageUrl}`;s.has(g)||(s.add(g),o.push({kind:"walkthrough-fail",key:g,criterion:i.criterionId,verdict:i.verdict,impact:i.impact,reasoning:i.reasoning,pageUrl:i.pageUrl}))}for(const i of n.walkthroughAcknowledgements??[]){const g=`wt-ack::${i.criterionId}::${i.pageUrl}`;s.has(g)||(s.add(g),o.push({kind:"walkthrough-ack",key:g,criterion:i.criterionId,verdict:i.verdict,reasoning:i.reasoning,pageUrl:i.pageUrl}))}}for(const n of r)o.push({kind:"auto-contrast",key:`auto::${n.ruleId}::${n.selector}::${n.pageUrl}`,criterion:n.wcagCriterion??"1.4.3",ruleId:n.ruleId,impact:"serious",selector:n.selector,pageUrl:n.pageUrl,reasoning:n.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return o.sort((n,i)=>{const g=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact],y=i.kind==="walkthrough-ack"?l.ack:i.kind==="needs-review"?l["needs-review"]:l[i.impact];return(g??99)-(y??99)}),o}function $t({open:t,onClose:a}){const{report:r}=oe(),o=f(v=>v.siteCrawlReport),s=f(v=>v.results),l=f(v=>v.componentId),n=f(v=>v.delta),i=!!o,g=i||s.length>0,y=f(v=>v.tier),h=v=>!_e(y,v),[p,b]=c.useState(!1),k=()=>b(!0),j=i?"ai-prompt-site-crawl":"ai-prompt",w=Le({storeComponentId:l,storeCrawlReport:o,pageUrls:(r==null?void 0:r.pages.map(v=>v.url))??[]}),[m,E]=c.useState({}),P=c.useRef(null);c.useEffect(()=>{var z;if(!t)return;const v=A=>{A.key==="Escape"&&a()};return document.addEventListener("keydown",v),(z=P.current)==null||z.focus(),()=>document.removeEventListener("keydown",v)},[t,a]);function x(v,z){E(A=>({...A,[v]:z}))}async function F(){x("ai-prompt",{state:"busy"});try{if(i){const v=await S({type:"EXPORT_REQUEST",format:"ai-prompt-site-crawl",results:[],...r?{siteCrawlReport:r}:{}});if(!(v!=null&&v.content))throw new Error("Empty response");await navigator.clipboard.writeText(v.content),et(v.content,"ai-fixer-prompt.md","text/markdown"),x("ai-prompt",{state:"done",message:"Copied to clipboard + saved ai-fixer-prompt.md to Downloads."})}else{if(!s.length)throw new Error("No audit results yet");await pt({results:s,componentId:l??null,delta:n}),x("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}}catch(v){x("ai-prompt",{state:"error",message:v instanceof Error?v.message:String(v)})}}async function O(){x("html",{state:"busy"});try{if(i&&r){const{renderSiteReportHtml:v}=await re(async()=>{const{renderSiteReportHtml:N}=await import("./site-report-renderer-Cdd4E5RB.js");return{renderSiteReportHtml:N}},__vite__mapDeps([0,1,2,3,4,5])),z=await ue([r.startUrl]).catch(()=>[]),A=v(r,void 0,z);await se(A,"site-report.html","text/html"),x("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}else{if(!s.length)throw new Error("No audit results yet");const{toHtmlPrint:v}=await re(async()=>{const{toHtmlPrint:A}=await import("./scheduled-audit-runner-DO-z335b.js").then(N=>N.ba);return{toHtmlPrint:A}},__vite__mapDeps([1,2,3,4,5])),z=v(s,n??void 0);await se(z,"page-report.html","text/html"),x("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}}catch(v){x("html",{state:"error",message:v instanceof Error?v.message:String(v)})}}async function U(v,z,A){x(v,{state:"busy"});try{const N=await S({type:"EXPORT_REQUEST",format:v,results:i?[]:s,...n&&!i?{delta:n}:{},...i?{siteCrawlSource:!0}:{},...w?{auditTargetId:w}:{}});if(!(N!=null&&N.content))throw new Error("Empty response");await se(N.content,A,"text/html"),x(v,{state:"done",message:`${z} opened in a new tab.`})}catch(N){x(v,{state:"error",message:N instanceof Error?N.message:String(N)})}}async function W(){const{createZip:v}=await re(async()=>{const{createZip:I}=await import("./zip-encoder-CtULHXx_.js");return{createZip:I}},[]),{renderSiteReportHtml:z}=await re(async()=>{const{renderSiteReportHtml:I}=await import("./site-report-renderer-Cdd4E5RB.js");return{renderSiteReportHtml:I}},__vite__mapDeps([0,1,2,3,4,5])),A=[],N=i?[{format:"ai-prompt-site-crawl",filename:"ai-fixer-prompt.md"},{format:"defense-bundle",filename:"defense-bundle.html"},{format:"deposition-packet",filename:"deposition-packet.html"},{format:"evidence-bundle",filename:"evidence-bundle.html"},{format:"vpat",filename:"vpat.html"},{format:"conformance-crosswalk",filename:"conformance-crosswalk.html"},{format:"methodology-doc",filename:"methodology-doc.html"},{format:"executive-report",filename:"executive-report.html"}]:[{format:"ai-prompt",filename:"ai-fixer-prompt.md"},{format:"html-print",filename:"page-report.html"}],H=N.length+(i&&r?1:0);let D=0;x("zip",{state:"busy",progress:{current:0,total:H,label:"Starting…"}});try{if(i&&r){D++,x("zip",{state:"busy",progress:{current:D,total:H,label:"site-report.html (client-side)"}});try{const T=await ue([r.startUrl]).catch(()=>[]);A.push({name:"site-report.html",content:z(r,void 0,T)})}catch{}}for(const{format:T,filename:L}of N){D++,x("zip",{state:"busy",progress:{current:D,total:H,label:L}});try{const d=await S({type:"EXPORT_REQUEST",format:T,results:i?[]:s,...n&&!i?{delta:n}:{},...i?{siteCrawlSource:!0}:{},...w?{auditTargetId:w}:{}});d!=null&&d.content&&A.push({name:L,content:d.content})}catch{}}if(A.length===0)throw new Error("All exports failed");const I=v(A),q=new Blob([I],{type:"application/zip"}),V=URL.createObjectURL(q),u=document.createElement("a");u.href=V,u.download=i?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",u.click(),setTimeout(()=>URL.revokeObjectURL(V),6e4),x("zip",{state:"done",message:`Downloaded ${A.length} file${A.length===1?"":"s"}.`})}catch(I){x("zip",{state:"error",message:I instanceof Error?I.message:String(I)})}}function R(v){f.getState().setView(v),f.getState().setUserMode("dev"),S({type:"SETTINGS_SET",key:"userMode",value:"dev"}),a()}function Q(){S({type:"OPEN_SETTINGS"})}return t?e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Tools and exports",style:{position:"fixed",inset:0,zIndex:50,display:"flex"},children:[e.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(26, 20, 16, 0.35)",backdropFilter:"blur(2px)"},"aria-hidden":"true"}),e.jsxs("div",{style:{position:"relative",marginLeft:"auto",width:"min(100%, 440px)",height:"100%",background:"var(--v2-bg)",borderLeft:"1px solid var(--v2-border-strong)",boxShadow:"-12px 0 28px rgba(26, 20, 16, 0.18)",overflowY:"auto",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{position:"sticky",top:0,background:"var(--v2-bg)",borderBottom:"1px solid var(--v2-border)",padding:"var(--v2-pad-4) var(--v2-pad-5)",display:"flex",alignItems:"center",justifyContent:"space-between",zIndex:1},children:[e.jsx("h2",{className:"v2-display",style:{margin:0,fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)"},children:"Tools"}),e.jsx("button",{ref:P,type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:a,"aria-label":"Close tools drawer",children:"Close"})]}),e.jsxs("div",{style:{padding:"var(--v2-pad-5)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-5)"},children:[!g&&e.jsx("p",{style:{margin:0,padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:4,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.5},children:"Most tools need an audit to act on. Run an audit first, then come back here."}),g&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:"AI fixer",children:e.jsx(G,{status:m["ai-prompt"],label:i?"Copy site-wide AI fix prompt":"Copy AI fix prompt",description:i?"Multi-page markdown for ChatGPT/Claude/Copilot. Site-wide summary, consistency findings, per-page violations + fix recipes.":"Markdown for ChatGPT/Claude/Copilot. Every violation with fix recipes, AI-resolved fails, acknowledged context.",onClick:F,locked:h(j),onUpgrade:k})}),e.jsxs(Y,{title:"Reports",children:[e.jsx(G,{status:m.html,label:i?"Site report (HTML)":"Page report (HTML)",description:i?"Full crawl summary with per-page grades, top violations, consistency findings. Print-ready.":"Print-friendly single-page report.",onClick:O}),e.jsx(G,{status:m["executive-report"],label:"Executive report",description:"Hero grade + framing, top risks, next steps. For non-technical readers.",onClick:()=>U("executive-report","Executive report","executive-report.html"),locked:h("executive-report"),onUpgrade:k}),i&&e.jsx(G,{status:m["ticket-bundle"],label:"Ticket bundle",description:"Markdown formatted for paste into Linear / Jira / GitHub Issues — one ticket per finding, sorted by severity.",onClick:()=>U("ticket-bundle","Ticket bundle","ticket-bundle.md")})]}),e.jsxs(Y,{title:"Compliance & legal",children:[e.jsx(G,{status:m["defense-bundle"],label:"Defense bundle",description:"Anchored chain-of-custody evidence package. Use in pre-litigation.",onClick:()=>U("defense-bundle","Defense bundle","defense-bundle.html"),locked:h("defense-bundle"),onUpgrade:k}),e.jsx(G,{status:m["deposition-packet"],label:"Deposition packet",description:"Full evidence bundle — anchor, receipts, fingerprints, signing cert.",onClick:()=>U("deposition-packet","Deposition packet","deposition-packet.html"),locked:h("deposition-packet"),onUpgrade:k}),e.jsx(G,{status:m.vpat,label:"VPAT",description:"Voluntary Product Accessibility Template. Procurement-ready.",onClick:()=>U("vpat","VPAT","vpat.html"),locked:h("vpat"),onUpgrade:k}),e.jsx(G,{status:m["conformance-crosswalk"],label:"Conformance crosswalk",description:"WCAG ↔ Section 508 ↔ EN 301 549 mapping.",onClick:()=>U("conformance-crosswalk","Conformance crosswalk","conformance-crosswalk.html"),locked:h("conformance-crosswalk"),onUpgrade:k}),e.jsx(G,{status:m["methodology-doc"],label:"Methodology PDF",description:"Auditor-explainable methodology — what was tested, how, with what tools.",onClick:()=>U("methodology-doc","Methodology doc","methodology-doc.html"),locked:h("methodology-doc"),onUpgrade:k}),e.jsx(G,{status:m["evidence-bundle"],label:"Evidence bundle",description:"Lighter than defense bundle — audit records + summary.",onClick:()=>U("evidence-bundle","Evidence bundle","evidence-bundle.html"),locked:h("evidence-bundle"),onUpgrade:k})]}),e.jsx(Y,{title:"Bulk",children:e.jsx(G,{status:m.zip,label:i?"Download all as ZIP":"Download both as ZIP",description:i?"Every format above bundled in one ZIP. Runs each export in sequence — ~30s for an 8-page crawl.":"AI fix prompt + page report in one ZIP.",onClick:W,locked:h(i?"defense-bundle":"ai-prompt"),onUpgrade:k})})]}),e.jsxs(Y,{title:"Specialized views (classic UI)",children:[e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:`These surfaces aren't ported to v2 yet — clicking opens them in the classic UI. Return to v2 anytime via the "Try v2 UI" button in the classic Header.`}),e.jsx(_,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>R("matrix")}),e.jsx(_,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>R("report")}),e.jsx(_,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>R("delta")}),e.jsx(_,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>R("forensic")}),e.jsx(_,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>R("risk")}),e.jsx(_,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>R("wcag3")}),e.jsx(_,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>R("compliance")}),e.jsx(_,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>R("schedules")}),e.jsx(_,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>R("copilot")}),e.jsx(_,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>R("ax-tree")}),e.jsx(_,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>R("tokens")}),e.jsx(_,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>R("guided")}),e.jsx(_,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>R("scorecard")}),e.jsx(_,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>R("flows")}),e.jsx(_,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>R("activity")})]}),e.jsx(Y,{title:"Settings",children:e.jsx(G,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:Q})})]})]}),e.jsx(we,{open:p,onClose:()=>b(!1)})]}):null}async function se(t,a,r){const{body:o,type:s}=tt(t,r),l=new Blob([o],{type:s}),n=URL.createObjectURL(l);try{await chrome.tabs.create({url:n})}catch{const i=document.createElement("a");i.href=n,i.download=a,i.click()}setTimeout(()=>URL.revokeObjectURL(n),6e4)}function Y({title:t,children:a}){return e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:"var(--v2-pad-2)",color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:a})]})}function G({label:t,description:a,status:r,onClick:o,locked:s=!1,onUpgrade:l}){const n=(r==null?void 0:r.state)==="busy",i=(r==null?void 0:r.state)==="done",g=(r==null?void 0:r.state)==="error";return s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-warning, #f59e0b)",borderRadius:4,background:"var(--v2-warning-bg, rgba(245,158,11,0.08))"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:["🔒 ",t]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-sm",onClick:l,children:"Upgrade"})]}),e.jsxs("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:[e.jsx("strong",{children:"Upgrade to unlock"}),a?` · ${a}`:""]})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:t}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,disabled:n,children:n?"Working…":i?"Run again":"Run"})]}),a&&e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a}),n&&(r==null?void 0:r.progress)&&e.jsxs("p",{role:"status","aria-live":"polite",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-ink-secondary)"},children:[r.progress.current,"/",r.progress.total," — ",r.progress.label??""]}),i&&(r==null?void 0:r.message)&&e.jsxs("p",{role:"status",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-verified)"},children:["✓ ",r.message]}),g&&(r==null?void 0:r.message)&&e.jsx("p",{role:"alert",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-critical)"},children:r.message})]})}function _({label:t,description:a,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,style:{appearance:"none",cursor:"pointer",display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)",textAlign:"left",font:"inherit",color:"var(--v2-ink-primary)",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500},children:[t," →"]}),e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a})]})}function Ot(){var l,n;const t=f(i=>i.siteCrawlReport),a=f(i=>i.results),[r,o]=c.useState(!1),s=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((n=a[0])==null?void 0:n.scope)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("header",{role:"banner",style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)",padding:"var(--v2-pad-3) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",background:"var(--v2-bg)"},children:[e.jsx("a",{href:"#main-content",className:"v2-skip-link",style:{position:"absolute",left:-9999},onFocus:i=>{i.currentTarget.style.left="var(--v2-pad-4)",i.currentTarget.style.top="var(--v2-pad-4)"},onBlur:i=>{i.currentTarget.style.left="-9999px"},children:"Skip to main content"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)",minWidth:0,minHeight:28},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)"},children:[e.jsx("span",{className:"v2-display",style:{fontSize:18,fontWeight:600,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)"},children:"wcagcheckr"}),e.jsx("span",{className:"v2-eyebrow",children:"v2"})]}),s&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",minWidth:0,flex:1},children:[e.jsx("span",{className:"v2-eyebrow",children:"scope"}),e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:s,children:s})]}),e.jsx("div",{style:{marginLeft:"auto"},children:e.jsx(We,{})})]}),e.jsxs("nav",{"aria-label":"Application",style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-2)",justifyContent:"flex-end"},children:[e.jsx(Ge,{}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(!0),"aria-label":"Open tools and exports drawer","aria-expanded":r,title:"Exports, baselines, schedules, forensic log, settings, more",children:"Tools"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>void S({type:"OPEN_SETTINGS"}),"aria-label":"Open settings",title:"Settings",children:"⚙"})]})]}),e.jsx($t,{open:r,onClose:()=>o(!1)})]})}function Ht(){return c.useEffect(()=>{const t=Fe(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),o=Me();$e({forceRefresh:!0}).catch(()=>{}),Oe().catch(()=>{}),He().catch(()=>{}),Be().catch(()=>{}),Ve().catch(()=>{}),qe().catch(()=>{}),dt().then(l=>{f.getState().setAcknowledgedKeys(new Set(l.map(n=>n.matchKey)))}).catch(()=>{});let s=!1;return ut().then(l=>{s||l&&f.setState(n=>n.siteCrawlStatus==="running"?{siteCrawlReport:l}:{siteCrawlReport:l,siteCrawlStatus:"complete"})}).catch(()=>{}),()=>{s=!0,o();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Ot,{}),e.jsx(Ke,{}),e.jsx(Ye,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(kt,{}),e.jsx(Wt,{})]})]})}function Bt({persona:t,children:a}){const r=t==="power"?"Power user":"Dev",[o,s]=c.useState(!1),l=c.useRef(null);c.useEffect(()=>{const i=l.current;i&&(i.inert=!0)},[]);function n(){chrome.storage.local.set({userMode:"owner",v2UiEnabled:!1}),S({type:"SETTINGS_SET",key:"userMode",value:"owner"})}return e.jsxs("div",{className:"relative h-screen overflow-hidden",children:[e.jsx("div",{ref:l,"aria-hidden":"true",className:"h-full overflow-hidden blur-[2px] opacity-50 pointer-events-none select-none",children:a}),e.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"locked-persona-title",className:"max-w-sm w-full bg-white border border-slate-200 rounded-xl shadow-xl p-5 space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl","aria-hidden":"true",children:"🔒"}),e.jsxs("h2",{id:"locked-persona-title",className:"text-base font-semibold text-slate-900",children:[r," mode is a paid feature"]})]}),e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[r," mode unlocks the full WCAG findings, fix recipes, and exports for every page — that needs a license. On the free plan, ",e.jsx("strong",{children:"Owner mode"})," ","(the lawsuit-target screener) is yours to use, no license required."]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:()=>s(!0),className:"w-full text-sm px-4 py-2 bg-brand-500 text-white rounded hover:bg-brand-600 font-medium",children:"Upgrade to unlock →"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void S({type:"OPEN_SETTINGS"}),className:"text-xs text-slate-600 hover:text-slate-900 underline-offset-2 hover:underline",children:"I have a license token"}),e.jsx("button",{type:"button",onClick:n,className:"text-xs font-medium text-brand-700 hover:underline",children:"← Back to Owner mode"})]})]})]})}),e.jsx(we,{open:o,onClose:()=>s(!1)})]})}function Vt(){return e.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center min-h-screen gap-4 px-6 py-10 text-center",children:[e.jsx("div",{className:"text-3xl","aria-hidden":"true",children:"📡"}),e.jsx("h1",{className:"text-base font-semibold text-slate-800",children:"Internet connection required"}),e.jsx("p",{className:"max-w-xs text-sm leading-relaxed text-slate-600",children:"wcagcheckr needs to reach its license server to run. Connect to the internet and reload."}),e.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"rounded bg-slate-800 px-4 py-1.5 text-sm font-medium text-white hover:bg-slate-700",children:"Reload"})]})}Je("side-panel");function qt(){const[t,a]=c.useState(null),[r,o]=c.useState(!1),[,s]=c.useState(0),[l,n]=c.useState(null),[i,g]=c.useState(!1),[y,h]=c.useState(!1);if(c.useEffect(()=>{let b=!1;(async()=>{if(await Promise.all([pe(),he()]),!b){if(o(!0),await ve()){b||n(!0),Promise.all([ge(),me()]).then(()=>{b||s(w=>w+1)}).catch(()=>{});return}await Promise.all([ge(),me()]).catch(()=>{}),!b&&(s(w=>w+1),n(await ve()))}})(),chrome.storage.local.get("licenseToken").then(w=>{b||h(!!w.licenseToken)}).catch(()=>{}).finally(()=>{b||g(!0)});function k(w){const m=w.userMode,E=!!w.v2UiEnabled;let P;m==="owner"||m==="power"||m==="dev"?P=m:P=E?"power":"owner",b||a(P)}chrome.storage.local.get(["userMode","v2UiEnabled"]).then(k).catch(()=>a("owner"));const j=(w,m)=>{m==="local"&&("tierConfig:cache"in w&&pe().then(()=>{b||s(E=>E+1)}),"rubricConfigCache"in w&&he().then(()=>{b||s(E=>E+1)}),"licenseToken"in w&&chrome.storage.local.get("licenseToken").then(E=>{b||h(!!E.licenseToken)}),!(!("userMode"in w)&&!("v2UiEnabled"in w))&&chrome.storage.local.get(["userMode","v2UiEnabled"]).then(k))};return chrome.storage.onChanged.addListener(j),()=>{b=!0,chrome.storage.onChanged.removeListener(j)}},[]),t===null||!r||!i||l===null)return null;if(!l)return e.jsx(Vt,{});const p=t==="power"?e.jsx(Ht,{}):e.jsx(Ze,{});return(t==="power"||t==="dev")&&!y?e.jsx(Bt,{persona:t,children:p}):p}const Te=document.getElementById("root");if(!Te)throw new Error("side-panel: #root not found");Ee(Te).render(e.jsx(Ae.StrictMode,{children:e.jsx(Qe,{children:e.jsx(qt,{})})}));
4
+ (Original empirical reasoning: ${t.reasoning})`,resolvedAt:new Date().toISOString(),costUsd:0,wcagCriterion:t.criterion,inputHash:m==null?void 0:m.inputHash};await lt(E),h(!0),r(!1)}catch(w){b(w instanceof Error?w.message:String(w))}finally{g(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"Empirical measurement",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.reasoning})}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-3)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5,fontStyle:"italic"},children:"This finding came from a pixel-level screenshot diff of text against the rendered background, not from axe-core. Treat as a strong hint for human review, not a confirmed violation — gradients, translucent overlays, and animated backdrops can fool the sampler."}),y?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[k&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>s(w=>!w),"aria-expanded":o,children:o?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(w=>!w),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),o&&k&&e.jsx(Te,{summary:k.summary,snippet:k.snippet}),a&&e.jsx(le,{note:l,setNote:n,busy:i,err:p,onConfirm:j,hint:"Why the empirical measurement is wrong, or why this is acceptable. Overrides the resolution to pass.",placeholder:"e.g., Text sits over a video poster image; static screenshot misreads the rendered background. Production poster passes 7:1."}),p&&!a&&e.jsx(ae,{message:p})]})]})}function Pt({row:t}){const[a,r]=c.useState(!1),[o,s]=c.useState(""),[l,n]=c.useState(!1),[i,g]=c.useState(!1),[y,h]=c.useState(!1),[p,b]=c.useState(null),[k,j]=c.useState(null),w=ke(t.criterion),m=_e();async function E(){if(n(!0),j(null),!o.trim()){j("Note is required — explain how you manually verified this."),n(!1);return}try{const x=await we(t.pageUrl);if(!x){j("Could not find this page in the audit data. Re-run the audit and try again.");return}await st({componentId:x,criterionId:t.criterion,pageUrl:t.pageUrl,note:o.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),g(!0),r(!1)}catch(x){j(x instanceof Error?x.message:String(x))}finally{n(!1)}}async function P(){var x;h(!0),b(null),j(null);try{const O=(x=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:x.id;if(!O){j("Open the audited page in your active tab to re-run.");return}const U=await we(t.pageUrl);if(!U){j("Could not find this page in the audit data.");return}if(!ke(t.criterion)){j(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const R=await S({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:O,componentId:U,pageUrl:t.pageUrl});if(!R.ok){j(R.error??"Re-run failed.");return}b(`Re-run verdict: ${R.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(F){j(F instanceof Error?F.message:String(F))}finally{h(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"AI reasoning",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),i?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[w&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:P,disabled:y||!m,title:m?void 0:"AI walkthroughs need an Anthropic API key. Add one in Settings → AI.",children:y?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(x=>!x),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),p&&e.jsx("p",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:11,lineHeight:1.5},children:p}),a&&e.jsx(le,{note:o,setNote:s,busy:l,err:k,onConfirm:E,hint:"Explain what you checked. This goes into the forensic record.",placeholder:"e.g., Verified — focus indicator visible on every interactive control under :focus-visible; tested with keyboard nav."}),k&&!a&&e.jsx(ae,{message:k})]})]})}function Dt({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"What the human verified",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),e.jsxs("p",{style:{color:"var(--v2-ink-tertiary)",fontSize:11,margin:0,marginTop:"var(--v2-pad-2)"},children:["Original AI verdict: ",e.jsx("strong",{children:t.verdict}),". Now treated as pass for conformance."]})]})}function Lt({row:t}){return e.jsx(Re,{row:t,kind:"needs-review"})}function _t({row:t}){return e.jsx(Re,{row:t,kind:"axe"})}function Re({row:t,kind:a}){const[r,o]=c.useState(!1),[s,l]=c.useState(""),[n,i]=c.useState(!1),[g,y]=c.useState(!1),[h,p]=c.useState(!1),[b,k]=c.useState(null),j=Ce(t.ruleId);async function w(){if(i(!0),k(null),!s.trim()){k(a==="needs-review"?"Note is required — explain your review judgment.":"Note is required — explain why this isn't actually an issue in your context."),i(!1);return}try{const m=await Rt(t.ruleId,t.pages);if(m.length===0){k("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const E of m)await ct({componentId:E.componentId,matchKey:E.matchKey,ruleId:t.ruleId,note:s.trim()});y(!0),o(!1)}catch(m){k(m instanceof Error?m.message:String(m))}finally{i(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[a==="needs-review"&&t.failureSummary&&e.jsx(te,{label:"AI assessment",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.failureSummary})}),e.jsx(te,{label:"Affected",children:e.jsxs("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:4},children:[t.pages.slice(0,8).map(m=>e.jsx("li",{children:e.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textDecorationColor:"var(--v2-ink-faint)",textUnderlineOffset:2},children:m.url})},m.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),g?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[a==="axe"&&j&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>p(m=>!m),"aria-expanded":h,children:h?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(m=>!m),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),h&&j&&e.jsx(Te,{summary:j.summary,snippet:j.snippet}),r&&e.jsx(le,{note:s,setNote:l,busy:n,err:b,onConfirm:w,hint:a==="needs-review"?"Your review judgment. Goes into the forensic record.":"Why this isn't actually an issue in your context. Goes into the forensic record.",placeholder:a==="needs-review"?"e.g., Verified — image is a portrait of the named founder; alt text correctly identifies subject and role.":'e.g., This element is decorative; aria-hidden + role="presentation" applied via design system.',confirmLabel:`Confirm — acknowledge on ${t.pages.length} page${t.pages.length===1?"":"s"}`}),b&&!r&&e.jsx(ae,{message:b})]})]})}function le({note:t,setNote:a,busy:r,err:o,onConfirm:s,hint:l,placeholder:n,confirmLabel:i="Confirm acknowledgement"}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border-strong)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:"verification note · required"}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)"},children:l}),e.jsx("textarea",{value:t,onChange:g=>a(g.target.value),placeholder:n,rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,lineHeight:1.5,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,resize:"vertical",minHeight:70},autoFocus:!0}),o&&e.jsx(ae,{message:o}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:s,disabled:r||!t.trim(),children:r?"Saving…":i})})]})}function Te({summary:t,snippet:a}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-verified)",borderRadius:4,background:"rgba(15, 143, 94, 0.06)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6,color:"var(--v2-verified)"},children:"how to fix"}),e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t}),a&&e.jsx("pre",{className:"v2-mono",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:3,fontSize:11,color:"var(--v2-ink-primary)",overflowX:"auto",whiteSpace:"pre"},children:e.jsx("code",{children:a})})]})}function ce(){return e.jsxs("div",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600},children:"✓ Acknowledged."})," ","The ack is saved. Re-audit or re-crawl to see this finding drop out of the list."]})}function ae({message:t}){return e.jsx("p",{role:"alert",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",background:"rgba(207, 44, 44, 0.06)",borderRadius:4,color:"var(--v2-critical)",fontSize:11,lineHeight:1.4},children:t})}function te({label:t,children:a}){return e.jsxs("div",{style:{marginBottom:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:t}),a]})}function de({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function Wt(){const{report:t,resolvedFails:a}=oe(),[r,o]=c.useState("open"),s=c.useMemo(()=>t?Mt(t.pages,t.findingGroups??[],a):[],[t,a]),l=c.useMemo(()=>r==="all"?s:s.filter(i=>r==="verified"?i.kind==="walkthrough-ack":r==="review"?i.kind==="needs-review"||i.kind==="walkthrough-fail"&&i.verdict==="uncertain":r==="open"?i.kind==="axe"||i.kind==="walkthrough-fail"&&i.verdict==="fail"||i.kind==="auto-contrast":!0),[s,r]);if(!t)return null;const n={all:s.length,open:s.filter(i=>i.kind==="axe"||i.kind==="walkthrough-fail"&&i.verdict==="fail"||i.kind==="auto-contrast").length,review:s.filter(i=>i.kind==="needs-review"||i.kind==="walkthrough-fail"&&i.verdict==="uncertain").length,verified:s.filter(i=>i.kind==="walkthrough-ack").length};return e.jsxs("section",{"aria-labelledby":"findings-heading",style:{padding:"var(--v2-pad-5) var(--v2-pad-5) var(--v2-pad-7)"},children:[e.jsxs("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)",marginBottom:"var(--v2-pad-4)",flexWrap:"wrap"},children:[e.jsx("h2",{id:"findings-heading",className:"v2-display",style:{fontSize:20,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0},children:"Findings"}),e.jsx(Gt,{filter:r,setFilter:o,counts:n})]}),l.length===0?e.jsx(Ft,{filter:r}):e.jsx("ul",{"aria-label":`${r} findings, ${l.length} items`,style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:l.map((i,g)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(g,12)*30}ms both`},children:e.jsx(Tt,{row:i})},i.key))})]})}function Gt({filter:t,setFilter:a,counts:r}){const o=[{id:"open",label:"Open"},{id:"review",label:"Review"},{id:"verified",label:"Verified"},{id:"all",label:"All"}];return e.jsx("div",{role:"tablist","aria-label":"Filter findings",style:{display:"inline-flex",gap:4,background:"var(--v2-bg-elev)",padding:3,borderRadius:6,border:"1px solid var(--v2-border)"},children:o.map(s=>{const l=t===s.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>a(s.id),style:{fontFamily:"var(--v2-body)",fontSize:11,padding:"5px 10px",borderRadius:4,border:"none",cursor:"pointer",background:l?"var(--v2-bg-elev-2)":"transparent",color:l?"var(--v2-ink-primary)":"var(--v2-ink-secondary)",fontWeight:l?600:500,transition:"background 120ms ease, color 120ms ease",display:"inline-flex",alignItems:"baseline",gap:5},children:[s.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:r[s.id]})]},s.id)})})}function Ft({filter:t}){const r={open:{headline:"Nothing open.",sub:"No axe violations or AI walkthrough failures across the audited pages. Switch to All to see everything, or to Verified for a record of acknowledged items."},review:{headline:"No items awaiting review.",sub:"AI walkthroughs returned definitive verdicts (or human verifications) for every criterion that needed judgment."},verified:{headline:"No human verifications recorded.",sub:"When you mark a walkthrough finding as manually verified, it appears here with your note + timestamp."},all:{headline:"Nothing to show.",sub:"No audit data yet — run a scan to begin."}}[t];return e.jsxs("div",{role:"status","aria-live":"polite",style:{padding:"var(--v2-pad-6) var(--v2-pad-4)",textAlign:"center",border:"1px dashed var(--v2-border)",borderRadius:6},children:[e.jsx("p",{className:"v2-display",style:{fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:r.headline}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,maxWidth:440,marginInline:"auto"},children:r.sub})]})}function Mt(t,a,r=[]){const o=[];for(const n of a)n.needsReview?o.push({kind:"needs-review",key:`nr::${n.ruleId}::${n.representativeSelector}`,criterion:n.wcagCriterion,ruleId:n.ruleId,description:n.axeDescription,selector:n.representativeSelector,failureSummary:n.failureSummary,pages:n.pages,group:n}):o.push({kind:"axe",key:`axe::${n.ruleId}::${n.representativeSelector}`,criterion:n.wcagCriterion,ruleId:n.ruleId,impact:n.impact,description:n.axeDescription,selector:n.representativeSelector,pages:n.pages,isShared:n.isShared});const s=new Set;for(const n of t){for(const i of n.walkthroughFindings??[]){const g=`wt-fail::${i.criterionId}::${i.pageUrl}`;s.has(g)||(s.add(g),o.push({kind:"walkthrough-fail",key:g,criterion:i.criterionId,verdict:i.verdict,impact:i.impact,reasoning:i.reasoning,pageUrl:i.pageUrl}))}for(const i of n.walkthroughAcknowledgements??[]){const g=`wt-ack::${i.criterionId}::${i.pageUrl}`;s.has(g)||(s.add(g),o.push({kind:"walkthrough-ack",key:g,criterion:i.criterionId,verdict:i.verdict,reasoning:i.reasoning,pageUrl:i.pageUrl}))}}for(const n of r)o.push({kind:"auto-contrast",key:`auto::${n.ruleId}::${n.selector}::${n.pageUrl}`,criterion:n.wcagCriterion??"1.4.3",ruleId:n.ruleId,impact:"serious",selector:n.selector,pageUrl:n.pageUrl,reasoning:n.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return o.sort((n,i)=>{const g=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact],y=i.kind==="walkthrough-ack"?l.ack:i.kind==="needs-review"?l["needs-review"]:l[i.impact];return(g??99)-(y??99)}),o}function $t({open:t,onClose:a}){const{report:r}=oe(),o=f(v=>v.siteCrawlReport),s=f(v=>v.results),l=f(v=>v.componentId),n=f(v=>v.delta),i=!!o,g=i||s.length>0,y=f(v=>v.tier),h=v=>!Ge(y,v),[p,b]=c.useState(!1),k=()=>b(!0),j=i?"ai-prompt-site-crawl":"ai-prompt",w=We({storeComponentId:l,storeCrawlReport:o,pageUrls:(r==null?void 0:r.pages.map(v=>v.url))??[]}),[m,E]=c.useState({}),P=c.useRef(null);c.useEffect(()=>{var z;if(!t)return;const v=A=>{A.key==="Escape"&&a()};return document.addEventListener("keydown",v),(z=P.current)==null||z.focus(),()=>document.removeEventListener("keydown",v)},[t,a]);function x(v,z){E(A=>({...A,[v]:z}))}async function F(){x("ai-prompt",{state:"busy"});try{if(i){const v=await S({type:"EXPORT_REQUEST",format:"ai-prompt-site-crawl",results:[],...r?{siteCrawlReport:r}:{}});if(!(v!=null&&v.content))throw new Error("Empty response");await navigator.clipboard.writeText(v.content),Ae(v.content,"ai-fixer-prompt.md","text/markdown"),x("ai-prompt",{state:"done",message:"Copied to clipboard + saved ai-fixer-prompt.md to Downloads."})}else{if(!s.length)throw new Error("No audit results yet");await pt({results:s,componentId:l??null,delta:n}),x("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}}catch(v){x("ai-prompt",{state:"error",message:v instanceof Error?v.message:String(v)})}}async function O(){x("html",{state:"busy"});try{if(i&&r){const{renderSiteReportHtml:v}=await re(async()=>{const{renderSiteReportHtml:N}=await import("./site-report-renderer-Bw9jYmSg.js");return{renderSiteReportHtml:N}},__vite__mapDeps([0,1,2,3,4,5])),z=await pe([r.startUrl]).catch(()=>[]),A=v(r,void 0,z);await se(A,"site-report.html","text/html"),x("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}else{if(!s.length)throw new Error("No audit results yet");const{toHtmlPrint:v}=await re(async()=>{const{toHtmlPrint:A}=await import("./scheduled-audit-runner-Dek_J9pU.js").then(N=>N.ba);return{toHtmlPrint:A}},__vite__mapDeps([1,2,3,4,5])),z=v(s,n??void 0);await se(z,"page-report.html","text/html"),x("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}}catch(v){x("html",{state:"error",message:v instanceof Error?v.message:String(v)})}}async function U(v,z,A){x(v,{state:"busy"});try{const N=await S({type:"EXPORT_REQUEST",format:v,results:i?[]:s,...n&&!i?{delta:n}:{},...i?{siteCrawlSource:!0}:{},...w?{auditTargetId:w}:{}});if(!(N!=null&&N.content))throw new Error("Empty response");await se(N.content,A,"text/html"),x(v,{state:"done",message:`${z} opened in a new tab.`})}catch(N){x(v,{state:"error",message:N instanceof Error?N.message:String(N)})}}async function W(){const{createZip:v}=await re(async()=>{const{createZip:I}=await import("./zip-encoder-CtULHXx_.js");return{createZip:I}},[]),{renderSiteReportHtml:z}=await re(async()=>{const{renderSiteReportHtml:I}=await import("./site-report-renderer-Bw9jYmSg.js");return{renderSiteReportHtml:I}},__vite__mapDeps([0,1,2,3,4,5])),A=[],N=i?[{format:"ai-prompt-site-crawl",filename:"ai-fixer-prompt.md"},{format:"defense-bundle",filename:"defense-bundle.html"},{format:"deposition-packet",filename:"deposition-packet.html"},{format:"evidence-bundle",filename:"evidence-bundle.html"},{format:"vpat",filename:"vpat.html"},{format:"conformance-crosswalk",filename:"conformance-crosswalk.html"},{format:"methodology-doc",filename:"methodology-doc.html"},{format:"executive-report",filename:"executive-report.html"}]:[{format:"ai-prompt",filename:"ai-fixer-prompt.md"},{format:"html-print",filename:"page-report.html"}],H=N.length+(i&&r?1:0);let D=0;x("zip",{state:"busy",progress:{current:0,total:H,label:"Starting…"}});try{if(i&&r){D++,x("zip",{state:"busy",progress:{current:D,total:H,label:"site-report.html (client-side)"}});try{const T=await pe([r.startUrl]).catch(()=>[]);A.push({name:"site-report.html",content:z(r,void 0,T)})}catch{}}for(const{format:T,filename:L}of N){D++,x("zip",{state:"busy",progress:{current:D,total:H,label:L}});try{const d=await S({type:"EXPORT_REQUEST",format:T,results:i?[]:s,...n&&!i?{delta:n}:{},...i?{siteCrawlSource:!0}:{},...w?{auditTargetId:w}:{}});d!=null&&d.content&&A.push({name:L,content:d.content})}catch{}}if(A.length===0)throw new Error("All exports failed");const I=v(A),q=new Blob([I],{type:"application/zip"}),V=URL.createObjectURL(q),u=document.createElement("a");u.href=V,u.download=i?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",u.click(),setTimeout(()=>URL.revokeObjectURL(V),6e4),x("zip",{state:"done",message:`Downloaded ${A.length} file${A.length===1?"":"s"}.`})}catch(I){x("zip",{state:"error",message:I instanceof Error?I.message:String(I)})}}function R(v){f.getState().setView(v),f.getState().setUserMode("dev"),S({type:"SETTINGS_SET",key:"userMode",value:"dev"}),a()}function Q(){S({type:"OPEN_SETTINGS"})}return t?e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Tools and exports",style:{position:"fixed",inset:0,zIndex:50,display:"flex"},children:[e.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(26, 20, 16, 0.35)",backdropFilter:"blur(2px)"},"aria-hidden":"true"}),e.jsxs("div",{style:{position:"relative",marginLeft:"auto",width:"min(100%, 440px)",height:"100%",background:"var(--v2-bg)",borderLeft:"1px solid var(--v2-border-strong)",boxShadow:"-12px 0 28px rgba(26, 20, 16, 0.18)",overflowY:"auto",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{position:"sticky",top:0,background:"var(--v2-bg)",borderBottom:"1px solid var(--v2-border)",padding:"var(--v2-pad-4) var(--v2-pad-5)",display:"flex",alignItems:"center",justifyContent:"space-between",zIndex:1},children:[e.jsx("h2",{className:"v2-display",style:{margin:0,fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)"},children:"Tools"}),e.jsx("button",{ref:P,type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:a,"aria-label":"Close tools drawer",children:"Close"})]}),e.jsxs("div",{style:{padding:"var(--v2-pad-5)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-5)"},children:[!g&&e.jsx("p",{style:{margin:0,padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:4,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.5},children:"Most tools need an audit to act on. Run an audit first, then come back here."}),g&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:"AI fixer",children:e.jsx(G,{status:m["ai-prompt"],label:i?"Copy site-wide AI fix prompt":"Copy AI fix prompt",description:i?"Multi-page markdown for ChatGPT/Claude/Copilot. Site-wide summary, consistency findings, per-page violations + fix recipes.":"Markdown for ChatGPT/Claude/Copilot. Every violation with fix recipes, AI-resolved fails, acknowledged context.",onClick:F,locked:h(j),onUpgrade:k})}),e.jsxs(Y,{title:"Reports",children:[e.jsx(G,{status:m.html,label:i?"Site report (HTML)":"Page report (HTML)",description:i?"Full crawl summary with per-page grades, top violations, consistency findings. Print-ready.":"Print-friendly single-page report.",onClick:O}),e.jsx(G,{status:m["executive-report"],label:"Executive report",description:"Hero grade + framing, top risks, next steps. For non-technical readers.",onClick:()=>U("executive-report","Executive report","executive-report.html"),locked:h("executive-report"),onUpgrade:k}),i&&e.jsx(G,{status:m["ticket-bundle"],label:"Ticket bundle",description:"Markdown formatted for paste into Linear / Jira / GitHub Issues — one ticket per finding, sorted by severity.",onClick:()=>U("ticket-bundle","Ticket bundle","ticket-bundle.md")})]}),e.jsxs(Y,{title:"Compliance & legal",children:[e.jsx(G,{status:m["defense-bundle"],label:"Defense bundle",description:"Anchored chain-of-custody evidence package. Use in pre-litigation.",onClick:()=>U("defense-bundle","Defense bundle","defense-bundle.html"),locked:h("defense-bundle"),onUpgrade:k}),e.jsx(G,{status:m["deposition-packet"],label:"Deposition packet",description:"Full evidence bundle — anchor, receipts, fingerprints, signing cert.",onClick:()=>U("deposition-packet","Deposition packet","deposition-packet.html"),locked:h("deposition-packet"),onUpgrade:k}),e.jsx(G,{status:m.vpat,label:"VPAT",description:"Voluntary Product Accessibility Template. Procurement-ready.",onClick:()=>U("vpat","VPAT","vpat.html"),locked:h("vpat"),onUpgrade:k}),e.jsx(G,{status:m["conformance-crosswalk"],label:"Conformance crosswalk",description:"WCAG ↔ Section 508 ↔ EN 301 549 mapping.",onClick:()=>U("conformance-crosswalk","Conformance crosswalk","conformance-crosswalk.html"),locked:h("conformance-crosswalk"),onUpgrade:k}),e.jsx(G,{status:m["methodology-doc"],label:"Methodology PDF",description:"Auditor-explainable methodology — what was tested, how, with what tools.",onClick:()=>U("methodology-doc","Methodology doc","methodology-doc.html"),locked:h("methodology-doc"),onUpgrade:k}),e.jsx(G,{status:m["evidence-bundle"],label:"Evidence bundle",description:"Lighter than defense bundle — audit records + summary.",onClick:()=>U("evidence-bundle","Evidence bundle","evidence-bundle.html"),locked:h("evidence-bundle"),onUpgrade:k})]}),e.jsx(Y,{title:"Bulk",children:e.jsx(G,{status:m.zip,label:i?"Download all as ZIP":"Download both as ZIP",description:i?"Every format above bundled in one ZIP. Runs each export in sequence — ~30s for an 8-page crawl.":"AI fix prompt + page report in one ZIP.",onClick:W,locked:h(i?"defense-bundle":"ai-prompt"),onUpgrade:k})})]}),e.jsxs(Y,{title:"Specialized views (classic UI)",children:[e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:`These surfaces aren't ported to v2 yet — clicking opens them in the classic UI. Return to v2 anytime via the "Try v2 UI" button in the classic Header.`}),e.jsx(_,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>R("matrix")}),e.jsx(_,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>R("report")}),e.jsx(_,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>R("delta")}),e.jsx(_,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>R("forensic")}),e.jsx(_,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>R("risk")}),e.jsx(_,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>R("wcag3")}),e.jsx(_,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>R("compliance")}),e.jsx(_,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>R("schedules")}),e.jsx(_,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>R("copilot")}),e.jsx(_,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>R("ax-tree")}),e.jsx(_,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>R("tokens")}),e.jsx(_,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>R("guided")}),e.jsx(_,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>R("scorecard")}),e.jsx(_,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>R("flows")}),e.jsx(_,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>R("activity")})]}),e.jsx(Y,{title:"Settings",children:e.jsx(G,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:Q})})]})]}),e.jsx(je,{open:p,onClose:()=>b(!1)})]}):null}async function se(t,a,r){const{body:o,type:s}=Ne(t,r),l=new Blob([o],{type:s}),n=URL.createObjectURL(l);try{await chrome.tabs.create({url:n})}catch{const i=document.createElement("a");i.href=n,i.download=a,i.click()}setTimeout(()=>URL.revokeObjectURL(n),6e4)}function Y({title:t,children:a}){return e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:"var(--v2-pad-2)",color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:a})]})}function G({label:t,description:a,status:r,onClick:o,locked:s=!1,onUpgrade:l}){const n=(r==null?void 0:r.state)==="busy",i=(r==null?void 0:r.state)==="done",g=(r==null?void 0:r.state)==="error";return s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-warning, #f59e0b)",borderRadius:4,background:"var(--v2-warning-bg, rgba(245,158,11,0.08))"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:["🔒 ",t]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-sm",onClick:l,children:"Upgrade"})]}),e.jsxs("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:[e.jsx("strong",{children:"Upgrade to unlock"}),a?` · ${a}`:""]})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:t}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,disabled:n,children:n?"Working…":i?"Run again":"Run"})]}),a&&e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a}),n&&(r==null?void 0:r.progress)&&e.jsxs("p",{role:"status","aria-live":"polite",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-ink-secondary)"},children:[r.progress.current,"/",r.progress.total," — ",r.progress.label??""]}),i&&(r==null?void 0:r.message)&&e.jsxs("p",{role:"status",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-verified)"},children:["✓ ",r.message]}),g&&(r==null?void 0:r.message)&&e.jsx("p",{role:"alert",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-critical)"},children:r.message})]})}function _({label:t,description:a,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,style:{appearance:"none",cursor:"pointer",display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)",textAlign:"left",font:"inherit",color:"var(--v2-ink-primary)",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500},children:[t," →"]}),e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a})]})}function Ot(){var l,n;const t=f(i=>i.siteCrawlReport),a=f(i=>i.results),[r,o]=c.useState(!1),s=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((n=a[0])==null?void 0:n.scope)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("header",{role:"banner",style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)",padding:"var(--v2-pad-3) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",background:"var(--v2-bg)"},children:[e.jsx("a",{href:"#main-content",className:"v2-skip-link",style:{position:"absolute",left:-9999},onFocus:i=>{i.currentTarget.style.left="var(--v2-pad-4)",i.currentTarget.style.top="var(--v2-pad-4)"},onBlur:i=>{i.currentTarget.style.left="-9999px"},children:"Skip to main content"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)",minWidth:0,minHeight:28},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)"},children:[e.jsx("span",{className:"v2-display",style:{fontSize:18,fontWeight:600,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)"},children:"wcagcheckr"}),e.jsx("span",{className:"v2-eyebrow",children:"v2"})]}),s&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",minWidth:0,flex:1},children:[e.jsx("span",{className:"v2-eyebrow",children:"scope"}),e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:s,children:s})]}),e.jsx("div",{style:{marginLeft:"auto"},children:e.jsx(Fe,{})})]}),e.jsxs("nav",{"aria-label":"Application",style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-2)",justifyContent:"flex-end"},children:[e.jsx(Me,{}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(!0),"aria-label":"Open tools and exports drawer","aria-expanded":r,title:"Exports, baselines, schedules, forensic log, settings, more",children:"Tools"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>void S({type:"OPEN_SETTINGS"}),"aria-label":"Open settings",title:"Settings",children:"⚙"})]})]}),e.jsx($t,{open:r,onClose:()=>o(!1)})]})}function Ht(){return c.useEffect(()=>{const t=$e(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),o=Oe();He({forceRefresh:!0}).catch(()=>{}),Be().catch(()=>{}),Ve().catch(()=>{}),qe().catch(()=>{}),Ke().catch(()=>{}),Ye().catch(()=>{}),dt().then(l=>{f.getState().setAcknowledgedKeys(new Set(l.map(n=>n.matchKey)))}).catch(()=>{});let s=!1;return ut().then(l=>{s||l&&f.setState(n=>n.siteCrawlStatus==="running"?{siteCrawlReport:l}:{siteCrawlReport:l,siteCrawlStatus:"complete"})}).catch(()=>{}),()=>{s=!0,o();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Ot,{}),e.jsx(Qe,{}),e.jsx(Ze,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(kt,{}),e.jsx(Wt,{})]})]})}function Bt({persona:t,children:a}){const r=t==="power"?"Power user":"Dev",[o,s]=c.useState(!1),l=c.useRef(null);c.useEffect(()=>{const i=l.current;i&&(i.inert=!0)},[]);function n(){chrome.storage.local.set({userMode:"owner",v2UiEnabled:!1}),S({type:"SETTINGS_SET",key:"userMode",value:"owner"})}return e.jsxs("div",{className:"relative h-screen overflow-hidden",children:[e.jsx("div",{ref:l,"aria-hidden":"true",className:"h-full overflow-hidden blur-[2px] opacity-50 pointer-events-none select-none",children:a}),e.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"locked-persona-title",className:"max-w-sm w-full bg-white border border-slate-200 rounded-xl shadow-xl p-5 space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl","aria-hidden":"true",children:"🔒"}),e.jsxs("h2",{id:"locked-persona-title",className:"text-base font-semibold text-slate-900",children:[r," mode is a paid feature"]})]}),e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[r," mode unlocks the full WCAG findings, fix recipes, and exports for every page — that needs a license. On the free plan, ",e.jsx("strong",{children:"Owner mode"})," ","(the lawsuit-target screener) is yours to use, no license required."]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:()=>s(!0),className:"w-full text-sm px-4 py-2 bg-brand-500 text-white rounded hover:bg-brand-600 font-medium",children:"Upgrade to unlock →"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void S({type:"OPEN_SETTINGS"}),className:"text-xs text-slate-600 hover:text-slate-900 underline-offset-2 hover:underline",children:"I have a license token"}),e.jsx("button",{type:"button",onClick:n,className:"text-xs font-medium text-brand-700 hover:underline",children:"← Back to Owner mode"})]})]})]})}),e.jsx(je,{open:o,onClose:()=>s(!1)})]})}function Vt(){return e.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center min-h-screen gap-4 px-6 py-10 text-center",children:[e.jsx("div",{className:"text-3xl","aria-hidden":"true",children:"📡"}),e.jsx("h1",{className:"text-base font-semibold text-slate-800",children:"Internet connection required"}),e.jsx("p",{className:"max-w-xs text-sm leading-relaxed text-slate-600",children:"wcagcheckr needs to reach its license server to run. Connect to the internet and reload."}),e.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"rounded bg-slate-800 px-4 py-1.5 text-sm font-medium text-white hover:bg-slate-700",children:"Reload"})]})}tt("side-panel");function qt(){const[t,a]=c.useState(null),[r,o]=c.useState(!1),[,s]=c.useState(0),[l,n]=c.useState(null),[i,g]=c.useState(!1),[y,h]=c.useState(!1);if(c.useEffect(()=>{let b=!1;(async()=>{if(await Promise.all([ve(),me()]),!b){if(o(!0),await ge()){b||n(!0),Promise.all([he(),fe()]).then(()=>{b||s(w=>w+1)}).catch(()=>{});return}await Promise.all([he(),fe()]).catch(()=>{}),!b&&(s(w=>w+1),n(await ge()))}})(),chrome.storage.local.get("licenseToken").then(w=>{b||h(!!w.licenseToken)}).catch(()=>{}).finally(()=>{b||g(!0)});function k(w){const m=w.userMode,E=!!w.v2UiEnabled;let P;m==="owner"||m==="power"||m==="dev"?P=m:P=E?"power":"owner",b||a(P)}chrome.storage.local.get(["userMode","v2UiEnabled"]).then(k).catch(()=>a("owner"));const j=(w,m)=>{m==="local"&&("tierConfig:cache"in w&&ve().then(()=>{b||s(E=>E+1)}),"rubricConfigCache"in w&&me().then(()=>{b||s(E=>E+1)}),"licenseToken"in w&&chrome.storage.local.get("licenseToken").then(E=>{b||h(!!E.licenseToken)}),!(!("userMode"in w)&&!("v2UiEnabled"in w))&&chrome.storage.local.get(["userMode","v2UiEnabled"]).then(k))};return chrome.storage.onChanged.addListener(j),()=>{b=!0,chrome.storage.onChanged.removeListener(j)}},[]),t===null||!r||!i||l===null)return null;if(!l)return e.jsx(Vt,{});const p=t==="power"?e.jsx(Ht,{}):e.jsx(Je,{});return(t==="power"||t==="dev")&&!y?e.jsx(Bt,{persona:t,children:p}):p}const Ee=document.getElementById("root");if(!Ee)throw new Error("side-panel: #root not found");Ie(Ee).render(e.jsx(Ue.StrictMode,{children:e.jsx(Xe,{children:e.jsx(qt,{})})}));
@@ -1,4 +1,4 @@
1
- import{aY as R,a2 as $,aZ as S,a_ as F,U as G,a$ as D,b0 as I}from"./scheduled-audit-runner-DO-z335b.js";import"./preload-helper-D7HrI6pR.js";import"./crash-reporter-DAZnNefT.js";import"./diff-CECbooHD.js";import"./ai-usage-log-HdIilbbf.js";const h={A:"#15803d",B:"#4d7c0f",C:"#a16207",D:"#dc2626",F:"#7f1d1d"},O={low:"#15803d",moderate:"#a16207",high:"#dc2626",critical:"#7f1d1d"},m={critical:"#7f1d1d",serious:"#dc2626",moderate:"#a16207",minor:"#4d7c0f"},v={critical:"#fca5a5",serious:"#fdba74",moderate:"#fcd34d",minor:"#bef264"};function n(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w(e){if(e<1e3)return`${e}ms`;const t=Math.round(e/100)/10;if(t<60)return`${t}s`;const i=Math.floor(t/60),s=Math.round(t-i*60);return`${i}m ${s}s`}function L(e){return`<span style="display:inline-block;background:${h[e]};color:#fff;font-weight:700;padding:2px 10px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;">${e}</span>`}const y={A:"#047857",C:"#a16207",D:"#c2410c",F:"#be123c"};function T(e){return`<span style="display:inline-block;background:${y[e]};color:#fff;font-weight:700;padding:2px 10px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;">${e}</span>`}function _(e){return $(e.findingGroups??[]).map(t=>{const i=[...new Set(t.pages.map(s=>s.url))];return{ruleId:t.ruleId,description:t.axeDescription,impact:t.impact,urlsAffected:i.length,totalOccurrences:t.totalOccurrences,sampleUrls:i.slice(0,5)}}).sort((t,i)=>i.urlsAffected-t.urlsAffected||i.totalOccurrences-t.totalOccurrences)}function b(e){return`<span style="display:inline-block;background:${O[e]};color:#fff;font-weight:600;padding:2px 10px;border-radius:12px;font-size:11px;text-transform:uppercase;letter-spacing:0.05em;">${e}</span>`}function U(e){return`<span style="display:inline-block;background:${m[e]};color:#fff;font-weight:600;padding:1px 8px;border-radius:10px;font-size:11px;">${e}</span>`}function j(e,t){var r,g,f;const i=`
1
+ import{aY as R,a2 as $,aZ as S,a_ as F,U as G,a$ as D,b0 as I}from"./scheduled-audit-runner-Dek_J9pU.js";import"./preload-helper-D7HrI6pR.js";import"./crash-reporter-DAZnNefT.js";import"./diff-CECbooHD.js";import"./ai-usage-log-DVzy9AU1.js";const h={A:"#15803d",B:"#4d7c0f",C:"#a16207",D:"#dc2626",F:"#7f1d1d"},O={low:"#15803d",moderate:"#a16207",high:"#dc2626",critical:"#7f1d1d"},m={critical:"#7f1d1d",serious:"#dc2626",moderate:"#a16207",minor:"#4d7c0f"},v={critical:"#fca5a5",serious:"#fdba74",moderate:"#fcd34d",minor:"#bef264"};function n(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w(e){if(e<1e3)return`${e}ms`;const t=Math.round(e/100)/10;if(t<60)return`${t}s`;const i=Math.floor(t/60),s=Math.round(t-i*60);return`${i}m ${s}s`}function L(e){return`<span style="display:inline-block;background:${h[e]};color:#fff;font-weight:700;padding:2px 10px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;">${e}</span>`}const y={A:"#047857",C:"#a16207",D:"#c2410c",F:"#be123c"};function T(e){return`<span style="display:inline-block;background:${y[e]};color:#fff;font-weight:700;padding:2px 10px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;">${e}</span>`}function _(e){return $(e.findingGroups??[]).map(t=>{const i=[...new Set(t.pages.map(s=>s.url))];return{ruleId:t.ruleId,description:t.axeDescription,impact:t.impact,urlsAffected:i.length,totalOccurrences:t.totalOccurrences,sampleUrls:i.slice(0,5)}}).sort((t,i)=>i.urlsAffected-t.urlsAffected||i.totalOccurrences-t.totalOccurrences)}function b(e){return`<span style="display:inline-block;background:${O[e]};color:#fff;font-weight:600;padding:2px 10px;border-radius:12px;font-size:11px;text-transform:uppercase;letter-spacing:0.05em;">${e}</span>`}function U(e){return`<span style="display:inline-block;background:${m[e]};color:#fff;font-weight:600;padding:1px 8px;border-radius:10px;font-size:11px;">${e}</span>`}function j(e,t){var r,g,f;const i=`
2
2
  ${e.pagesAudited} page${e.pagesAudited===1?"":"s"} audited
3
3
  ${e.pagesFailed>0?`· <span style="color:#fca5a5;">${e.pagesFailed} failed</span>`:""}
4
4
  · ${w(e.totalDurationMs)}