@wcag-checkr/ci 1.0.0-rc.32 → 1.0.0-rc.33
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.
- package/dist/assets/{ErrorBoundary-BLcMSVSr.js → ErrorBoundary-BWJWAUYU.js} +1 -1
- package/dist/assets/{devtools-panel-DQ3Bbomf.js → devtools-panel-B358qnLS.js} +1 -1
- package/dist/assets/service-worker.ts-CPcp7Jdb.js +715 -0
- package/dist/assets/{side-panel-XSB07vDa.js → side-panel-CCJEZSqr.js} +1 -1
- package/dist/devtools/panel.html +2 -2
- package/dist/manifest.json +2 -2
- package/dist/service-worker-loader.js +1 -1
- package/dist/side-panel/side-panel.html +2 -2
- package/dist/side-panel/store.ts +6 -0
- package/dist/side-panel/wire-messaging.ts +4 -1
- package/package.json +1 -1
- package/dist/assets/service-worker.ts-BV-I06Vz.js +0 -715
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/site-report-renderer-CyHkM6hB.js","assets/forensic-log-B1UCXZ23.js","assets/crash-reporter-Dc5lvxvY.js","assets/state-PELIq3oj.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var zt=Object.defineProperty;var qt=(t,s,n)=>s in t?zt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var He=(t,s,n)=>qt(t,typeof s!="symbol"?s+"":s,n);import{R as ce,i as q,r as x,j as e,M as ae,C as Te,l as Kt,o as _e,t as Le,m as pt,s as ht,k as we}from"./styles-C4Kq0zOO.js";import{_ as Ue}from"./preload-helper-D7HrI6pR.js";import{o as H,r as M,s as F,c as mt,b as K,d as me}from"./crash-reporter-Dc5lvxvY.js";import{g as Qt,a as W,b as Jt,d as Yt,A as Q,l as Fe,s as Xt,O as xt,c as Zt,e as es,f as ze,h as gt,i as ft,j as ts,k as ss,m as ns}from"./forensic-log-B1UCXZ23.js";import{B as Ne,i as bt,b as vt,T as yt}from"./state-PELIq3oj.js";const qe=t=>{let s;const n=new Set,a=(p,c)=>{const u=typeof p=="function"?p(s):p;if(!Object.is(u,s)){const h=s;s=c??(typeof u!="object"||u===null)?u:Object.assign({},s,u),n.forEach(m=>m(s,h))}},r=()=>s,l={setState:a,getState:r,getInitialState:()=>d,subscribe:p=>(n.add(p),()=>n.delete(p))},d=s=t(a,r,l);return l},as=t=>t?qe(t):qe,rs=t=>t;function is(t,s=rs){const n=ce.useSyncExternalStore(t.subscribe,ce.useCallback(()=>s(t.getState()),[t,s]),ce.useCallback(()=>s(t.getInitialState()),[t,s]));return ce.useDebugValue(n),n}const Ke=t=>{const s=as(t),n=a=>is(s,a);return Object.assign(n,s),n},os=t=>t?Ke(t):Ke,g=os(t=>({status:"idle",progress:null,results:[],delta:null,componentId:null,errorMessage:null,freshThisSession:!1,baselineList:[],tier:"trial",trialDaysRemaining:null,seatsUsed:null,seatsTotal:null,planCode:null,licenseDaysRemaining:null,pastDue:!1,messages:[],unreadMessageCount:0,criticalUnacked:!1,view:"matrix",userMode:null,siteCrawlStatus:"idle",siteCrawlProgress:null,siteCrawlReport:null,siteCrawlError:null,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null,setStatus:s=>t({status:s}),startNewScan:()=>t({status:"running",results:[],delta:null,errorMessage:null,progress:null,componentId:null,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null}),setProgress:s=>t({progress:s}),setResults:(s,n,a)=>t({results:s,delta:n,componentId:a,status:"complete",errorMessage:null,freshThisSession:!0,aiProgress:null,pinnedMatchKey:null,pinnedFound:!0}),setDelta:s=>t({delta:s}),setError:s=>t({errorMessage:s,status:"failed"}),setBaselineList:s=>t({baselineList:s}),clearResults:()=>t({results:[],delta:null,componentId:null,errorMessage:null,progress:null,status:"idle",freshThisSession:!1,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null}),setTier:(s,n)=>t({tier:s,trialDaysRemaining:(n==null?void 0:n.trialDaysRemaining)??null,seatsUsed:(n==null?void 0:n.seatsUsed)??null,seatsTotal:(n==null?void 0:n.seatsTotal)??null,planCode:(n==null?void 0:n.planCode)??null,licenseDaysRemaining:(n==null?void 0:n.licenseDaysRemaining)??null,pastDue:(n==null?void 0:n.pastDue)??!1}),setView:s=>t({view:s}),setUserMode:s=>t({userMode:s}),setSiteCrawlStatus:s=>t({siteCrawlStatus:s}),setSiteCrawlProgress:s=>t({siteCrawlProgress:s}),setSiteCrawlReport:s=>t({siteCrawlReport:s}),setSiteCrawlError:s=>t({siteCrawlError:s}),setPinned:(s,n=!0)=>t({pinnedMatchKey:s,pinnedFound:n}),setAiFailure:s=>t({aiFailure:s}),clearAiFailure:()=>t({aiFailure:null}),setAiProgress:s=>t({aiProgress:s}),setMessages:(s,n,a)=>t({messages:s,unreadMessageCount:n,criticalUnacked:a}),applyMessageAck:(s,n)=>t(a=>{const r=a.messages.map(l=>l.id!==s?l:n==="seen"?{...l,seen:!0}:n==="dismissed"?{...l,dismissed:!0}:n==="acknowledged"?{...l,acknowledged:!0}:n==="clicked"?{...l,clicked:!0}:l).filter(l=>l.severity==="critical"?!l.acknowledged:!l.dismissed),i=r.filter(l=>!l.seen).length,o=r.some(l=>l.severity==="critical"&&!l.acknowledged);return{messages:r,unreadMessageCount:i,criticalUnacked:o}})})),xe="sidePanel:lastAudit";function ls(){const t=[];return t.push(H("AUDIT_PROGRESS_EVENT",s=>{const n=g.getState().status==="running";g.getState().setProgress({current:s.current,total:s.total,currentState:s.currentState}),g.getState().setStatus("running"),n||q.polite(`Audit running, scanning ${s.total} state${s.total===1?"":"s"}.`)})),t.push(H("AUDIT_COMPLETE_EVENT",s=>{var i;g.getState().setResults(s.results,s.delta,s.componentId);const n=s.results.reduce((o,l)=>o+l.violations.length,0),a=((i=s.delta)==null?void 0:i.newCount)??0,r=s.delta?`Audit complete. ${a} new violation${a===1?"":"s"} versus baseline.`:`Audit complete. ${n} violation${n===1?"":"s"} found across ${s.results.length} state${s.results.length===1?"":"s"}.`;q.polite(r),cs({results:s.results,delta:s.delta,componentId:s.componentId})})),t.push(H("AUDIT_FAILED_EVENT",s=>{g.getState().setError(s.error.message)})),t.push(H("AI_AUGMENTATION_PROGRESS_EVENT",s=>{const n=g.getState().aiProgress;g.getState().setAiProgress({currentCheckLabel:s.currentCheckLabel,current:s.current,total:s.total}),n||q.polite(`AI augmentation running ${s.total} check${s.total===1?"":"s"}.`)})),t.push(H("AI_AUGMENTATION_FAILED_EVENT",s=>{g.getState().setAiFailure({severity:s.severity,reason:s.reason,checksAttempted:s.checksAttempted,checksSucceeded:s.checksSucceeded,checksErrored:s.checksErrored,errorDetails:s.errorDetails})})),t.push(H("SCORECARD_UPDATED_EVENT",()=>{ge()})),t.push(H("LICENSE_CHANGED_EVENT",()=>{jt()})),t.push(H("SITE_CRAWL_PROGRESS_EVENT",s=>{const n=g.getState();n.setSiteCrawlStatus("running"),n.setSiteCrawlProgress({current:s.current,total:s.total,url:s.url,lastViolations:s.violations}),s.status==="auditing"&&s.current===1&&q.polite(`Site crawl started, scanning up to ${s.total} pages.`)})),t.push(H("SITE_CRAWL_COMPLETE_EVENT",s=>{const n=g.getState();n.setSiteCrawlStatus("complete"),n.setSiteCrawlReport(s.report),n.setSiteCrawlProgress(null),q.polite(`Site crawl complete. Grade ${s.report.siteGrade}, ${s.report.totalUniqueViolations} unique violation${s.report.totalUniqueViolations===1?"":"s"}.`)})),t.push(H("SITE_CRAWL_FAILED_EVENT",s=>{const n=g.getState();n.setSiteCrawlStatus("failed"),n.setSiteCrawlError(s.error.message),n.setSiteCrawlProgress(null),q.assertive(`Site crawl failed: ${s.error.message}`)})),()=>t.forEach(s=>s())}async function cs(t){const s={...t,results:t.results.map(({screenshotDataUrl:n,...a})=>a)};try{await chrome.storage.local.set({[xe]:s})}catch(n){console.warn("[wire-messaging] persistLastAudit failed; results stay in-memory only",n)}}async function ds(){const s=(await chrome.storage.local.get(xe))[xe];s&&g.setState({results:s.results,delta:s.delta,componentId:s.componentId,status:"complete"})}async function us(){await chrome.storage.local.remove(xe)}async function Me(){g.getState().clearResults(),await us()}async function ge(){const t=await M({type:"BASELINE_LIST"});g.getState().setBaselineList(t.items)}async function jt(t){const s=await M({type:"TIER_GET",forceRefresh:(t==null?void 0:t.forceRefresh)===!0});g.getState().setTier(s.tier,{trialDaysRemaining:s.trialDaysRemaining,seatsUsed:s.seatsUsed,seatsTotal:s.seatsTotal,planCode:s.planCode,licenseDaysRemaining:s.licenseDaysRemaining,pastDue:s.pastDue}),wt()}async function wt(){const{fetchMessages:t}=await Ue(async()=>{const{fetchMessages:a}=await Promise.resolve().then(()=>ys);return{fetchMessages:a}},void 0),s=g.getState().userMode,n=await t(s);n&&g.getState().setMessages(n.messages,n.unreadCount,n.criticalUnacked)}async function ps(){const s=(await M({type:"SETTINGS_GET",key:"userMode"})).data,n=s==="owner"||s==="dev"?s:null;g.getState().setUserMode(n)}function hs(){return chrome.runtime.connect({name:"audit-keepalive"})}let fe=null;async function ms(){if(fe===null)try{const t=await chrome.windows.getCurrent();typeof t.id=="number"&&(fe=t.id)}catch{}}function Nt(){if(fe===null)return;const t=chrome.sidePanel;!t||typeof t.open!="function"||t.open({windowId:fe}).catch(()=>{})}function X(t){Nt(),F(t)}function xs({onClose:t}){const[s,n]=x.useState(""),[a,r]=x.useState(""),[i,o]=x.useState(!0),[l,d]=x.useState(""),[p,c]=x.useState(!1),[u,h]=x.useState(null);async function m(b){var j;if(b.preventDefault(),!(!s.trim()||!a.trim())){c(!0),h(null);try{const E=await M({type:"SUPPORT_MESSAGE_REQUEST",subject:s.trim(),body:a.trim(),includeContext:i,replyEmail:l.trim()||void 0});E.success?(h({ok:!0,msg:`Sent (ref: ${E.ticketRef??"n/a"})`}),setTimeout(t,1200)):h({ok:!1,msg:((j=E.error)==null?void 0:j.message)??"Failed to send"})}finally{c(!1)}}}return e.jsxs("form",{onSubmit:m,className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-subject",className:"block text-xs font-medium mb-1",children:"Subject"}),e.jsx("input",{id:"support-subject",type:"text",value:s,onChange:b=>n(b.target.value),required:!0,className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-body",className:"block text-xs font-medium mb-1",children:"Message"}),e.jsx("textarea",{id:"support-body",value:a,onChange:b=>r(b.target.value),required:!0,rows:6,className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-reply",className:"block text-xs font-medium mb-1",children:"Reply email (optional)"}),e.jsx("input",{id:"support-reply",type:"email",autoComplete:"email",value:l,onChange:b=>d(b.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:b=>o(b.target.checked),className:"mt-0.5"}),e.jsx("span",{className:"text-slate-600",children:"Include extension version, browser platform, and license tier (no URLs, page content, or audit data is sent)."})]}),u&&e.jsx("p",{id:"support-form-result",role:u.ok?"status":"alert",className:`text-xs ${u.ok?"text-green-700":"text-red-700"}`,children:u.msg}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:t,className:"text-xs px-3 py-1 hover:bg-slate-100 rounded",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:p,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:p?"Sending…":"Send"})]})]})}function Qe({onClick:t,ariaLabel:s,title:n,children:a,className:r}){return e.jsx("button",{onClick:t,"aria-label":s,title:n??s,className:`inline-flex items-center justify-center min-w-[24px] min-h-[24px] text-xs text-slate-500 hover:text-slate-900 ${r??""}`,children:a})}const be=mt("messages-client"),gs="https://api.wcagcheckr.com",St="wcagcheckr",fs=1e4;function bs(){try{return chrome.runtime.getManifest().version}catch{return"0.0.0"}}async function At(t,s){const n=await Qt();if(!n)throw new Error("no_license_token");const a={...(s==null?void 0:s.headers)??{},Authorization:`Bearer ${n}`,"X-Extension-Version":bs()};return s!=null&&s.userMode&&(a["X-User-Mode"]=s.userMode),fetch(`${gs}${t}`,{...s,headers:a,signal:AbortSignal.timeout(fs)})}async function vs(t){try{const s=await At(`/v1/products/${St}/messages`,{userMode:t??null});return s.ok?await s.json():(be.warn("fetchMessages http",s.status),null)}catch(s){return be.warn("fetchMessages failed",s),null}}async function ne(t,s){try{const n=await At(`/v1/products/${St}/messages/${t}/ack`,{method:"POST",body:JSON.stringify({action:s}),headers:{"content-type":"application/json"}});return n.ok?!0:(be.warn("ackMessage http",n.status,"action",s),!1)}catch(n){return be.warn("ackMessage failed",n),!1}}const ys=Object.freeze(Object.defineProperty({__proto__:null,ackMessage:ne,fetchMessages:vs},Symbol.toStringTag,{value:"Module"})),js=["http:","https:"];function ws(t){try{const s=new URL(t);return js.includes(s.protocol)}catch{return!1}}function Je(t){const s=[];let n=0,a=0;for(;n<t.length;){if(t[n]==="["){const i=t.indexOf("]",n+1);if(i!==-1&&t[i+1]==="("){const o=t.indexOf(")",i+2);if(o!==-1){const l=t.slice(n+1,i),d=t.slice(i+2,o);ws(d)?s.push(e.jsx("a",{href:d,target:"_blank",rel:"noopener",className:"text-brand-700 underline",children:l},`l-${a++}`)):s.push(e.jsx(x.Fragment,{children:l},`l-${a++}`)),n=o+1;continue}}}if(t[n]==="*"&&t[n+1]==="*"){const i=t.indexOf("**",n+2);if(i!==-1){s.push(e.jsx("strong",{children:t.slice(n+2,i)},`b-${a++}`)),n=i+2;continue}}if(t[n]==="*"&&t[n+1]!=="*"){const i=t.indexOf("*",n+1);if(i!==-1&&t[i+1]!=="*"){s.push(e.jsx("em",{children:t.slice(n+1,i)},`i-${a++}`)),n=i+1;continue}}let r=n+1;for(;r<t.length&&t[r]!=="*"&&t[r]!=="[";)r++;s.push(e.jsx(x.Fragment,{children:t.slice(n,r)},`t-${a++}`)),n=r}return s}function kt({source:t}){const s=t.split(/\r?\n/),n=[];let a=[],r=[],i=0;function o(){if(r.length===0)return;const d=r.join(" ");n.push(e.jsx("p",{className:"leading-snug",children:Je(d)},`p-${i++}`)),r=[]}function l(){a.length!==0&&(n.push(e.jsx("ul",{className:"list-disc pl-5 space-y-0.5",children:a.map((d,p)=>e.jsx("li",{children:Je(d)},p))},`u-${i++}`)),a=[])}for(const d of s){const p=d.trimEnd();if(p===""){o(),l();continue}const c=/^[-*]\s+(.*)$/.exec(p);if(c){o(),a.push(c[1]);continue}l(),r.push(p)}return o(),l(),e.jsx("div",{className:"space-y-1.5",children:n})}const Ns={info:"bg-blue-500",promo:"bg-purple-500",warning:"bg-amber-500",critical:"bg-rose-500"},Ss={critical:"bg-rose-50 border-rose-200"};function Ct(){const t=g(h=>h.unreadMessageCount),s=g(h=>h.messages),n=g(h=>h.applyMessageAck),[a,r]=x.useState(!1),i=x.useRef(-1),[o,l]=x.useState(!1);x.useEffect(()=>{const h=s.filter(b=>!b.seen);if(h.length===0)return;const m=Math.max(...h.map(b=>b.id));if(m>i.current){i.current=m,l(!0);const b=setTimeout(()=>l(!1),1500);return()=>clearTimeout(b)}},[s]);async function d(){const h=s.filter(m=>!m.seen);if(h.length!==0)for(const m of h)n(m.id,"seen"),ne(m.id,"seen")}function p(){const h=!a;r(h),h&&d()}async function c(h){n(h.id,"dismissed"),await ne(h.id,"dismissed")}async function u(h){h.ctaUrl&&(n(h.id,"clicked"),ne(h.id,"clicked"),chrome.tabs.create({url:h.ctaUrl}).catch(()=>{window.open(h.ctaUrl,"_blank","noopener")}))}return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:p,"aria-label":t>0?`Notifications (${t} unread)`:"Notifications","aria-expanded":a,"aria-haspopup":"dialog",className:`relative grid place-items-center w-7 h-7 rounded text-slate-500 hover:bg-slate-100 hover:text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand-500 ${o?"animate-bell-pulse":""}`,title:t>0?`${t} new message${t===1?"":"s"}`:"No new messages",children:[e.jsx(As,{active:t>0}),t>0&&e.jsx("span",{"aria-hidden":"true",className:"absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-rose-500 ring-2 ring-white"})]}),a&&e.jsx(ks,{messages:s,onClose:()=>r(!1),onDismiss:c,onCtaClick:u})]})}function As({active:t}){return e.jsx("svg",{viewBox:"0 0 20 20",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",className:t?"text-rose-500":"",children:e.jsx("path",{d:"M10 2a5 5 0 00-5 5v3l-1.6 2.4a1 1 0 00.84 1.6h11.52a1 1 0 00.84-1.6L15 10V7a5 5 0 00-5-5zm-1.5 13a1.5 1.5 0 003 0h-3z"})})}function ks({messages:t,onClose:s,onDismiss:n,onCtaClick:a}){const r=x.useRef(null);return x.useEffect(()=>{const i=l=>{r.current&&(r.current.contains(l.target)||s())},o=l=>{l.key==="Escape"&&s()};return document.addEventListener("mousedown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",o)}},[s]),e.jsxs("div",{ref:r,role:"dialog","aria-label":"Notifications",className:"absolute right-0 top-full mt-1 w-80 max-h-[420px] overflow-y-auto bg-white border border-slate-200 rounded shadow-lg z-50 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-slate-200",children:[e.jsx("span",{className:"font-medium",children:"Notifications"}),e.jsx("button",{type:"button",onClick:()=>{wt()},className:"text-[11px] text-brand-700 hover:underline",children:"Refresh"})]}),t.length===0?e.jsx("div",{className:"p-4 text-center text-slate-500 text-[11px]",children:"No messages."}):e.jsx("ul",{className:"divide-y divide-slate-100",children:t.map(i=>e.jsx("li",{className:`p-3 ${i.seen?"":"bg-slate-50"}`,children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:`shrink-0 w-1 self-stretch rounded ${Ns[i.severity]}`,"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"font-medium text-slate-800",children:i.title}),i.dismissible&&i.severity!=="critical"&&e.jsx("button",{type:"button",onClick:()=>n(i),"aria-label":"Dismiss message",className:"text-slate-400 hover:text-slate-700 shrink-0",children:"✕"})]}),e.jsx("div",{className:"mt-1 text-slate-700",children:e.jsx(kt,{source:i.bodyMd})}),i.ctaLabel&&i.ctaUrl&&e.jsx("button",{type:"button",onClick:()=>a(i),className:"mt-2 text-[11px] px-2 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:i.ctaLabel}),e.jsx("div",{className:"mt-1 text-[10px] text-slate-400",children:new Date(i.createdAt).toLocaleString()})]})]})},i.id))})]})}function It(){const t=g(i=>i.messages),s=g(i=>i.applyMessageAck),n=t.find(i=>i.severity==="critical"&&!i.acknowledged);if(!n)return null;async function a(){s(n.id,"acknowledged"),await ne(n.id,"acknowledged")}async function r(){n.ctaUrl&&(s(n.id,"clicked"),ne(n.id,"clicked"),chrome.tabs.create({url:n.ctaUrl}).catch(()=>{}))}return e.jsxs("div",{role:"alert",className:`border-y ${Ss.critical} px-3 py-2 text-xs flex items-start gap-2`,children:[e.jsx("span",{"aria-hidden":"true",className:"text-rose-600 text-sm leading-none mt-0.5",children:"⚠"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-rose-900",children:n.title}),e.jsx("div",{className:"mt-0.5 text-rose-900/90",children:e.jsx(kt,{source:n.bodyMd})}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[n.ctaLabel&&n.ctaUrl&&e.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-2 py-1 bg-rose-600 text-white rounded hover:bg-rose-700",children:n.ctaLabel}),e.jsx("button",{type:"button",onClick:a,className:"text-[11px] px-2 py-1 border border-rose-300 text-rose-800 rounded hover:bg-rose-100",children:"Acknowledge"})]})]})]})}const ie=["matrix","delta","activity","guided","flows","scorecard","crawl","forensic","compliance"];function Cs(t){if(!t)return null;try{return new URL(t).hostname}catch{return t}}function Is(){var u,h;const t=g(m=>m.view),s=g(m=>m.setView),n=g(m=>m.setUserMode),a=g(m=>m.results),r=g(m=>m.status),[i,o]=x.useState(!1),l=((u=a[0])==null?void 0:u.pageUrl)??((h=a[0])==null?void 0:h.scope),d=Cs(l),p=a.length>0&&r!=="running";function c(){n("owner"),F({type:"SETTINGS_SET",key:"userMode",value:"owner"})}return e.jsxs("header",{className:"border-b border-slate-200 bg-white px-3 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-semibold text-sm leading-tight",children:"wcagcheckr"}),e.jsxs("p",{className:"text-[10px] text-slate-500 leading-tight font-mono",children:["v",chrome.runtime.getManifest().version]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:c,title:"Switch to the simplified site-owner view",className:"text-[11px] px-2 py-1 border border-slate-300 rounded text-slate-600 hover:bg-slate-50",children:"Owner mode"}),e.jsx(Ct,{}),e.jsx(Qe,{onClick:()=>void F({type:"OPEN_SETTINGS"}),ariaLabel:"Open settings",children:"⚙"}),e.jsx(Qe,{onClick:()=>o(!0),ariaLabel:"Send support message",children:"?"})]})]}),p&&d&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2 py-1 rounded bg-brand-50 border border-brand-200 text-[11px]",title:l??"",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"Audit:"}),e.jsx("span",{className:"font-mono font-medium text-slate-800 truncate flex-1","aria-label":`Showing audit results for ${d}`,children:d}),e.jsx("button",{type:"button",onClick:()=>void Me(),className:"shrink-0 text-[11px] px-2 py-0.5 rounded border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 hover:border-slate-400",title:"Clear these results so you can run a fresh audit",children:"Clear"})]}),e.jsx(Es,{view:t,setView:s}),e.jsx(ae,{open:i,onClose:()=>o(!1),title:"Send support message",children:e.jsx(xs,{onClose:()=>o(!1)})})]})}function Es({view:t,setView:s}){const n=x.useRef([]);function a(i){var d;const o=(i+ie.length)%ie.length,l=ie[o];l&&(s(l),(d=n.current[o])==null||d.focus())}function r(i,o){switch(i.key){case"ArrowRight":i.preventDefault(),a(o+1);break;case"ArrowLeft":i.preventDefault(),a(o-1);break;case"Home":i.preventDefault(),a(0);break;case"End":i.preventDefault(),a(ie.length-1);break}}return e.jsx("nav",{className:"flex flex-wrap gap-1","aria-label":"Audit views",role:"tablist",children:ie.map((i,o)=>{const l=t===i;return e.jsx("button",{ref:d=>{n.current[o]=d},role:"tab","aria-selected":l,tabIndex:l?0:-1,onClick:()=>s(i),onKeyDown:d=>r(d,o),className:l?"text-xs px-3 py-1 rounded bg-brand-500 text-white":"text-xs px-3 py-1 rounded text-slate-600 hover:bg-slate-100",children:i[0].toUpperCase()+i.slice(1)},i)})})}function Rs({feature:t,upgradeUrl:s}){const[n,a]=x.useState(!1);return e.jsxs("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:[e.jsxs("p",{className:"text-xs text-amber-900 mb-2",children:[e.jsx("strong",{children:t})," requires a higher tier."]}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"text-xs text-brand-600 hover:underline font-medium",children:"Upgrade →"}),e.jsx(Te,{open:n,onClose:()=>a(!1)})]})}const Ts="https://wcagcheckr.com/upgrade";function $s(){const[t,s]=x.useState("single-element"),[n,a]=x.useState(!1),[r,i]=x.useState(null),[o,l]=x.useState(null),[d,p]=x.useState(Ne),[c,u]=x.useState(Ne[0].id),h=g(w=>w.status),m=g(w=>w.tier),b=g(w=>w.results.length>0),j=h==="running";x.useEffect(()=>{Promise.all([M({type:"SETTINGS_GET",key:"matrixPresets"}),M({type:"SETTINGS_GET",key:"activePresetId"})]).then(([w,T])=>{const C=Array.isArray(w.data)?w.data:null;p(C&&C.length>0?C:Ne),typeof T.data=="string"&&u(T.data)})},[]);function E(w){const T=d.find(C=>C.id===w);T&&(u(w),F({type:"SETTINGS_SET",key:"activePresetId",value:w}),F({type:"SETTINGS_SET",key:"stateMatrix",value:T.matrix}))}const k=bt(m,"storybookAutoIterate");x.useEffect(()=>{const w=H("ELEMENT_PICKED_EVENT",(C,L)=>{a(!1);const D=L.frameId;R(D),i({selector:C.selector,frameId:D})}),T=H("PICKER_CANCELLED_EVENT",()=>a(!1));return()=>{w(),T()}},[]);async function f(){const w=await W();w&&(a(!0),await K(w,{type:"PICKER_ACTIVATE_REQUEST",tabId:w}))}function v(){r&&(R(r.frameId),X({type:"START_AUDIT",mode:"single-element",scope:r.selector,frameId:r.frameId}),g.getState().startNewScan())}function y(){if(!k){l("storybook:auto-iterate");return}R(),X({type:"START_AUDIT",mode:"storybook-all"}),g.getState().startNewScan()}function I(){R(),X({type:"START_AUDIT",mode:"all-frames"}),g.getState().startNewScan()}function _(){R(),X({type:"START_AUDIT",mode:"full-page"}),g.getState().startNewScan()}function S(){F({type:"CANCEL_AUDIT"})}async function R(w){g.getState().setPinned(null);const T=await W();if(T)try{await K(T,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:T},w)}catch{}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-3 py-2 border-b border-slate-200 bg-white space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"aria-label":"Audit mode",value:t,onChange:w=>s(w.target.value),disabled:j||n,className:"text-xs border border-slate-300 rounded px-2 py-1",children:[e.jsx("option",{value:"single-element",children:"Single element"}),e.jsx("option",{value:"full-page",children:"Full page"}),e.jsx("option",{value:"all-frames",children:"All iframes"}),e.jsxs("option",{value:"storybook-all",children:["All stories (Storybook / Ladle)",k?"":" (paid)"]})]}),e.jsx("select",{"aria-label":"State-matrix preset",value:c,onChange:w=>E(w.target.value),disabled:j||n,title:"Switch the state-matrix preset used for the next audit",className:"text-xs border border-slate-300 rounded px-2 py-1",children:d.map(w=>e.jsx("option",{value:w.id,children:w.name},w.id))}),t==="single-element"?e.jsx(Ds,{picking:n,picked:r,isRunning:j,onPick:f,onRun:v,onClearPick:()=>i(null)}):t==="full-page"?e.jsx("button",{onClick:_,disabled:j,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:j?"Auditing…":"Scan page"}):t==="all-frames"?e.jsx("button",{onClick:I,disabled:j,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:j?"Auditing…":"Audit all iframes"}):e.jsx("button",{onClick:y,disabled:j,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:j?"Auditing…":"Audit all stories"}),j&&e.jsx("button",{onClick:S,className:"text-xs px-3 py-1 border border-slate-300 text-slate-700 rounded hover:bg-slate-100",children:"Stop"}),!j&&b&&e.jsx("button",{type:"button",onClick:()=>void Me(),className:"text-xs text-slate-500 hover:text-slate-800 hover:underline ml-auto",title:"Clear current results",children:"Clear"})]}),t==="single-element"&&r&&!n&&!j&&e.jsx(_s,{selector:r.selector,onRepick:f,onClear:()=>i(null)})]}),e.jsx(ae,{open:o!==null,onClose:()=>l(null),title:"Upgrade to continue",children:e.jsx(Rs,{feature:o??"",upgradeUrl:Ts})})]})}function Ds({picking:t,picked:s,isRunning:n,onPick:a,onRun:r,onClearPick:i}){return n?e.jsx("button",{disabled:!0,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded opacity-50",children:"Auditing…"}):t?e.jsx("button",{disabled:!0,className:"text-xs px-3 py-1 bg-brand-400 text-white rounded",children:"Click an element on the page"}):s?e.jsx("button",{onClick:r,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Run audit"}):e.jsx("button",{onClick:a,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Pick element"})}function _s({selector:t,onRepick:s,onClear:n}){return e.jsxs("div",{className:"text-[11px] text-slate-600 flex items-center gap-2 flex-wrap",children:[e.jsx("span",{children:"Selected:"}),e.jsx("code",{className:"font-mono bg-slate-100 px-1.5 py-0.5 rounded text-slate-700 truncate max-w-[180px]",title:t,children:t}),e.jsx("button",{type:"button",onClick:s,className:"text-brand-600 hover:underline",children:"Re-pick"}),e.jsx("span",{"aria-hidden":"true",className:"text-slate-300",children:"·"}),e.jsx("button",{type:"button",onClick:n,className:"text-slate-500 hover:text-slate-700 hover:underline",children:"Clear"})]})}const Ls={outline:"OUTLINE_HIDE_REQUEST","tab-order":"TAB_ORDER_HIDE_REQUEST","reading-order":"READING_ORDER_HIDE_REQUEST","target-size":"TARGET_SIZE_HIDE_REQUEST"},Us={outline:"OUTLINE_SHOW_REQUEST","tab-order":"TAB_ORDER_SHOW_REQUEST","reading-order":"READING_ORDER_SHOW_REQUEST","target-size":"TARGET_SIZE_SHOW_REQUEST"};function Fs(){const[t,s]=x.useState(null),[n,a]=x.useState(!1),[r,i]=x.useState(null),[o,l]=x.useState("off"),p=g(m=>m.results).flatMap(m=>m.violations);async function c(m){const b=await W();b&&(l(m),m==="off"?await K(b,{type:"VISION_SIMULATOR_CLEAR",tabId:b}).catch(()=>{}):await K(b,{type:"VISION_SIMULATOR_APPLY",tabId:b,mode:m}).catch(()=>{}))}async function u(m){const b=await W();if(b){if(t&&await K(b,{type:Ls[t],tabId:b}).catch(()=>{}),t===m){s(null);return}await K(b,{type:Us[m],tabId:b}).catch(()=>{}),s(m)}}async function h(){const m=await W();if(m){if(n){await K(m,{type:"FIX_PREVIEW_HIDE_REQUEST",tabId:m}).catch(()=>{}),a(!1),i(null);return}if(p.length===0){i("Run an audit first.");return}try{const b=await me(m,{type:"FIX_PREVIEW_SHOW_REQUEST",tabId:m,violations:p});a(!0),i(`Previewing ${b.visualFixCount} visual fix${b.visualFixCount===1?"":"es"} + ${b.annotationCount} annotation${b.annotationCount===1?"":"s"}.`)}catch{i("Preview failed.")}}}return e.jsxs("div",{className:"px-3 py-2 border-b border-slate-200 bg-white flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-slate-500 mr-1",title:"Page overlays — these draw information on the live page. They do NOT change what the audit detects.",children:"Visualizers"}),e.jsx(oe,{label:"Outline",title:"Show heading + landmark structure overlay",on:t==="outline",onClick:()=>u("outline")}),e.jsx(oe,{label:"Tab order",title:"Number focusables in tab sequence. Red = tab order doesn't follow visual layout (focus jumps around). Amber = positive tabindex reordered the DOM sequence.",on:t==="tab-order",onClick:()=>u("tab-order")}),e.jsx(oe,{label:"Reading order",title:"Number content in DOM order (what a screen reader reads). Red = element's DOM position differs from its visual position; badge shows DOM→Visual.",on:t==="reading-order",onClick:()=>u("reading-order")}),e.jsx(oe,{label:"Targets",title:"Show interactive-element dimensions vs WCAG 2.5.8 (24px AA) / 2.5.5 (44px AAA)",on:t==="target-size",onClick:()=>u("target-size")}),e.jsx("span",{className:"w-px h-4 bg-slate-200 mx-1","aria-hidden":"true"}),e.jsx(oe,{label:"Preview fixes ✨",title:"Apply contrast/target-size/focus-ring fixes to the live page + annotate where labels and alt text are missing. Toggle off to revert.",on:n,onClick:h}),e.jsx("span",{className:"w-px h-4 bg-slate-200 mx-1","aria-hidden":"true"}),e.jsxs("label",{className:"text-[11px] text-slate-700 flex items-center gap-1.5",children:[e.jsx("span",{title:"Apply a CSS filter that simulates how the page looks for users with color-vision or low-vision impairments. Visual only — does NOT change what the audit detects.",children:"Vision sim:"}),e.jsxs("select",{"aria-label":"Vision-impairment simulator",value:o,onChange:m=>void c(m.target.value),className:`text-xs border rounded px-1.5 py-0.5 ${o==="off"?"border-slate-300 bg-white text-slate-700":"border-brand-500 bg-brand-50 text-brand-700 font-medium"}`,children:[e.jsx("option",{value:"off",children:"Off"}),e.jsxs("optgroup",{label:"Color blindness",children:[e.jsx("option",{value:"deuteranomaly",children:"Deuteranomaly (green-weak — most common)"}),e.jsx("option",{value:"deuteranopia",children:"Deuteranopia (green-blind)"}),e.jsx("option",{value:"protanomaly",children:"Protanomaly (red-weak)"}),e.jsx("option",{value:"protanopia",children:"Protanopia (red-blind)"}),e.jsx("option",{value:"tritanomaly",children:"Tritanomaly (blue-weak)"}),e.jsx("option",{value:"tritanopia",children:"Tritanopia (blue-blind)"}),e.jsx("option",{value:"achromatomaly",children:"Achromatomaly (partial color blindness)"}),e.jsx("option",{value:"achromatopsia",children:"Achromatopsia (no color)"})]}),e.jsxs("optgroup",{label:"Low vision",children:[e.jsx("option",{value:"cataract",children:"Cataract (blur)"}),e.jsx("option",{value:"low-contrast",children:"Low contrast sensitivity"}),e.jsx("option",{value:"glaucoma",children:"Glaucoma (tunnel vision)"}),e.jsx("option",{value:"macular",children:"Macular degeneration (central loss)"})]})]})]}),r&&e.jsx("span",{className:"text-[11px] text-slate-500 basis-full",children:r})]})}function oe({label:t,title:s,on:n,onClick:a}){return e.jsx("button",{type:"button",title:s,"aria-pressed":n,onClick:a,className:`text-xs px-2 py-1 rounded border transition-colors ${n?"bg-brand-500 text-white border-brand-500 hover:bg-brand-600":"bg-white text-slate-700 border-slate-300 hover:bg-slate-50"}`,children:t})}function Ms(t){if(!t)return"";const s=[t.pseudoState];return t.theme!=="light"&&s.push(t.theme),t.direction!=="ltr"&&s.push(t.direction),s.join(" · ")}function Os(){const t=g(p=>p.status),s=g(p=>p.progress),n=g(p=>p.aiProgress);if(t!=="running"||!s)return null;const a=n!=null,r=!a&&s.current>=s.total,i=a?n.current/n.total*100:s.current/s.total*100,o=a?n.current:s.current,l=a?n.total:s.total,d=a?`AI augmentation: ${n.current} of ${n.total} checks. ${n.currentCheckLabel}`:r?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${s.current} of ${s.total} states`;return e.jsxs("div",{className:"px-3 py-2 bg-slate-100 border-b border-slate-200",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2 text-xs text-slate-600 mb-1",children:[e.jsx("span",{children:a?e.jsxs(e.Fragment,{children:["AI augmentation… ",n.current,"/",n.total]}):r?e.jsx(e.Fragment,{children:"Running deep analyzers…"}):e.jsxs(e.Fragment,{children:["Auditing… ",s.current,"/",s.total]})}),e.jsx("span",{className:"text-slate-500 truncate flex-1",children:a?n.currentCheckLabel:r?"reading order · tab order · typography · CSS vars · AI candidates":Ms(s.currentState)}),e.jsx("button",{type:"button",onClick:()=>void F({type:"CANCEL_AUDIT"}),className:"text-[11px] px-2 py-0.5 border border-slate-400 bg-white text-slate-700 rounded hover:bg-slate-200 shrink-0",children:"Stop"})]}),e.jsx("div",{className:`h-1 rounded-full overflow-hidden ${a?"bg-violet-100":"bg-slate-200"}`,role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":l,"aria-label":d,children:e.jsx("div",{className:`h-full transition-all ${a?"bg-violet-500":"bg-brand-500"}`,style:{width:`${i}%`}})})]})}const le={"ada-iii":{id:"ada-iii",name:"ADA Title III",region:"US",blurb:"US civil-rights law; courts treat WCAG 2.1 AA as the de facto digital standard."},508:{id:"508",name:"Section 508",region:"US federal",blurb:"US federal procurement requirement; references WCAG 2.0 AA via 36 CFR Part 1194."},eaa:{id:"eaa",name:"EAA",region:"EU",blurb:"European Accessibility Act, in force 2025-06-28; references EN 301 549 → WCAG 2.1 AA."},"en-301-549":{id:"en-301-549",name:"EN 301 549",region:"EU",blurb:"European harmonized accessibility standard, baseline WCAG 2.1 AA."},aoda:{id:"aoda",name:"AODA",region:"Ontario",blurb:"Accessibility for Ontarians with Disabilities Act; WCAG 2.0 AA required since 2021."}};function Ps(t){return/^wcag\d/.test(t.wcagCriterion)?[le["ada-iii"],le[508],le.eaa,le["en-301-549"],le.aoda]:[]}const Gs={minor:"bg-blue-100 text-blue-700",moderate:"bg-yellow-100 text-yellow-700",serious:"bg-orange-100 text-orange-700",critical:"bg-red-100 text-red-700"};function Et({violation:t}){const s=g(h=>h.pinnedMatchKey),n=g(h=>h.pinnedFound),a=g(h=>h.setPinned),r=g(h=>{var m;return(m=h.results[0])==null?void 0:m.frameId}),i=g(h=>{var m;return(m=h.results[0])==null?void 0:m.scope}),o=s===t.matchKey,l=o&&!n;async function d(h){try{return(await me(h,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:h,selector:t.target.selector},r)).found}catch{return!0}}async function p(){const h=await W();if(!h)return;if(o){a(null);try{await K(h,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:h},r)}catch{}return}const m=await d(h);a(t.matchKey,m)}function c(h){h.stopPropagation(),t.currentState.breakpoint.width<=640&&Nt(),(async()=>{const m=await W();if(!m)return;try{await M({type:"STATE_DRIVE_REQUEST",tabId:m,state:t.currentState,scope:i,frameId:r})}catch{}const b=await d(m);a(t.matchKey,b)})()}async function u(h){h.stopPropagation();const m=await W();if(!m)return;try{await M({type:"STATE_DRIVE_REQUEST",tabId:m,state:Ws(),scope:i,frameId:r})}catch{F({type:"STATE_RESET_REQUEST",tabId:m})}const b=await d(m);a(t.matchKey,b)}return e.jsxs("button",{type:"button",onClick:p,"aria-pressed":o,className:`w-full text-left border rounded p-2 bg-white block transition-shadow
|
|
2
|
+
var zt=Object.defineProperty;var qt=(t,s,n)=>s in t?zt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var He=(t,s,n)=>qt(t,typeof s!="symbol"?s+"":s,n);import{R as ce,i as q,r as x,j as e,M as ae,C as Te,l as Kt,o as _e,t as Le,m as pt,s as ht,k as we}from"./styles-C4Kq0zOO.js";import{_ as Ue}from"./preload-helper-D7HrI6pR.js";import{o as H,r as M,s as F,c as mt,b as K,d as me}from"./crash-reporter-Dc5lvxvY.js";import{g as Qt,a as W,b as Jt,d as Yt,A as Q,l as Fe,s as Xt,O as xt,c as Zt,e as es,f as ze,h as gt,i as ft,j as ts,k as ss,m as ns}from"./forensic-log-B1UCXZ23.js";import{B as Ne,i as bt,b as vt,T as yt}from"./state-PELIq3oj.js";const qe=t=>{let s;const n=new Set,a=(p,c)=>{const u=typeof p=="function"?p(s):p;if(!Object.is(u,s)){const h=s;s=c??(typeof u!="object"||u===null)?u:Object.assign({},s,u),n.forEach(m=>m(s,h))}},r=()=>s,l={setState:a,getState:r,getInitialState:()=>d,subscribe:p=>(n.add(p),()=>n.delete(p))},d=s=t(a,r,l);return l},as=t=>t?qe(t):qe,rs=t=>t;function is(t,s=rs){const n=ce.useSyncExternalStore(t.subscribe,ce.useCallback(()=>s(t.getState()),[t,s]),ce.useCallback(()=>s(t.getInitialState()),[t,s]));return ce.useDebugValue(n),n}const Ke=t=>{const s=as(t),n=a=>is(s,a);return Object.assign(n,s),n},os=t=>t?Ke(t):Ke,g=os(t=>({status:"idle",progress:null,results:[],delta:null,componentId:null,errorMessage:null,freshThisSession:!1,baselineList:[],tier:"trial",trialDaysRemaining:null,seatsUsed:null,seatsTotal:null,planCode:null,licenseDaysRemaining:null,pastDue:!1,messages:[],unreadMessageCount:0,criticalUnacked:!1,view:"matrix",userMode:null,siteCrawlStatus:"idle",siteCrawlProgress:null,siteCrawlReport:null,siteCrawlError:null,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null,setStatus:s=>t({status:s}),startNewScan:()=>t({status:"running",results:[],delta:null,errorMessage:null,progress:null,componentId:null,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null}),setProgress:s=>t({progress:s}),setResults:(s,n,a)=>t({results:s,delta:n,componentId:a,status:"complete",errorMessage:null,freshThisSession:!0,aiProgress:null,pinnedMatchKey:null,pinnedFound:!0}),setDelta:s=>t({delta:s}),setError:s=>t({errorMessage:s,status:"failed"}),setBaselineList:s=>t({baselineList:s}),clearResults:()=>t({results:[],delta:null,componentId:null,errorMessage:null,progress:null,status:"idle",freshThisSession:!1,pinnedMatchKey:null,pinnedFound:!0,aiFailure:null,aiProgress:null}),setTier:(s,n)=>t({tier:s,trialDaysRemaining:(n==null?void 0:n.trialDaysRemaining)??null,seatsUsed:(n==null?void 0:n.seatsUsed)??null,seatsTotal:(n==null?void 0:n.seatsTotal)??null,planCode:(n==null?void 0:n.planCode)??null,licenseDaysRemaining:(n==null?void 0:n.licenseDaysRemaining)??null,pastDue:(n==null?void 0:n.pastDue)??!1}),setView:s=>t({view:s}),setUserMode:s=>t({userMode:s}),setSiteCrawlStatus:s=>t({siteCrawlStatus:s}),setSiteCrawlProgress:s=>t({siteCrawlProgress:s}),setSiteCrawlReport:s=>t({siteCrawlReport:s}),setSiteCrawlError:s=>t({siteCrawlError:s}),setPinned:(s,n=!0)=>t({pinnedMatchKey:s,pinnedFound:n}),setAiFailure:s=>t({aiFailure:s}),clearAiFailure:()=>t({aiFailure:null}),setAiProgress:s=>t({aiProgress:s}),setMessages:(s,n,a)=>t({messages:s,unreadMessageCount:n,criticalUnacked:a}),applyMessageAck:(s,n)=>t(a=>{const r=a.messages.map(l=>l.id!==s?l:n==="seen"?{...l,seen:!0}:n==="dismissed"?{...l,dismissed:!0}:n==="acknowledged"?{...l,acknowledged:!0}:n==="clicked"?{...l,clicked:!0}:l).filter(l=>l.severity==="critical"?!l.acknowledged:!l.dismissed),i=r.filter(l=>!l.seen).length,o=r.some(l=>l.severity==="critical"&&!l.acknowledged);return{messages:r,unreadMessageCount:i,criticalUnacked:o}})})),xe="sidePanel:lastAudit";function ls(){const t=[];return t.push(H("AUDIT_PROGRESS_EVENT",s=>{const n=g.getState().status==="running";g.getState().setProgress({current:s.current,total:s.total,currentState:s.currentState}),g.getState().setStatus("running"),n||q.polite(`Audit running, scanning ${s.total} state${s.total===1?"":"s"}.`)})),t.push(H("AUDIT_COMPLETE_EVENT",s=>{var i;g.getState().setResults(s.results,s.delta,s.componentId);const n=s.results.reduce((o,l)=>o+l.violations.length,0),a=((i=s.delta)==null?void 0:i.newCount)??0,r=s.delta?`Audit complete. ${a} new violation${a===1?"":"s"} versus baseline.`:`Audit complete. ${n} violation${n===1?"":"s"} found across ${s.results.length} state${s.results.length===1?"":"s"}.`;q.polite(r),cs({results:s.results,delta:s.delta,componentId:s.componentId})})),t.push(H("AUDIT_FAILED_EVENT",s=>{g.getState().setError(s.error.message)})),t.push(H("AI_AUGMENTATION_PROGRESS_EVENT",s=>{const n=g.getState().aiProgress;g.getState().setAiProgress({currentCheckLabel:s.currentCheckLabel,current:s.current,total:s.total,candidatesDone:s.candidatesDone,candidatesTotal:s.candidatesTotal}),n||q.polite(`AI augmentation running ${s.total} check${s.total===1?"":"s"}.`)})),t.push(H("AI_AUGMENTATION_FAILED_EVENT",s=>{g.getState().setAiFailure({severity:s.severity,reason:s.reason,checksAttempted:s.checksAttempted,checksSucceeded:s.checksSucceeded,checksErrored:s.checksErrored,errorDetails:s.errorDetails})})),t.push(H("SCORECARD_UPDATED_EVENT",()=>{ge()})),t.push(H("LICENSE_CHANGED_EVENT",()=>{jt()})),t.push(H("SITE_CRAWL_PROGRESS_EVENT",s=>{const n=g.getState();n.setSiteCrawlStatus("running"),n.setSiteCrawlProgress({current:s.current,total:s.total,url:s.url,lastViolations:s.violations}),s.status==="auditing"&&s.current===1&&q.polite(`Site crawl started, scanning up to ${s.total} pages.`)})),t.push(H("SITE_CRAWL_COMPLETE_EVENT",s=>{const n=g.getState();n.setSiteCrawlStatus("complete"),n.setSiteCrawlReport(s.report),n.setSiteCrawlProgress(null),q.polite(`Site crawl complete. Grade ${s.report.siteGrade}, ${s.report.totalUniqueViolations} unique violation${s.report.totalUniqueViolations===1?"":"s"}.`)})),t.push(H("SITE_CRAWL_FAILED_EVENT",s=>{const n=g.getState();n.setSiteCrawlStatus("failed"),n.setSiteCrawlError(s.error.message),n.setSiteCrawlProgress(null),q.assertive(`Site crawl failed: ${s.error.message}`)})),()=>t.forEach(s=>s())}async function cs(t){const s={...t,results:t.results.map(({screenshotDataUrl:n,...a})=>a)};try{await chrome.storage.local.set({[xe]:s})}catch(n){console.warn("[wire-messaging] persistLastAudit failed; results stay in-memory only",n)}}async function ds(){const s=(await chrome.storage.local.get(xe))[xe];s&&g.setState({results:s.results,delta:s.delta,componentId:s.componentId,status:"complete"})}async function us(){await chrome.storage.local.remove(xe)}async function Me(){g.getState().clearResults(),await us()}async function ge(){const t=await M({type:"BASELINE_LIST"});g.getState().setBaselineList(t.items)}async function jt(t){const s=await M({type:"TIER_GET",forceRefresh:(t==null?void 0:t.forceRefresh)===!0});g.getState().setTier(s.tier,{trialDaysRemaining:s.trialDaysRemaining,seatsUsed:s.seatsUsed,seatsTotal:s.seatsTotal,planCode:s.planCode,licenseDaysRemaining:s.licenseDaysRemaining,pastDue:s.pastDue}),wt()}async function wt(){const{fetchMessages:t}=await Ue(async()=>{const{fetchMessages:a}=await Promise.resolve().then(()=>ys);return{fetchMessages:a}},void 0),s=g.getState().userMode,n=await t(s);n&&g.getState().setMessages(n.messages,n.unreadCount,n.criticalUnacked)}async function ps(){const s=(await M({type:"SETTINGS_GET",key:"userMode"})).data,n=s==="owner"||s==="dev"?s:null;g.getState().setUserMode(n)}function hs(){return chrome.runtime.connect({name:"audit-keepalive"})}let fe=null;async function ms(){if(fe===null)try{const t=await chrome.windows.getCurrent();typeof t.id=="number"&&(fe=t.id)}catch{}}function Nt(){if(fe===null)return;const t=chrome.sidePanel;!t||typeof t.open!="function"||t.open({windowId:fe}).catch(()=>{})}function X(t){Nt(),F(t)}function xs({onClose:t}){const[s,n]=x.useState(""),[a,r]=x.useState(""),[i,o]=x.useState(!0),[l,d]=x.useState(""),[p,c]=x.useState(!1),[u,h]=x.useState(null);async function m(b){var j;if(b.preventDefault(),!(!s.trim()||!a.trim())){c(!0),h(null);try{const E=await M({type:"SUPPORT_MESSAGE_REQUEST",subject:s.trim(),body:a.trim(),includeContext:i,replyEmail:l.trim()||void 0});E.success?(h({ok:!0,msg:`Sent (ref: ${E.ticketRef??"n/a"})`}),setTimeout(t,1200)):h({ok:!1,msg:((j=E.error)==null?void 0:j.message)??"Failed to send"})}finally{c(!1)}}}return e.jsxs("form",{onSubmit:m,className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-subject",className:"block text-xs font-medium mb-1",children:"Subject"}),e.jsx("input",{id:"support-subject",type:"text",value:s,onChange:b=>n(b.target.value),required:!0,className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-body",className:"block text-xs font-medium mb-1",children:"Message"}),e.jsx("textarea",{id:"support-body",value:a,onChange:b=>r(b.target.value),required:!0,rows:6,className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"support-reply",className:"block text-xs font-medium mb-1",children:"Reply email (optional)"}),e.jsx("input",{id:"support-reply",type:"email",autoComplete:"email",value:l,onChange:b=>d(b.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:b=>o(b.target.checked),className:"mt-0.5"}),e.jsx("span",{className:"text-slate-600",children:"Include extension version, browser platform, and license tier (no URLs, page content, or audit data is sent)."})]}),u&&e.jsx("p",{id:"support-form-result",role:u.ok?"status":"alert",className:`text-xs ${u.ok?"text-green-700":"text-red-700"}`,children:u.msg}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:t,className:"text-xs px-3 py-1 hover:bg-slate-100 rounded",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:p,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:p?"Sending…":"Send"})]})]})}function Qe({onClick:t,ariaLabel:s,title:n,children:a,className:r}){return e.jsx("button",{onClick:t,"aria-label":s,title:n??s,className:`inline-flex items-center justify-center min-w-[24px] min-h-[24px] text-xs text-slate-500 hover:text-slate-900 ${r??""}`,children:a})}const be=mt("messages-client"),gs="https://api.wcagcheckr.com",St="wcagcheckr",fs=1e4;function bs(){try{return chrome.runtime.getManifest().version}catch{return"0.0.0"}}async function At(t,s){const n=await Qt();if(!n)throw new Error("no_license_token");const a={...(s==null?void 0:s.headers)??{},Authorization:`Bearer ${n}`,"X-Extension-Version":bs()};return s!=null&&s.userMode&&(a["X-User-Mode"]=s.userMode),fetch(`${gs}${t}`,{...s,headers:a,signal:AbortSignal.timeout(fs)})}async function vs(t){try{const s=await At(`/v1/products/${St}/messages`,{userMode:t??null});return s.ok?await s.json():(be.warn("fetchMessages http",s.status),null)}catch(s){return be.warn("fetchMessages failed",s),null}}async function ne(t,s){try{const n=await At(`/v1/products/${St}/messages/${t}/ack`,{method:"POST",body:JSON.stringify({action:s}),headers:{"content-type":"application/json"}});return n.ok?!0:(be.warn("ackMessage http",n.status,"action",s),!1)}catch(n){return be.warn("ackMessage failed",n),!1}}const ys=Object.freeze(Object.defineProperty({__proto__:null,ackMessage:ne,fetchMessages:vs},Symbol.toStringTag,{value:"Module"})),js=["http:","https:"];function ws(t){try{const s=new URL(t);return js.includes(s.protocol)}catch{return!1}}function Je(t){const s=[];let n=0,a=0;for(;n<t.length;){if(t[n]==="["){const i=t.indexOf("]",n+1);if(i!==-1&&t[i+1]==="("){const o=t.indexOf(")",i+2);if(o!==-1){const l=t.slice(n+1,i),d=t.slice(i+2,o);ws(d)?s.push(e.jsx("a",{href:d,target:"_blank",rel:"noopener",className:"text-brand-700 underline",children:l},`l-${a++}`)):s.push(e.jsx(x.Fragment,{children:l},`l-${a++}`)),n=o+1;continue}}}if(t[n]==="*"&&t[n+1]==="*"){const i=t.indexOf("**",n+2);if(i!==-1){s.push(e.jsx("strong",{children:t.slice(n+2,i)},`b-${a++}`)),n=i+2;continue}}if(t[n]==="*"&&t[n+1]!=="*"){const i=t.indexOf("*",n+1);if(i!==-1&&t[i+1]!=="*"){s.push(e.jsx("em",{children:t.slice(n+1,i)},`i-${a++}`)),n=i+1;continue}}let r=n+1;for(;r<t.length&&t[r]!=="*"&&t[r]!=="[";)r++;s.push(e.jsx(x.Fragment,{children:t.slice(n,r)},`t-${a++}`)),n=r}return s}function kt({source:t}){const s=t.split(/\r?\n/),n=[];let a=[],r=[],i=0;function o(){if(r.length===0)return;const d=r.join(" ");n.push(e.jsx("p",{className:"leading-snug",children:Je(d)},`p-${i++}`)),r=[]}function l(){a.length!==0&&(n.push(e.jsx("ul",{className:"list-disc pl-5 space-y-0.5",children:a.map((d,p)=>e.jsx("li",{children:Je(d)},p))},`u-${i++}`)),a=[])}for(const d of s){const p=d.trimEnd();if(p===""){o(),l();continue}const c=/^[-*]\s+(.*)$/.exec(p);if(c){o(),a.push(c[1]);continue}l(),r.push(p)}return o(),l(),e.jsx("div",{className:"space-y-1.5",children:n})}const Ns={info:"bg-blue-500",promo:"bg-purple-500",warning:"bg-amber-500",critical:"bg-rose-500"},Ss={critical:"bg-rose-50 border-rose-200"};function Ct(){const t=g(h=>h.unreadMessageCount),s=g(h=>h.messages),n=g(h=>h.applyMessageAck),[a,r]=x.useState(!1),i=x.useRef(-1),[o,l]=x.useState(!1);x.useEffect(()=>{const h=s.filter(b=>!b.seen);if(h.length===0)return;const m=Math.max(...h.map(b=>b.id));if(m>i.current){i.current=m,l(!0);const b=setTimeout(()=>l(!1),1500);return()=>clearTimeout(b)}},[s]);async function d(){const h=s.filter(m=>!m.seen);if(h.length!==0)for(const m of h)n(m.id,"seen"),ne(m.id,"seen")}function p(){const h=!a;r(h),h&&d()}async function c(h){n(h.id,"dismissed"),await ne(h.id,"dismissed")}async function u(h){h.ctaUrl&&(n(h.id,"clicked"),ne(h.id,"clicked"),chrome.tabs.create({url:h.ctaUrl}).catch(()=>{window.open(h.ctaUrl,"_blank","noopener")}))}return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:p,"aria-label":t>0?`Notifications (${t} unread)`:"Notifications","aria-expanded":a,"aria-haspopup":"dialog",className:`relative grid place-items-center w-7 h-7 rounded text-slate-500 hover:bg-slate-100 hover:text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand-500 ${o?"animate-bell-pulse":""}`,title:t>0?`${t} new message${t===1?"":"s"}`:"No new messages",children:[e.jsx(As,{active:t>0}),t>0&&e.jsx("span",{"aria-hidden":"true",className:"absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-rose-500 ring-2 ring-white"})]}),a&&e.jsx(ks,{messages:s,onClose:()=>r(!1),onDismiss:c,onCtaClick:u})]})}function As({active:t}){return e.jsx("svg",{viewBox:"0 0 20 20",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",className:t?"text-rose-500":"",children:e.jsx("path",{d:"M10 2a5 5 0 00-5 5v3l-1.6 2.4a1 1 0 00.84 1.6h11.52a1 1 0 00.84-1.6L15 10V7a5 5 0 00-5-5zm-1.5 13a1.5 1.5 0 003 0h-3z"})})}function ks({messages:t,onClose:s,onDismiss:n,onCtaClick:a}){const r=x.useRef(null);return x.useEffect(()=>{const i=l=>{r.current&&(r.current.contains(l.target)||s())},o=l=>{l.key==="Escape"&&s()};return document.addEventListener("mousedown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",o)}},[s]),e.jsxs("div",{ref:r,role:"dialog","aria-label":"Notifications",className:"absolute right-0 top-full mt-1 w-80 max-h-[420px] overflow-y-auto bg-white border border-slate-200 rounded shadow-lg z-50 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-slate-200",children:[e.jsx("span",{className:"font-medium",children:"Notifications"}),e.jsx("button",{type:"button",onClick:()=>{wt()},className:"text-[11px] text-brand-700 hover:underline",children:"Refresh"})]}),t.length===0?e.jsx("div",{className:"p-4 text-center text-slate-500 text-[11px]",children:"No messages."}):e.jsx("ul",{className:"divide-y divide-slate-100",children:t.map(i=>e.jsx("li",{className:`p-3 ${i.seen?"":"bg-slate-50"}`,children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:`shrink-0 w-1 self-stretch rounded ${Ns[i.severity]}`,"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"font-medium text-slate-800",children:i.title}),i.dismissible&&i.severity!=="critical"&&e.jsx("button",{type:"button",onClick:()=>n(i),"aria-label":"Dismiss message",className:"text-slate-400 hover:text-slate-700 shrink-0",children:"✕"})]}),e.jsx("div",{className:"mt-1 text-slate-700",children:e.jsx(kt,{source:i.bodyMd})}),i.ctaLabel&&i.ctaUrl&&e.jsx("button",{type:"button",onClick:()=>a(i),className:"mt-2 text-[11px] px-2 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:i.ctaLabel}),e.jsx("div",{className:"mt-1 text-[10px] text-slate-400",children:new Date(i.createdAt).toLocaleString()})]})]})},i.id))})]})}function It(){const t=g(i=>i.messages),s=g(i=>i.applyMessageAck),n=t.find(i=>i.severity==="critical"&&!i.acknowledged);if(!n)return null;async function a(){s(n.id,"acknowledged"),await ne(n.id,"acknowledged")}async function r(){n.ctaUrl&&(s(n.id,"clicked"),ne(n.id,"clicked"),chrome.tabs.create({url:n.ctaUrl}).catch(()=>{}))}return e.jsxs("div",{role:"alert",className:`border-y ${Ss.critical} px-3 py-2 text-xs flex items-start gap-2`,children:[e.jsx("span",{"aria-hidden":"true",className:"text-rose-600 text-sm leading-none mt-0.5",children:"⚠"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-rose-900",children:n.title}),e.jsx("div",{className:"mt-0.5 text-rose-900/90",children:e.jsx(kt,{source:n.bodyMd})}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[n.ctaLabel&&n.ctaUrl&&e.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-2 py-1 bg-rose-600 text-white rounded hover:bg-rose-700",children:n.ctaLabel}),e.jsx("button",{type:"button",onClick:a,className:"text-[11px] px-2 py-1 border border-rose-300 text-rose-800 rounded hover:bg-rose-100",children:"Acknowledge"})]})]})]})}const ie=["matrix","delta","activity","guided","flows","scorecard","crawl","forensic","compliance"];function Cs(t){if(!t)return null;try{return new URL(t).hostname}catch{return t}}function Is(){var u,h;const t=g(m=>m.view),s=g(m=>m.setView),n=g(m=>m.setUserMode),a=g(m=>m.results),r=g(m=>m.status),[i,o]=x.useState(!1),l=((u=a[0])==null?void 0:u.pageUrl)??((h=a[0])==null?void 0:h.scope),d=Cs(l),p=a.length>0&&r!=="running";function c(){n("owner"),F({type:"SETTINGS_SET",key:"userMode",value:"owner"})}return e.jsxs("header",{className:"border-b border-slate-200 bg-white px-3 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-semibold text-sm leading-tight",children:"wcagcheckr"}),e.jsxs("p",{className:"text-[10px] text-slate-500 leading-tight font-mono",children:["v",chrome.runtime.getManifest().version]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:c,title:"Switch to the simplified site-owner view",className:"text-[11px] px-2 py-1 border border-slate-300 rounded text-slate-600 hover:bg-slate-50",children:"Owner mode"}),e.jsx(Ct,{}),e.jsx(Qe,{onClick:()=>void F({type:"OPEN_SETTINGS"}),ariaLabel:"Open settings",children:"⚙"}),e.jsx(Qe,{onClick:()=>o(!0),ariaLabel:"Send support message",children:"?"})]})]}),p&&d&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2 py-1 rounded bg-brand-50 border border-brand-200 text-[11px]",title:l??"",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"Audit:"}),e.jsx("span",{className:"font-mono font-medium text-slate-800 truncate flex-1","aria-label":`Showing audit results for ${d}`,children:d}),e.jsx("button",{type:"button",onClick:()=>void Me(),className:"shrink-0 text-[11px] px-2 py-0.5 rounded border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 hover:border-slate-400",title:"Clear these results so you can run a fresh audit",children:"Clear"})]}),e.jsx(Es,{view:t,setView:s}),e.jsx(ae,{open:i,onClose:()=>o(!1),title:"Send support message",children:e.jsx(xs,{onClose:()=>o(!1)})})]})}function Es({view:t,setView:s}){const n=x.useRef([]);function a(i){var d;const o=(i+ie.length)%ie.length,l=ie[o];l&&(s(l),(d=n.current[o])==null||d.focus())}function r(i,o){switch(i.key){case"ArrowRight":i.preventDefault(),a(o+1);break;case"ArrowLeft":i.preventDefault(),a(o-1);break;case"Home":i.preventDefault(),a(0);break;case"End":i.preventDefault(),a(ie.length-1);break}}return e.jsx("nav",{className:"flex flex-wrap gap-1","aria-label":"Audit views",role:"tablist",children:ie.map((i,o)=>{const l=t===i;return e.jsx("button",{ref:d=>{n.current[o]=d},role:"tab","aria-selected":l,tabIndex:l?0:-1,onClick:()=>s(i),onKeyDown:d=>r(d,o),className:l?"text-xs px-3 py-1 rounded bg-brand-500 text-white":"text-xs px-3 py-1 rounded text-slate-600 hover:bg-slate-100",children:i[0].toUpperCase()+i.slice(1)},i)})})}function Rs({feature:t,upgradeUrl:s}){const[n,a]=x.useState(!1);return e.jsxs("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:[e.jsxs("p",{className:"text-xs text-amber-900 mb-2",children:[e.jsx("strong",{children:t})," requires a higher tier."]}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"text-xs text-brand-600 hover:underline font-medium",children:"Upgrade →"}),e.jsx(Te,{open:n,onClose:()=>a(!1)})]})}const Ts="https://wcagcheckr.com/upgrade";function $s(){const[t,s]=x.useState("single-element"),[n,a]=x.useState(!1),[r,i]=x.useState(null),[o,l]=x.useState(null),[d,p]=x.useState(Ne),[c,u]=x.useState(Ne[0].id),h=g(w=>w.status),m=g(w=>w.tier),b=g(w=>w.results.length>0),j=h==="running";x.useEffect(()=>{Promise.all([M({type:"SETTINGS_GET",key:"matrixPresets"}),M({type:"SETTINGS_GET",key:"activePresetId"})]).then(([w,T])=>{const C=Array.isArray(w.data)?w.data:null;p(C&&C.length>0?C:Ne),typeof T.data=="string"&&u(T.data)})},[]);function E(w){const T=d.find(C=>C.id===w);T&&(u(w),F({type:"SETTINGS_SET",key:"activePresetId",value:w}),F({type:"SETTINGS_SET",key:"stateMatrix",value:T.matrix}))}const k=bt(m,"storybookAutoIterate");x.useEffect(()=>{const w=H("ELEMENT_PICKED_EVENT",(C,L)=>{a(!1);const D=L.frameId;R(D),i({selector:C.selector,frameId:D})}),T=H("PICKER_CANCELLED_EVENT",()=>a(!1));return()=>{w(),T()}},[]);async function f(){const w=await W();w&&(a(!0),await K(w,{type:"PICKER_ACTIVATE_REQUEST",tabId:w}))}function v(){r&&(R(r.frameId),X({type:"START_AUDIT",mode:"single-element",scope:r.selector,frameId:r.frameId}),g.getState().startNewScan())}function y(){if(!k){l("storybook:auto-iterate");return}R(),X({type:"START_AUDIT",mode:"storybook-all"}),g.getState().startNewScan()}function I(){R(),X({type:"START_AUDIT",mode:"all-frames"}),g.getState().startNewScan()}function _(){R(),X({type:"START_AUDIT",mode:"full-page"}),g.getState().startNewScan()}function S(){F({type:"CANCEL_AUDIT"})}async function R(w){g.getState().setPinned(null);const T=await W();if(T)try{await K(T,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:T},w)}catch{}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-3 py-2 border-b border-slate-200 bg-white space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"aria-label":"Audit mode",value:t,onChange:w=>s(w.target.value),disabled:j||n,className:"text-xs border border-slate-300 rounded px-2 py-1",children:[e.jsx("option",{value:"single-element",children:"Single element"}),e.jsx("option",{value:"full-page",children:"Full page"}),e.jsx("option",{value:"all-frames",children:"All iframes"}),e.jsxs("option",{value:"storybook-all",children:["All stories (Storybook / Ladle)",k?"":" (paid)"]})]}),e.jsx("select",{"aria-label":"State-matrix preset",value:c,onChange:w=>E(w.target.value),disabled:j||n,title:"Switch the state-matrix preset used for the next audit",className:"text-xs border border-slate-300 rounded px-2 py-1",children:d.map(w=>e.jsx("option",{value:w.id,children:w.name},w.id))}),t==="single-element"?e.jsx(Ds,{picking:n,picked:r,isRunning:j,onPick:f,onRun:v,onClearPick:()=>i(null)}):t==="full-page"?e.jsx("button",{onClick:_,disabled:j,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:j?"Auditing…":"Scan page"}):t==="all-frames"?e.jsx("button",{onClick:I,disabled:j,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:j?"Auditing…":"Audit all iframes"}):e.jsx("button",{onClick:y,disabled:j,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:j?"Auditing…":"Audit all stories"}),j&&e.jsx("button",{onClick:S,className:"text-xs px-3 py-1 border border-slate-300 text-slate-700 rounded hover:bg-slate-100",children:"Stop"}),!j&&b&&e.jsx("button",{type:"button",onClick:()=>void Me(),className:"text-xs text-slate-500 hover:text-slate-800 hover:underline ml-auto",title:"Clear current results",children:"Clear"})]}),t==="single-element"&&r&&!n&&!j&&e.jsx(_s,{selector:r.selector,onRepick:f,onClear:()=>i(null)})]}),e.jsx(ae,{open:o!==null,onClose:()=>l(null),title:"Upgrade to continue",children:e.jsx(Rs,{feature:o??"",upgradeUrl:Ts})})]})}function Ds({picking:t,picked:s,isRunning:n,onPick:a,onRun:r,onClearPick:i}){return n?e.jsx("button",{disabled:!0,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded opacity-50",children:"Auditing…"}):t?e.jsx("button",{disabled:!0,className:"text-xs px-3 py-1 bg-brand-400 text-white rounded",children:"Click an element on the page"}):s?e.jsx("button",{onClick:r,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Run audit"}):e.jsx("button",{onClick:a,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Pick element"})}function _s({selector:t,onRepick:s,onClear:n}){return e.jsxs("div",{className:"text-[11px] text-slate-600 flex items-center gap-2 flex-wrap",children:[e.jsx("span",{children:"Selected:"}),e.jsx("code",{className:"font-mono bg-slate-100 px-1.5 py-0.5 rounded text-slate-700 truncate max-w-[180px]",title:t,children:t}),e.jsx("button",{type:"button",onClick:s,className:"text-brand-600 hover:underline",children:"Re-pick"}),e.jsx("span",{"aria-hidden":"true",className:"text-slate-300",children:"·"}),e.jsx("button",{type:"button",onClick:n,className:"text-slate-500 hover:text-slate-700 hover:underline",children:"Clear"})]})}const Ls={outline:"OUTLINE_HIDE_REQUEST","tab-order":"TAB_ORDER_HIDE_REQUEST","reading-order":"READING_ORDER_HIDE_REQUEST","target-size":"TARGET_SIZE_HIDE_REQUEST"},Us={outline:"OUTLINE_SHOW_REQUEST","tab-order":"TAB_ORDER_SHOW_REQUEST","reading-order":"READING_ORDER_SHOW_REQUEST","target-size":"TARGET_SIZE_SHOW_REQUEST"};function Fs(){const[t,s]=x.useState(null),[n,a]=x.useState(!1),[r,i]=x.useState(null),[o,l]=x.useState("off"),p=g(m=>m.results).flatMap(m=>m.violations);async function c(m){const b=await W();b&&(l(m),m==="off"?await K(b,{type:"VISION_SIMULATOR_CLEAR",tabId:b}).catch(()=>{}):await K(b,{type:"VISION_SIMULATOR_APPLY",tabId:b,mode:m}).catch(()=>{}))}async function u(m){const b=await W();if(b){if(t&&await K(b,{type:Ls[t],tabId:b}).catch(()=>{}),t===m){s(null);return}await K(b,{type:Us[m],tabId:b}).catch(()=>{}),s(m)}}async function h(){const m=await W();if(m){if(n){await K(m,{type:"FIX_PREVIEW_HIDE_REQUEST",tabId:m}).catch(()=>{}),a(!1),i(null);return}if(p.length===0){i("Run an audit first.");return}try{const b=await me(m,{type:"FIX_PREVIEW_SHOW_REQUEST",tabId:m,violations:p});a(!0),i(`Previewing ${b.visualFixCount} visual fix${b.visualFixCount===1?"":"es"} + ${b.annotationCount} annotation${b.annotationCount===1?"":"s"}.`)}catch{i("Preview failed.")}}}return e.jsxs("div",{className:"px-3 py-2 border-b border-slate-200 bg-white flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-slate-500 mr-1",title:"Page overlays — these draw information on the live page. They do NOT change what the audit detects.",children:"Visualizers"}),e.jsx(oe,{label:"Outline",title:"Show heading + landmark structure overlay",on:t==="outline",onClick:()=>u("outline")}),e.jsx(oe,{label:"Tab order",title:"Number focusables in tab sequence. Red = tab order doesn't follow visual layout (focus jumps around). Amber = positive tabindex reordered the DOM sequence.",on:t==="tab-order",onClick:()=>u("tab-order")}),e.jsx(oe,{label:"Reading order",title:"Number content in DOM order (what a screen reader reads). Red = element's DOM position differs from its visual position; badge shows DOM→Visual.",on:t==="reading-order",onClick:()=>u("reading-order")}),e.jsx(oe,{label:"Targets",title:"Show interactive-element dimensions vs WCAG 2.5.8 (24px AA) / 2.5.5 (44px AAA)",on:t==="target-size",onClick:()=>u("target-size")}),e.jsx("span",{className:"w-px h-4 bg-slate-200 mx-1","aria-hidden":"true"}),e.jsx(oe,{label:"Preview fixes ✨",title:"Apply contrast/target-size/focus-ring fixes to the live page + annotate where labels and alt text are missing. Toggle off to revert.",on:n,onClick:h}),e.jsx("span",{className:"w-px h-4 bg-slate-200 mx-1","aria-hidden":"true"}),e.jsxs("label",{className:"text-[11px] text-slate-700 flex items-center gap-1.5",children:[e.jsx("span",{title:"Apply a CSS filter that simulates how the page looks for users with color-vision or low-vision impairments. Visual only — does NOT change what the audit detects.",children:"Vision sim:"}),e.jsxs("select",{"aria-label":"Vision-impairment simulator",value:o,onChange:m=>void c(m.target.value),className:`text-xs border rounded px-1.5 py-0.5 ${o==="off"?"border-slate-300 bg-white text-slate-700":"border-brand-500 bg-brand-50 text-brand-700 font-medium"}`,children:[e.jsx("option",{value:"off",children:"Off"}),e.jsxs("optgroup",{label:"Color blindness",children:[e.jsx("option",{value:"deuteranomaly",children:"Deuteranomaly (green-weak — most common)"}),e.jsx("option",{value:"deuteranopia",children:"Deuteranopia (green-blind)"}),e.jsx("option",{value:"protanomaly",children:"Protanomaly (red-weak)"}),e.jsx("option",{value:"protanopia",children:"Protanopia (red-blind)"}),e.jsx("option",{value:"tritanomaly",children:"Tritanomaly (blue-weak)"}),e.jsx("option",{value:"tritanopia",children:"Tritanopia (blue-blind)"}),e.jsx("option",{value:"achromatomaly",children:"Achromatomaly (partial color blindness)"}),e.jsx("option",{value:"achromatopsia",children:"Achromatopsia (no color)"})]}),e.jsxs("optgroup",{label:"Low vision",children:[e.jsx("option",{value:"cataract",children:"Cataract (blur)"}),e.jsx("option",{value:"low-contrast",children:"Low contrast sensitivity"}),e.jsx("option",{value:"glaucoma",children:"Glaucoma (tunnel vision)"}),e.jsx("option",{value:"macular",children:"Macular degeneration (central loss)"})]})]})]}),r&&e.jsx("span",{className:"text-[11px] text-slate-500 basis-full",children:r})]})}function oe({label:t,title:s,on:n,onClick:a}){return e.jsx("button",{type:"button",title:s,"aria-pressed":n,onClick:a,className:`text-xs px-2 py-1 rounded border transition-colors ${n?"bg-brand-500 text-white border-brand-500 hover:bg-brand-600":"bg-white text-slate-700 border-slate-300 hover:bg-slate-50"}`,children:t})}function Ms(t){if(!t)return"";const s=[t.pseudoState];return t.theme!=="light"&&s.push(t.theme),t.direction!=="ltr"&&s.push(t.direction),s.join(" · ")}function Os(){const t=g(p=>p.status),s=g(p=>p.progress),n=g(p=>p.aiProgress);if(t!=="running"||!s)return null;const a=n!=null,r=!a&&s.current>=s.total,i=a?n.current/n.total*100:s.current/s.total*100,o=a?n.current:s.current,l=a?n.total:s.total,d=a?`AI augmentation: ${n.current} of ${n.total} checks. ${n.currentCheckLabel}`:r?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${s.current} of ${s.total} states`;return e.jsxs("div",{className:"px-3 py-2 bg-slate-100 border-b border-slate-200",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2 text-xs text-slate-600 mb-1",children:[e.jsx("span",{children:a?e.jsxs(e.Fragment,{children:["AI augmentation… ",n.current,"/",n.total]}):r?e.jsx(e.Fragment,{children:"Running deep analyzers…"}):e.jsxs(e.Fragment,{children:["Auditing… ",s.current,"/",s.total]})}),e.jsx("span",{className:"text-slate-500 truncate flex-1",children:a?n.candidatesTotal&&n.candidatesTotal>0?`${n.currentCheckLabel} (${n.candidatesDone??0}/${n.candidatesTotal})`:n.currentCheckLabel:r?"reading order · tab order · typography · CSS vars · AI candidates":Ms(s.currentState)}),e.jsx("button",{type:"button",onClick:()=>void F({type:"CANCEL_AUDIT"}),className:"text-[11px] px-2 py-0.5 border border-slate-400 bg-white text-slate-700 rounded hover:bg-slate-200 shrink-0",children:"Stop"})]}),e.jsx("div",{className:`h-1 rounded-full overflow-hidden ${a?"bg-violet-100":"bg-slate-200"}`,role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":l,"aria-label":d,children:e.jsx("div",{className:`h-full transition-all ${a?"bg-violet-500":"bg-brand-500"}`,style:{width:`${i}%`}})})]})}const le={"ada-iii":{id:"ada-iii",name:"ADA Title III",region:"US",blurb:"US civil-rights law; courts treat WCAG 2.1 AA as the de facto digital standard."},508:{id:"508",name:"Section 508",region:"US federal",blurb:"US federal procurement requirement; references WCAG 2.0 AA via 36 CFR Part 1194."},eaa:{id:"eaa",name:"EAA",region:"EU",blurb:"European Accessibility Act, in force 2025-06-28; references EN 301 549 → WCAG 2.1 AA."},"en-301-549":{id:"en-301-549",name:"EN 301 549",region:"EU",blurb:"European harmonized accessibility standard, baseline WCAG 2.1 AA."},aoda:{id:"aoda",name:"AODA",region:"Ontario",blurb:"Accessibility for Ontarians with Disabilities Act; WCAG 2.0 AA required since 2021."}};function Ps(t){return/^wcag\d/.test(t.wcagCriterion)?[le["ada-iii"],le[508],le.eaa,le["en-301-549"],le.aoda]:[]}const Gs={minor:"bg-blue-100 text-blue-700",moderate:"bg-yellow-100 text-yellow-700",serious:"bg-orange-100 text-orange-700",critical:"bg-red-100 text-red-700"};function Et({violation:t}){const s=g(h=>h.pinnedMatchKey),n=g(h=>h.pinnedFound),a=g(h=>h.setPinned),r=g(h=>{var m;return(m=h.results[0])==null?void 0:m.frameId}),i=g(h=>{var m;return(m=h.results[0])==null?void 0:m.scope}),o=s===t.matchKey,l=o&&!n;async function d(h){try{return(await me(h,{type:"HIGHLIGHT_SHOW_REQUEST",tabId:h,selector:t.target.selector},r)).found}catch{return!0}}async function p(){const h=await W();if(!h)return;if(o){a(null);try{await K(h,{type:"HIGHLIGHT_CLEAR_REQUEST",tabId:h},r)}catch{}return}const m=await d(h);a(t.matchKey,m)}function c(h){h.stopPropagation(),t.currentState.breakpoint.width<=640&&Nt(),(async()=>{const m=await W();if(!m)return;try{await M({type:"STATE_DRIVE_REQUEST",tabId:m,state:t.currentState,scope:i,frameId:r})}catch{}const b=await d(m);a(t.matchKey,b)})()}async function u(h){h.stopPropagation();const m=await W();if(!m)return;try{await M({type:"STATE_DRIVE_REQUEST",tabId:m,state:Ws(),scope:i,frameId:r})}catch{F({type:"STATE_RESET_REQUEST",tabId:m})}const b=await d(m);a(t.matchKey,b)}return e.jsxs("button",{type:"button",onClick:p,"aria-pressed":o,className:`w-full text-left border rounded p-2 bg-white block transition-shadow
|
|
3
3
|
${o?"border-rose-400 ring-2 ring-rose-300":"border-slate-200 hover:border-slate-300"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-1 gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-xs truncate",children:t.ruleId}),e.jsxs("div",{className:"text-xs text-slate-500",children:[t.wcagCriterion," · ",t.wcagLevel]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.flakyAcrossRuns&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-700",title:"Did not appear in every audit run — likely a transient environment artifact",children:"flaky"}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${Gs[t.impact]}`,children:t.impact})]})]}),e.jsx("p",{className:"text-xs text-slate-700 mb-2",children:t.description}),e.jsx("code",{className:"text-[11px] bg-slate-50 p-1.5 rounded block text-slate-600 font-mono whitespace-pre-wrap break-all",children:t.target.outerHTML}),e.jsx(Bs,{violation:t}),e.jsx(qs,{violation:t}),e.jsx(zs,{violation:t}),e.jsx(Hs,{text:t.target.failureSummary}),e.jsx(Ks,{ruleId:t.ruleId}),o&&e.jsxs("div",{className:"text-[11px] text-slate-600 mt-2 flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsxs("span",{children:["State: ",Vs(t.currentState)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("a",{role:"button",tabIndex:0,onClick:c,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),c(h))},className:"text-brand-600 hover:underline cursor-pointer",children:"Load state"}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("a",{role:"button",tabIndex:0,onClick:u,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u(h))},className:"text-brand-600 hover:underline cursor-pointer",children:"Load default"}),l&&e.jsx("span",{className:"text-amber-700 basis-full",children:"Couldn't find this element on the page. The story may have re-rendered or unmounted."})]}),t.helpUrl&&e.jsx("a",{href:t.helpUrl,target:"_blank",rel:"noreferrer",onClick:h=>h.stopPropagation(),className:"text-xs text-brand-600 hover:underline mt-2 inline-block",children:"Learn more →"})]})}function Vs(t){const s=[];return s.push(t.pseudoState==="default"?"default":`:${t.pseudoState}`),t.theme!=="light"&&s.push(t.theme),t.direction!=="ltr"&&s.push(t.direction),t.breakpoint.id!=="desktop"&&s.push(t.breakpoint.id),t.ariaVariation&&s.push(t.ariaVariation.id),s.join(" · ")}function Ws(){const t=vt.breakpointPresets;return{pseudoState:"default",ariaVariation:null,theme:"light",direction:"ltr",breakpoint:t.find(n=>n.id==="desktop")??t[0]}}function Rt(t){if(t.ruleId!=="color-contrast"&&t.ruleId!=="color-contrast-enhanced")return null;const s=t.target.failureSummary||"",n=/contrast of (\d+(?:\.\d+)?)/i.exec(s),a=/Expected contrast ratio of (\d+(?:\.\d+)?):1/i.exec(s),r=/foreground color:\s*(#[0-9a-fA-F]+)/i.exec(s),i=/background color:\s*(#[0-9a-fA-F]+)/i.exec(s);return!n||!a?null:{ratio:parseFloat(n[1]),required:parseFloat(a[1]),fg:(r==null?void 0:r[1])??"#000000",bg:(i==null?void 0:i[1])??"#ffffff"}}function Bs({violation:t}){const s=Rt(t);if(!s)return null;const n=s.ratio>=s.required;return e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[11px]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-6 rounded border border-slate-300",style:{background:s.bg,color:s.fg},title:`fg ${s.fg} on bg ${s.bg}`,children:"Aa"}),e.jsxs("span",{className:n?"text-green-700":"text-rose-700 font-medium",children:[s.ratio.toFixed(2)," : 1"]}),e.jsxs("span",{className:"text-slate-500",children:["needs ",s.required.toFixed(1)," : 1"]})]})}function Hs({text:t}){return t?e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-[11px] text-slate-500 cursor-pointer hover:text-slate-700",children:"Show failure detail"}),e.jsx("pre",{className:"text-[11px] text-slate-600 whitespace-pre-wrap mt-1 bg-slate-50 p-1.5 rounded",children:t})]}):null}function zs({violation:t}){const s=Ps(t);return s.length===0?null:e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:s.map(n=>e.jsx("span",{title:`${n.region} — ${n.blurb}`,className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 border border-slate-200",children:n.name},n.id))})}function qs({violation:t}){const s=Rt(t),[n,a]=x.useState({kind:"idle"});if(!s)return null;async function r(){a({kind:"loading"});try{const i=t.ruleId==="color-contrast-enhanced"?"AAA":"AA",o=await M({type:"AI_COLOR_SUGGEST_REQUEST",inputs:[{matchKey:t.matchKey,foreground:s.fg,background:s.bg,fontSize:16,fontWeight:400,targetLevel:i}]}),l=o.results.find(d=>d.matchKey===t.matchKey);a(l?{kind:"ready",suggestion:l}:{kind:"empty",reason:o.unavailableReason??"AI returned no suggestions for this contrast pair."})}catch(i){a({kind:"empty",reason:i instanceof Error?i.message:String(i)})}}return e.jsxs("div",{className:"mt-2",children:[n.kind==="idle"&&e.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),r()},className:"text-[11px] px-2 py-1 rounded border border-brand-300 bg-brand-50 text-brand-700 hover:bg-brand-100 font-medium",title:"Ask the configured AI for in-palette color replacements that pass WCAG contrast.",children:"✨ AI fix suggestions"}),n.kind==="loading"&&e.jsx("span",{className:"text-[11px] text-slate-500",children:"Asking AI for color suggestions…"}),n.kind==="empty"&&e.jsx("p",{className:"text-[11px] text-slate-500 bg-slate-50 border border-slate-200 rounded p-2",children:n.reason}),n.kind==="ready"&&e.jsxs("div",{className:"border border-brand-200 rounded bg-brand-50 p-2 space-y-2",children:[e.jsxs("p",{className:"text-[11px] text-brand-900 font-medium",children:["AI suggestions (",n.suggestion.suggestions.length,")"]}),e.jsx("ul",{className:"space-y-1.5",children:n.suggestion.suggestions.map((i,o)=>e.jsxs("li",{className:"flex items-start gap-2 text-[11px]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-6 rounded border border-slate-300 shrink-0",style:{background:i.background,color:i.foreground},title:`fg ${i.foreground} on bg ${i.background}`,children:"Aa"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-1.5",children:[e.jsx("code",{className:"font-mono",children:i.foreground}),e.jsx("span",{className:"text-slate-500",children:"on"}),e.jsx("code",{className:"font-mono",children:i.background}),e.jsxs("span",{className:"text-emerald-700 font-medium",children:[i.contrast.toFixed(2)," : 1"]})]}),i.rationale&&e.jsx("p",{className:"text-slate-600 mt-0.5",children:i.rationale})]})]},o))}),n.suggestion.reasoning&&e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:n.suggestion.reasoning})]})]})}function Ks({ruleId:t}){const s=Jt(t);return s?e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-[11px] text-emerald-700 cursor-pointer hover:text-emerald-900 font-medium",children:"How to fix"}),e.jsxs("div",{className:"mt-1 bg-emerald-50 border border-emerald-200 rounded p-2 space-y-2",children:[e.jsx("p",{className:"text-[11px] text-slate-700 leading-relaxed",children:s.summary}),s.snippet&&e.jsx("pre",{className:"text-[11px] text-slate-700 bg-white p-1.5 rounded border border-emerald-100 overflow-x-auto",children:e.jsx("code",{children:s.snippet})})]})]}):null}const Qs=[{id:"contrast",label:"Color & contrast",axeRules:["color-contrast","color-contrast-enhanced","link-in-text-block"],igtWorkflowIds:["visual-indicators"]},{id:"alt-text",label:"Alt text",axeRules:["image-alt","input-image-alt","object-alt","svg-img-alt","area-alt","role-img-alt"],igtWorkflowIds:[]},{id:"forms",label:"Forms",axeRules:["label","select-name","aria-input-field-name","aria-toggle-field-name","form-field-multiple-labels","label-content-name-mismatch","autocomplete-valid","label-title-only"],igtWorkflowIds:["forms"]},{id:"keyboard",label:"Keyboard",axeRules:["nested-interactive","tabindex","frame-focusable-content","no-focusable-content","focus-order-semantics"],igtWorkflowIds:["keyboard","focus-management"]},{id:"tab-order",label:"Tab order",axeRules:[],igtWorkflowIds:[],verifiedByWorkflowIds:["keyboard"],heuristic:"tab-order"},{id:"screen-reader",label:"Screen reader / ARIA",axeRules:["aria-allowed-attr","aria-required-attr","aria-required-children","aria-required-parent","aria-roles","aria-valid-attr-value","aria-valid-attr","aria-hidden-body","aria-hidden-focus","button-name","input-button-name","link-name","frame-title","presentation-role-conflict","aria-allowed-role","aria-prohibited-attr","aria-text","aria-deprecated-role","aria-conditional-attr","aria-braille-equivalent","empty-button","empty-heading","empty-link"],igtWorkflowIds:["screen-reader"]},{id:"reading-order",label:"Reading order",axeRules:[],igtWorkflowIds:[],verifiedByWorkflowIds:["page-structure"],heuristic:"reading-order"},{id:"page-structure",label:"Page structure",axeRules:["heading-order","page-has-heading-one","landmark-one-main","landmark-no-duplicate-banner","landmark-no-duplicate-contentinfo","landmark-no-duplicate-main","region","bypass","empty-table-header","landmark-banner-is-top-level","landmark-complementary-is-top-level","landmark-contentinfo-is-top-level","landmark-main-is-top-level","landmark-unique"],igtWorkflowIds:["page-structure"]},{id:"other-manual",label:"Other manual checks",axeRules:[],igtWorkflowIds:["reflow","hover-focus-content","pointer","time-based","error-prevention","consistency"]}];function Js(t){const s=Qs.map(i=>Ys(i,t)),n=s.reduce((i,o)=>i+Xs(o.letter),0)/Math.max(1,s.length),a=Zs(Math.round(n)),r=s.filter(i=>i.letter==="D"||i.letter==="F");return{overallLetter:a,subGrades:s,warningAreas:r,isLawsuitRisk:r.length>0}}function Ys(t,s){const n=new Set(t.axeRules),a=s.violations.filter(S=>n.has(S.ruleId)),r=s.manualRuns.filter(S=>t.igtWorkflowIds.includes(S.workflowId)),i=t.igtWorkflowIds.map(S=>s.workflows.find(R=>R.id===S)).filter(S=>S!=null);let o=i.length>0;for(const S of i){const R=r.find(T=>T.workflowId===S.id);if((R?Object.keys(R.steps).length:0)!==S.steps.length){o=!1;break}}const l=r.some(S=>Object.keys(S.steps).length>0),d=t.verifiedByWorkflowIds??[],p=s.manualRuns.filter(S=>d.includes(S.workflowId)),c=d.map(S=>s.workflows.find(R=>R.id===S)).filter(S=>S!=null);let u=d.length>0&&c.length===d.length;for(const S of c){const R=p.find(T=>T.workflowId===S.id);if((R?Object.keys(R.steps).length:0)!==S.steps.length){u=!1;break}}let h=null;if(u)for(const S of p)S.completedAt&&(h===null||S.completedAt>h)&&(h=S.completedAt);const m=t.heuristic==="tab-order"?s.heuristicCounts.tabOrder??0:t.heuristic==="reading-order"?s.heuristicCounts.readingOrder??0:0,b=d[0]??t.igtWorkflowIds[0]??null;if(u&&d.length>0)return{id:t.id,label:t.label,letter:"A",untested:!1,needsIgt:!1,igtCompleted:!0,verifiedByIgt:!0,verifiedAt:h,suppressedHeuristicCount:m,primaryVerifierWorkflowId:b,counts:{critical:0,serious:0,moderate:0,minor:0},caps:{cappedAtC:!1,cappedAtB:!1}};const j=t.axeRules.length>0||t.heuristic!=null,E=t.igtWorkflowIds.length>0;let k=!1;if(j&&E?k=!s.auditRan&&!l:j?k=!s.auditRan:E?k=!l:k=!0,k)return{id:t.id,label:t.label,letter:"F",untested:!0,needsIgt:E||d.length>0,igtCompleted:!1,verifiedByIgt:!1,verifiedAt:null,suppressedHeuristicCount:0,primaryVerifierWorkflowId:b,counts:{critical:0,serious:0,moderate:0,minor:0},caps:{cappedAtC:!1,cappedAtB:!1}};const f={critical:0,serious:0,moderate:0,minor:0};for(const S of Yt(a))f[S.impact]++;f.serious+=m;for(const S of r){const R=i.find(w=>w.id===S.workflowId);if(R)for(const w of R.steps){const T=S.steps[w.id];(T==null?void 0:T.status)==="fail"&&(w.severity==="required"?f.serious++:f.moderate++)}}const v=f.critical>0,y=f.serious>0;let I;f.critical>=5?I="F":f.critical>=1?I="D":f.serious>=1?I="C":f.moderate>=1?I="B":I="A";const _=E&&!o||d.length>0&&!u;return{id:t.id,label:t.label,letter:I,untested:!1,needsIgt:_,igtCompleted:o,verifiedByIgt:!1,verifiedAt:null,suppressedHeuristicCount:0,primaryVerifierWorkflowId:b,counts:f,caps:{cappedAtC:v,cappedAtB:y}}}function Xs(t){return t==="A"?4:t==="B"?3:t==="C"?2:t==="D"?1:0}function Zs(t){return t>=4?"A":t>=3?"B":t>=2?"C":t>=1?"D":"F"}const en={A:"bg-emerald-500",B:"bg-lime-500",C:"bg-yellow-500",D:"bg-orange-500",F:"bg-rose-600"},tn={A:"bg-emerald-500 text-white",B:"bg-lime-500 text-white",C:"bg-yellow-500 text-slate-900",D:"bg-orange-500 text-white",F:"bg-rose-600 text-white"};function sn({violations:t,componentId:s}){var h,m,b,j,E;const[n,a]=x.useState([]),r=g(k=>k.status),i=g(k=>k.progress),o=g(k=>k.freshThisSession),l=g(k=>k.results),d=(h=l[0])==null?void 0:h.startedAt;if(x.useEffect(()=>{if(!s){a([]);return}let k=!1;return chrome.storage.local.get("igtRuns").then(f=>{if(k)return;const y=((f==null?void 0:f.igtRuns)??{})[s]??{};a(Object.values(y))}),()=>{k=!0}},[s]),r==="running")return e.jsx(ln,{current:i==null?void 0:i.current,total:i==null?void 0:i.total});const p=Js({violations:t,auditRan:l.length>0,manualRuns:n,workflows:Q,heuristicCounts:{tabOrder:((b=(m=l[0])==null?void 0:m.tabOrderIssues)==null?void 0:b.length)??0,readingOrder:((E=(j=l[0])==null?void 0:j.readingOrderIssues)==null?void 0:E.length)??0}});let c=0;for(const k of Q){const f=n.find(v=>v.workflowId===k.id);f&&Object.keys(f.steps).length===k.steps.length&&c++}const u=t.length;return e.jsxs("div",{className:"border border-slate-200 rounded-lg bg-white overflow-hidden",children:[!o&&d&&e.jsx(cn,{scannedAt:d}),e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:`flex items-center justify-center w-24 ${en[p.overallLetter]} text-white shrink-0`,children:e.jsx("span",{className:"text-5xl font-bold leading-none",children:p.overallLetter})}),e.jsxs("div",{className:"flex-1 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-900",children:"Overall grade"}),e.jsxs("p",{className:"text-[11px] text-slate-600 leading-snug",children:["Mean of ",p.subGrades.length," verification areas below. Untested areas count as F until verified."]})]})]}),p.isLawsuitRisk&&e.jsx(nn,{areas:p.warningAreas}),e.jsx(an,{grades:p.subGrades}),e.jsx(on,{violationsRemaining:u,manualCompleted:c,manualTotal:Q.length}),c>0||l.length>0?e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2 bg-slate-50",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Manual coverage (Guided Tests)"}),e.jsxs("div",{className:"text-[11px] text-slate-700 mb-1.5",children:[e.jsx("strong",{children:c})," of ",e.jsx("strong",{children:Q.length})," workflows complete"]}),e.jsx("div",{className:"flex h-1 bg-slate-200 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-emerald-500",style:{width:`${c/Q.length*100}%`}})})]}):null]})}function nn({areas:t}){const s=t.map(n=>n.label);return e.jsxs("div",{className:"border-t border-rose-200 bg-rose-50 px-3 py-2 text-[11px] text-rose-900 leading-snug",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:"⚠ Not lawsuit-safe"}),e.jsx("p",{children:s.length===1?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:s[0]})," scored ",t[0].letter,". Even a high overall grade doesn't help if one area is failing — demand-letter mills target the weakest link."]}):e.jsxs(e.Fragment,{children:[s.length," areas are at lawsuit-risk:"," ",s.map((n,a)=>e.jsxs("span",{children:[e.jsx("strong",{children:n}),a<s.length-1?", ":""]},n)),". Fix these before relying on the overall grade."]})})]})}function an({grades:t}){const s=g(n=>n.setView);return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-2",children:"Verification areas"}),e.jsx("ul",{className:"grid grid-cols-1 gap-1.5",children:t.map(n=>e.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`w-6 h-6 inline-flex items-center justify-center rounded text-xs font-bold ${tn[n.letter]}`,"aria-label":`Grade ${n.letter}`,children:n.letter}),e.jsx("span",{className:"font-medium text-slate-800 flex-1 min-w-0",children:n.label}),e.jsx(rn,{grade:n,onOpenGuided:()=>s("guided")})]},n.id))})]})}function rn({grade:t,onOpenGuided:s}){const n=a=>{if(!a)return"";const r=Q.find(i=>i.id===a);return(r==null?void 0:r.name)??a};if(t.untested)return e.jsxs("span",{className:"text-slate-500 text-[10px] italic",children:["not graded —"," ",t.primaryVerifierWorkflowId?e.jsxs("button",{type:"button",onClick:s,className:"text-brand-600 hover:underline not-italic",children:["run ",n(t.primaryVerifierWorkflowId)," →"]}):"no data yet"]});if(t.verifiedByIgt){const a=t.verifiedAt?Tt(Date.now()-new Date(t.verifiedAt).getTime()):null;return e.jsxs("span",{className:"text-emerald-700 text-[10px]",title:t.suppressedHeuristicCount>0?`Heuristic flagged ${t.suppressedHeuristicCount} issue${t.suppressedHeuristicCount===1?"":"s"}, but you verified this area in Guided Tests — those are treated as noise unless you re-verify.`:"Verified via Guided Tests",children:["✓ verified",a?` ${a} ago`:""]})}return t.needsIgt?e.jsxs("button",{type:"button",onClick:s,className:"text-amber-700 hover:underline text-[10px]",title:"Verify this area by running the relevant Guided Tests workflow",children:["verify with ",n(t.primaryVerifierWorkflowId)," →"]}):t.counts.critical>0||t.counts.serious>0?e.jsxs("span",{className:"text-slate-500 text-[10px]",children:[t.counts.critical>0&&e.jsxs("span",{className:"text-rose-700",children:[t.counts.critical," critical"]}),t.counts.critical>0&&t.counts.serious>0&&" · ",t.counts.serious>0&&e.jsxs("span",{className:"text-orange-700",children:[t.counts.serious," serious"]})]}):e.jsx("span",{className:"text-emerald-700 text-[10px]",children:"clean"})}function on({violationsRemaining:t,manualCompleted:s,manualTotal:n}){const a=g(o=>o.setView),r=[{done:t===0,label:t===0?"Automated checks pass":`Fix ${t} automated violation${t===1?"":"s"}`,action:void 0,tooltip:void 0},{done:s===n,label:`Run Guided Tests (${s}/${n} workflows complete)`,action:()=>a("guided"),tooltip:'12 separate workflows total. Click → pick a workflow → mark each step pass/fail/skip → "Back to workflows" → click again for the next. Repeat until 12/12.'},{done:!1,label:"Export AI fix prompt + complete manual checklist",action:()=>a("delta"),tooltip:`Switches to the Delta tab. Click the Export menu and pick "AI fix prompt" — markdown for ChatGPT/Claude/Copilot, with manual checklist for the WCAG criteria automation can't detect.`}],i=r.findIndex(o=>!o.done);return e.jsxs("div",{className:"border-t border-slate-200 px-3 py-2 bg-slate-50",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-slate-500 mb-1.5",children:"Path to full WCAG compliance"}),e.jsx("ol",{className:"space-y-1 text-[11px]",children:r.map((o,l)=>{const d=l===i,p=o.done;return e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:p?"font-mono text-emerald-700 shrink-0":d?"font-mono text-brand-600 font-semibold shrink-0":"font-mono text-slate-400 shrink-0","aria-hidden":"true",children:p?"✓":`${l+1}.`}),o.action?e.jsxs("button",{type:"button",onClick:o.action,title:o.tooltip,className:d?"text-brand-700 font-semibold underline-offset-2 hover:underline text-left leading-snug":"text-slate-600 underline-offset-2 hover:underline hover:text-slate-900 text-left leading-snug",children:[o.label," →"]}):e.jsx("span",{className:p?"text-slate-500 line-through leading-snug":d?"text-slate-900 font-medium leading-snug":"text-slate-500 leading-snug",children:o.label})]},l)})})]})}function ln({current:t,total:s}){return e.jsxs("div",{role:"status","aria-live":"polite",className:"border border-slate-200 rounded-lg bg-white p-4 flex items-center gap-3",children:[e.jsx("span",{className:"inline-block w-5 h-5 border-2 border-brand-500 border-t-transparent rounded-full animate-spin motion-reduce:animate-none","aria-hidden":"true"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:"Scanning…"}),e.jsx("p",{className:"text-[11px] text-slate-500",children:typeof t=="number"&&typeof s=="number"?`State ${t} of ${s}. Grade will appear when the scan completes.`:"Grade will appear when the scan completes."})]})]})}function cn({scannedAt:t}){const s=Date.now()-new Date(t).getTime();return e.jsxs("div",{className:"bg-amber-50 border-b border-amber-200 px-3 py-1.5 text-[11px] text-amber-900 flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",children:"↻"}),e.jsxs("span",{children:["Showing a previous scan (",Tt(s)," old). Re-scan to grade the current page state."]})]})}function Tt(t){const s=Math.floor(t/1e3);if(s<60)return"less than a minute";if(s<120)return"1 minute";if(s<3600)return`${Math.floor(s/60)} minutes`;if(s<7200)return"1 hour";if(s<86400)return`${Math.floor(s/3600)} hours`;const n=Math.floor(s/86400);return n===1?"1 day":`${n} days`}const $e="dismissedFindings";function Oe(t){try{const s=new URL(t);return`${s.origin}${s.pathname.replace(/\/+$/,"")}`}catch{return t}}function ve(t){return`reading-order::${t}`}function ye(t){return`tab-order::${t}`}async function Pe(){try{const t=await chrome.storage.local.get($e),s=t==null?void 0:t[$e];if(s&&typeof s=="object")return s}catch{}return{}}async function $t(t){await chrome.storage.local.set({[$e]:t})}async function je(t){return(await Pe())[Oe(t)]??{}}async function Dt(t,s,n,a){const r=await Pe(),i=Oe(t),o=r[i]??{};o[s]={reason:n,dismissedAt:new Date().toISOString(),snippet:a},r[i]=o,await $t(r)}async function _t(t,s){const n=await Pe(),a=Oe(t),r=n[a];!r||!(s in r)||(delete r[s],Object.keys(r).length===0?delete n[a]:n[a]=r,await $t(n))}const dn=Object.freeze(Object.defineProperty({__proto__:null,addDismissal:Dt,dismissalKeyForReadingOrder:ve,dismissalKeyForTabOrder:ye,getDismissalsForUrl:je,removeDismissal:_t},Symbol.toStringTag,{value:"Module"}));function Lt(t){return[t.pseudoState,t.theme,t.direction,t.breakpoint.id].join(" · ")}function Ut(t){return`${Fe(t.ruleId,t.target.selector)}::${t.target.outerHTML.slice(0,64)}`}function un(t){const s=new Map;for(const n of t)for(const a of n.violations){const r=Ut(a),i=s.get(r);i?i.states.push(a.currentState):s.set(r,{representative:a,states:[a.currentState]})}return Array.from(s.values())}const Ye={critical:0,serious:1,moderate:2,minor:3};function pn(){var b,j,E,k;const t=g(f=>f.results),s=g(f=>f.componentId),n=g(f=>f.setView),a=((b=t[0])==null?void 0:b.pageUrl)??((j=t[0])==null?void 0:j.scope)??"",[r,i]=x.useState({}),[o,l]=x.useState(new Set);if(x.useEffect(()=>{if(!a)return;je(a).then(i);const f=()=>{document.visibilityState==="visible"&&a&&je(a).then(i)};return document.addEventListener("visibilitychange",f),()=>document.removeEventListener("visibilitychange",f)},[a]),x.useEffect(()=>{if(!s){l(new Set);return}let f=!1;const v=async()=>{const I=await chrome.storage.local.get("igtRuns");if(f)return;const S=((I==null?void 0:I.igtRuns)??{})[s]??{},R=new Set;for(const w of Q){const T=S[w.id];T&&Object.keys(T.steps).length===w.steps.length&&R.add(w.id)}l(R)};v();const y=()=>{document.visibilityState==="visible"&&v()};return document.addEventListener("visibilitychange",y),()=>{f=!0,document.removeEventListener("visibilitychange",y)}},[s]),t.length===0)return e.jsx("div",{className:"p-4 text-center text-slate-500 text-sm",children:"No audit results yet. Pick an element to start."});const d=t.reduce((f,v)=>f+v.durationMs,0),p=t.reduce((f,v)=>f+v.violations.length,0),c=un(t);c.sort((f,v)=>{const y=Ye[f.representative.impact]??99,I=Ye[v.representative.impact]??99;return y!==I?y-I:v.states.length-f.states.length});const u=t.map(f=>Lt(f.state)).join(`
|
|
4
4
|
`),h=o.has("keyboard")?0:(((E=t[0])==null?void 0:E.tabOrderIssues)??[]).filter(f=>!(ye(f.selector)in r)).length,m=o.has("page-structure")?0:(((k=t[0])==null?void 0:k.readingOrderIssues)??[]).filter(f=>!(ve(f.selector)in r)).length;return e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsx(sn,{violations:t.flatMap(f=>f.violations),componentId:s}),(h>0||m>0)&&e.jsxs("button",{type:"button",onClick:()=>n("activity"),className:"w-full text-left border border-rose-200 rounded bg-rose-50 px-3 py-2 hover:bg-rose-100 transition-colors",children:[e.jsx("p",{className:"text-xs font-semibold text-rose-900",children:"⚠ Keyboard / screen-reader concerns axe-core can't see"}),e.jsxs("p",{className:"text-[11px] text-rose-800 leading-snug mt-0.5",children:[h>0&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:h})," tab-order issue",h===1?"":"s"," (WCAG 2.4.3)"]}),h>0&&m>0&&" · ",m>0&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:m})," reading-order issue",m===1?"":"s"," (WCAG 1.3.2)"]})," ","— click to view in ",e.jsx("span",{className:"underline",children:"Activity"})," tab."]})]}),e.jsxs("div",{className:"text-xs text-slate-500 border-b border-slate-200 pb-2",children:[e.jsxs("span",{title:u,"aria-label":`${t.length} states tested: ${u.replace(/\n/g,", ")}`,className:"underline decoration-dotted decoration-slate-400 cursor-help",children:[t.length," ",t.length===1?"state":"states"]})," · ",c.length," unique ",c.length===1?"violation":"violations"," ",e.jsxs("span",{className:"text-slate-500",children:["(",p," across all states)"]})," · ",(d/1e3).toFixed(1),"s"]}),c.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic px-1",children:"No violations found."}):e.jsx("div",{className:"space-y-1.5",children:c.map(f=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(Et,{violation:f.representative}),e.jsx(hn,{states:f.states,totalStates:t.length})]},Ut(f.representative)))})]})}function hn({states:t,totalStates:s}){if(t.length===s)return e.jsxs("p",{className:"text-[11px] text-slate-500 px-1",children:["Found in ",e.jsxs("span",{className:"font-medium",children:["all ",s," states"]}),"."]});const n=Array.from(new Set(t.map(Lt))),a=n.slice(0,3).join(", "),r=n.length>3?`, +${n.length-3} more`:"",i=n.join(`
|
|
5
5
|
`);return e.jsxs("p",{className:"text-[11px] text-slate-500 px-1",title:i,children:["Found in ",n.length," of ",s," states:"," ",e.jsxs("span",{className:"text-slate-600",children:[a,r]})]})}const mn={"defense-bundle":"Defense report ready","evidence-bundle":"Evidence bundle ready"};function Ft({open:t,onClose:s,format:n,content:a,filename:r}){const i=Kt(new Blob([a]).size);function o(){Le(a,r),s()}function l(){_e(a),s()}return e.jsxs(ae,{open:t,onClose:s,title:mn[n],description:`Generated bundle — ${i}. Save to your Downloads folder, or open in a new tab to preview.`,children:[e.jsxs("div",{className:"space-y-3 text-xs text-slate-700",children:[e.jsxs("p",{children:["File: ",e.jsx("code",{className:"bg-slate-100 px-1 py-0.5 rounded text-[11px]",children:r})]}),e.jsxs("p",{className:"text-slate-500",children:["Tip: open the report and press Ctrl+P (Cmd+P on Mac) → ",e.jsx("em",{children:"Save as PDF"})," if you want a sealed-format version for legal use."]}),e.jsxs("p",{className:"text-[10px] text-slate-400",children:["To skip this prompt and download immediately on future exports, enable",e.jsx("em",{children:' "Skip the download confirmation"'})," in Settings → Advanced."]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Cancel"}),e.jsx("button",{onClick:l,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Open preview"}),e.jsx("button",{onClick:o,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Download HTML"})]})]})}const Xe=7800;function xn(t,s,n){const a=t.replace(/\/$/,""),r=[];for(const c of n){const u=`${c.ruleId}::${c.target.selector}`,h=`:${c.currentState.pseudoState} · ${c.currentState.theme} · ${c.currentState.direction}`,m=r.find(b=>`${b.ruleId}::${b.target.selector}`===u);if(m){m._states.includes(h)||m._states.push(h);continue}r.push({...c,_states:[h]})}const i=`a11y: ${r.length} new violation${r.length===1?"":"s"} in ${s??"audited component"}`,o=[];o.push(`**Component:** \`${s??"unknown"}\``),o.push(""),o.push("Detected by WCAG Component Auditor as **new** vs the saved baseline — these are violations introduced since the last accepted baseline."),o.push(""),o.push("---"),o.push("");for(const c of r)o.push(`### \`${c.ruleId}\` — ${c.impact}`),o.push(""),o.push(c.description),o.push(""),o.push(`- **WCAG:** ${c.wcagCriterion} (${c.wcagLevel})`),o.push(`- **Selector:** \`${c.target.selector}\``),o.push(`- **Found in state(s):** ${c._states.join(", ")}`),c.helpUrl&&o.push(`- **More info:** ${c.helpUrl}`),o.push(""),o.push("```html"),o.push(c.target.outerHTML),o.push("```"),o.push("");o.push("---"),o.push(""),o.push("_Filed via WCAG Component Auditor (delta-only — inherited debt not included)._");const l=o.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as o,R as e}from"./styles-C4Kq0zOO.js";import{E as s,A as i}from"./ErrorBoundary-
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as o,R as e}from"./styles-C4Kq0zOO.js";import{E as s,A as i}from"./ErrorBoundary-BWJWAUYU.js";import{i as m}from"./crash-reporter-Dc5lvxvY.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./state-PELIq3oj.js";import"./preload-helper-D7HrI6pR.js";import"./forensic-log-B1UCXZ23.js";m("devtools-panel");const r=document.getElementById("root");if(!r)throw new Error("devtools panel: #root not found");t(r).render(o.jsx(e.StrictMode,{children:o.jsx(s,{children:o.jsx(i,{})})}));
|