@wcag-checkr/ci 1.0.24 → 1.0.25
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-Br_Uo0Yj.js → ErrorBoundary-Dz8MotbH.js} +42 -42
- package/dist/assets/{copy-ai-fixer-prompt-BsuQPjnV.js → copy-ai-fixer-prompt-zCj1CiZK.js} +2 -2
- package/dist/assets/{devtools-panel-C0Ox9lL4.js → devtools-panel-DZkip4u6.js} +1 -1
- package/dist/assets/{options-C7TJwA_a.js → options-DjXDOL93.js} +1 -1
- package/dist/assets/side-panel-BcBA4SnN.js +4 -0
- package/dist/assets/{styles-Dg6rHpW6.js → styles-BsDacBC8.js} +1 -1
- package/dist/devtools/panel.html +3 -3
- package/dist/manifest.json +1 -1
- package/dist/options/options.html +2 -2
- package/dist/side-panel/side-panel.html +4 -4
- package/package.json +1 -1
- package/dist/assets/side-panel-BYTBGY_c.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ErrorBoundary-
|
|
2
|
-
import{_ as l}from"./preload-helper-D7HrI6pR.js";import{r as v}from"./crash-reporter-DAZnNefT.js";async function C(e){var f,w,y,g;if(e.results.length===0)return;let d;if(e.componentId){const o=await chrome.storage.local.get("igtRuns"),a=((o==null?void 0:o.igtRuns)??{})[e.componentId]??{};d=Object.values(a)}let p,u;const i=((f=e.results[0])==null?void 0:f.pageUrl)??((w=e.results[0])==null?void 0:w.scope)??"";if(i){const{getDismissalsForUrl:o}=await l(async()=>{const{getDismissalsForUrl:t}=await import("./ErrorBoundary-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ErrorBoundary-Dz8MotbH.js","assets/styles-BsDacBC8.js","assets/_commonjsHelpers-Cpj98o6Y.js","assets/crash-reporter-DAZnNefT.js","assets/ai-usage-log-DVzy9AU1.js","assets/styles-BwnbwQRf.css","assets/scheduled-audit-runner-BJXKsQZK.js","assets/preload-helper-D7HrI6pR.js","assets/diff-CECbooHD.js","assets/design-system-audit-DpxJrxnb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as l}from"./preload-helper-D7HrI6pR.js";import{r as v}from"./crash-reporter-DAZnNefT.js";async function C(e){var f,w,y,g;if(e.results.length===0)return;let d;if(e.componentId){const o=await chrome.storage.local.get("igtRuns"),a=((o==null?void 0:o.igtRuns)??{})[e.componentId]??{};d=Object.values(a)}let p,u;const i=((f=e.results[0])==null?void 0:f.pageUrl)??((w=e.results[0])==null?void 0:w.scope)??"";if(i){const{getDismissalsForUrl:o}=await l(async()=>{const{getDismissalsForUrl:t}=await import("./ErrorBoundary-Dz8MotbH.js").then(n=>n.o);return{getDismissalsForUrl:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),r=await o(i);p=Object.keys(r);const{getResolutionsForPage:a}=await l(async()=>{const{getResolutionsForPage:t}=await import("./scheduled-audit-runner-BJXKsQZK.js").then(n=>n.b8);return{getResolutionsForPage:t}},__vite__mapDeps([6,7,3,8,4])),c=await a(i),x=new Set;for(const t of e.results)for(const n of((y=t.axeRulesEvaluated)==null?void 0:y.incomplete)??[])for(const _ of n.elements??[])x.add(`${n.ruleId}::${_.selector}`);u=c.filter(t=>x.has(`${t.ruleId}::${t.selector}`))}let m;if(e.componentId){const{loadAcknowledgedKeysForComponent:o}=await l(async()=>{const{loadAcknowledgedKeysForComponent:a}=await import("./scheduled-audit-runner-BJXKsQZK.js").then(c=>c.b7);return{loadAcknowledgedKeysForComponent:a}},__vite__mapDeps([6,7,3,8,4])),r=await o(e.componentId);m=r.size>0?Array.from(r):void 0}const b=await v({type:"EXPORT_REQUEST",format:"ai-prompt",results:e.results,delta:e.delta??void 0,manualRuns:d,siteCrawlReport:e.siteCrawlReport??void 0,dismissedKeys:p,incompleteResolutions:u,acknowledgedKeys:m});try{await navigator.clipboard.writeText(b.content)}catch{}const h=`<!doctype html><html><head><meta charset="utf-8"><title>AI fix prompt</title>
|
|
3
3
|
<style>body{font:14px/1.5 ui-monospace,Menlo,monospace;max-width:920px;margin:24px auto;padding:0 16px;color:#0f172a;}
|
|
4
4
|
.banner{background:#ecfdf5;border:1px solid #6ee7b7;padding:12px 14px;border-radius:6px;margin-bottom:16px;font-family:system-ui;}
|
|
5
5
|
pre{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid #e2e8f0;padding:14px;border-radius:6px;font-size:13px;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as s,j as e,R as n}from"./styles-
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as s,j as e,R as n}from"./styles-BsDacBC8.js";import{E as i,u as a,n as l}from"./ErrorBoundary-Dz8MotbH.js";import{i as p,e as m}from"./crash-reporter-DAZnNefT.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ai-usage-log-DVzy9AU1.js";import"./scheduled-audit-runner-BJXKsQZK.js";import"./preload-helper-D7HrI6pR.js";import"./diff-CECbooHD.js";import"./design-system-audit-DpxJrxnb.js";p("devtools-panel");function c(){const t=a(r=>r.tier);return m(t,"devtoolsPanel")?e.jsx(l,{}):e.jsxs("div",{style:{padding:24,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif'},children:[e.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"#1f2923"},children:"DevTools panel isn’t available on your current plan"}),e.jsx("p",{style:{marginTop:8,fontSize:13,color:"#64748b"},children:"The wcagcheckr DevTools panel is part of a higher-tier plan. The extension’s side panel is still available — open it from the extensions menu."})]})}const o=document.getElementById("root");if(!o)throw new Error("devtools panel: #root not found");s(o).render(e.jsx(n.StrictMode,{children:e.jsx(i,{children:e.jsx(c,{})})}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{a as q,R as D,b as z,j as e,d as X,r as i,e as fe,P,f as L,g as be,h as $e,i as Ge,k as ge,l as _,y as Be,C as Ke,A as K,m as Ve,c as He}from"./styles-Dg6rHpW6.js";import{c as ye,r as T,o as Je,T as Ye,a as ze,s as C,O as Z,b as We,l as qe,g as Qe,d as Xe}from"./crash-reporter-DAZnNefT.js";import{w as Ze,r as et}from"./tier-config-client-CimEdyEg.js";import{D as tt,g as st,A as at,s as ee,c as nt,a as V,l as rt,b as ot,d as te}from"./ai-usage-log-DVzy9AU1.js";import{l as lt,s as se,v as it}from"./custom-rules-CAe0nbES.js";import"./_commonjsHelpers-Cpj98o6Y.js";function ct(t){const s=t+"CollectionProvider",[a,r]=q(s),[o,x]=a(s,{collectionRef:{current:null},itemMap:new Map}),c=N=>{const{scope:p,children:u}=N,f=D.useRef(null),y=D.useRef(new Map).current;return e.jsx(o,{scope:p,itemMap:y,collectionRef:f,children:u})};c.displayName=s;const n=t+"CollectionSlot",d=X(n),m=D.forwardRef((N,p)=>{const{scope:u,children:f}=N,y=x(n,u),k=z(p,y.collectionRef);return e.jsx(d,{ref:k,children:f})});m.displayName=n;const l=t+"CollectionItemSlot",h="data-radix-collection-item",b=X(l),g=D.forwardRef((N,p)=>{const{scope:u,children:f,...y}=N,k=D.useRef(null),F=z(p,k),R=x(l,u);return D.useEffect(()=>(R.itemMap.set(k,{ref:k,...y}),()=>void R.itemMap.delete(k))),e.jsx(b,{[h]:"",ref:F,children:f})});g.displayName=l;function j(N){const p=x(t+"CollectionConsumer",N);return D.useCallback(()=>{const f=p.collectionRef.current;if(!f)return[];const y=Array.from(f.querySelectorAll(`[${h}]`));return Array.from(p.itemMap.values()).sort((R,E)=>y.indexOf(R.ref.current)-y.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:c,Slot:m,ItemSlot:g},j,r]}var dt=i.createContext(void 0);function ve(t){const s=i.useContext(dt);return t||s||"ltr"}var H="rovingFocusGroup.onEntryFocus",ut={bubbles:!1,cancelable:!0},O="RovingFocusGroup",[W,je,xt]=ct(O),[mt,Ne]=q(O,[xt]),[ht,pt]=mt(O),ke=i.forwardRef((t,s)=>e.jsx(W.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(W.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ft,{...t,ref:s})})}));ke.displayName=O;var ft=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,orientation:r,loop:o=!1,dir:x,currentTabStopId:c,defaultCurrentTabStopId:n,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:l=!1,...h}=t,b=i.useRef(null),g=z(s,b),j=ve(x),[N,p]=be({prop:c,defaultProp:n??null,onChange:d,caller:O}),[u,f]=i.useState(!1),y=$e(m),k=je(a),F=i.useRef(!1),[R,E]=i.useState(0);return i.useEffect(()=>{const w=b.current;if(w)return w.addEventListener(H,y),()=>w.removeEventListener(H,y)},[y]),e.jsx(ht,{scope:a,orientation:r,dir:j,loop:o,currentTabStopId:N,onItemFocus:i.useCallback(w=>p(w),[p]),onItemShiftTab:i.useCallback(()=>f(!0),[]),onFocusableItemAdd:i.useCallback(()=>E(w=>w+1),[]),onFocusableItemRemove:i.useCallback(()=>E(w=>w-1),[]),children:e.jsx(P.div,{tabIndex:u||R===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:L(t.onMouseDown,()=>{F.current=!0}),onFocus:L(t.onFocus,w=>{const v=!F.current;if(w.target===w.currentTarget&&v&&!u){const S=new CustomEvent(H,ut);if(w.currentTarget.dispatchEvent(S),!S.defaultPrevented){const A=k().filter(U=>U.focusable),I=A.find(U=>U.active),Me=A.find(U=>U.id===N),Oe=[I,Me,...A].filter(Boolean).map(U=>U.ref.current);Te(Oe,l)}}F.current=!1}),onBlur:L(t.onBlur,()=>f(!1))})})}),Se="RovingFocusGroupItem",we=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,focusable:r=!0,active:o=!1,tabStopId:x,children:c,...n}=t,d=fe(),m=x||d,l=pt(Se,a),h=l.currentTabStopId===m,b=je(a),{onFocusableItemAdd:g,onFocusableItemRemove:j,currentTabStopId:N}=l;return i.useEffect(()=>{if(r)return g(),()=>j()},[r,g,j]),e.jsx(W.ItemSlot,{scope:a,id:m,focusable:r,active:o,children:e.jsx(P.span,{tabIndex:h?0:-1,"data-orientation":l.orientation,...n,ref:s,onMouseDown:L(t.onMouseDown,p=>{r?l.onItemFocus(m):p.preventDefault()}),onFocus:L(t.onFocus,()=>l.onItemFocus(m)),onKeyDown:L(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const u=yt(p,l.orientation,l.dir);if(u!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let y=b().filter(k=>k.focusable).map(k=>k.ref.current);if(u==="last")y.reverse();else if(u==="prev"||u==="next"){u==="prev"&&y.reverse();const k=y.indexOf(p.currentTarget);y=l.loop?vt(y,k+1):y.slice(k+1)}setTimeout(()=>Te(y))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:N!=null}):c})})});we.displayName=Se;var bt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gt(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function yt(t,s,a){const r=gt(t.key,a);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bt[r]}function Te(t,s=!1){const a=document.activeElement;for(const r of t)if(r===a||(r.focus({preventScroll:s}),document.activeElement!==a))return}function vt(t,s){return t.map((a,r)=>t[(s+r)%t.length])}var jt=ke,Nt=we,B="Tabs",[kt]=q(B,[Ne]),Ce=Ne(),[St,Q]=kt(B),Ee=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,onValueChange:o,defaultValue:x,orientation:c="horizontal",dir:n,activationMode:d="automatic",...m}=t,l=ve(n),[h,b]=be({prop:r,onChange:o,defaultProp:x??"",caller:B});return e.jsx(St,{scope:a,baseId:fe(),value:h,onValueChange:b,orientation:c,dir:l,activationMode:d,children:e.jsx(P.div,{dir:l,"data-orientation":c,...m,ref:s})})});Ee.displayName=B;var Ae="TabsList",Ie=i.forwardRef((t,s)=>{const{__scopeTabs:a,loop:r=!0,...o}=t,x=Q(Ae,a),c=Ce(a);return e.jsx(jt,{asChild:!0,...c,orientation:x.orientation,dir:x.dir,loop:r,children:e.jsx(P.div,{role:"tablist","aria-orientation":x.orientation,...o,ref:s})})});Ie.displayName=Ae;var Re="TabsTrigger",_e=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,disabled:o=!1,...x}=t,c=Q(Re,a),n=Ce(a),d=De(c.baseId,r),m=Ue(c.baseId,r),l=r===c.value;return e.jsx(Nt,{asChild:!0,...n,focusable:!o,active:l,children:e.jsx(P.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":m,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...x,ref:s,onMouseDown:L(t.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?c.onValueChange(r):h.preventDefault()}),onKeyDown:L(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&c.onValueChange(r)}),onFocus:L(t.onFocus,()=>{const h=c.activationMode!=="manual";!l&&!o&&h&&c.onValueChange(r)})})})});_e.displayName=Re;var Le="TabsContent",Fe=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,forceMount:o,children:x,...c}=t,n=Q(Le,a),d=De(n.baseId,r),m=Ue(n.baseId,r),l=r===n.value,h=i.useRef(l);return i.useEffect(()=>{const b=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(b)},[]),e.jsx(Ge,{present:o||l,children:({present:b})=>e.jsx(P.div,{"data-state":l?"active":"inactive","data-orientation":n.orientation,role:"tabpanel","aria-labelledby":d,hidden:!b,id:m,tabIndex:0,...c,ref:s,style:{...t.style,animationDuration:h.current?"0s":void 0},children:b&&x})})});Fe.displayName=Le;function De(t,s){return`${t}-trigger-${s}`}function Ue(t,s){return`${t}-content-${s}`}var wt=Ee,Tt=Ie,Ct=_e,$=Fe;const Et=["default","hover","focus","focus-visible","active","disabled"],At=["light","dark","forced-colors-active","forced-colors-none"],It=["ltr","rtl"];function Rt({value:t,onChange:s}){function a(o,x){return o.includes(x)?o.filter(c=>c!==x):[...o,x]}function r(){const o=t.ariaVariations.length===0?1:t.ariaVariations.length;return t.pseudoStates.length*o*t.themes.length*t.directions.length*t.breakpoints.length}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[e.jsx(G,{label:"Pseudo-states",all:Et,selected:t.pseudoStates,onToggle:o=>s({...t,pseudoStates:a(t.pseudoStates,o)})}),e.jsx(G,{label:"Themes",all:At,selected:t.themes,onToggle:o=>s({...t,themes:a(t.themes,o)})}),e.jsx(G,{label:"Directions",all:It,selected:t.directions,onToggle:o=>s({...t,directions:a(t.directions,o)})}),e.jsx(G,{label:"Breakpoints",all:t.breakpointPresets.map(o=>o.id),selected:t.breakpoints,onToggle:o=>s({...t,breakpoints:a(t.breakpoints,o)})}),e.jsxs("p",{className:"text-xs text-slate-500 pt-2 border-t border-slate-100",children:[e.jsx("strong",{children:r()})," audits per component"]})]})}function G({label:t,all:s,selected:a,onToggle:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium mb-1.5",children:t}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(o=>{const x=a.includes(o);return e.jsx("button",{type:"button",onClick:()=>r(o),className:x?"text-xs px-2 py-1 rounded bg-brand-500 text-white":"text-xs px-2 py-1 rounded bg-slate-100 text-slate-700 hover:bg-slate-200",children:o},o)})})]})}function _t({value:t,onChange:s}){const[a,r]=i.useState(""),[o,x]=i.useState("");function c(m){m.preventDefault();const l=a.trim(),h=o.trim();!l||!h||(s({...t,[l]:h}),r(""),x(""))}function n(m){const l={...t};delete l[m],s(l)}const d=Object.entries(t);return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[d.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no aliases"}):e.jsx("ul",{className:"space-y-1",children:d.map(([m,l])=>e.jsxs("li",{className:"text-xs flex items-center justify-between gap-2 border border-slate-100 rounded p-1.5",children:[e.jsxs("span",{className:"font-mono truncate",title:`${m} → ${l}`,children:[m," ",e.jsx("span",{className:"text-slate-500",children:"→"})," ",l]}),e.jsx("button",{onClick:()=>n(m),className:"text-slate-500 hover:text-red-600 shrink-0","aria-label":`Remove alias ${m}`,children:"×"})]},m))}),e.jsxs("form",{onSubmit:c,className:"grid grid-cols-[1fr_1fr_auto] gap-2 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"From"}),e.jsx("input",{type:"text",value:a,onChange:m=>r(m.target.value),placeholder:"https://example.com::testid:btn-a",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Treat as"}),e.jsx("input",{type:"text",value:o,onChange:m=>x(m.target.value),placeholder:"https://example.com::testid:btn-canonical",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsx("button",{type:"submit",className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",disabled:!a.trim()||!o.trim(),children:"Add"})]})]})}const ae=ye("billing-portal-client"),Lt="https://api.wcagcheckr.com",Ft="wcagcheckr",Dt=15e3;async function Ut(t){const s=`${Lt}/v1/products/${Ft}/billing-portal`;try{const a=await fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Dt)}),r=await a.json().catch(()=>null);return a.ok?r!=null&&r.url?{ok:!0,url:r.url}:{ok:!1,error:"malformed response — no url",status:a.status}:(ae.warn(`billing portal HTTP ${a.status}`,r),{ok:!1,status:a.status,error:(r==null?void 0:r.hint)??(r==null?void 0:r.error)??`HTTP ${a.status}`})}catch(a){return ae.warn("billing portal request failed",a),{ok:!1,error:a instanceof Error?a.message:String(a)}}}const ne=ye("subscription-resume-client"),Pt="https://api.wcagcheckr.com",Mt="wcagcheckr",Ot=1e4;async function $t(t){try{const s=await fetch(`${Pt}/v1/products/${Mt}/subscription/resume`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Ot)}),a=await s.json().catch(()=>null);return s.ok?{ok:!0,alreadyActive:(a==null?void 0:a.alreadyActive)===!0}:(ne.warn(`resume http ${s.status}`,a),{ok:!1,status:s.status,error:(a==null?void 0:a.hint)??(a==null?void 0:a.error)??`HTTP ${s.status}`})}catch(s){return ne.warn("resume request failed",s),{ok:!1,error:s instanceof Error?s.message:String(s)}}}const Gt={free:"Free",solo:"Solo",team:"Team"},Bt={free:"Free",solo:"Solo (monthly)","solo-yearly":"Solo (yearly)","solo-single-month":"Solo (single month — non-recurring)",team:"Team (5 seats, monthly)","team-yearly":"Team (5 seats, yearly)","team-15":"Team (15 seats, monthly)","team-15-yearly":"Team (15 seats, yearly)"},Kt=new Set(["solo-single-month"]);function Vt(t){if(!t)return null;const s=new Date(t).getTime()-Date.now();return Number.isFinite(s)?Math.ceil(s/(24*60*60*1e3)):null}function M(t){return t?Bt[t]??t:"—"}function re(t){if(!t)return"no expiry on file";try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return t}}function Ht({tier:t,onTierChange:s}){const[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(!1),[d,m]=i.useState(""),[l,h]=i.useState(!1),[b,g]=i.useState(null),[j,N]=i.useState(!1),[p,u]=i.useState(!1),f=ge(),y=i.useCallback(async v=>{const A=(await chrome.storage.local.get("licenseToken")).licenseToken??null;if(r(A),!A){x(null);return}try{const I=await T({type:"LICENSE_VALIDATE_REQUEST",token:A,forceRefresh:(v==null?void 0:v.forceRefresh)===!0});x(I)}catch{x(null)}},[]);i.useEffect(()=>(y({forceRefresh:!0}),Je("LICENSE_CHANGED_EVENT",()=>{y()})),[y]);async function k(){if(d.trim()){h(!0),g(null);try{const v=await T({type:"LICENSE_SET_REQUEST",token:d.trim()}),S=await T({type:"LICENSE_VALIDATE_REQUEST",token:d.trim()});if(S.valid&&S.plan){const A=zt(S.plan);s(A);let I=`Activated as ${M(S.plan)}.`;v.seatClaim.ok?v.seatClaim.overCapacity&&(I=`Activated as ${M(S.plan)}. Note: this license is currently OVER its seat cap (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats). Release one or upgrade.`):v.seatClaim.reason==="cap-reached"?I=`Activated as ${M(S.plan)}, BUT this license is at its seat capacity (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats used). Release a seat from another device, or upgrade to a higher-seat plan. This device's seat won't be active until you do.`:v.seatClaim.reason==="network"&&(I=`Activated as ${M(S.plan)}. (Seat-tracking ping failed — retrying in the background.)`),g(I),v.seatClaim.ok&&!v.seatClaim.overCapacity?_.polite(I):_.assertive(I),m(""),n(!1),await y()}else{const A="Token did not validate. Check the value and try again.";g(A),_.assertive(A)}}catch(v){const S=v instanceof Error?v.message:String(v);g(S),_.assertive(S)}finally{h(!1)}}}async function F(){if(a)try{await navigator.clipboard.writeText(a),N(!0),setTimeout(()=>N(!1),2e3)}catch{}}async function R(){if(window.confirm(`Remove the active license token from this extension?
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{a as q,R as D,b as z,j as e,d as X,r as i,e as fe,P,f as L,g as be,h as $e,i as Ge,k as ge,l as _,y as Be,C as Ke,A as K,m as Ve,c as He}from"./styles-BsDacBC8.js";import{c as ye,r as T,o as Je,T as Ye,a as ze,s as C,O as Z,b as We,l as qe,g as Qe,d as Xe}from"./crash-reporter-DAZnNefT.js";import{w as Ze,r as et}from"./tier-config-client-CimEdyEg.js";import{D as tt,g as st,A as at,s as ee,c as nt,a as V,l as rt,b as ot,d as te}from"./ai-usage-log-DVzy9AU1.js";import{l as lt,s as se,v as it}from"./custom-rules-CAe0nbES.js";import"./_commonjsHelpers-Cpj98o6Y.js";function ct(t){const s=t+"CollectionProvider",[a,r]=q(s),[o,x]=a(s,{collectionRef:{current:null},itemMap:new Map}),c=N=>{const{scope:p,children:u}=N,f=D.useRef(null),y=D.useRef(new Map).current;return e.jsx(o,{scope:p,itemMap:y,collectionRef:f,children:u})};c.displayName=s;const n=t+"CollectionSlot",d=X(n),m=D.forwardRef((N,p)=>{const{scope:u,children:f}=N,y=x(n,u),k=z(p,y.collectionRef);return e.jsx(d,{ref:k,children:f})});m.displayName=n;const l=t+"CollectionItemSlot",h="data-radix-collection-item",b=X(l),g=D.forwardRef((N,p)=>{const{scope:u,children:f,...y}=N,k=D.useRef(null),F=z(p,k),R=x(l,u);return D.useEffect(()=>(R.itemMap.set(k,{ref:k,...y}),()=>void R.itemMap.delete(k))),e.jsx(b,{[h]:"",ref:F,children:f})});g.displayName=l;function j(N){const p=x(t+"CollectionConsumer",N);return D.useCallback(()=>{const f=p.collectionRef.current;if(!f)return[];const y=Array.from(f.querySelectorAll(`[${h}]`));return Array.from(p.itemMap.values()).sort((R,E)=>y.indexOf(R.ref.current)-y.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:c,Slot:m,ItemSlot:g},j,r]}var dt=i.createContext(void 0);function ve(t){const s=i.useContext(dt);return t||s||"ltr"}var H="rovingFocusGroup.onEntryFocus",ut={bubbles:!1,cancelable:!0},O="RovingFocusGroup",[W,je,xt]=ct(O),[mt,Ne]=q(O,[xt]),[ht,pt]=mt(O),ke=i.forwardRef((t,s)=>e.jsx(W.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(W.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ft,{...t,ref:s})})}));ke.displayName=O;var ft=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,orientation:r,loop:o=!1,dir:x,currentTabStopId:c,defaultCurrentTabStopId:n,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:l=!1,...h}=t,b=i.useRef(null),g=z(s,b),j=ve(x),[N,p]=be({prop:c,defaultProp:n??null,onChange:d,caller:O}),[u,f]=i.useState(!1),y=$e(m),k=je(a),F=i.useRef(!1),[R,E]=i.useState(0);return i.useEffect(()=>{const w=b.current;if(w)return w.addEventListener(H,y),()=>w.removeEventListener(H,y)},[y]),e.jsx(ht,{scope:a,orientation:r,dir:j,loop:o,currentTabStopId:N,onItemFocus:i.useCallback(w=>p(w),[p]),onItemShiftTab:i.useCallback(()=>f(!0),[]),onFocusableItemAdd:i.useCallback(()=>E(w=>w+1),[]),onFocusableItemRemove:i.useCallback(()=>E(w=>w-1),[]),children:e.jsx(P.div,{tabIndex:u||R===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:L(t.onMouseDown,()=>{F.current=!0}),onFocus:L(t.onFocus,w=>{const v=!F.current;if(w.target===w.currentTarget&&v&&!u){const S=new CustomEvent(H,ut);if(w.currentTarget.dispatchEvent(S),!S.defaultPrevented){const A=k().filter(U=>U.focusable),I=A.find(U=>U.active),Me=A.find(U=>U.id===N),Oe=[I,Me,...A].filter(Boolean).map(U=>U.ref.current);Te(Oe,l)}}F.current=!1}),onBlur:L(t.onBlur,()=>f(!1))})})}),Se="RovingFocusGroupItem",we=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,focusable:r=!0,active:o=!1,tabStopId:x,children:c,...n}=t,d=fe(),m=x||d,l=pt(Se,a),h=l.currentTabStopId===m,b=je(a),{onFocusableItemAdd:g,onFocusableItemRemove:j,currentTabStopId:N}=l;return i.useEffect(()=>{if(r)return g(),()=>j()},[r,g,j]),e.jsx(W.ItemSlot,{scope:a,id:m,focusable:r,active:o,children:e.jsx(P.span,{tabIndex:h?0:-1,"data-orientation":l.orientation,...n,ref:s,onMouseDown:L(t.onMouseDown,p=>{r?l.onItemFocus(m):p.preventDefault()}),onFocus:L(t.onFocus,()=>l.onItemFocus(m)),onKeyDown:L(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const u=yt(p,l.orientation,l.dir);if(u!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let y=b().filter(k=>k.focusable).map(k=>k.ref.current);if(u==="last")y.reverse();else if(u==="prev"||u==="next"){u==="prev"&&y.reverse();const k=y.indexOf(p.currentTarget);y=l.loop?vt(y,k+1):y.slice(k+1)}setTimeout(()=>Te(y))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:N!=null}):c})})});we.displayName=Se;var bt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gt(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function yt(t,s,a){const r=gt(t.key,a);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bt[r]}function Te(t,s=!1){const a=document.activeElement;for(const r of t)if(r===a||(r.focus({preventScroll:s}),document.activeElement!==a))return}function vt(t,s){return t.map((a,r)=>t[(s+r)%t.length])}var jt=ke,Nt=we,B="Tabs",[kt]=q(B,[Ne]),Ce=Ne(),[St,Q]=kt(B),Ee=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,onValueChange:o,defaultValue:x,orientation:c="horizontal",dir:n,activationMode:d="automatic",...m}=t,l=ve(n),[h,b]=be({prop:r,onChange:o,defaultProp:x??"",caller:B});return e.jsx(St,{scope:a,baseId:fe(),value:h,onValueChange:b,orientation:c,dir:l,activationMode:d,children:e.jsx(P.div,{dir:l,"data-orientation":c,...m,ref:s})})});Ee.displayName=B;var Ae="TabsList",Ie=i.forwardRef((t,s)=>{const{__scopeTabs:a,loop:r=!0,...o}=t,x=Q(Ae,a),c=Ce(a);return e.jsx(jt,{asChild:!0,...c,orientation:x.orientation,dir:x.dir,loop:r,children:e.jsx(P.div,{role:"tablist","aria-orientation":x.orientation,...o,ref:s})})});Ie.displayName=Ae;var Re="TabsTrigger",_e=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,disabled:o=!1,...x}=t,c=Q(Re,a),n=Ce(a),d=De(c.baseId,r),m=Ue(c.baseId,r),l=r===c.value;return e.jsx(Nt,{asChild:!0,...n,focusable:!o,active:l,children:e.jsx(P.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":m,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...x,ref:s,onMouseDown:L(t.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?c.onValueChange(r):h.preventDefault()}),onKeyDown:L(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&c.onValueChange(r)}),onFocus:L(t.onFocus,()=>{const h=c.activationMode!=="manual";!l&&!o&&h&&c.onValueChange(r)})})})});_e.displayName=Re;var Le="TabsContent",Fe=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:r,forceMount:o,children:x,...c}=t,n=Q(Le,a),d=De(n.baseId,r),m=Ue(n.baseId,r),l=r===n.value,h=i.useRef(l);return i.useEffect(()=>{const b=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(b)},[]),e.jsx(Ge,{present:o||l,children:({present:b})=>e.jsx(P.div,{"data-state":l?"active":"inactive","data-orientation":n.orientation,role:"tabpanel","aria-labelledby":d,hidden:!b,id:m,tabIndex:0,...c,ref:s,style:{...t.style,animationDuration:h.current?"0s":void 0},children:b&&x})})});Fe.displayName=Le;function De(t,s){return`${t}-trigger-${s}`}function Ue(t,s){return`${t}-content-${s}`}var wt=Ee,Tt=Ie,Ct=_e,$=Fe;const Et=["default","hover","focus","focus-visible","active","disabled"],At=["light","dark","forced-colors-active","forced-colors-none"],It=["ltr","rtl"];function Rt({value:t,onChange:s}){function a(o,x){return o.includes(x)?o.filter(c=>c!==x):[...o,x]}function r(){const o=t.ariaVariations.length===0?1:t.ariaVariations.length;return t.pseudoStates.length*o*t.themes.length*t.directions.length*t.breakpoints.length}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[e.jsx(G,{label:"Pseudo-states",all:Et,selected:t.pseudoStates,onToggle:o=>s({...t,pseudoStates:a(t.pseudoStates,o)})}),e.jsx(G,{label:"Themes",all:At,selected:t.themes,onToggle:o=>s({...t,themes:a(t.themes,o)})}),e.jsx(G,{label:"Directions",all:It,selected:t.directions,onToggle:o=>s({...t,directions:a(t.directions,o)})}),e.jsx(G,{label:"Breakpoints",all:t.breakpointPresets.map(o=>o.id),selected:t.breakpoints,onToggle:o=>s({...t,breakpoints:a(t.breakpoints,o)})}),e.jsxs("p",{className:"text-xs text-slate-500 pt-2 border-t border-slate-100",children:[e.jsx("strong",{children:r()})," audits per component"]})]})}function G({label:t,all:s,selected:a,onToggle:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium mb-1.5",children:t}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(o=>{const x=a.includes(o);return e.jsx("button",{type:"button",onClick:()=>r(o),className:x?"text-xs px-2 py-1 rounded bg-brand-500 text-white":"text-xs px-2 py-1 rounded bg-slate-100 text-slate-700 hover:bg-slate-200",children:o},o)})})]})}function _t({value:t,onChange:s}){const[a,r]=i.useState(""),[o,x]=i.useState("");function c(m){m.preventDefault();const l=a.trim(),h=o.trim();!l||!h||(s({...t,[l]:h}),r(""),x(""))}function n(m){const l={...t};delete l[m],s(l)}const d=Object.entries(t);return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[d.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no aliases"}):e.jsx("ul",{className:"space-y-1",children:d.map(([m,l])=>e.jsxs("li",{className:"text-xs flex items-center justify-between gap-2 border border-slate-100 rounded p-1.5",children:[e.jsxs("span",{className:"font-mono truncate",title:`${m} → ${l}`,children:[m," ",e.jsx("span",{className:"text-slate-500",children:"→"})," ",l]}),e.jsx("button",{onClick:()=>n(m),className:"text-slate-500 hover:text-red-600 shrink-0","aria-label":`Remove alias ${m}`,children:"×"})]},m))}),e.jsxs("form",{onSubmit:c,className:"grid grid-cols-[1fr_1fr_auto] gap-2 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"From"}),e.jsx("input",{type:"text",value:a,onChange:m=>r(m.target.value),placeholder:"https://example.com::testid:btn-a",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Treat as"}),e.jsx("input",{type:"text",value:o,onChange:m=>x(m.target.value),placeholder:"https://example.com::testid:btn-canonical",className:"w-full text-xs border border-slate-300 rounded px-2 py-1 font-mono"})]}),e.jsx("button",{type:"submit",className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",disabled:!a.trim()||!o.trim(),children:"Add"})]})]})}const ae=ye("billing-portal-client"),Lt="https://api.wcagcheckr.com",Ft="wcagcheckr",Dt=15e3;async function Ut(t){const s=`${Lt}/v1/products/${Ft}/billing-portal`;try{const a=await fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Dt)}),r=await a.json().catch(()=>null);return a.ok?r!=null&&r.url?{ok:!0,url:r.url}:{ok:!1,error:"malformed response — no url",status:a.status}:(ae.warn(`billing portal HTTP ${a.status}`,r),{ok:!1,status:a.status,error:(r==null?void 0:r.hint)??(r==null?void 0:r.error)??`HTTP ${a.status}`})}catch(a){return ae.warn("billing portal request failed",a),{ok:!1,error:a instanceof Error?a.message:String(a)}}}const ne=ye("subscription-resume-client"),Pt="https://api.wcagcheckr.com",Mt="wcagcheckr",Ot=1e4;async function $t(t){try{const s=await fetch(`${Pt}/v1/products/${Mt}/subscription/resume`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Ot)}),a=await s.json().catch(()=>null);return s.ok?{ok:!0,alreadyActive:(a==null?void 0:a.alreadyActive)===!0}:(ne.warn(`resume http ${s.status}`,a),{ok:!1,status:s.status,error:(a==null?void 0:a.hint)??(a==null?void 0:a.error)??`HTTP ${s.status}`})}catch(s){return ne.warn("resume request failed",s),{ok:!1,error:s instanceof Error?s.message:String(s)}}}const Gt={free:"Free",solo:"Solo",team:"Team"},Bt={free:"Free",solo:"Solo (monthly)","solo-yearly":"Solo (yearly)","solo-single-month":"Solo (single month — non-recurring)",team:"Team (5 seats, monthly)","team-yearly":"Team (5 seats, yearly)","team-15":"Team (15 seats, monthly)","team-15-yearly":"Team (15 seats, yearly)"},Kt=new Set(["solo-single-month"]);function Vt(t){if(!t)return null;const s=new Date(t).getTime()-Date.now();return Number.isFinite(s)?Math.ceil(s/(24*60*60*1e3)):null}function M(t){return t?Bt[t]??t:"—"}function re(t){if(!t)return"no expiry on file";try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return t}}function Ht({tier:t,onTierChange:s}){const[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(!1),[d,m]=i.useState(""),[l,h]=i.useState(!1),[b,g]=i.useState(null),[j,N]=i.useState(!1),[p,u]=i.useState(!1),f=ge(),y=i.useCallback(async v=>{const A=(await chrome.storage.local.get("licenseToken")).licenseToken??null;if(r(A),!A){x(null);return}try{const I=await T({type:"LICENSE_VALIDATE_REQUEST",token:A,forceRefresh:(v==null?void 0:v.forceRefresh)===!0});x(I)}catch{x(null)}},[]);i.useEffect(()=>(y({forceRefresh:!0}),Je("LICENSE_CHANGED_EVENT",()=>{y()})),[y]);async function k(){if(d.trim()){h(!0),g(null);try{const v=await T({type:"LICENSE_SET_REQUEST",token:d.trim()}),S=await T({type:"LICENSE_VALIDATE_REQUEST",token:d.trim()});if(S.valid&&S.plan){const A=zt(S.plan);s(A);let I=`Activated as ${M(S.plan)}.`;v.seatClaim.ok?v.seatClaim.overCapacity&&(I=`Activated as ${M(S.plan)}. Note: this license is currently OVER its seat cap (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats). Release one or upgrade.`):v.seatClaim.reason==="cap-reached"?I=`Activated as ${M(S.plan)}, BUT this license is at its seat capacity (${v.seatClaim.seatsUsed} of ${v.seatClaim.seatsTotal} seats used). Release a seat from another device, or upgrade to a higher-seat plan. This device's seat won't be active until you do.`:v.seatClaim.reason==="network"&&(I=`Activated as ${M(S.plan)}. (Seat-tracking ping failed — retrying in the background.)`),g(I),v.seatClaim.ok&&!v.seatClaim.overCapacity?_.polite(I):_.assertive(I),m(""),n(!1),await y()}else{const A="Token did not validate. Check the value and try again.";g(A),_.assertive(A)}}catch(v){const S=v instanceof Error?v.message:String(v);g(S),_.assertive(S)}finally{h(!1)}}}async function F(){if(a)try{await navigator.clipboard.writeText(a),N(!0),setTimeout(()=>N(!1),2e3)}catch{}}async function R(){if(window.confirm(`Remove the active license token from this extension?
|
|
2
2
|
|
|
3
3
|
Your subscription stays active server-side — you can paste the same token back in any time. The extension will fall back to trial / free until then.`)){a&&await ze(a),await chrome.storage.local.remove("licenseToken"),r(null),x(null);try{const S=await T({type:"TIER_GET"});s(S.tier)}catch{s("free")}_.polite("License token removed.")}}const E=Ye[t],w=a!==null&&(o==null?void 0:o.valid)===!0;return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Current tier"}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-slate-100 text-slate-700",children:Gt[t]})]}),e.jsxs("ul",{className:"text-xs text-slate-600 space-y-1",children:[e.jsxs("li",{children:["Components:"," ",Number.isFinite(E.maxComponents)?E.maxComponents:"unlimited"]}),e.jsxs("li",{children:["Baselines:"," ",Number.isFinite(E.maxBaselines)?E.maxBaselines:"unlimited"]}),e.jsxs("li",{children:["State matrix: ",E.stateMatrix]}),e.jsxs("li",{children:["Storybook auto-iterate: ",E.storybookAutoIterate?"yes":"no"]}),e.jsxs("li",{children:["JSON export: ",E.exportJson?"yes":"no"]}),e.jsxs("li",{children:["SARIF / JUnit export: ",E.exportSarif?"yes":"no"]})]}),w&&o?e.jsx(Jt,{token:a,info:o,copied:j,onCopy:F,onRemove:R,onUseDifferent:()=>n(!0),onManageSubscription:async()=>{const v=await Ut({licenseToken:a});v.ok?window.open(v.url,"_blank","noopener,noreferrer"):(g(`Couldn't open billing portal: ${v.error}`),_.assertive("Could not open billing portal."))},onResumeSubscription:async()=>{const v=await $t({licenseToken:a});if(v.ok){const S=v.alreadyActive?"Subscription was already active — no change needed.":"Subscription resumed. Cancellation has been reversed.";g(S),_.polite(S),await y({forceRefresh:!0})}else g(`Couldn't resume subscription: ${v.error}`),_.assertive("Could not resume subscription.")},onRenew:()=>u(!0),message:b}):a?e.jsx(Yt,{token:a,onRemove:R,onUseDifferent:()=>n(!0)}):e.jsx(oe,{token:d,onTokenChange:m,submitting:l,message:b,onSubmit:k}),w&&c&&e.jsx(oe,{token:d,onTokenChange:m,submitting:l,message:b,onSubmit:k,replacing:!0,onCancel:()=>{n(!1),m(""),g(null)}}),!w&&t==="free"&&e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Solo"}),": $",f.solo.monthlyUsd,"/mo (recurring) ·"," ","$",f.solo.yearlyUsd,"/yr (save"," ",Be(f.solo.monthlyUsd,f.solo.yearlyUsd),"%) ·"," ","$",f.solo.singleMonthUsd," single month (no recurring) · single user."]}),e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Team"}),": $",f.team.fiveSeatMonthlyUsd,"/mo for 5 seats ·"," ","$",f.team.fifteenSeatMonthlyUsd,"/mo for 15 seats."]}),e.jsx("button",{type:"button",onClick:()=>u(!0),className:"inline-block text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Upgrade →"})]}),e.jsx(Ke,{open:p,onClose:()=>u(!1)})]})}function Jt({token:t,info:s,copied:a,onCopy:r,onRemove:o,onUseDifferent:x,onManageSubscription:c,onResumeSubscription:n,onRenew:d,message:m}){const l=s.features,h=typeof(l==null?void 0:l.seatsUsed)=="number"?l.seatsUsed:null,b=typeof(l==null?void 0:l.seatsTotal)=="number"?l.seatsTotal:null,g=b!==null,j=h!==null&&b!==null&&h>b,N=h!==null&&b!==null&&h===b,p=s.plan?Kt.has(s.plan):!1,u=Vt(s.expiresAt),f=p&&u!==null&&u<=7,y=ge();return e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-slate-700",children:"Active license"}),e.jsx("span",{className:s.cancelAtPeriodEnd?"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-100 text-amber-900":"text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-800",children:s.cancelAtPeriodEnd?"cancellation scheduled":s.status??"unknown"})]}),s.pastDueSince&&e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-[11px] text-rose-900",children:[e.jsx("strong",{children:"Payment failed."})," Stripe couldn't charge your card. Access continues during the grace period (usually up to 7 days while Stripe retries), then this license will cancel automatically."," ",e.jsx("button",{type:"button",onClick:c,className:"font-medium underline-offset-2 hover:underline",children:"Update your card via the Stripe portal →"})]}),s.cancelAtPeriodEnd&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900 space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Cancellation scheduled."})," Your subscription was cancelled via Stripe. Access continues until ",e.jsx("strong",{children:re(s.expiresAt)}),", then this license stops working."]}),e.jsx("button",{type:"button",onClick:n,className:"text-[11px] font-medium underline-offset-2 hover:underline",children:"Resume subscription →"})]}),j&&e.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-[11px] text-rose-900",children:[e.jsx("strong",{children:"Over seat capacity."})," This license has"," ",e.jsx("strong",{children:h})," seats in use but the plan only includes"," ",e.jsx("strong",{children:b}),". New devices will be rejected. Release a seat from another device, or upgrade to a higher-seat plan via Manage subscription below."]}),N&&!j&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900",children:[e.jsx("strong",{children:"At seat capacity."})," All ",e.jsx("strong",{children:b})," seats are in use. The next new device that tries to activate this license will be rejected until a seat is released."]}),e.jsxs("dl",{className:"text-xs text-slate-600 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1",children:[e.jsx("dt",{className:"text-slate-500",children:"Plan"}),e.jsx("dd",{children:M(s.plan)}),e.jsx("dt",{className:"text-slate-500",children:"Email"}),e.jsx("dd",{className:"truncate",children:s.email??"—"}),e.jsx("dt",{className:"text-slate-500",children:p?"Expires":"Renews / ends"}),e.jsxs("dd",{children:[re(s.expiresAt),u!==null&&u>=0&&u<=14?e.jsx("span",{className:f?"ml-2 text-[10px] text-amber-900 bg-amber-100 rounded px-1.5 py-0.5":"ml-2 text-[10px] text-slate-500",children:u===0?"today":u===1?"1 day left":`${u} days left`}):null]}),g?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-slate-500",children:"Seats"}),e.jsx("dd",{children:h!==null?`${h} of ${b} used`:`${b} total`})]}):null]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-slate-500 mb-1",children:"Token"}),e.jsxs("div",{className:"flex items-stretch gap-1",children:[e.jsx("code",{className:"flex-1 font-mono text-[11px] bg-slate-100 border border-slate-200 rounded px-2 py-1.5 select-all break-all",children:t}),e.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-2 py-1.5 border border-slate-300 rounded bg-white hover:bg-slate-50 shrink-0",children:a?"Copied ✓":"Copy"})]})]}),e.jsx("div",{className:"pt-1 flex flex-wrap gap-2",children:p?e.jsx("button",{type:"button",onClick:d,className:f?"text-xs px-3 py-1.5 bg-amber-500 text-white rounded hover:bg-amber-600":"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Buy another month — extends your existing license, no new token to copy",children:f?`Renew now — $${y.solo.singleMonthUsd} →`:`Buy another month — $${y.solo.singleMonthUsd} →`}):e.jsx("button",{type:"button",onClick:c,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Open Stripe's billing portal — change plan or seat count, update card, view invoices, cancel",children:"Manage subscription →"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:x,className:"text-[11px] text-brand-600 hover:underline",children:"Use a different token"}),e.jsx("span",{className:"text-slate-300","aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:o,className:"text-[11px] text-rose-700 hover:underline",children:"Remove license from this extension"})]}),m&&e.jsx("p",{className:"text-xs text-slate-600 pt-1",children:m})]})}function Yt({token:t,onRemove:s,onUseDifferent:a}){return e.jsxs("div",{className:"border-t border-rose-100 pt-3 space-y-2 bg-rose-50/40 -mx-3 px-3 pb-2 rounded-b",children:[e.jsxs("p",{className:"text-xs text-rose-800",children:[e.jsx("strong",{children:"License token rejected by the server."})," The token may have been revoked, the subscription canceled, or the network is down. Verify your subscription and try a different token — or remove this one and continue on the trial / free tier."]}),e.jsx("p",{className:"text-[11px] text-rose-700 font-mono break-all",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:a,className:"text-[11px] text-brand-600 hover:underline",children:"Use a different token"}),e.jsx("span",{className:"text-slate-300","aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:s,className:"text-[11px] text-rose-700 hover:underline",children:"Remove and continue without a license"})]})]})}function oe({token:t,onTokenChange:s,submitting:a,message:r,onSubmit:o,replacing:x,onCancel:c}){return e.jsxs("div",{className:"border-t border-slate-100 pt-3 space-y-2",children:[e.jsx("label",{htmlFor:"opt-license-token",className:"block text-xs font-medium",children:x?"Replace with a different token":"Activate license token"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"opt-license-token",type:"text",value:t,onChange:n=>s(n.target.value),placeholder:"00000000-0000-0000-0000-000000000000",className:"flex-1 text-xs border border-slate-300 rounded px-2 py-1 font-mono"}),e.jsx("button",{onClick:o,disabled:a||!t.trim(),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:a?"Validating…":x?"Replace":"Activate"}),x&&c&&e.jsx("button",{type:"button",onClick:c,className:"text-xs px-3 py-1 border border-slate-300 rounded text-slate-700 hover:bg-slate-50",children:"Cancel"})]}),r&&e.jsx("p",{className:"text-xs text-slate-600",children:r})]})}function zt(t){return t==="solo"||t==="solo-yearly"||t==="solo-single-month"?"solo":t==="team"||t==="team-15"||t==="team-yearly"||t==="team-15-yearly"?"team":"free"}const Wt=new Set(tt.map(t=>t.id));function qt({presets:t,onChange:s}){const[a,r]=i.useState({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1});function o(n){n.preventDefault();const d=a.id.trim();!d||t.some(m=>m.id===d)||(s([...t,{...a,id:d,label:a.label.trim()||`${d} (${a.width}×${a.height})`}]),r({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1}))}function x(n){s(t.filter(d=>d.id!==n))}function c(n,d){s(t.map(m=>m.id===n?{...m,...d}:m))}return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[t.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no breakpoints"}):e.jsx("ul",{className:"space-y-1.5",children:t.map(n=>{const d=Wt.has(n.id);return e.jsxs("li",{className:"grid grid-cols-[1fr_70px_70px_auto_auto] gap-2 items-center text-xs",children:[e.jsxs("span",{className:"font-medium truncate",title:n.id,children:[n.label,d&&e.jsx("span",{className:"text-slate-500 font-normal ml-1",children:"(default)"})]}),e.jsx("input",{type:"number",value:n.width,onChange:m=>c(n.id,{width:Number(m.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Width for ${n.label}`,min:1}),e.jsx("input",{type:"number",value:n.height,onChange:m=>c(n.id,{height:Number(m.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Height for ${n.label}`,min:1}),e.jsxs("label",{className:"flex items-center gap-1 text-slate-600",children:[e.jsx("input",{type:"checkbox",checked:n.mobile,onChange:m=>c(n.id,{mobile:m.target.checked})}),"mobile"]}),d?e.jsx("span",{className:"w-4","aria-hidden":"true"}):e.jsx("button",{onClick:()=>x(n.id),className:"text-slate-500 hover:text-red-600","aria-label":`Remove ${n.label}`,children:"×"})]},n.id)})}),e.jsxs("form",{onSubmit:o,className:"grid grid-cols-[1fr_1fr_70px_70px_auto] gap-2 items-end pt-3 border-t border-slate-100",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-id",className:"block text-xs text-slate-500 mb-1",children:"ID"}),e.jsx("input",{id:"bp-draft-id",type:"text",value:a.id,onChange:n=>r({...a,id:n.target.value}),placeholder:"laptop",className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-label",className:"block text-xs text-slate-500 mb-1",children:"Label"}),e.jsx("input",{id:"bp-draft-label",type:"text",value:a.label,onChange:n=>r({...a,label:n.target.value}),placeholder:"Laptop (1440×900)",className:"w-full text-xs border border-slate-300 rounded px-2 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-width",className:"block text-xs text-slate-500 mb-1",children:"W"}),e.jsx("input",{id:"bp-draft-width",type:"number",value:a.width,onChange:n=>r({...a,width:Number(n.target.value)||0}),min:1,className:"w-full text-xs border border-slate-300 rounded px-1.5 py-1"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bp-draft-height",className:"block text-xs text-slate-500 mb-1",children:"H"}),e.jsx("input",{id:"bp-draft-height",type:"number",value:a.height,onChange:n=>r({...a,height:Number(n.target.value)||0}),min:1,className:"w-full text-xs border border-slate-300 rounded px-1.5 py-1"})]}),e.jsx("button",{type:"submit",disabled:!a.id.trim()||t.some(n=>n.id===a.id.trim()),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:"Add"})]})]})}function Qt({stateMatrix:t,componentIdAliases:s,onImport:a}){const r=i.useRef(null),[o,x]=i.useState(null);function c(){const d={schemaVersion:1,exportedAt:new Date().toISOString(),stateMatrix:t,componentIdAliases:s},m=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),l=URL.createObjectURL(m),h=document.createElement("a");h.href=l,h.download=`wcag-auditor-settings-${new Date().toISOString().slice(0,10)}.json`,h.click(),URL.revokeObjectURL(l),x("Exported.")}async function n(d){var m,l;x(null);try{const h=await d.text(),b=JSON.parse(h);if(b.schemaVersion!==1)throw new Error(`Unsupported schemaVersion: ${b.schemaVersion}`);if(!((m=b.stateMatrix)!=null&&m.pseudoStates)||!((l=b.stateMatrix)!=null&&l.breakpointPresets))throw new Error("stateMatrix is malformed");await C({type:"SETTINGS_SET",key:"stateMatrix",value:b.stateMatrix}),await C({type:"SETTINGS_SET",key:"componentIdAliases",value:b.componentIdAliases??{}}),a({stateMatrix:b.stateMatrix,componentIdAliases:b.componentIdAliases??{}}),x("Imported.")}catch(h){x(`Import failed: ${h instanceof Error?h.message:String(h)}`)}}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Export settings"}),e.jsx("button",{onClick:()=>{var d;return(d=r.current)==null?void 0:d.click()},className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Import settings…"}),e.jsx("input",{ref:r,type:"file",accept:"application/json,.json",className:"hidden",onChange:d=>{var l;const m=(l=d.target.files)==null?void 0:l[0];m&&n(m),d.target.value=""}})]}),o&&e.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Xt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(Z).then(r=>s(r[Z]===!0))},[]);async function a(){const r=!t;s(r),await We(r)}return t===null?e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"}):e.jsx("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a,className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Send anonymized crash reports"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"When the extension hits an unexpected error, send the error message + redacted stack trace + extension version. URLs, emails, and license tokens are stripped before sending. No audit data, page content, or browsing history is included."})]})]})})}function Zt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(K).then(r=>s(r[K]===!0))},[]);async function a(){const r=!t;s(r),await chrome.storage.local.set({[K]:r})}return t===null?e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"}):e.jsx("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a,className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Skip the download confirmation"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"By default, generating a defense or evidence bundle pops up a small confirmation asking whether to download or preview. Enable this to skip the prompt and have the file land directly in your Downloads folder. Keep it off if you'd rather decide each time (recommended for non-technical users — surprise downloads can be alarming)."})]})]})})}const es={"deposition-packet":{name:"Deposition packet",description:"Court-grade HTML with VPS-anchored RFC 3161 timestamp. Use for active litigation / regulatory submission."},"defense-bundle":{name:"Defense bundle",description:"Locally anchored attorney-ready HTML. The everyday remediation-trail artifact — exec summary, findings, screenshots, VPAT, methodology. Recommended baseline."},"html-print":{name:"Printable HTML",description:"Simple print-ready HTML for sharing with stakeholders. No anchoring, no legal framing — just the findings."},"ai-prompt":{name:"AI fix prompt (markdown)",description:"Markdown prompt for Claude / Cursor / Copilot Chat. Includes fix recipes per violation + acknowledged-findings context. Use for dev handoff after each audit."}};function ts(){const[t,s]=i.useState(null);if(i.useEffect(()=>{let o=!1;return(async()=>{const x=await st();o||s(x)})(),()=>{o=!0}},[]),!t)return e.jsx("p",{className:"text-xs text-slate-500",children:"Loading…"});async function a(){const o={...t,enabled:!t.enabled};s(o),await ee(o)}async function r(o){const x=t.formats.includes(o);let c;x?(c=t.formats.filter(d=>d!==o),c.length===0&&t.enabled&&(c=t.formats)):c=[...t.formats,o];const n={...t,formats:c};s(n),await ee(n)}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>void a(),className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"Auto-save an evidence pack after every audit"}),e.jsxs("span",{className:"block text-slate-500 mt-0.5",children:["Each recorded audit (manual or scheduled) bundles the documents checked below into a single zip and saves it to"," ",e.jsx("span",{className:"font-mono",children:"Downloads/wcagcheckr/{domain}/{page}/{date}.zip"}),", with a ",e.jsx("span",{className:"font-mono",children:"_index.html"}),' trail per domain. Nothing is uploaded — it stays on this machine. Uncheck "Record this run" before an audit to skip it; scheduled audits only fire while Chrome is running and the computer is awake.']})]})]}),t.enabled&&e.jsxs("fieldset",{className:"pl-6 space-y-2",children:[e.jsx("legend",{className:"text-xs font-medium text-slate-700",children:"Formats to export"}),at.map(o=>{const x=t.formats.includes(o),c=es[o];return e.jsxs("label",{className:"flex items-start gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:()=>void r(o),className:"mt-0.5"}),e.jsxs("span",{className:"leading-snug",children:[e.jsx("span",{className:"font-medium",children:c.name}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:c.description})]})]},o)})]})]})}function ss(){const[t,s]=i.useState(null),[a,r]=i.useState(!1);async function o(){const c=await chrome.storage.local.get(null),n=Object.keys(c).filter(d=>d.startsWith("auditCache:"));s(n.length)}i.useEffect(()=>{o()},[]);async function x(){r(!0);try{await nt(),await o()}finally{r(!1)}}return e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"Audit cache"}),e.jsx("span",{className:"block text-slate-500 mt-0.5",children:"Repeat audits of the same component skip the state-matrix iteration when the DOM is unchanged from the last audit (10-50× faster). The fingerprint is DOM-only — if you change ONLY CSS, the cache won't notice and will return stale results. Clear it here when that happens."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:x,disabled:a||(t??0)===0,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 disabled:opacity-50 disabled:cursor-not-allowed border border-slate-300 rounded",children:a?"Clearing…":"Clear audit cache"}),e.jsx("span",{className:"text-xs text-slate-500",children:t===null?"Loading…":t===0?"Cache is empty.":`${t} cached audit${t===1?"":"s"}.`})]})]})}const le="licenseToken";function ie(t){const s=Date.now()-new Date(t).getTime(),a=Math.floor(s/6e4);if(a<1)return"just now";if(a<60)return`${a} min ago`;const r=Math.floor(a/60);if(r<24)return`${r}h ago`;const o=Math.floor(r/24);return o<30?`${o}d ago`:new Date(t).toLocaleDateString()}function as(t){return t.slice(0,8)+"…"}function ns(t){return t?/Edg\//.test(t)?"Edge":/Chrome\//.test(t)?"Chrome":/Firefox\//.test(t)?"Firefox":/Safari\//.test(t)?"Safari":t.slice(0,30):"unknown"}function rs(){const[t,s]=i.useState(null),[a,r]=i.useState(null),[o,x]=i.useState(null),[c,n]=i.useState(0),[d,m]=i.useState(null),[l,h]=i.useState(!1),[b,g]=i.useState(null),j=i.useCallback(async()=>{h(!0),g(null);try{const u=(await chrome.storage.local.get(le))[le]??null;if(s(u),!u){r(null);return}const f=await qe(u);if(!f){g("Could not load seats — check network or license validity.");return}r(f.seats),x(f.seatsTotal),n(f.seatsUsed),m(await Qe())}finally{h(!1)}},[]);i.useEffect(()=>{j()},[j]);async function N(p){if(!t)return;const f=p===d?"Revoke THIS device? You will have to re-claim a seat on the next audit (if a seat is available).":"Revoke this seat? The device will be denied audits until it re-claims a seat (subject to the seat cap).";if(window.confirm(f)){h(!0);try{if(!await Xe(t,p)){g("Revoke failed — try again or check network.");return}await j()}finally{h(!1)}}}return t?o===null?e.jsx("div",{className:"text-xs text-slate-500",children:"This license has no seat cap (Solo / single-month / free / trial). Upgrade to a Team plan to see and manage seats here."}):e.jsxs("div",{className:"border border-slate-200 rounded p-3 bg-white space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"Team seats"}),e.jsxs("span",{className:"text-slate-500 ml-2",children:[c," of ",o," used",c>o&&e.jsx("span",{className:"ml-2 text-amber-700",children:"(over capacity — release to bring under limit)"})]})]}),e.jsx("button",{onClick:j,disabled:l,className:"text-xs px-2 py-0.5 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:l?"Loading…":"Refresh"})]}),b&&e.jsx("p",{className:"text-xs text-red-700",children:b}),a&&a.length>0?e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-slate-500",children:[e.jsx("th",{className:"font-normal py-1",children:"Device"}),e.jsx("th",{className:"font-normal py-1",children:"Browser"}),e.jsx("th",{className:"font-normal py-1",children:"Claimed"}),e.jsx("th",{className:"font-normal py-1",children:"Last active"}),e.jsx("th",{className:"font-normal py-1"})]})}),e.jsx("tbody",{children:a.map(p=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsxs("td",{className:"py-1",children:[e.jsx("code",{className:"text-[10px] text-slate-600",children:as(p.deviceId)}),p.deviceId===d&&e.jsx("span",{className:"ml-1 text-[10px] text-brand-700",children:"(this device)"})]}),e.jsx("td",{className:"py-1 text-slate-700",children:ns(p.userAgent)}),e.jsx("td",{className:"py-1 text-slate-500",children:ie(p.claimedAt)}),e.jsx("td",{className:"py-1 text-slate-500",children:ie(p.lastSeenAt)}),e.jsx("td",{className:"py-1 text-right",children:e.jsx("button",{onClick:()=>N(p.deviceId),disabled:l,className:"text-[11px] px-2 py-0.5 border border-slate-300 rounded hover:bg-red-50 hover:text-red-800 hover:border-red-300 disabled:opacity-50",children:"Revoke"})})]},p.deviceId))})]}):e.jsx("p",{className:"text-xs text-slate-500",children:"No seats claimed yet."})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Activate a Team license to manage seats here."})}const os=[{id:"use-our-button",description:"Use the design-system Button, not raw <button>.",impact:"moderate",selector:"button:not([data-component='Button']):not([data-component^='ds-'])",check:{type:"fail-on-match",message:"Replace raw <button> with the design-system Button component."},enabled:!0},{id:"no-inline-styles",description:"Inline style attribute escapes the design tokens.",impact:"minor",selector:"[style]",check:{type:"fail-on-match",message:"Move this style into a design-token-aware CSS class."},enabled:!0},{id:"cta-needs-testid",description:"Every call-to-action button must have data-testid for E2E.",impact:"serious",selector:'button.cta, [data-component="Button"][data-variant="primary"]',check:{type:"attribute-required",attribute:"data-testid",message:"Add a data-testid attribute so QA can target this element."},enabled:!1}];function ls(){const[t,s]=i.useState(""),[a,r]=i.useState([]),[o,x]=i.useState(!1),[c,n]=i.useState(null);i.useEffect(()=>{lt().then(l=>{s(l.length>0?JSON.stringify(l,null,2):""),x(!0)})},[]);function d(){if(t.trim().length===0){se([]),r([]),n(Date.now());return}let l;try{l=JSON.parse(t)}catch(g){r([`Invalid JSON: ${g instanceof Error?g.message:String(g)}`]);return}const{valid:h,errors:b}=it(l);if(b.length>0){r(b);return}r([]),se(h),n(Date.now()),s(JSON.stringify(h,null,2))}function m(){s(JSON.stringify(os,null,2)),r([])}return o?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["Custom rules check your design-system contracts during every audit. Three check types supported:"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"fail-on-match"})," (every element matching the selector is a violation),"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attribute-required"})," ","(the named attribute must be present), and"," ",e.jsx("code",{className:"bg-slate-100 px-1 rounded",children:"attribute-equals"})," ","(attribute must equal a specific value). Output appears in audit results alongside built-in WCAG rules."]}),e.jsx("textarea",{value:t,onChange:l=>s(l.target.value),rows:14,spellCheck:!1,placeholder:"[]",className:"w-full text-xs font-mono border border-slate-300 rounded p-2 resize-y"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:d,className:"text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Save"}),e.jsx("button",{onClick:m,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50",children:"Load example rules"}),c&&a.length===0&&e.jsxs("span",{className:"text-[11px] text-slate-500",children:["Saved at ",new Date(c).toLocaleTimeString(),"."]})]}),a.length>0&&e.jsx("div",{className:"border border-red-200 bg-red-50 rounded p-2 text-xs text-red-800 space-y-1",children:a.map((l,h)=>e.jsx("div",{children:l},h))})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ce="disabledRules";function is(){const[t,s]=i.useState(""),[a,r]=i.useState(!1),[o,x]=i.useState(null);i.useEffect(()=>{T({type:"SETTINGS_GET",key:ce}).then(n=>{const d=Array.isArray(n.data)?n.data:[];s(d.join(`
|
|
4
4
|
`)),r(!0)})},[]);function c(n){const d=n.split(`
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/site-report-renderer-DelUUXsi.js","assets/scheduled-audit-runner-BJXKsQZK.js","assets/preload-helper-D7HrI6pR.js","assets/crash-reporter-DAZnNefT.js","assets/diff-CECbooHD.js","assets/ai-usage-log-DVzy9AU1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as c,j as e,C as Se,t as Ne,u as Ie,o as Ue,c as ze,R as Pe}from"./styles-BsDacBC8.js";import{u as f,a as oe,R as ue,c as De,C as Le,M as _e,l as ne,b as We,d as Ge,e as Fe,i as Me,P as Oe,f as $e,s as He,w as Be,r as Ve,g as qe,h as Ke,j as Ye,p as Qe,k as Ze,A as Xe,m as Je,E as et,n as tt}from"./ErrorBoundary-Dz8MotbH.js";import{s as S,r as rt,i as at}from"./crash-reporter-DAZnNefT.js";import{B as ie}from"./ai-usage-log-DVzy9AU1.js";import{c as nt,C as it,a as st,d as ot,l as Ce,g as Re,s as lt,b as ct,e as dt,f as ut,h as pe,i as pt,j as vt}from"./scheduled-audit-runner-BJXKsQZK.js";import{_ as re}from"./preload-helper-D7HrI6pR.js";import{copyAiFixerPrompt as gt}from"./copy-ai-fixer-prompt-zCj1CiZK.js";import{w as ve,h as ge,r as he}from"./tier-config-client-CimEdyEg.js";import{w as me,r as fe}from"./rubric-config-client-VuUmF7Y1.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./diff-CECbooHD.js";import"./design-system-audit-DpxJrxnb.js";function xe({initialUrl:t,isRunning:a,onCrawl:r,onVerifyFixes:o,onAuditThisPage:s,reviewEnabled:l,onToggleReview:i}){const[n,g]=c.useState(t),[y,h]=c.useState(25),[p,b]=c.useState(""),[k,j]=c.useState(""),[w,m]=c.useState(!1),[E,P]=c.useState(ie),[x,F]=c.useState(ie[0].id),[$,U]=c.useState(null),[W,R]=c.useState(!0);c.useEffect(()=>{t&&!n&&g(t)},[t]),c.useEffect(()=>{let u=!1;return Promise.all([S({type:"SETTINGS_GET",key:"matrixPresets"}),S({type:"SETTINGS_GET",key:"activePresetId"})]).then(([T,L])=>{if(u)return;const d=Array.isArray(T.data)?T.data:null;P(d&&d.length>0?d:ie),typeof L.data=="string"&&F(L.data)}),()=>{u=!0}},[]),c.useEffect(()=>{let u=!1;return S({type:"SETTINGS_GET",key:"crawlRememberSettings"}).then(async T=>{if(u)return;const d=T.data!==!1;if(R(d),!d)return;const[C,B,M]=await Promise.all([S({type:"SETTINGS_GET",key:"crawlMaxPages"}),S({type:"SETTINGS_GET",key:"crawlIncludeRegex"}),S({type:"SETTINGS_GET",key:"crawlExcludeRegex"})]);if(u)return;const O=C.data;typeof O=="number"&&O>=1&&h(Math.min(200,O));const Z=B.data,X=M.data;typeof Z=="string"&&Z&&b(Z),typeof X=="string"&&X&&j(X),(typeof Z=="string"&&Z||typeof X=="string"&&X)&&m(!0)}),()=>{u=!0}},[]);function Q(u){h(u),W&&S({type:"SETTINGS_SET",key:"crawlMaxPages",value:u})}function v(u){b(u),W&&S({type:"SETTINGS_SET",key:"crawlIncludeRegex",value:u})}function z(u){j(u),W&&S({type:"SETTINGS_SET",key:"crawlExcludeRegex",value:u})}function A(u){R(u),S({type:"SETTINGS_SET",key:"crawlRememberSettings",value:u}),u&&(S({type:"SETTINGS_SET",key:"crawlMaxPages",value:y}),S({type:"SETTINGS_SET",key:"crawlIncludeRegex",value:p.trim()}),S({type:"SETTINGS_SET",key:"crawlExcludeRegex",value:k.trim()}))}function N(u){const T=E.find(L=>L.id===u);T&&(F(u),S({type:"SETTINGS_SET",key:"activePresetId",value:u}),S({type:"SETTINGS_SET",key:"stateMatrix",value:T.matrix}))}function H(){U(null);for(const[u,T]of[["Include",p.trim()],["Exclude",k.trim()]])if(T)try{new RegExp(T)}catch(L){return U(`${u} regex invalid: ${L instanceof Error?L.message:String(L)}`),!1}return!0}function D(){const u=n.trim();if(!u)return null;let T;try{T=new URL(u)}catch{return"Start URL must be a full URL starting with http:// or https://."}return T.protocol!=="http:"&&T.protocol!=="https:"?`Start URL must use http:// or https:// — ${T.protocol} can't be crawled.`:null}const I=D(),q=!!n.trim()&&!I;function V(u){if(!H()||!q)return;const T={startUrl:n.trim(),maxPages:y,includeRegex:p.trim(),excludeRegex:k.trim()};u&&o?o(T):r(T)}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsxs(J,{label:"Start URL",children:[e.jsx("input",{type:"url",value:n,onChange:u=>g(u.target.value),placeholder:"https://yoursite.com",disabled:a,"aria-invalid":!!I,className:"v2-mono",style:ee}),I&&e.jsx("p",{role:"alert",style:{margin:"4px 0 0",fontSize:11,color:"var(--v2-critical)",lineHeight:1.4},children:I})]}),e.jsx(J,{label:"Max pages",hint:"1–200. Each page runs the full pipeline you configured.",children:e.jsx("input",{type:"number",min:1,max:200,value:y,onChange:u=>Q(Math.min(200,Math.max(1,parseInt(u.target.value,10)||25))),disabled:a,className:"v2-mono",style:{...ee,maxWidth:100}})}),e.jsx(J,{label:"Audit depth",hint:"State matrix preset applied to every crawled page.",children:e.jsx("select",{value:x,onChange:u=>N(u.target.value),disabled:a,style:ee,children:E.map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))})}),e.jsx("button",{type:"button",onClick:()=>m(u=>!u),className:"v2-eyebrow",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-ink-secondary)",textAlign:"left",alignSelf:"flex-start"},children:w?"− hide advanced filters":"+ show URL filters (include / exclude)"}),w&&e.jsxs(e.Fragment,{children:[e.jsx(J,{label:"Include only URLs matching",hint:"Optional regex. Empty = no filter.",children:e.jsx("input",{type:"text",value:p,onChange:u=>v(u.target.value),placeholder:"^https://example\\.com/products/",disabled:a,className:"v2-mono",style:ee})}),e.jsx(J,{label:"Exclude URLs matching",hint:"Optional regex. Useful for /admin or /login while logged in.",children:e.jsx("input",{type:"text",value:k,onChange:u=>z(u.target.value),placeholder:"/admin|/dashboard|/login",disabled:a,className:"v2-mono",style:ee})})]}),$&&e.jsx("p",{role:"alert",style:{color:"var(--v2-critical)",fontSize:12,margin:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)"},children:$}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",fontSize:12,lineHeight:1.4,color:"var(--v2-ink-secondary)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:W,disabled:a,onChange:u=>A(u.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:"Remember these settings."})," ","Keep max pages + the include/exclude filters for next time (the audit-depth preset is always remembered)."]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",fontSize:12,lineHeight:1.4,color:"var(--v2-ink-secondary)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l,disabled:a,onChange:u=>i(u.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:"Review pages before auditing."})," ","List every page that would be crawled, then remove any you don't want before the audit runs."]})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:a||!q,onClick:()=>V(!1),children:a?"Crawling…":l?"Find pages to audit":"Crawl whole site"}),o&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a||!q,onClick:()=>V(!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),s&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",disabled:a,onClick:s,title:"Single-page audit on the active tab (no crawl)",children:"Just this page"})]})]})}function ht(){var h;const t=f(p=>p.siteCrawlProgress),a=f(p=>p.siteCrawlStatus),r=f(p=>p.progress),o=f(p=>p.aiProgress),[s,l]=c.useState(!1);function i(){l(!0),S({type:"CANCEL_SITE_CRAWL"})}if(a!=="running")return null;const n=t?Math.min(100,Math.max(0,t.current/Math.max(1,t.total)*100)):0,g=r?Math.min(100,Math.max(0,r.current/Math.max(1,r.total)*100)):0,y=r!=null&&r.currentState?[r.currentState.pseudoState,r.currentState.theme&&r.currentState.theme!=="light"?r.currentState.theme:null,r.currentState.direction&&r.currentState.direction!=="ltr"?r.currentState.direction:null,(h=r.currentState.breakpoint)!=null&&h.id&&r.currentState.breakpoint.id!=="desktop"?r.currentState.breakpoint.id:null].filter(Boolean).join(" · "):"";return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"crawling…"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:t?`${t.current} / ${t.total}`:"…"})]}),e.jsx("div",{role:"progressbar","aria-valuenow":(t==null?void 0:t.current)??0,"aria-valuemin":0,"aria-valuemax":(t==null?void 0:t.total)??1,"aria-label":"Crawl progress",style:{height:8,background:"var(--v2-bg-elev-2)",borderRadius:4,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${n}%`,background:"var(--v2-action)",transition:"width 240ms ease"}})}),(t==null?void 0:t.url)&&e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:4},children:"current page"}),e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:t.url})]}),(t==null?void 0:t.lastViolations)!==void 0&&t.lastViolations>0&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:["last page: ",t.lastViolations," axe violation",t.lastViolations===1?"":"s"]}),r&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-2)",paddingTop:"var(--v2-pad-3)",borderTop:"1px solid var(--v2-border)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-tertiary)"},children:"this page · auditing"}),e.jsxs("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",fontVariantNumeric:"tabular-nums"},children:[r.current," / ",r.total]})]}),e.jsx("div",{role:"progressbar","aria-valuenow":r.current,"aria-valuemin":0,"aria-valuemax":r.total,"aria-label":"Current page audit progress",style:{height:4,background:"var(--v2-bg-elev-2)",borderRadius:2,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${g}%`,background:"var(--v2-ink-tertiary)",transition:"width 240ms ease"}})}),y&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)"},children:["state: ",y]}),o&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-needs-review)",fontVariantNumeric:"tabular-nums"},children:["AI: ",o.current," / ",o.total," · ",o.currentCheckLabel,o.candidatesTotal&&o.candidatesTotal>0?` (${o.candidatesDone??0}/${o.candidatesTotal})`:""]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:i,disabled:s,children:s?"Cancelling…":"Cancel crawl"}),s&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up current page audit — final cancel can take up to a few seconds."})]})]})}function mt(){const t=f(s=>s.crawlDiscoveryStatus),a=f(s=>s.crawlDiscoveryFound),r=f(s=>s.crawlDiscoveryLastUrl);function o(){S({type:"CANCEL_CRAWL_DISCOVERY"}),f.getState().resetCrawlDiscovery()}return t!=="discovering"?null:e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"finding pages…"}),e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:12,fontWeight:600,color:"var(--v2-ink-primary)",fontVariantNumeric:"tabular-nums"},children:[a," page",a===1?"":"s"," found"]}),r&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:r}),e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:"Loading each page to read its links — no audit yet. You'll prune the list before anything is audited."}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,children:"Cancel"})})]})}function ft({onAudit:t}){const a=f(i=>i.crawlDiscoveryStatus),r=f(i=>i.crawlDiscoveryUrls),[o,s]=c.useState(new Set);c.useEffect(()=>{a==="reviewing"&&s(new Set(r))},[a,r]);function l(){S({type:"CANCEL_CRAWL_DISCOVERY"}),f.getState().resetCrawlDiscovery()}return a!=="reviewing"?null:e.jsxs("div",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",textAlign:"left"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:"review pages to audit"}),e.jsxs("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-secondary)",lineHeight:1.4},children:["Found ",e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:r.length})," page",r.length===1?"":"s",". Uncheck any you don't want, then audit the rest. ",e.jsx("strong",{style:{color:"var(--v2-ink-primary)"},children:o.size})," selected."]}),r.length===0?e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--v2-ink-tertiary)"},children:"No pages discovered from this URL. Check the start URL + filters and try again."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",onClick:()=>s(new Set(r)),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-action)",fontSize:11},children:"select all"}),e.jsx("button",{type:"button",onClick:()=>s(new Set),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--v2-action)",fontSize:11},children:"select none"})]}),e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,maxHeight:300,overflowY:"auto",border:"1px solid var(--v2-border)",borderRadius:4},children:r.map(i=>e.jsx("li",{style:{borderBottom:"1px solid var(--v2-border)"},children:e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-2)",padding:"6px 10px",fontSize:11,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:o.has(i),onChange:n=>s(g=>{const y=new Set(g);return n.target.checked?y.add(i):y.delete(i),y}),style:{marginTop:2}}),e.jsx("span",{className:"v2-mono",style:{wordBreak:"break-all",color:"var(--v2-ink-secondary)"},children:i})]})},i))})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",className:"v2-btn v2-btn-primary",disabled:o.size===0,onClick:()=>t(r.filter(i=>o.has(i))),children:["Audit ",o.size," page",o.size===1?"":"s"]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:l,children:"Cancel"})]})]})}function xt(){const t=f(h=>h.status),a=f(h=>h.progress),r=f(h=>h.aiProgress),[o,s]=c.useState(!1);if(t!=="running")return null;const l=a?a.current>=a.total:!1,i=a?l?"Running deep analyzers…":`Auditing… ${a.current} / ${a.total}`:"Starting audit…",n=a?l?"reading order · tab order · typography · CSS vars · AI candidates":yt(a.currentState):"Loading axe + DOM analyzers",g=a?l?100:a.current/Math.max(1,a.total)*100:0;function y(){s(!0),S({type:"CANCEL_AUDIT"})}return e.jsxs("div",{role:"status","aria-live":"polite",style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,padding:"var(--v2-pad-4)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-4)"},children:[e.jsx(ye,{label:i,detail:n,pct:g,valuenow:a?Math.min(a.current,a.total):0,valuemax:a?a.total:1,ariaLabel:a?l?"Running deep analyzers: reading order, tab order, typography, custom properties, AI candidates.":`Audit progress: ${a.current} of ${a.total} states`:"Audit starting",fillColor:"var(--v2-action)"}),r&&e.jsx(ye,{label:`AI augmentation… ${r.current} / ${r.total}`,detail:r.candidatesTotal&&r.candidatesTotal>0?`${r.currentCheckLabel} (${r.candidatesDone??0}/${r.candidatesTotal})`:r.currentCheckLabel,pct:r.current/Math.max(1,r.total)*100,valuenow:r.current,valuemax:r.total,ariaLabel:`AI augmentation: ${r.current} of ${r.total} checks. ${r.currentCheckLabel}`,fillColor:"var(--v2-needs-review)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:y,disabled:o,children:o?"Cancelling…":"Cancel audit"}),o&&e.jsx("span",{"aria-live":"polite",style:{fontSize:11,color:"var(--v2-ink-tertiary)"},children:"Wrapping up — final cancel can take up to a few seconds."})]})]})}function ye({label:t,detail:a,pct:r,valuenow:o,valuemax:s,ariaLabel:l,fillColor:i}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:e.jsx("span",{className:"v2-eyebrow",style:{margin:0,color:"var(--v2-action)"},children:t})}),e.jsx("div",{role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":s,"aria-label":l,style:{height:6,background:"var(--v2-bg-elev-2)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${r}%`,background:i,transition:"width 240ms ease"}})}),a&&e.jsx("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-secondary)",wordBreak:"break-all"},children:a})]})}function yt(t){if(!t)return"";const a=[t.pseudoState];return t.theme&&t.theme!=="light"&&a.push(t.theme),t.direction&&t.direction!=="ltr"&&a.push(t.direction),a.join(" · ")}function J({label:t,hint:a,children:r}){return e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{className:"v2-eyebrow",style:{color:"var(--v2-ink-secondary)"},children:t}),r,a&&e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.4},children:a})]})}const ee={fontFamily:"var(--v2-body)",fontSize:12,padding:"8px 10px",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,outline:"none"};function bt({sealed:t}){const[a,r]=c.useState(!1),o=JSON.stringify({claim:t.claim,hash:t.hash,receipt:t.receipt},null,2),s=new Date(t.claim.auditedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),l=()=>{navigator.clipboard.writeText(o).then(()=>{r(!0),setTimeout(()=>r(!1),2500)})};return e.jsxs("div",{role:"group","aria-label":"Wall of Fame badge",style:{marginTop:"var(--v2-pad-5)",padding:"var(--v2-pad-4)",border:"1px solid var(--v2-verified, #15803d)",borderRadius:6,background:"var(--v2-verified-bg, rgba(21,128,61,0.06))",maxWidth:640},children:[e.jsx("p",{style:{margin:0,fontWeight:600,fontSize:13,color:"var(--v2-ink-primary)"},children:"🏆 You earned a Wall of Fame badge"}),e.jsxs("p",{style:{margin:"var(--v2-pad-2) 0 0",fontSize:12,color:"var(--v2-ink-secondary)"},children:["WCAG ",t.claim.wcagLevel," · grade ",t.claim.grade," · ",t.claim.pageCount," page",t.claim.pageCount===1?"":"s"," · audited ",s]}),e.jsxs("p",{style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,lineHeight:1.5,color:"var(--v2-ink-tertiary)"},children:["Submit this signed attestation at ",e.jsx("strong",{children:"accessibilitywatch.org"})," to claim a public, dated, verifiable badge for ",e.jsx("strong",{children:t.claim.domain}),". They verify the signature and confirm you control the domain before it goes live."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-3)"},children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:l,children:a?"Copied ✓":"Copy attestation"}),e.jsx("span",{role:"status","aria-live":"polite",style:{fontSize:11,color:"var(--v2-verified, #15803d)"},children:a?"Attestation copied to clipboard.":""})]})]})}function kt(t){const[a,r]=c.useState(null);return c.useEffect(()=>{if(!t){r(null);return}let o=!1;const s=()=>rt({type:"SITE_CLAIM_GET_REQUEST",domain:t}).then(i=>{o||r(i.claim)}).catch(()=>{o||r(null)});s();const l=i=>{typeof i=="object"&&i!==null&&i.type==="SITE_CLAIM_SEALED_EVENT"&&i.domain===t&&s()};return chrome.runtime.onMessage.addListener(l),()=>{o=!0,chrome.runtime.onMessage.removeListener(l)}},[t]),a}function be({open:t,gaps:a,onRunFull:r,onQuickCheck:o,onCancel:s}){return t?e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Audit settings are below WCAG 2.1 AA conformance",style:{position:"fixed",inset:0,background:"rgba(2,6,23,0.7)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:s,children:e.jsxs("div",{onClick:l=>l.stopPropagation(),style:{background:"#0f172a",border:"1px solid #334155",borderRadius:10,maxWidth:460,width:"100%",padding:20,color:"#e2e8f0"},children:[e.jsx("h2",{style:{margin:"0 0 8px",fontSize:16},children:"Your settings aren’t a Full 2.1 AA audit"}),e.jsxs("p",{style:{margin:"0 0 10px",fontSize:13,color:"#cbd5e1",lineHeight:1.5},children:["A grade only means WCAG 2.1 AA if the audit exercised the states and checks the AA criteria live in. With your current settings, this run is a ",e.jsx("strong",{children:"quick check"}),", not a conformance result."]}),e.jsx("ul",{style:{margin:"0 0 14px",paddingLeft:18,fontSize:12,color:"#fca5a5",lineHeight:1.6},children:a.map((l,i)=>e.jsx("li",{children:l},i))}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:r,style:{background:"#2563eb",color:"#fff",border:"none",borderRadius:6,padding:"10px 12px",fontSize:13,fontWeight:600,cursor:"pointer"},children:"Run the Full 2.1 AA audit (applies the preset, then crawls)"}),e.jsx("button",{onClick:o,style:{background:"#1e293b",color:"#cbd5e1",border:"1px solid #334155",borderRadius:6,padding:"10px 12px",fontSize:13,cursor:"pointer"},children:"Quick check with current settings — not a conformance result"}),e.jsx("button",{onClick:s,style:{background:"none",color:"#64748b",border:"none",fontSize:12,padding:"4px",cursor:"pointer"},children:"Cancel"})]}),e.jsx("p",{style:{margin:"12px 0 0",fontSize:11,color:"#64748b",lineHeight:1.5},children:"Either way, the grade and every export are stamped with the exact settings used — a quick check can’t be mistaken for a conformance result. (Owner mode isn’t affected; it only flags demand-letter bait.)"})]})}):null}function wt(){const[t,a]=c.useState([]),[r,o]=c.useState(!1),s=c.useRef(null),l=c.useRef(!1),i=c.useCallback(async()=>{try{const p=await chrome.storage.local.get(["stateMatrix","runsPerState","aiConfig"]),b=p.aiConfig??{},k=nt({stateMatrix:p.stateMatrix,runsPerState:typeof p.runsPerState=="number"?p.runsPerState:1,aiEnabled:!!b.enabled&&!!b.apiKey});return a(k),k}catch{return a([]),[]}},[]);c.useEffect(()=>{i()},[i]);const n=c.useCallback(async p=>{if((await i()).length===0||l.current){p();return}s.current=p,o(!0)},[i]),g=c.useCallback(async()=>{try{const k=(await chrome.storage.local.get("aiConfig")).aiConfig??{};await chrome.storage.local.set({stateMatrix:st,runsPerState:it,aiConfig:{...k,enabled:!0}})}catch{}l.current=!0,o(!1);const p=s.current;s.current=null,p==null||p()},[]),y=c.useCallback(()=>{l.current=!0,o(!1);const p=s.current;s.current=null,p==null||p()},[]),h=c.useCallback(()=>{o(!1),s.current=null},[]);return{gaps:t,gateOpen:r,requestCrawl:n,runFull:g,quickCheck:y,cancel:h}}function jt(){const{report:t,resolvedFails:a}=oe(),r=f(d=>d.siteCrawlReport),o=f(d=>d.siteCrawlStatus),s=f(d=>d.siteCrawlError),l=f(d=>d.status),i=o==="running",g=i||l==="running"&&!i,y=!!t&&!r,h=!y&&(t==null?void 0:t.siteGrade)==="A"&&t.startUrl?ot(t.startUrl):null,p=kt(h),[b,k]=c.useState(null);c.useEffect(()=>{let d=!1;return chrome.tabs.query({active:!0,currentWindow:!0}).then(C=>{var M;if(d)return;const B=((M=C[0])==null?void 0:M.url)??null;k(B&&/^https?:\/\//i.test(B)?B:null)}),()=>{d=!0}},[]);const[j,w]=c.useState(!1),m=f(d=>d.crawlDiscoveryStatus),[E,P]=c.useState(!0),x=wt(),[F,$]=c.useState("");c.useEffect(()=>{S({type:"SETTINGS_GET",key:"crawlReviewEnabled"}).then(d=>{const C=d.data;typeof C=="boolean"&&P(C)})},[]);function U(d){P(d),S({type:"SETTINGS_SET",key:"crawlReviewEnabled",value:d})}function W(d,C=!1){if(d.startUrl){if(C){R(d,!0);return}x.requestCrawl(()=>R(d,!1))}}function R(d,C=!1){if(E&&!C){$(d.startUrl),f.getState().setSiteCrawlError(null),f.getState().setCrawlDiscoveryStatus("discovering"),We({type:"START_CRAWL_DISCOVERY",startUrl:d.startUrl,maxPages:d.maxPages,...d.includeRegex?{includeRegex:d.includeRegex}:{},...d.excludeRegex?{excludeRegex:d.excludeRegex}:{}});return}f.getState().setSiteCrawlStatus("running"),f.getState().setSiteCrawlReport(null),f.getState().setSiteCrawlError(null),ne({type:"START_SITE_CRAWL",startUrl:d.startUrl,maxPages:d.maxPages,...d.includeRegex?{includeRegex:d.includeRegex}:{},...d.excludeRegex?{excludeRegex:d.excludeRegex}:{},...C?{verifyFixesOnly:!0}:{}})}function Q(d){d.length!==0&&(f.getState().setSiteCrawlStatus("running"),f.getState().setSiteCrawlReport(null),f.getState().setSiteCrawlError(null),f.getState().resetCrawlDiscovery(),ne({type:"START_SITE_CRAWL",startUrl:F,urls:d}))}function v(){ne({type:"START_AUDIT",mode:"full-page"}),f.getState().startNewScan()}const[z,A]=c.useState(!1),[N,H]=c.useState(null),[D,I]=c.useState(null);async function q(){A(!0),H(null),I(null);const d=(t==null?void 0:t.siteGrade)??"A";try{const C=await S({type:"REGRADE_SITE_CRAWL"});if((C==null?void 0:C.ok)===!0)setTimeout(()=>{var O;const M=((O=f.getState().siteCrawlReport)==null?void 0:O.siteGrade)??d;I({prevGrade:d,nextGrade:M,at:Date.now()})},0);else{const M=(C==null?void 0:C.reason)??"Regrade failed.";H(M)}}catch(C){H(C instanceof Error?C.message:String(C))}finally{A(!1)}}if(c.useEffect(()=>{if(!D)return;const d=setTimeout(()=>I(null),6e3);return()=>clearTimeout(d)},[D]),g)return e.jsx("section",{"aria-label":"Audit in progress",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:i?e.jsx(ht,{}):e.jsx(xt,{})});if(m==="discovering"||m==="reviewing")return e.jsx("section",{"aria-label":"Choose pages to audit",style:{padding:"var(--v2-pad-5) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:m==="discovering"?e.jsx(mt,{}):e.jsx(ft,{onAudit:Q})});if(!t)return e.jsxs("section",{"aria-label":"No audit yet",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",maxWidth:640,margin:"0 auto"},children:[e.jsx("p",{className:"v2-eyebrow",style:{marginBottom:"var(--v2-pad-2)"},children:"new audit"}),e.jsx("h1",{className:"v2-display",style:{fontSize:28,fontWeight:500,letterSpacing:"-0.02em",color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:"Configure your crawl."}),s&&e.jsxs("div",{role:"alert",style:{marginBottom:"var(--v2-pad-4)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-critical)",borderRadius:4,background:"rgba(207, 44, 44, 0.06)",color:"var(--v2-critical)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600,marginRight:6},children:"Last crawl failed:"}),s]}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,marginBottom:"var(--v2-pad-5)",maxWidth:520},children:"The crawler follows internal links from the start URL, same-origin only. Each page runs your full audit pipeline (axe + DOM analyzers + AI walkthroughs). Findings appear below as a single unified list."}),e.jsx(xe,{initialUrl:b??"",isRunning:g,onCrawl:d=>W(d,!1),onAuditThisPage:v,reviewEnabled:E,onToggleReview:U}),e.jsx("div",{style:{marginTop:"var(--v2-pad-3)"},children:e.jsx(ue,{})}),e.jsx(be,{open:x.gateOpen,gaps:x.gaps,onRunFull:x.runFull,onQuickCheck:x.quickCheck,onCancel:x.cancel})]});const V=a.length,u=(t.totalWalkthroughFindings??0)+t.totalUniqueViolations+V,T=(t.walkthroughAcknowledgements??[]).length,L=t.totalNeedsReview;return e.jsxs("section",{"aria-label":"Audit summary",style:{padding:"var(--v2-pad-6) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"var(--v2-pad-6)"},children:[e.jsx(Ct,{grade:t.siteGrade}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",gap:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0},children:y?"page grade · single-page audit":`site grade · ${t.pagesAudited} page${t.pagesAudited===1?"":"s"}`}),e.jsxs("p",{style:{margin:0,fontSize:11,lineHeight:1.4,color:"var(--v2-ink-tertiary)"},children:["Your ",e.jsx("strong",{children:"combined grade"})," — severity (your most serious finding) and breadth (how many of the 9 areas have issues) together, with a legal floor so a serious issue can't be averaged away. The Dev view shows the same letter."]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-3)",marginTop:"var(--v2-pad-5)"},children:[e.jsx("h1",{className:"v2-display",style:{fontSize:22,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0,lineHeight:1.25},children:(()=>{var B,M;if(((B=t.spotCheckGate)==null?void 0:B.status)==="pending"){const O=t.spotCheckGate;return`On track for A — answer ${O.unanswered.length} more content-meaning spot-check${O.unanswered.length===1?"":"s"} below to finalize your grade (${O.answered}/${O.total} done).`}const d=u+L,C=((M=t.blockingCriteria)==null?void 0:M.length)??0;return d===0&&C===0?"All clear — nothing open.":d===0&&C>0?`Visible findings clear — ${C} criteri${C===1?"on":"a"} still need${C===1?"s":""} your judgment.`:`${d} finding${d===1?"":"s"} to address.`})()}),e.jsx(Rt,{openCount:u,reviewCount:L,verifiedCount:T,axeCount:t.totalUniqueViolations,walkthroughCount:t.totalWalkthroughFindings??0,autoCount:V}),b&&!St(b,t.startUrl)&&e.jsxs("p",{className:"v2-mono",style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:["Active tab: ",b]}),e.jsxs("div",{style:{display:"flex",gap:"var(--v2-pad-2)",marginTop:"var(--v2-pad-2)",flexWrap:"wrap"},children:[y?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:v,title:"Re-audit the current page",children:"Re-audit this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>w(d=>!d),"aria-expanded":j,title:"Open crawl setup to audit the whole site instead",children:j?"Hide crawl options":"Crawl whole site"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary",onClick:q,disabled:z,title:"Re-aggregate this audit against your latest verdicts + acks. No re-crawl. Use this after marking criteria in the Coverage gaps panel.",children:z?"Regrading…":"Regrade"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>W({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!1),title:`Re-crawl ${t.startUrl} (same options) — full audit re-run, use when page code changed`,children:"Re-crawl"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:v,title:"Single-page audit of the active tab (no crawl)",children:"Just this page"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>W({startUrl:t.startUrl,maxPages:25,includeRegex:"",excludeRegex:""},!0),title:"Skip walkthroughs that previously passed or were human-verified",children:"Verify fixes only"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost",onClick:()=>w(d=>!d),"aria-expanded":j,children:j?"Hide options":"Adjust options"})]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>void De(),title:"Wipe these results so you can start fresh",style:{marginLeft:"auto"},children:"Clear results"})]}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx(ue,{})}),N&&e.jsx("p",{role:"alert",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-critical)"},children:N}),D&&!N&&e.jsx("p",{role:"status",style:{margin:"var(--v2-pad-2) 0 0",fontSize:11,color:"var(--v2-verified)"},children:D.prevGrade===D.nextGrade?`Regraded — grade unchanged at ${D.nextGrade}. Any verdict changes you made were already in this report.`:`Regraded — grade ${D.prevGrade} → ${D.nextGrade}.`})]}),(p==null?void 0:p.receipt)&&e.jsx(bt,{sealed:p}),e.jsx(Le,{}),e.jsx(_e,{}),j&&e.jsxs("div",{style:{marginTop:"var(--v2-pad-5)",paddingTop:"var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)",maxWidth:640},children:[e.jsx(xe,{initialUrl:t.startUrl,isRunning:g,onCrawl:d=>W(d,!1),onVerifyFixes:d=>W(d,!0),onAuditThisPage:v,reviewEnabled:E,onToggleReview:U}),e.jsx(be,{open:x.gateOpen,gaps:x.gaps,onRunFull:x.runFull,onQuickCheck:x.quickCheck,onCancel:x.cancel})]})]})}function St(t,a){try{return new URL(t).origin===new URL(a).origin}catch{return!1}}function Ct({grade:t}){if(t==="pending")return e.jsx("div",{"aria-label":"Grade pending — spot-checks outstanding",role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:40,lineHeight:1.05,fontWeight:600,color:"var(--v2-ink-secondary, #94a3b8)",letterSpacing:"-0.02em",textAlign:"center"},children:"Pending"})});const a={A:"var(--v2-grade-a)",B:"var(--v2-grade-b)",C:"var(--v2-grade-c)",D:"var(--v2-grade-d)",F:"var(--v2-grade-f)"};return e.jsx("div",{"aria-label":`Grade ${t}`,role:"img",style:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:140},children:e.jsx("span",{className:"v2-display",style:{fontSize:132,lineHeight:1,fontWeight:500,color:a[t],letterSpacing:"-0.04em",fontVariationSettings:'"opsz" 144'},children:t})})}function Rt({openCount:t,reviewCount:a,verifiedCount:r,axeCount:o,walkthroughCount:s,autoCount:l}){return e.jsxs("dl",{style:{display:"flex",gap:"var(--v2-pad-4)",flexWrap:"wrap",margin:0,color:"var(--v2-ink-secondary)",fontSize:12},children:[e.jsx(K,{term:"open",value:t,tone:t>0?"attention":"neutral"}),e.jsx(K,{term:"review",value:a,tone:a>0?"review":"neutral"}),e.jsx(K,{term:"verified",value:r,tone:r>0?"positive":"neutral"}),e.jsx("span",{style:{color:"var(--v2-ink-faint)"},children:"·"}),e.jsx(K,{term:"axe",value:o,tone:"neutral"}),e.jsx(K,{term:"walkthrough",value:s,tone:"neutral"}),l>0&&e.jsx(K,{term:"auto-contrast",value:l,tone:"neutral"})]})}function K({term:t,value:a,tone:r}){const o={attention:"var(--v2-critical)",review:"var(--v2-needs-review)",positive:"var(--v2-verified)",neutral:"var(--v2-ink-secondary)"};return e.jsxs("div",{style:{display:"inline-flex",alignItems:"baseline",gap:6},children:[e.jsx("dt",{className:"v2-eyebrow",style:{display:"inline",margin:0,color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("dd",{className:"v2-mono",style:{margin:0,fontWeight:600,fontSize:13,color:o[r],fontVariantNumeric:"tabular-nums"},children:a})]})}const Tt=new Set(["2.4.3","2.1.2","2.4.7","1.3.2","1.4.11","2.5.3"]);function ke(t){return Tt.has(t)}async function we(t){var o,s;const a=f.getState();if(a.componentId&&((o=a.results[0])==null?void 0:o.pageUrl)===t)return a.componentId;const r=await Ce();return((s=r==null?void 0:r.find(l=>l.url===t))==null?void 0:s.componentId)??null}async function Et(t,a){var n;const r=f.getState(),o=[],s=new Set,l=(g,y)=>{const h=`${g}::${y}`;s.has(h)||(s.add(h),o.push({componentId:g,matchKey:y}))};if(r.componentId&&r.results.length>0){const g=(n=r.results[0])==null?void 0:n.pageUrl,y=a.find(h=>h.url===g);if(y)for(const h of r.results)for(const p of h.violations)p.ruleId===t&&p.target.selector===y.selector&&l(r.componentId,p.matchKey)}const i=await Ce()??[];for(const g of a){const y=i.find(h=>h.url===g.url);if(y)for(const h of y.results)for(const p of h.violations)p.ruleId===t&&p.target.selector===g.selector&&l(y.componentId,p.matchKey)}return o}function At({row:t}){return e.jsxs("details",{style:{background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:6,overflow:"hidden"},children:[e.jsxs("summary",{style:{cursor:"pointer",padding:"var(--v2-pad-3) var(--v2-pad-4)",listStyle:"none",display:"flex",alignItems:"flex-start",gap:"var(--v2-pad-3)"},children:[e.jsx(Nt,{row:t}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(It,{row:t}),e.jsx(Ut,{row:t})]}),e.jsx(zt,{})]}),e.jsx("div",{style:{padding:"0 var(--v2-pad-4) var(--v2-pad-4)",borderTop:"1px solid var(--v2-border)"},children:e.jsx(Pt,{row:t})})]})}function Nt({row:t}){if(t.kind==="walkthrough-ack")return e.jsx("span",{className:"v2-chip v2-chip-verified","aria-label":"Status: human verified",children:"verified"});if(t.kind==="needs-review")return e.jsx("span",{className:"v2-chip v2-chip-review","aria-label":"Status: needs human review",children:"review"});if(t.kind==="auto-contrast")return e.jsx("span",{className:"v2-chip v2-chip-serious","aria-label":"Severity: serious, auto-resolved by pixel sampler",title:"Empirical pixel-contrast measurement, not an axe-confirmed violation. Human verification recommended.",children:"auto · serious"});if(t.kind==="walkthrough-fail")return e.jsx("span",{className:t.verdict==="fail"?"v2-chip v2-chip-serious":"v2-chip v2-chip-moderate","aria-label":`Severity: ${t.verdict}`,children:t.verdict});const a={critical:"v2-chip-critical",serious:"v2-chip-serious",moderate:"v2-chip-moderate",minor:"v2-chip-minor"};return e.jsx("span",{className:`v2-chip ${a[t.impact]}`,"aria-label":`Severity: ${t.impact}`,children:t.impact})}function It({row:t}){const a=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="needs-review"||t.kind==="axe"||t.kind==="auto-contrast"?t.criterion:null,r=t.kind==="walkthrough-fail"?t.verdict==="uncertain"?"AI could not decide this criterion — needs your manual verification.":"AI walkthrough fail on this criterion.":t.kind==="walkthrough-ack"?"Human-verified by an auditor.":t.kind==="needs-review"?t.description:t.kind==="auto-contrast"?"Empirical contrast measurement fell below threshold.":t.description;return e.jsxs("p",{style:{margin:0,marginBottom:4,color:"var(--v2-ink-primary)",fontSize:13,fontWeight:500,lineHeight:1.4},children:[a&&e.jsxs("span",{className:"v2-mono",style:{fontSize:11,fontWeight:600,color:"var(--v2-ink-tertiary)",marginRight:8},children:["WCAG ",a]}),r]})}function Ut({row:t}){const a=t.kind==="axe"||t.kind==="needs-review"?t.pages.length:1,r=t.kind==="axe"||t.kind==="needs-review"||t.kind==="auto-contrast"?t.selector:null,o=t.kind==="walkthrough-fail"||t.kind==="walkthrough-ack"||t.kind==="auto-contrast"?t.pageUrl:null;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",flexWrap:"wrap"},children:[r&&e.jsx("code",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",background:"var(--v2-bg-elev-2)",padding:"2px 6px",borderRadius:2,wordBreak:"break-all"},children:r}),o&&e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-tertiary)",wordBreak:"break-all"},children:o}),a>1&&e.jsxs("span",{className:"v2-eyebrow",style:{marginLeft:"auto"},children:["on ",a," pages"]})]})}function zt(){return e.jsx("span",{"aria-hidden":"true",style:{color:"var(--v2-ink-tertiary)",fontFamily:"var(--v2-mono)",fontSize:12,marginLeft:8,marginTop:2},children:"⏵"})}function Pt({row:t}){return t.kind==="walkthrough-fail"?e.jsx(Lt,{row:t}):t.kind==="walkthrough-ack"?e.jsx(_t,{row:t}):t.kind==="needs-review"?e.jsx(Wt,{row:t}):t.kind==="auto-contrast"?e.jsx(Dt,{row:t}):e.jsx(Gt,{row:t})}function Dt({row:t}){const[a,r]=c.useState(!1),[o,s]=c.useState(!1),[l,i]=c.useState(""),[n,g]=c.useState(!1),[y,h]=c.useState(!1),[p,b]=c.useState(null),k=Re(t.ruleId);async function j(){if(g(!0),b(null),!l.trim()){b("Note is required — explain why the empirical contrast measurement is wrong, or why this element is acceptable in context."),g(!1);return}try{const m=(await ct(t.pageUrl)).find(P=>P.ruleId===t.ruleId&&P.selector===t.selector),E={pageUrl:t.pageUrl,ruleId:t.ruleId,selector:t.selector,verdict:"pass",reasoning:`Human override: ${l.trim()}
|
|
3
|
+
|
|
4
|
+
(Original empirical reasoning: ${t.reasoning})`,resolvedAt:new Date().toISOString(),costUsd:0,wcagCriterion:t.criterion,inputHash:m==null?void 0:m.inputHash};await dt(E),h(!0),r(!1)}catch(w){b(w instanceof Error?w.message:String(w))}finally{g(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"Empirical measurement",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.reasoning})}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-3)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5,fontStyle:"italic"},children:"This finding came from a pixel-level screenshot diff of text against the rendered background, not from axe-core. Treat as a strong hint for human review, not a confirmed violation — gradients, translucent overlays, and animated backdrops can fool the sampler."}),y?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[k&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>s(w=>!w),"aria-expanded":o,children:o?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(w=>!w),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),o&&k&&e.jsx(Ee,{summary:k.summary,snippet:k.snippet}),a&&e.jsx(le,{note:l,setNote:i,busy:n,err:p,onConfirm:j,hint:"Why the empirical measurement is wrong, or why this is acceptable. Overrides the resolution to pass.",placeholder:"e.g., Text sits over a video poster image; static screenshot misreads the rendered background. Production poster passes 7:1."}),p&&!a&&e.jsx(ae,{message:p})]})]})}function Lt({row:t}){const[a,r]=c.useState(!1),[o,s]=c.useState(""),[l,i]=c.useState(!1),[n,g]=c.useState(!1),[y,h]=c.useState(!1),[p,b]=c.useState(null),[k,j]=c.useState(null),w=ke(t.criterion),m=Ge();async function E(){if(i(!0),j(null),!o.trim()){j("Note is required — explain how you manually verified this."),i(!1);return}try{const x=await we(t.pageUrl);if(!x){j("Could not find this page in the audit data. Re-run the audit and try again.");return}await lt({componentId:x,criterionId:t.criterion,pageUrl:t.pageUrl,note:o.trim(),acknowledgedAt:new Date().toISOString(),verdictAtAck:t.verdict}),g(!0),r(!1)}catch(x){j(x instanceof Error?x.message:String(x))}finally{i(!1)}}async function P(){var x;h(!0),b(null),j(null);try{const $=(x=(await chrome.tabs.query({active:!0,currentWindow:!0}))[0])==null?void 0:x.id;if(!$){j("Open the audited page in your active tab to re-run.");return}const U=await we(t.pageUrl);if(!U){j("Could not find this page in the audit data.");return}if(!ke(t.criterion)){j(`Re-run is only available for interactive criteria. ${t.criterion} is not supported.`);return}const R=await S({type:"INTERACTIVE_AUDIT_REQUEST",criterionId:t.criterion,tabId:$,componentId:U,pageUrl:t.pageUrl});if(!R.ok){j(R.error??"Re-run failed.");return}b(`Re-run verdict: ${R.verdict??"unknown"}. Re-audit the page to refresh this list.`)}catch(F){j(F instanceof Error?F.message:String(F))}finally{h(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"AI reasoning",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),n?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[w&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:P,disabled:y||!m,title:m?void 0:"AI walkthroughs need an Anthropic API key. Add one in Settings → AI.",children:y?"Re-running…":"Re-run walkthrough"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>r(x=>!x),"aria-expanded":a,children:a?"Cancel":"Mark verified manually"})]}),p&&e.jsx("p",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:11,lineHeight:1.5},children:p}),a&&e.jsx(le,{note:o,setNote:s,busy:l,err:k,onConfirm:E,hint:"Explain what you checked. This goes into the forensic record.",placeholder:"e.g., Verified — focus indicator visible on every interactive control under :focus-visible; tested with keyboard nav."}),k&&!a&&e.jsx(ae,{message:k})]})]})}function _t({row:t}){return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[e.jsx(te,{label:"What the human verified",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t.reasoning})}),e.jsxs("p",{style:{color:"var(--v2-ink-tertiary)",fontSize:11,margin:0,marginTop:"var(--v2-pad-2)"},children:["Original AI verdict: ",e.jsx("strong",{children:t.verdict}),". Now treated as pass for conformance."]})]})}function Wt({row:t}){return e.jsx(Te,{row:t,kind:"needs-review"})}function Gt({row:t}){return e.jsx(Te,{row:t,kind:"axe"})}function Te({row:t,kind:a}){const[r,o]=c.useState(!1),[s,l]=c.useState(""),[i,n]=c.useState(!1),[g,y]=c.useState(!1),[h,p]=c.useState(!1),[b,k]=c.useState(null),j=Re(t.ruleId);async function w(){if(n(!0),k(null),!s.trim()){k(a==="needs-review"?"Note is required — explain your review judgment.":"Note is required — explain why this isn't actually an issue in your context."),n(!1);return}try{const m=await Et(t.ruleId,t.pages);if(m.length===0){k("Could not find this finding in the persisted audit data. Re-run the audit and try again.");return}for(const E of m)await ut({componentId:E.componentId,matchKey:E.matchKey,ruleId:t.ruleId,note:s.trim()});y(!0),o(!1)}catch(m){k(m instanceof Error?m.message:String(m))}finally{n(!1)}}return e.jsxs("div",{style:{paddingTop:"var(--v2-pad-3)"},children:[a==="needs-review"&&t.failureSummary&&e.jsx(te,{label:"AI assessment",children:e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap"},children:t.failureSummary})}),e.jsx(te,{label:"Affected",children:e.jsxs("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:4},children:[t.pages.slice(0,8).map(m=>e.jsx("li",{children:e.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",textDecoration:"underline",textDecorationColor:"var(--v2-ink-faint)",textUnderlineOffset:2},children:m.url})},m.url)),t.pages.length>8&&e.jsxs("li",{className:"v2-eyebrow",children:["+ ",t.pages.length-8," more"]})]})}),g?e.jsx(ce,{}):e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[a==="axe"&&j&&e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>p(m=>!m),"aria-expanded":h,children:h?"Hide fix recipe":"Show fix recipe"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(m=>!m),"aria-expanded":r,children:r?"Cancel":"Mark verified manually"})]}),h&&j&&e.jsx(Ee,{summary:j.summary,snippet:j.snippet}),r&&e.jsx(le,{note:s,setNote:l,busy:i,err:b,onConfirm:w,hint:a==="needs-review"?"Your review judgment. Goes into the forensic record.":"Why this isn't actually an issue in your context. Goes into the forensic record.",placeholder:a==="needs-review"?"e.g., Verified — image is a portrait of the named founder; alt text correctly identifies subject and role.":'e.g., This element is decorative; aria-hidden + role="presentation" applied via design system.',confirmLabel:`Confirm — acknowledge on ${t.pages.length} page${t.pages.length===1?"":"s"}`}),b&&!r&&e.jsx(ae,{message:b})]})]})}function le({note:t,setNote:a,busy:r,err:o,onConfirm:s,hint:l,placeholder:i,confirmLabel:n="Confirm acknowledgement"}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border-strong)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:"verification note · required"}),e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)"},children:l}),e.jsx("textarea",{value:t,onChange:g=>a(g.target.value),placeholder:i,rows:3,style:{width:"100%",fontFamily:"var(--v2-body)",fontSize:12,lineHeight:1.5,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",color:"var(--v2-ink-primary)",border:"1px solid var(--v2-border-strong)",borderRadius:4,resize:"vertical",minHeight:70},autoFocus:!0}),o&&e.jsx(ae,{message:o}),e.jsx("div",{style:{marginTop:"var(--v2-pad-2)"},children:e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:s,disabled:r||!t.trim(),children:r?"Saving…":n})})]})}function Ee({summary:t,snippet:a}){return e.jsxs("div",{style:{marginTop:"var(--v2-pad-3)",padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-verified)",borderRadius:4,background:"rgba(15, 143, 94, 0.06)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6,color:"var(--v2-verified)"},children:"how to fix"}),e.jsx("p",{style:{margin:0,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.6},children:t}),a&&e.jsx("pre",{className:"v2-mono",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"var(--v2-bg)",border:"1px solid var(--v2-border)",borderRadius:3,fontSize:11,color:"var(--v2-ink-primary)",overflowX:"auto",whiteSpace:"pre"},children:e.jsx("code",{children:a})})]})}function ce(){return e.jsxs("div",{role:"status",style:{marginTop:"var(--v2-pad-2)",padding:"var(--v2-pad-2) var(--v2-pad-3)",background:"rgba(15, 143, 94, 0.08)",border:"1px solid var(--v2-verified)",borderRadius:4,color:"var(--v2-verified)",fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:600},children:"✓ Acknowledged."})," ","The ack is saved. Re-audit or re-crawl to see this finding drop out of the list."]})}function ae({message:t}){return e.jsx("p",{role:"alert",style:{marginTop:"var(--v2-pad-2)",marginBottom:0,padding:"var(--v2-pad-2) var(--v2-pad-3)",border:"1px solid var(--v2-critical)",background:"rgba(207, 44, 44, 0.06)",borderRadius:4,color:"var(--v2-critical)",fontSize:11,lineHeight:1.4},children:t})}function te({label:t,children:a}){return e.jsxs("div",{style:{marginBottom:"var(--v2-pad-3)"},children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:6},children:t}),a]})}function de({children:t}){return e.jsx("div",{style:{display:"flex",gap:"var(--v2-pad-2)",flexWrap:"wrap",marginTop:"var(--v2-pad-2)"},children:t})}function Ft(){const{report:t,resolvedFails:a}=oe(),[r,o]=c.useState("open"),s=c.useMemo(()=>t?$t(t.pages,t.findingGroups??[],a):[],[t,a]),l=c.useMemo(()=>r==="all"?s:s.filter(n=>r==="verified"?n.kind==="walkthrough-ack":r==="review"?n.kind==="needs-review"||n.kind==="walkthrough-fail"&&n.verdict==="uncertain":r==="open"?n.kind==="axe"||n.kind==="walkthrough-fail"&&n.verdict==="fail"||n.kind==="auto-contrast":!0),[s,r]);if(!t)return null;const i={all:s.length,open:s.filter(n=>n.kind==="axe"||n.kind==="walkthrough-fail"&&n.verdict==="fail"||n.kind==="auto-contrast").length,review:s.filter(n=>n.kind==="needs-review"||n.kind==="walkthrough-fail"&&n.verdict==="uncertain").length,verified:s.filter(n=>n.kind==="walkthrough-ack").length};return e.jsxs("section",{"aria-labelledby":"findings-heading",style:{padding:"var(--v2-pad-5) var(--v2-pad-5) var(--v2-pad-7)"},children:[e.jsxs("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"var(--v2-pad-3)",marginBottom:"var(--v2-pad-4)",flexWrap:"wrap"},children:[e.jsx("h2",{id:"findings-heading",className:"v2-display",style:{fontSize:20,fontWeight:500,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)",margin:0},children:"Findings"}),e.jsx(Mt,{filter:r,setFilter:o,counts:i})]}),l.length===0?e.jsx(Ot,{filter:r}):e.jsx("ul",{"aria-label":`${r} findings, ${l.length} items`,style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:l.map((n,g)=>e.jsx("li",{style:{animation:`v2-row-in 240ms ease ${Math.min(g,12)*30}ms both`},children:e.jsx(At,{row:n})},n.key))})]})}function Mt({filter:t,setFilter:a,counts:r}){const o=[{id:"open",label:"Open"},{id:"review",label:"Review"},{id:"verified",label:"Verified"},{id:"all",label:"All"}];return e.jsx("div",{role:"tablist","aria-label":"Filter findings",style:{display:"inline-flex",gap:4,background:"var(--v2-bg-elev)",padding:3,borderRadius:6,border:"1px solid var(--v2-border)"},children:o.map(s=>{const l=t===s.id;return e.jsxs("button",{type:"button",role:"tab","aria-selected":l,onClick:()=>a(s.id),style:{fontFamily:"var(--v2-body)",fontSize:11,padding:"5px 10px",borderRadius:4,border:"none",cursor:"pointer",background:l?"var(--v2-bg-elev-2)":"transparent",color:l?"var(--v2-ink-primary)":"var(--v2-ink-secondary)",fontWeight:l?600:500,transition:"background 120ms ease, color 120ms ease",display:"inline-flex",alignItems:"baseline",gap:5},children:[s.label,e.jsx("span",{className:"v2-mono",style:{fontSize:10,color:"var(--v2-ink-tertiary)",fontVariantNumeric:"tabular-nums"},children:r[s.id]})]},s.id)})})}function Ot({filter:t}){const r={open:{headline:"Nothing open.",sub:"No axe violations or AI walkthrough failures across the audited pages. Switch to All to see everything, or to Verified for a record of acknowledged items."},review:{headline:"No items awaiting review.",sub:"AI walkthroughs returned definitive verdicts (or human verifications) for every criterion that needed judgment."},verified:{headline:"No human verifications recorded.",sub:"When you mark a walkthrough finding as manually verified, it appears here with your note + timestamp."},all:{headline:"Nothing to show.",sub:"No audit data yet — run a scan to begin."}}[t];return e.jsxs("div",{role:"status","aria-live":"polite",style:{padding:"var(--v2-pad-6) var(--v2-pad-4)",textAlign:"center",border:"1px dashed var(--v2-border)",borderRadius:6},children:[e.jsx("p",{className:"v2-display",style:{fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)",margin:0,marginBottom:"var(--v2-pad-2)"},children:r.headline}),e.jsx("p",{style:{color:"var(--v2-ink-secondary)",margin:0,maxWidth:440,marginInline:"auto"},children:r.sub})]})}function $t(t,a,r=[]){const o=[];for(const i of a)i.needsReview?o.push({kind:"needs-review",key:`nr::${i.ruleId}::${i.representativeSelector}`,criterion:i.wcagCriterion,ruleId:i.ruleId,description:i.axeDescription,selector:i.representativeSelector,failureSummary:i.failureSummary,pages:i.pages,group:i}):o.push({kind:"axe",key:`axe::${i.ruleId}::${i.representativeSelector}`,criterion:i.wcagCriterion,ruleId:i.ruleId,impact:i.impact,description:i.axeDescription,selector:i.representativeSelector,pages:i.pages,isShared:i.isShared});const s=new Set;for(const i of t){for(const n of i.walkthroughFindings??[]){const g=`wt-fail::${n.criterionId}::${n.pageUrl}`;s.has(g)||(s.add(g),o.push({kind:"walkthrough-fail",key:g,criterion:n.criterionId,verdict:n.verdict,impact:n.impact,reasoning:n.reasoning,pageUrl:n.pageUrl}))}for(const n of i.walkthroughAcknowledgements??[]){const g=`wt-ack::${n.criterionId}::${n.pageUrl}`;s.has(g)||(s.add(g),o.push({kind:"walkthrough-ack",key:g,criterion:n.criterionId,verdict:n.verdict,reasoning:n.reasoning,pageUrl:n.pageUrl}))}}for(const i of r)o.push({kind:"auto-contrast",key:`auto::${i.ruleId}::${i.selector}::${i.pageUrl}`,criterion:i.wcagCriterion??"1.4.3",ruleId:i.ruleId,impact:"serious",selector:i.selector,pageUrl:i.pageUrl,reasoning:i.reasoning});const l={critical:0,serious:1,moderate:2,minor:3,"needs-review":4,ack:5};return o.sort((i,n)=>{const g=i.kind==="walkthrough-ack"?l.ack:i.kind==="needs-review"?l["needs-review"]:l[i.impact],y=n.kind==="walkthrough-ack"?l.ack:n.kind==="needs-review"?l["needs-review"]:l[n.impact];return(g??99)-(y??99)}),o}function Ht({open:t,onClose:a}){const{report:r}=oe(),o=f(v=>v.siteCrawlReport),s=f(v=>v.results),l=f(v=>v.componentId),i=f(v=>v.delta),n=!!o,g=n||s.length>0,y=f(v=>v.tier),h=v=>!Me(y,v),[p,b]=c.useState(!1),k=()=>b(!0),j=n?"ai-prompt-site-crawl":"ai-prompt",w=Fe({storeComponentId:l,storeCrawlReport:o,pageUrls:(r==null?void 0:r.pages.map(v=>v.url))??[]}),[m,E]=c.useState({}),P=c.useRef(null);c.useEffect(()=>{var z;if(!t)return;const v=A=>{A.key==="Escape"&&a()};return document.addEventListener("keydown",v),(z=P.current)==null||z.focus(),()=>document.removeEventListener("keydown",v)},[t,a]);function x(v,z){E(A=>({...A,[v]:z}))}async function F(){x("ai-prompt",{state:"busy"});try{if(n){const v=await S({type:"EXPORT_REQUEST",format:"ai-prompt-site-crawl",results:[],...r?{siteCrawlReport:r}:{}});if(!(v!=null&&v.content))throw new Error("Empty response");await navigator.clipboard.writeText(v.content),Ne(v.content,"ai-fixer-prompt.md","text/markdown"),x("ai-prompt",{state:"done",message:"Copied to clipboard + saved ai-fixer-prompt.md to Downloads."})}else{if(!s.length)throw new Error("No audit results yet");await gt({results:s,componentId:l??null,delta:i}),x("ai-prompt",{state:"done",message:"Copied to clipboard + opened in a new tab."})}}catch(v){x("ai-prompt",{state:"error",message:v instanceof Error?v.message:String(v)})}}async function $(){x("html",{state:"busy"});try{if(n&&r){const{renderSiteReportHtml:v}=await re(async()=>{const{renderSiteReportHtml:N}=await import("./site-report-renderer-DelUUXsi.js");return{renderSiteReportHtml:N}},__vite__mapDeps([0,1,2,3,4,5])),z=await pe([r.startUrl]).catch(()=>[]),A=v(r,void 0,z);await se(A,"site-report.html","text/html"),x("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}else{if(!s.length)throw new Error("No audit results yet");const{toHtmlPrint:v}=await re(async()=>{const{toHtmlPrint:A}=await import("./scheduled-audit-runner-BJXKsQZK.js").then(N=>N.ba);return{toHtmlPrint:A}},__vite__mapDeps([1,2,3,4,5])),z=v(s,i??void 0);await se(z,"page-report.html","text/html"),x("html",{state:"done",message:"Opened in a new tab — Save as PDF or use Cmd/Ctrl+S."})}}catch(v){x("html",{state:"error",message:v instanceof Error?v.message:String(v)})}}async function U(v,z,A){x(v,{state:"busy"});try{const N=await S({type:"EXPORT_REQUEST",format:v,results:n?[]:s,...i&&!n?{delta:i}:{},...n?{siteCrawlSource:!0}:{},...w?{auditTargetId:w}:{}});if(!(N!=null&&N.content))throw new Error("Empty response");await se(N.content,A,"text/html"),x(v,{state:"done",message:`${z} opened in a new tab.`})}catch(N){x(v,{state:"error",message:N instanceof Error?N.message:String(N)})}}async function W(){const{createZip:v}=await re(async()=>{const{createZip:I}=await import("./zip-encoder-CtULHXx_.js");return{createZip:I}},[]),{renderSiteReportHtml:z}=await re(async()=>{const{renderSiteReportHtml:I}=await import("./site-report-renderer-DelUUXsi.js");return{renderSiteReportHtml:I}},__vite__mapDeps([0,1,2,3,4,5])),A=[],N=n?[{format:"ai-prompt-site-crawl",filename:"ai-fixer-prompt.md"},{format:"defense-bundle",filename:"defense-bundle.html"},{format:"deposition-packet",filename:"deposition-packet.html"},{format:"evidence-bundle",filename:"evidence-bundle.html"},{format:"vpat",filename:"vpat.html"},{format:"conformance-crosswalk",filename:"conformance-crosswalk.html"},{format:"methodology-doc",filename:"methodology-doc.html"},{format:"executive-report",filename:"executive-report.html"}]:[{format:"ai-prompt",filename:"ai-fixer-prompt.md"},{format:"html-print",filename:"page-report.html"}],H=N.length+(n&&r?1:0);let D=0;x("zip",{state:"busy",progress:{current:0,total:H,label:"Starting…"}});try{if(n&&r){D++,x("zip",{state:"busy",progress:{current:D,total:H,label:"site-report.html (client-side)"}});try{const T=await pe([r.startUrl]).catch(()=>[]);A.push({name:"site-report.html",content:z(r,void 0,T)})}catch{}}for(const{format:T,filename:L}of N){D++,x("zip",{state:"busy",progress:{current:D,total:H,label:L}});try{const d=await S({type:"EXPORT_REQUEST",format:T,results:n?[]:s,...i&&!n?{delta:i}:{},...n?{siteCrawlSource:!0}:{},...w?{auditTargetId:w}:{}});d!=null&&d.content&&A.push({name:L,content:d.content})}catch{}}if(A.length===0)throw new Error("All exports failed");const I=v(A),q=new Blob([I],{type:"application/zip"}),V=URL.createObjectURL(q),u=document.createElement("a");u.href=V,u.download=n?"wcagcheckr-site-bundle.zip":"wcagcheckr-page-bundle.zip",u.click(),setTimeout(()=>URL.revokeObjectURL(V),6e4),x("zip",{state:"done",message:`Downloaded ${A.length} file${A.length===1?"":"s"}.`})}catch(I){x("zip",{state:"error",message:I instanceof Error?I.message:String(I)})}}function R(v){f.getState().setView(v),f.getState().setUserMode("dev"),S({type:"SETTINGS_SET",key:"userMode",value:"dev"}),a()}function Q(){S({type:"OPEN_SETTINGS"})}return t?e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Tools and exports",style:{position:"fixed",inset:0,zIndex:50,display:"flex"},children:[e.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(26, 20, 16, 0.35)",backdropFilter:"blur(2px)"},"aria-hidden":"true"}),e.jsxs("div",{style:{position:"relative",marginLeft:"auto",width:"min(100%, 440px)",height:"100%",background:"var(--v2-bg)",borderLeft:"1px solid var(--v2-border-strong)",boxShadow:"-12px 0 28px rgba(26, 20, 16, 0.18)",overflowY:"auto",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{position:"sticky",top:0,background:"var(--v2-bg)",borderBottom:"1px solid var(--v2-border)",padding:"var(--v2-pad-4) var(--v2-pad-5)",display:"flex",alignItems:"center",justifyContent:"space-between",zIndex:1},children:[e.jsx("h2",{className:"v2-display",style:{margin:0,fontSize:18,fontWeight:500,color:"var(--v2-ink-primary)"},children:"Tools"}),e.jsx("button",{ref:P,type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:a,"aria-label":"Close tools drawer",children:"Close"})]}),e.jsxs("div",{style:{padding:"var(--v2-pad-5)",display:"flex",flexDirection:"column",gap:"var(--v2-pad-5)"},children:[!g&&e.jsx("p",{style:{margin:0,padding:"var(--v2-pad-3) var(--v2-pad-4)",background:"var(--v2-bg-elev)",border:"1px solid var(--v2-border)",borderRadius:4,color:"var(--v2-ink-secondary)",fontSize:12,lineHeight:1.5},children:"Most tools need an audit to act on. Run an audit first, then come back here."}),g&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:"AI fixer",children:e.jsx(G,{status:m["ai-prompt"],label:n?"Copy site-wide AI fix prompt":"Copy AI fix prompt",description:n?"Multi-page markdown for ChatGPT/Claude/Copilot. Site-wide summary, consistency findings, per-page violations + fix recipes.":"Markdown for ChatGPT/Claude/Copilot. Every violation with fix recipes, AI-resolved fails, acknowledged context.",onClick:F,locked:h(j),onUpgrade:k})}),e.jsxs(Y,{title:"Reports",children:[e.jsx(G,{status:m.html,label:n?"Site report (HTML)":"Page report (HTML)",description:n?"Full crawl summary with per-page grades, top violations, consistency findings. Print-ready.":"Print-friendly single-page report.",onClick:$}),e.jsx(G,{status:m["executive-report"],label:"Executive report",description:"Hero grade + framing, top risks, next steps. For non-technical readers.",onClick:()=>U("executive-report","Executive report","executive-report.html"),locked:h("executive-report"),onUpgrade:k}),n&&e.jsx(G,{status:m["ticket-bundle"],label:"Ticket bundle",description:"Markdown formatted for paste into Linear / Jira / GitHub Issues — one ticket per finding, sorted by severity.",onClick:()=>U("ticket-bundle","Ticket bundle","ticket-bundle.md")})]}),e.jsxs(Y,{title:"Compliance & legal",children:[e.jsx(G,{status:m["defense-bundle"],label:"Defense bundle",description:"Anchored chain-of-custody evidence package. Use in pre-litigation.",onClick:()=>U("defense-bundle","Defense bundle","defense-bundle.html"),locked:h("defense-bundle"),onUpgrade:k}),e.jsx(G,{status:m["deposition-packet"],label:"Deposition packet",description:"Full evidence bundle — anchor, receipts, fingerprints, signing cert.",onClick:()=>U("deposition-packet","Deposition packet","deposition-packet.html"),locked:h("deposition-packet"),onUpgrade:k}),e.jsx(G,{status:m.vpat,label:"VPAT",description:"Voluntary Product Accessibility Template. Procurement-ready.",onClick:()=>U("vpat","VPAT","vpat.html"),locked:h("vpat"),onUpgrade:k}),e.jsx(G,{status:m["conformance-crosswalk"],label:"Conformance crosswalk",description:"WCAG ↔ Section 508 ↔ EN 301 549 mapping.",onClick:()=>U("conformance-crosswalk","Conformance crosswalk","conformance-crosswalk.html"),locked:h("conformance-crosswalk"),onUpgrade:k}),e.jsx(G,{status:m["methodology-doc"],label:"Methodology PDF",description:"Auditor-explainable methodology — what was tested, how, with what tools.",onClick:()=>U("methodology-doc","Methodology doc","methodology-doc.html"),locked:h("methodology-doc"),onUpgrade:k}),e.jsx(G,{status:m["evidence-bundle"],label:"Evidence bundle",description:"Lighter than defense bundle — audit records + summary.",onClick:()=>U("evidence-bundle","Evidence bundle","evidence-bundle.html"),locked:h("evidence-bundle"),onUpgrade:k})]}),e.jsx(Y,{title:"Bulk",children:e.jsx(G,{status:m.zip,label:n?"Download all as ZIP":"Download both as ZIP",description:n?"Every format above bundled in one ZIP. Runs each export in sequence.":"AI fix prompt + page report in one ZIP.",onClick:W,locked:h(n?"defense-bundle":"ai-prompt"),onUpgrade:k})})]}),e.jsxs(Y,{title:"Specialized views (classic UI)",children:[e.jsx("p",{style:{margin:0,marginBottom:"var(--v2-pad-2)",fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:`These surfaces aren't ported to v2 yet — clicking opens them in the classic UI. Return to v2 anytime via the "Try v2 UI" button in the classic Header.`}),e.jsx(_,{label:"State matrix",description:"Per-state findings grid (hover · focus · dark · RTL · etc.)",onClick:()=>R("matrix")}),e.jsx(_,{label:"Per-area compliance",description:"9 sub-grade areas with drill-in: Color & contrast, Keyboard, etc.",onClick:()=>R("report")}),e.jsx(_,{label:"Baseline delta",description:"New vs. persistent vs. fixed vs. acknowledged since the last baseline.",onClick:()=>R("delta")}),e.jsx(_,{label:"Forensic log",description:"Anchored audit history with chain-of-custody.",onClick:()=>R("forensic")}),e.jsx(_,{label:"Risk dashboard",description:"Lawsuit / conformance risk tiers with prioritized actions.",onClick:()=>R("risk")}),e.jsx(_,{label:"WCAG 3 mapping",description:"Outcome-level grouping per WCAG 3 snapshot.",onClick:()=>R("wcag3")}),e.jsx(_,{label:"WCAG-EM verdicts",description:"Formal per-criterion verdict map.",onClick:()=>R("compliance")}),e.jsx(_,{label:"Schedules",description:"Recurring audit management with email alerts.",onClick:()=>R("schedules")}),e.jsx(_,{label:"Copilot chat",description:"Anthropic-powered Q&A over your audit context.",onClick:()=>R("copilot")}),e.jsx(_,{label:"Accessibility tree",description:"Inspect the live aria tree as assistive tech sees it.",onClick:()=>R("ax-tree")}),e.jsx(_,{label:"Design tokens",description:"CSS-token / design-system audit.",onClick:()=>R("tokens")}),e.jsx(_,{label:"Guided audit",description:"13 manual IGT workflows (keyboard, screen reader, etc.).",onClick:()=>R("guided")}),e.jsx(_,{label:"Per-component scorecard",description:"Custom rules, baselines, per-component drill-in.",onClick:()=>R("scorecard")}),e.jsx(_,{label:"User journey flows",description:"Multi-step audit recordings.",onClick:()=>R("flows")}),e.jsx(_,{label:"Activity / IGT runs",description:"Manual workflow run history.",onClick:()=>R("activity")})]}),e.jsx(Y,{title:"Settings",children:e.jsx(G,{status:void 0,label:"Open settings",description:"Matrix preset, AI config, axe rule overrides, breakpoints, auto-export.",onClick:Q})})]})]}),e.jsx(Se,{open:p,onClose:()=>b(!1)})]}):null}async function se(t,a,r){const{body:o,type:s}=Ie(t,r),l=new Blob([o],{type:s}),i=URL.createObjectURL(l);try{await chrome.tabs.create({url:i})}catch{const n=document.createElement("a");n.href=i,n.download=a,n.click()}setTimeout(()=>URL.revokeObjectURL(i),6e4)}function Y({title:t,children:a}){return e.jsxs("div",{children:[e.jsx("p",{className:"v2-eyebrow",style:{margin:0,marginBottom:"var(--v2-pad-2)",color:"var(--v2-ink-tertiary)"},children:t}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)"},children:a})]})}function G({label:t,description:a,status:r,onClick:o,locked:s=!1,onUpgrade:l}){const i=(r==null?void 0:r.state)==="busy",n=(r==null?void 0:r.state)==="done",g=(r==null?void 0:r.state)==="error";return s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-warning, #f59e0b)",borderRadius:4,background:"var(--v2-warning-bg, rgba(245,158,11,0.08))"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:["🔒 ",t]}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-sm",onClick:l,children:"Upgrade"})]}),e.jsxs("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:[e.jsx("strong",{children:"Upgrade to unlock"}),a?` · ${a}`:""]})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--v2-pad-3)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--v2-ink-primary)"},children:t}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:o,disabled:i,children:i?"Working…":n?"Run again":"Run"})]}),a&&e.jsx("p",{style:{margin:0,fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a}),i&&(r==null?void 0:r.progress)&&e.jsxs("p",{role:"status","aria-live":"polite",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-ink-secondary)"},children:[r.progress.current,"/",r.progress.total," — ",r.progress.label??""]}),n&&(r==null?void 0:r.message)&&e.jsxs("p",{role:"status",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-verified)"},children:["✓ ",r.message]}),g&&(r==null?void 0:r.message)&&e.jsx("p",{role:"alert",style:{margin:0,marginTop:4,fontSize:11,color:"var(--v2-critical)"},children:r.message})]})}function _({label:t,description:a,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,style:{appearance:"none",cursor:"pointer",display:"flex",flexDirection:"column",gap:4,padding:"var(--v2-pad-3) var(--v2-pad-4)",border:"1px solid var(--v2-border)",borderRadius:4,background:"var(--v2-bg)",textAlign:"left",font:"inherit",color:"var(--v2-ink-primary)",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:500},children:[t," →"]}),e.jsx("span",{style:{fontSize:11,color:"var(--v2-ink-tertiary)",lineHeight:1.5},children:a})]})}const je="https://wcagcheckr.com/tutorials/";function Bt(){var l,i;const t=f(n=>n.siteCrawlReport),a=f(n=>n.results),[r,o]=c.useState(!1),s=(t==null?void 0:t.startUrl)??((l=a[0])==null?void 0:l.pageUrl)??((i=a[0])==null?void 0:i.scope)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("header",{role:"banner",style:{display:"flex",flexDirection:"column",gap:"var(--v2-pad-2)",padding:"var(--v2-pad-3) var(--v2-pad-5)",borderBottom:"1px solid var(--v2-border)",background:"var(--v2-bg)"},children:[e.jsx("a",{href:"#main-content",className:"v2-skip-link",style:{position:"absolute",left:-9999},onFocus:n=>{n.currentTarget.style.left="var(--v2-pad-4)",n.currentTarget.style.top="var(--v2-pad-4)"},onBlur:n=>{n.currentTarget.style.left="-9999px"},children:"Skip to main content"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-3)",minWidth:0,minHeight:28},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)"},children:[e.jsx("span",{className:"v2-display",style:{fontSize:18,fontWeight:600,letterSpacing:"-0.01em",color:"var(--v2-ink-primary)"},children:"wcagcheckr"}),e.jsx("span",{className:"v2-eyebrow",children:"v2"})]}),s&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--v2-pad-2)",minWidth:0,flex:1},children:[e.jsx("span",{className:"v2-eyebrow",children:"scope"}),e.jsx("span",{className:"v2-mono",style:{fontSize:11,color:"var(--v2-ink-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:s,children:s})]}),e.jsx("div",{style:{marginLeft:"auto"},children:e.jsx(Oe,{})})]}),e.jsxs("nav",{"aria-label":"Application",style:{display:"flex",alignItems:"center",gap:"var(--v2-pad-2)",justifyContent:"flex-end"},children:[e.jsx("a",{href:je,className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:n=>{n.preventDefault(),Ue(je)},title:"Open the wcagcheckr tutorials in a new tab",children:"Tutorials"}),e.jsx($e,{}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-primary v2-btn-sm",onClick:()=>o(!0),"aria-label":"Open tools and exports drawer","aria-expanded":r,title:"Exports, baselines, schedules, forensic log, settings, more",children:"Tools"}),e.jsx("button",{type:"button",className:"v2-btn v2-btn-ghost v2-btn-sm",onClick:()=>void S({type:"OPEN_SETTINGS"}),"aria-label":"Open settings",title:"Settings",children:"⚙"})]})]}),e.jsx(Ht,{open:r,onClose:()=>o(!1)})]})}function Vt(){return c.useEffect(()=>{const t=He(),r=new URLSearchParams(window.location.search).get("context")==="overlay"?null:chrome.runtime.connect({name:"sidepanel-tracker"}),o=Be();Ve({forceRefresh:!0}).catch(()=>{}),qe().catch(()=>{}),Ke().catch(()=>{}),Ye().catch(()=>{}),Qe().catch(()=>{}),Ze().catch(()=>{}),pt().then(l=>{f.getState().setAcknowledgedKeys(new Set(l.map(i=>i.matchKey)))}).catch(()=>{});let s=!1;return vt().then(l=>{s||l&&f.setState(i=>i.siteCrawlStatus==="running"?{siteCrawlReport:l}:{siteCrawlReport:l,siteCrawlStatus:"complete"})}).catch(()=>{}),()=>{s=!0,o();try{t.disconnect()}catch{}try{r==null||r.disconnect()}catch{}}},[]),e.jsxs("div",{className:"v2-root",children:[e.jsx(Bt,{}),e.jsx(Xe,{}),e.jsx(Je,{}),e.jsxs("main",{id:"main-content","aria-label":"wcagcheckr findings",children:[e.jsx(jt,{}),e.jsx(Ft,{})]})]})}function qt({persona:t,children:a}){const r=t==="power"?"Power user":"Dev",[o,s]=c.useState(!1),l=c.useRef(null);c.useEffect(()=>{const n=l.current;n&&(n.inert=!0)},[]);function i(){chrome.storage.local.set({userMode:"owner",v2UiEnabled:!1}),S({type:"SETTINGS_SET",key:"userMode",value:"owner"})}return e.jsxs("div",{className:"relative h-screen overflow-hidden",children:[e.jsx("div",{ref:l,"aria-hidden":"true",className:"h-full overflow-hidden blur-[2px] opacity-50 pointer-events-none select-none",children:a}),e.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"locked-persona-title",className:"max-w-sm w-full bg-white border border-slate-200 rounded-xl shadow-xl p-5 space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl","aria-hidden":"true",children:"🔒"}),e.jsxs("h2",{id:"locked-persona-title",className:"text-base font-semibold text-slate-900",children:[r," mode is a paid feature"]})]}),e.jsxs("p",{className:"text-xs text-slate-600 leading-snug",children:[r," mode unlocks the full WCAG findings, fix recipes, and exports for every page — that needs a license. On the free plan, ",e.jsx("strong",{children:"Owner mode"})," ","(the lawsuit-target screener) is yours to use, no license required."]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:()=>s(!0),className:"w-full text-sm px-4 py-2 bg-brand-500 text-white rounded hover:bg-brand-600 font-medium",children:"Upgrade to unlock →"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void S({type:"OPEN_SETTINGS"}),className:"text-xs text-slate-600 hover:text-slate-900 underline-offset-2 hover:underline",children:"I have a license token"}),e.jsx("button",{type:"button",onClick:i,className:"text-xs font-medium text-brand-700 hover:underline",children:"← Back to Owner mode"})]})]})]})}),e.jsx(Se,{open:o,onClose:()=>s(!1)})]})}function Kt(){return e.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center min-h-screen gap-4 px-6 py-10 text-center",children:[e.jsx("div",{className:"text-3xl","aria-hidden":"true",children:"📡"}),e.jsx("h1",{className:"text-base font-semibold text-slate-800",children:"Internet connection required"}),e.jsx("p",{className:"max-w-xs text-sm leading-relaxed text-slate-600",children:"wcagcheckr needs to reach its license server to run. Connect to the internet and reload."}),e.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"rounded bg-slate-800 px-4 py-1.5 text-sm font-medium text-white hover:bg-slate-700",children:"Reload"})]})}at("side-panel");function Yt(){const[t,a]=c.useState(null),[r,o]=c.useState(!1),[,s]=c.useState(0),[l,i]=c.useState(null),[n,g]=c.useState(!1),[y,h]=c.useState(!1);if(c.useEffect(()=>{let b=!1;(async()=>{if(await Promise.all([ve(),me()]),!b){if(o(!0),await ge()){b||i(!0),Promise.all([he(),fe()]).then(()=>{b||s(w=>w+1)}).catch(()=>{});return}await Promise.all([he(),fe()]).catch(()=>{}),!b&&(s(w=>w+1),i(await ge()))}})(),chrome.storage.local.get("licenseToken").then(w=>{b||h(!!w.licenseToken)}).catch(()=>{}).finally(()=>{b||g(!0)});function k(w){const m=w.userMode,E=!!w.v2UiEnabled;let P;m==="owner"||m==="power"||m==="dev"?P=m:P=E?"power":"owner",b||a(P)}chrome.storage.local.get(["userMode","v2UiEnabled"]).then(k).catch(()=>a("owner"));const j=(w,m)=>{m==="local"&&("tierConfig:cache"in w&&ve().then(()=>{b||s(E=>E+1)}),"rubricConfigCache"in w&&me().then(()=>{b||s(E=>E+1)}),"licenseToken"in w&&chrome.storage.local.get("licenseToken").then(E=>{b||h(!!E.licenseToken)}),!(!("userMode"in w)&&!("v2UiEnabled"in w))&&chrome.storage.local.get(["userMode","v2UiEnabled"]).then(k))};return chrome.storage.onChanged.addListener(j),()=>{b=!0,chrome.storage.onChanged.removeListener(j)}},[]),t===null||!r||!n||l===null)return null;if(!l)return e.jsx(Kt,{});const p=t==="power"?e.jsx(Vt,{}):e.jsx(tt,{});return(t==="power"||t==="dev")&&!y?e.jsx(qt,{persona:t,children:p}):p}const Ae=document.getElementById("root");if(!Ae)throw new Error("side-panel: #root not found");ze(Ae).render(e.jsx(Pe.StrictMode,{children:e.jsx(et,{children:e.jsx(Yt,{})})}));
|
|
@@ -81,4 +81,4 @@ Error generating stack: `+o.message+`
|
|
|
81
81
|
|
|
82
82
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
83
83
|
|
|
84
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Gh="DialogDescriptionWarning",Zh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Af(Gh).contentName}}.`;return h.useEffect(()=>{var o;const l=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Jh=Pf,qh=Rf,bh=jf,ev=Lf,tv=Df,nv=If,rv=Ff;function $f({open:e,onClose:t,title:n,description:r,children:l}){const o=h.useRef(null);return h.useEffect(()=>{if(e){const i=document.activeElement;o.current=i instanceof HTMLElement?i:null}},[e]),y.jsx(Jh,{open:e,onOpenChange:i=>!i&&t(),children:y.jsxs(qh,{children:[y.jsx(bh,{className:"fixed inset-0 bg-black/40 z-40"}),y.jsxs(ev,{onCloseAutoFocus:i=>{const u=o.current;u&&u.isConnected&&(i.preventDefault(),u.focus())},className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white rounded-lg p-4 w-[min(28rem,90vw)] z-50 shadow-xl",children:[y.jsxs("div",{className:"flex items-center justify-between mb-3",children:[y.jsx(tv,{className:"font-semibold text-sm",children:n}),y.jsx(rv,{className:"text-slate-500 hover:text-slate-700 text-lg leading-none inline-flex items-center justify-center w-6 h-6 rounded focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-brand-500","aria-label":"Close",children:"×"})]}),y.jsx(nv,{className:r?"text-xs text-slate-600 mb-2":"sr-only",children:r??`${n} dialog`}),l]})]})})}const Hs=Ys("checkout-client"),lv="https://api.wcagcheckr.com",ov="wcagcheckr",iv=15e3;async function uv(e){const t=e.uiMode??"hosted",n=`${lv}/v1/products/${ov}/checkout`;try{const r=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({planCode:e.planCode,email:e.email,uiMode:t}),signal:AbortSignal.timeout(iv)}),l=await r.json().catch(()=>null);return r.ok?t==="embedded"?l!=null&&l.clientSecret?{ok:!0,mode:"embedded",clientSecret:l.clientSecret,sessionId:l.sessionId,stub:l.stub===!0}:{ok:!1,error:"malformed response — no clientSecret",status:r.status}:l!=null&&l.checkoutUrl?{ok:!0,mode:"hosted",checkoutUrl:l.checkoutUrl,sessionId:l.sessionId,stub:l.stub===!0}:{ok:!1,error:"malformed response — no checkoutUrl",status:r.status}:(Hs.warn(`checkout HTTP ${r.status}`,l),{ok:!1,status:r.status,error:(l==null?void 0:l.hint)??(l==null?void 0:l.error)??`HTTP ${r.status}`})}catch(r){return Hs.warn("checkout request failed",r),{ok:!1,error:r instanceof Error?r.message:String(r)}}}const We={solo:{monthlyUsd:99,yearlyUsd:990,singleMonthUsd:149},team:{fiveSeatMonthlyUsd:149,fifteenSeatMonthlyUsd:299,fiveSeatYearlyUsd:1490,fifteenSeatYearlyUsd:2990}};function sv(e){const t=(n,r)=>{const l=e.plans.find(o=>o.code===n);return l&&typeof l.priceCents=="number"?l.priceCents/100:r};return{solo:{monthlyUsd:t("solo",We.solo.monthlyUsd),yearlyUsd:t("solo-yearly",We.solo.yearlyUsd),singleMonthUsd:t("solo-single-month",We.solo.singleMonthUsd)},team:{fiveSeatMonthlyUsd:t("team",We.team.fiveSeatMonthlyUsd),fifteenSeatMonthlyUsd:t("team-15",We.team.fifteenSeatMonthlyUsd),fiveSeatYearlyUsd:t("team-yearly",We.team.fiveSeatYearlyUsd),fifteenSeatYearlyUsd:t("team-15-yearly",We.team.fifteenSeatYearlyUsd)}}}function Wf(e,t){return Math.round(100-t/(e*12)*100)}async function av(){try{const e=await Vf();return e?sv(e.config):We}catch{return We}}function cv(){const[e,t]=h.useState(We);return h.useEffect(()=>{let n=!0;return av().then(r=>{n&&t(r)}),()=>{n=!1}},[]),e}const Qs=Ys("sales-inquiry-client"),fv="https://api.wcagcheckr.com",dv="wcagcheckr",pv=15e3;async function mv(e){const t=`${fv}/v1/products/${dv}/sales-inquiry`;try{const n=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,source:e.source??"extension"}),signal:AbortSignal.timeout(pv)}),r=await n.json().catch(()=>null);return!n.ok||!(r!=null&&r.success)?(Qs.warn(`sales-inquiry HTTP ${n.status}`,r),{ok:!1,status:n.status,error:(r==null?void 0:r.error)??`HTTP ${n.status}`}):typeof r.inquiryId!="number"?{ok:!1,error:"malformed response — no inquiryId"}:{ok:!0,inquiryId:r.inquiryId}}catch(n){return Qs.warn("sales-inquiry request failed",n),{ok:!1,error:n instanceof Error?n.message:String(n)}}}function hv({open:e,onClose:t,initialSeatEstimate:n}){const[r,l]=h.useState("form"),[o,i]=h.useState(""),[u,s]=h.useState(""),[a,v]=h.useState(""),[m,p]=h.useState(n!=null?String(n):""),[x,S]=h.useState(""),[g,P]=h.useState(null),[f,c]=h.useState(null);function d(){l("form"),i(""),s(""),v(""),p(n!=null?String(n):""),S(""),P(null),c(null)}function w(){d(),t()}async function C(){if(P(null),!o.trim()||!o.includes("@")){P("Please enter a valid email address.");return}l("submitting");const N=m.trim()?parseInt(m,10):null,k=await mv({email:o.trim(),name:u.trim()||void 0,company:a.trim()||void 0,seatCountEstimate:N!=null&&Number.isFinite(N)&&N>0?N:void 0,message:x.trim()||void 0});k.ok?(c(k.inquiryId),l("success")):(P(k.error),l("error"))}return y.jsxs($f,{open:e,onClose:w,title:r==="success"?"Thanks — we got it":"Contact sales",description:r==="success"?"We received your inquiry. A human will reply from support@wcagcheckr.com.":"For Team plans larger than 15 seats. Email is the only required field — leave the rest blank if you want.",children:[r==="success"&&y.jsx(vv,{inquiryId:f,email:o,onClose:w}),r==="error"&&y.jsx(yv,{message:g,onRetry:()=>{P(null),l("form")},onClose:w}),(r==="form"||r==="submitting")&&y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{children:[y.jsxs("label",{htmlFor:"sales-email",className:"block text-[11px] font-medium mb-1",children:["Email ",y.jsx("span",{className:"text-rose-700",children:"*"})]}),y.jsx("input",{id:"sales-email",type:"email",autoComplete:"email",value:o,onChange:N=>i(N.target.value),placeholder:"you@company.com",className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]}),y.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-name",className:"block text-[11px] font-medium mb-1",children:"Name"}),y.jsx("input",{id:"sales-name",type:"text",autoComplete:"name",value:u,onChange:N=>s(N.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-company",className:"block text-[11px] font-medium mb-1",children:"Company"}),y.jsx("input",{id:"sales-company",type:"text",autoComplete:"organization",value:a,onChange:N=>v(N.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-seats",className:"block text-[11px] font-medium mb-1",children:"Roughly how many seats?"}),y.jsx("input",{id:"sales-seats",type:"number",min:1,max:1e5,inputMode:"numeric",value:m,onChange:N=>p(N.target.value),placeholder:"e.g. 50",className:"w-32 text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-message",className:"block text-[11px] font-medium mb-1",children:"Anything else? (optional)"}),y.jsx("textarea",{id:"sales-message",value:x,onChange:N=>S(N.target.value),placeholder:"Compliance timeline, procurement quirks, ICP questions — whatever's useful for our reply.",rows:4,className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5 resize-y",disabled:r==="submitting"})]}),g&&y.jsx("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-rose-900",children:g}),y.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[y.jsx("button",{type:"button",onClick:w,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",disabled:r==="submitting",children:"Cancel"}),y.jsx("button",{type:"button",onClick:C,disabled:r==="submitting"||!o.trim(),className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:r==="submitting"?"Sending…":"Send inquiry"})]})]})]})}function vv({inquiryId:e,email:t,onClose:n}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded p-3 text-emerald-900",children:[y.jsx("p",{className:"font-semibold",children:"✓ Inquiry received."}),y.jsxs("p",{className:"mt-1 text-[11px]",children:["We'll reply to ",y.jsx("strong",{children:t})," within a couple of business days.",e!=null&&y.jsxs(y.Fragment,{children:[" ","Reference #",y.jsx("code",{className:"font-mono",children:e}),"."]})]})]}),y.jsx("div",{className:"flex justify-end",children:y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Close"})})]})}function yv({message:e,onRetry:t,onClose:n}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-3 text-rose-900",children:[y.jsx("p",{className:"font-semibold",children:"✗ Couldn't send your inquiry."}),y.jsx("p",{className:"mt-1 text-[11px]",children:e??"Unknown error."}),y.jsxs("p",{className:"mt-2 text-[11px]",children:["If this keeps happening, email"," ",y.jsx("a",{href:"mailto:support@wcagcheckr.com",className:"underline",children:"support@wcagcheckr.com"})," ","directly."]})]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Close"}),y.jsx("button",{onClick:t,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Try again"})]})]})}const gv="pk_live_LT0oTyV8a5uI7dOcJIY849aq";function wv(e){return[{code:"team",seats:5,monthlyUsd:e.team.fiveSeatMonthlyUsd,yearlyUsd:e.team.fiveSeatYearlyUsd},{code:"team-15",seats:15,monthlyUsd:e.team.fifteenSeatMonthlyUsd,yearlyUsd:e.team.fifteenSeatYearlyUsd}]}function Mv({open:e,onClose:t,initialPlan:n="solo"}){const[r,l]=h.useState("form"),[o,i]=h.useState(n),[u,s]=h.useState("month"),[a,v]=h.useState("team"),[m,p]=h.useState("month"),[x,S]=h.useState(!1),[g,P]=h.useState(""),[f,c]=h.useState(!1),[d,w]=h.useState(null),[C,N]=h.useState(null),k=h.useRef(null),R=h.useRef(null),M=h.useRef(null);function L(){return o==="team"?m==="year"?a==="team-15"?"team-15-yearly":"team-yearly":a:u==="year"?"solo-yearly":u==="single-month"?"solo-single-month":"solo"}function J(){l("form"),w(null),P(""),i(n),s("month"),v("team"),p("month"),c(!1),N(null),k.current=null,R.current=null}function de(){J(),t()}h.useEffect(()=>{if(r!=="paying")return;function X(Ke){if(!M.current||Ke.source!==M.current.contentWindow)return;const je=Ke.data;if(!(!je||typeof je.type!="string"))switch(je.type){case"ready":M.current.contentWindow&&k.current&&M.current.contentWindow.postMessage({type:"init",clientSecret:k.current,publishableKey:gv},"*");break;case"mounted":break;case"complete":l("success");break;case"error":w(je.message??"Checkout failed inside Stripe iframe."),l("error");break}}return window.addEventListener("message",X),()=>window.removeEventListener("message",X)},[r]),h.useEffect(()=>{if(r!=="success"||C)return;const X=R.current;if(!X)return;let Ke=!1,je=0;const Nn=20,_=1500;async function j(){if(!Ke){je++;try{const F=await(await fetch(`https://api.wcagcheckr.com/v1/products/wcagcheckr/checkout-status?session_id=${encodeURIComponent(X)}`)).json().catch(()=>null);if(Ke)return;if((F==null?void 0:F.state)==="ready"){N(F.licenseToken);return}}catch{}je<Nn&&!Ke&&setTimeout(j,_)}}return j(),()=>{Ke=!0}},[r,C]);async function Pt(){if(w(null),!g.trim()||!g.includes("@")){w("Please enter a valid email address.");return}c(!0);try{const X=await uv({planCode:L(),email:g.trim(),uiMode:"embedded"});if(!X.ok){w(X.error),l("error");return}if(X.mode!=="embedded"){w("Server returned the wrong checkout mode."),l("error");return}if(X.stub){l("stub");return}k.current=X.clientSecret,R.current=X.sessionId??null,l("paying")}catch(X){w(X instanceof Error?X.message:String(X)),l("error")}finally{c(!1)}}return y.jsxs($f,{open:e,onClose:de,title:r==="success"?"Payment complete":r==="paying"?"Complete your payment":"Upgrade your plan",description:r==="success"?"Your subscription is active. Copy your license token below and paste it into Settings → License to activate the extension.":r==="paying"?"Your card is processed by Stripe — we never see it. Your license token will appear here when payment finishes.":"Pick a plan and enter your email — payment happens here, no new tab. Your license token will appear on the success screen.",children:[r==="success"&&y.jsx(Cv,{email:g,licenseToken:C,onClose:de}),r==="stub"&&y.jsx(Nv,{onClose:de}),r==="error"&&y.jsx(Pv,{message:d,onRetry:()=>{w(null),l("form")},onClose:de}),r==="paying"&&y.jsxs("div",{className:"space-y-3",children:[y.jsx("iframe",{ref:M,title:"Stripe checkout",src:"https://api.wcagcheckr.com/v1/products/wcagcheckr/checkout-embed",className:"w-full min-h-[540px] border-0"}),y.jsx("div",{className:"flex justify-end",children:y.jsx("button",{type:"button",onClick:()=>{k.current=null,l("form")},className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"← Back to plan selection"})})]}),r==="form"&&y.jsx(xv,{planFamily:o,setPlanFamily:i,soloInterval:u,setSoloInterval:s,teamSeatTier:a,setTeamSeatTier:v,teamInterval:m,setTeamInterval:p,email:g,setEmail:P,errorMessage:d,submitting:f,onSubmit:Pt,onCancel:de,onContactSales:()=>S(!0)}),y.jsx(hv,{open:x,onClose:()=>S(!1),initialSeatEstimate:20})]})}function xv({planFamily:e,setPlanFamily:t,soloInterval:n,setSoloInterval:r,teamSeatTier:l,setTeamSeatTier:o,teamInterval:i,setTeamInterval:u,email:s,setEmail:a,errorMessage:v,submitting:m,onSubmit:p,onCancel:x,onContactSales:S}){const g=cv(),P=wv(g),f=P.find(w=>w.code===l)??P[0],c=i==="year"?f.yearlyUsd:f.monthlyUsd,d=i==="year"?"/yr":"/mo";return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("fieldset",{className:"space-y-2",children:[y.jsx("legend",{className:"text-[11px] font-medium uppercase tracking-wide text-slate-500",children:"Plan"}),y.jsxs("label",{className:`flex items-start gap-2 p-2 rounded border cursor-pointer transition-colors ${e==="solo"?"border-brand-500 bg-brand-50/40":"border-slate-200 hover:bg-slate-50"}`,children:[y.jsx("input",{type:"radio",name:"plan-family",value:"solo",checked:e==="solo",onChange:()=>t("solo"),className:"mt-0.5"}),y.jsxs("span",{className:"flex-1",children:[y.jsx("span",{className:"block font-medium",children:"Solo"}),y.jsx("span",{className:"block text-[11px] text-slate-500 mt-0.5",children:"Single user. Unlimited components, baselines, full state matrix, all exports, forensic anchoring."}),e==="solo"&&y.jsx(Ev,{value:n,onChange:r,solo:g.solo})]})]}),y.jsxs("label",{className:`flex items-start gap-2 p-2 rounded border cursor-pointer transition-colors ${e==="team"?"border-brand-500 bg-brand-50/40":"border-slate-200 hover:bg-slate-50"}`,children:[y.jsx("input",{type:"radio",name:"plan-family",value:"team",checked:e==="team",onChange:()=>t("team"),className:"mt-0.5"}),y.jsxs("span",{className:"flex-1",children:[y.jsxs("span",{className:"block font-medium",children:["Team — $",c,d,y.jsxs("span",{className:"text-[11px] text-slate-500 font-normal",children:[" ","· ",f.seats," seats"]})]}),y.jsx("span",{className:"block text-[11px] text-slate-500 mt-0.5",children:"Everything in Solo, plus baseline cloud-sync across teammates."}),e==="team"&&y.jsxs(y.Fragment,{children:[y.jsx(Sv,{value:l,onChange:o,teamTiers:P}),y.jsx(kv,{value:i,onChange:u,activeTeam:f}),y.jsxs("p",{className:"text-[11px] text-slate-500 mt-2",children:["Need more than 15 seats?"," ",y.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),S()},className:"text-brand-600 hover:underline underline-offset-2",children:"Talk to us →"})]})]})]})]})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"checkout-email",className:"block text-[11px] font-medium mb-1",children:"Email (where we send your license token)"}),y.jsx("input",{id:"checkout-email",type:"email",autoComplete:"email",value:s,onChange:w=>a(w.target.value),placeholder:"you@example.com",className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5"})]}),v&&y.jsx("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-rose-900",children:v}),y.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[y.jsx("button",{onClick:x,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Cancel"}),y.jsx("button",{onClick:p,disabled:m||!s.trim(),className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:m?"Preparing checkout…":"Continue →"})]})]})}function Sv({value:e,onChange:t,teamTiers:n}){return y.jsx("div",{role:"radiogroup","aria-label":"Team seat count",className:"mt-2 inline-flex rounded border border-slate-300 overflow-hidden text-[11px] bg-white",onClick:r=>r.stopPropagation(),children:n.map(r=>{const l=r.code===e,o=(r.monthlyUsd/r.seats).toFixed(2);return y.jsxs("button",{type:"button",role:"radio","aria-checked":l,onClick:()=>t(r.code),className:l?"px-2.5 py-1 bg-brand-500 text-white":"px-2.5 py-1 text-slate-700 hover:bg-slate-50",title:`$${o} per seat per month at ${r.seats} seats`,children:[r.seats," seats · $",r.monthlyUsd,"/mo"]},r.code)})})}function kv({value:e,onChange:t,activeTeam:n}){return y.jsxs("div",{role:"radiogroup","aria-label":"Team billing interval",className:"mt-2 inline-flex flex-wrap rounded border border-slate-300 overflow-hidden text-[11px] bg-white",onClick:r=>r.stopPropagation(),children:[y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="month",onClick:()=>t("month"),className:e==="month"?"px-2.5 py-1 bg-brand-500 text-white border-r border-slate-300 last:border-r-0":"px-2.5 py-1 text-slate-700 hover:bg-slate-50 border-r border-slate-300 last:border-r-0",children:["Monthly · $",n.monthlyUsd,"/mo"]}),y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="year",onClick:()=>t("year"),className:e==="year"?"px-2.5 py-1 bg-brand-500 text-white":"px-2.5 py-1 text-slate-700 hover:bg-slate-50",children:["Yearly · $",n.yearlyUsd,"/yr"," ",y.jsxs("span",{className:e==="year"?"text-emerald-100 font-medium":"text-emerald-700 font-medium",children:["(save ",Wf(n.monthlyUsd,n.yearlyUsd),"%)"]})]})]})}function Ev({value:e,onChange:t,solo:n}){return y.jsxs("div",{role:"radiogroup","aria-label":"Solo billing interval",className:"mt-2 inline-flex flex-wrap rounded border border-slate-300 overflow-hidden text-[11px] bg-white",onClick:r=>r.stopPropagation(),children:[y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="month",onClick:()=>t("month"),className:e==="month"?"px-2.5 py-1 bg-brand-500 text-white border-r border-slate-300 last:border-r-0":"px-2.5 py-1 text-slate-700 hover:bg-slate-50 border-r border-slate-300 last:border-r-0",children:["Monthly · $",n.monthlyUsd,"/mo"]}),y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="year",onClick:()=>t("year"),className:e==="year"?"px-2.5 py-1 bg-brand-500 text-white border-r border-slate-300 last:border-r-0":"px-2.5 py-1 text-slate-700 hover:bg-slate-50 border-r border-slate-300 last:border-r-0",children:["Yearly · $",n.yearlyUsd,"/yr"," ",y.jsxs("span",{className:e==="year"?"text-emerald-100 font-medium":"text-emerald-700 font-medium",children:["(save ",Wf(n.monthlyUsd,n.yearlyUsd),"%)"]})]}),y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="single-month",onClick:()=>t("single-month"),className:e==="single-month"?"px-2.5 py-1 bg-brand-500 text-white":"px-2.5 py-1 text-slate-700 hover:bg-slate-50",title:"One-time payment for 30 days of access — no recurring charge. Buy again whenever you need it.",children:["Single month · $",n.singleMonthUsd," ",y.jsx("span",{className:e==="single-month"?"text-amber-100":"text-amber-700",children:"(no recurring)"})]})]})}function Cv({email:e,licenseToken:t,onClose:n}){const[r,l]=h.useState(!1);async function o(){if(t)try{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}const[i,u]=h.useState(null);async function s(){if(t){u(null);try{const a=await Bf({type:"LICENSE_SET_REQUEST",token:t});if(!a.seatClaim.ok&&a.seatClaim.reason==="cap-reached"){u(`Activated, but the license is at its seat capacity (${a.seatClaim.seatsUsed} of ${a.seatClaim.seatsTotal} seats). Release a seat on another device from Settings → License, then re-activate here.`);return}if(a.seatClaim.ok&&a.seatClaim.overCapacity){u(`Activated. Note: this license is currently OVER its seat cap (${a.seatClaim.seatsUsed} of ${a.seatClaim.seatsTotal}). Release a seat or upgrade the plan.`),setTimeout(()=>n(),1500);return}n()}catch{}}}return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded p-3 text-emerald-900",children:[y.jsx("p",{className:"font-semibold",children:"✓ Payment received."}),y.jsxs("p",{className:"mt-1 text-[11px]",children:["Subscription active for ",y.jsx("strong",{children:e}),".",t===null?" Issuing your license — this usually takes a few seconds…":" Your license token is ready below."]})]}),t===null?y.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-slate-600",children:[y.jsx("span",{className:"inline-block w-3 h-3 border-2 border-brand-500 border-t-transparent rounded-full animate-spin motion-reduce:animate-none","aria-hidden":"true"}),"Waiting for license server to finish issuing…"]}):y.jsxs("div",{className:"space-y-2",children:[y.jsx("label",{className:"block text-[11px] font-medium uppercase tracking-wide text-slate-500",children:"License token"}),y.jsxs("div",{className:"flex items-stretch gap-1",children:[y.jsx("code",{className:"flex-1 font-mono text-[11px] bg-slate-100 border border-slate-200 rounded px-2 py-1.5 select-all break-all","aria-label":"Your license token",children:t}),y.jsx("button",{type:"button",onClick:o,className:"text-[11px] px-2 py-1.5 border border-slate-300 rounded bg-white hover:bg-slate-50 shrink-0",title:"Copy token to clipboard",children:r?"Copied ✓":"Copy"})]}),y.jsx("p",{className:"text-[11px] text-slate-500",children:"Save this somewhere safe. (Email delivery is coming — until then, this screen is the only place it'll show.)"})]}),i&&y.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900",children:i}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Close"}),t&&y.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Save this token to the extension's settings and activate your plan immediately",children:"Activate now →"})]})]})}function Nv({onClose:e}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded p-3 text-amber-900",children:"Checkout is not yet activated. The product owner needs to finish Stripe setup. Please email support — your interest is noted!"}),y.jsx("div",{className:"flex justify-end",children:y.jsx("button",{onClick:e,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded",children:"OK"})})]})}function Pv({message:e,onRetry:t,onClose:n}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-3 text-rose-900",children:[y.jsx("p",{className:"font-semibold",children:"✗ Checkout couldn't start."}),y.jsx("p",{className:"mt-1 text-[11px]",children:e??"Unknown error."})]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Close"}),y.jsx("button",{onClick:t,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Try again"})]})]})}const Ei="autoDownloadReports";async function Iv(){return(await chrome.storage.local.get(Ei))[Ei]===!0}const zv=Ei;function _v(e,t){const r=/^text\/(markdown|plain|csv)\b/i.test(t)?"\uFEFF"+e:e,l=/charset=/i.test(t)?t:`${t};charset=utf-8`;return{body:r,type:l}}function Fv(e,t,n="text/html"){const r=(t.split(".").pop()??"").toLowerCase(),l=n==="text/html"&&(r==="md"||r==="markdown")?"text/markdown":n==="text/html"&&r==="txt"?"text/plain":n,{body:o,type:i}=_v(e,l),u=new Blob([o],{type:i}),s=URL.createObjectURL(u),a=document.createElement("a");a.href=s,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(s),5e3)}function Uv(e){var t;typeof chrome<"u"&&((t=chrome.tabs)!=null&&t.create)?chrome.tabs.create({url:e,active:!0}).catch(n=>{console.warn("[download-helper] chrome.tabs.create failed; falling back to window.open",n),window.open(e,"_blank","noopener,noreferrer")}):window.open(e,"_blank","noopener,noreferrer")}function Av(e,t="text/html"){var l;const n=new Blob([e],{type:t}),r=URL.createObjectURL(n);return typeof chrome<"u"&&((l=chrome.tabs)!=null&&l.create)?chrome.tabs.create({url:r,active:!0}).catch(o=>{console.warn("[download-helper] chrome.tabs.create failed; falling back to window.open",o),window.open(r,"_blank","noopener,noreferrer")}):window.open(r,"_blank","noopener,noreferrer"),setTimeout(()=>URL.revokeObjectURL(r),6e4),r}function $v(e,t){const n=new Date().toISOString().slice(0,10),r=(t??"audit").replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,24).toLowerCase()||"audit";return`wcagcheckr-${e}-${n}-${r}.${e==="ai-prompt"?"md":"html"}`}function Wv(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{zv as A,Mv as C,$f as M,rt as P,id as R,xm as a,Ht as b,gm as c,af as d,So as e,xt as f,Nm as g,pr as h,Hl as i,y as j,cv as k,Lv as l,Ov as m,Wv as n,Av as o,$v as p,Uv as q,h as r,Iv as s,Fv as t,_v as u,Wf as y};
|
|
84
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Gh="DialogDescriptionWarning",Zh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Af(Gh).contentName}}.`;return h.useEffect(()=>{var o;const l=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Jh=Pf,qh=Rf,bh=jf,ev=Lf,tv=Df,nv=If,rv=Ff;function $f({open:e,onClose:t,title:n,description:r,children:l}){const o=h.useRef(null);return h.useEffect(()=>{if(e){const i=document.activeElement;o.current=i instanceof HTMLElement?i:null}},[e]),y.jsx(Jh,{open:e,onOpenChange:i=>!i&&t(),children:y.jsxs(qh,{children:[y.jsx(bh,{className:"fixed inset-0 bg-black/40 z-40"}),y.jsxs(ev,{onCloseAutoFocus:i=>{const u=o.current;u&&u.isConnected&&(i.preventDefault(),u.focus())},className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white rounded-lg p-4 w-[min(28rem,90vw)] z-50 shadow-xl",children:[y.jsxs("div",{className:"flex items-center justify-between mb-3",children:[y.jsx(tv,{className:"font-semibold text-sm",children:n}),y.jsx(rv,{className:"text-slate-500 hover:text-slate-700 text-lg leading-none inline-flex items-center justify-center w-6 h-6 rounded focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-brand-500","aria-label":"Close",children:"×"})]}),y.jsx(nv,{className:r?"text-xs text-slate-600 mb-2":"sr-only",children:r??`${n} dialog`}),l]})]})})}const Ei="autoDownloadReports";async function Mv(){return(await chrome.storage.local.get(Ei))[Ei]===!0}const Iv=Ei;function lv(e,t){const r=/^text\/(markdown|plain|csv)\b/i.test(t)?"\uFEFF"+e:e,l=/charset=/i.test(t)?t:`${t};charset=utf-8`;return{body:r,type:l}}function zv(e,t,n="text/html"){const r=(t.split(".").pop()??"").toLowerCase(),l=n==="text/html"&&(r==="md"||r==="markdown")?"text/markdown":n==="text/html"&&r==="txt"?"text/plain":n,{body:o,type:i}=lv(e,l),u=new Blob([o],{type:i}),s=URL.createObjectURL(u),a=document.createElement("a");a.href=s,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(s),5e3)}function Fv(e){var t;typeof chrome<"u"&&((t=chrome.tabs)!=null&&t.create)?chrome.tabs.create({url:e,active:!0}).catch(n=>{console.warn("[download-helper] chrome.tabs.create failed; falling back to window.open",n),window.open(e,"_blank","noopener,noreferrer")}):window.open(e,"_blank","noopener,noreferrer")}function Uv(e,t="text/html"){var l;const n=new Blob([e],{type:t}),r=URL.createObjectURL(n);return typeof chrome<"u"&&((l=chrome.tabs)!=null&&l.create)?chrome.tabs.create({url:r,active:!0}).catch(o=>{console.warn("[download-helper] chrome.tabs.create failed; falling back to window.open",o),window.open(r,"_blank","noopener,noreferrer")}):window.open(r,"_blank","noopener,noreferrer"),setTimeout(()=>URL.revokeObjectURL(r),6e4),r}function Av(e,t){const n=new Date().toISOString().slice(0,10),r=(t??"audit").replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,24).toLowerCase()||"audit";return`wcagcheckr-${e}-${n}-${r}.${e==="ai-prompt"?"md":"html"}`}function $v(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const Hs=Ys("checkout-client"),ov="https://api.wcagcheckr.com",iv="wcagcheckr",uv=15e3;async function sv(e){const t=e.uiMode??"hosted",n=`${ov}/v1/products/${iv}/checkout`;try{const r=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({planCode:e.planCode,email:e.email,uiMode:t}),signal:AbortSignal.timeout(uv)}),l=await r.json().catch(()=>null);return r.ok?t==="embedded"?l!=null&&l.clientSecret?{ok:!0,mode:"embedded",clientSecret:l.clientSecret,sessionId:l.sessionId,stub:l.stub===!0}:{ok:!1,error:"malformed response — no clientSecret",status:r.status}:l!=null&&l.checkoutUrl?{ok:!0,mode:"hosted",checkoutUrl:l.checkoutUrl,sessionId:l.sessionId,stub:l.stub===!0}:{ok:!1,error:"malformed response — no checkoutUrl",status:r.status}:(Hs.warn(`checkout HTTP ${r.status}`,l),{ok:!1,status:r.status,error:(l==null?void 0:l.hint)??(l==null?void 0:l.error)??`HTTP ${r.status}`})}catch(r){return Hs.warn("checkout request failed",r),{ok:!1,error:r instanceof Error?r.message:String(r)}}}const We={solo:{monthlyUsd:99,yearlyUsd:990,singleMonthUsd:149},team:{fiveSeatMonthlyUsd:149,fifteenSeatMonthlyUsd:299,fiveSeatYearlyUsd:1490,fifteenSeatYearlyUsd:2990}};function av(e){const t=(n,r)=>{const l=e.plans.find(o=>o.code===n);return l&&typeof l.priceCents=="number"?l.priceCents/100:r};return{solo:{monthlyUsd:t("solo",We.solo.monthlyUsd),yearlyUsd:t("solo-yearly",We.solo.yearlyUsd),singleMonthUsd:t("solo-single-month",We.solo.singleMonthUsd)},team:{fiveSeatMonthlyUsd:t("team",We.team.fiveSeatMonthlyUsd),fifteenSeatMonthlyUsd:t("team-15",We.team.fifteenSeatMonthlyUsd),fiveSeatYearlyUsd:t("team-yearly",We.team.fiveSeatYearlyUsd),fifteenSeatYearlyUsd:t("team-15-yearly",We.team.fifteenSeatYearlyUsd)}}}function Wf(e,t){return Math.round(100-t/(e*12)*100)}async function cv(){try{const e=await Vf();return e?av(e.config):We}catch{return We}}function fv(){const[e,t]=h.useState(We);return h.useEffect(()=>{let n=!0;return cv().then(r=>{n&&t(r)}),()=>{n=!1}},[]),e}const Qs=Ys("sales-inquiry-client"),dv="https://api.wcagcheckr.com",pv="wcagcheckr",mv=15e3;async function hv(e){const t=`${dv}/v1/products/${pv}/sales-inquiry`;try{const n=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,source:e.source??"extension"}),signal:AbortSignal.timeout(mv)}),r=await n.json().catch(()=>null);return!n.ok||!(r!=null&&r.success)?(Qs.warn(`sales-inquiry HTTP ${n.status}`,r),{ok:!1,status:n.status,error:(r==null?void 0:r.error)??`HTTP ${n.status}`}):typeof r.inquiryId!="number"?{ok:!1,error:"malformed response — no inquiryId"}:{ok:!0,inquiryId:r.inquiryId}}catch(n){return Qs.warn("sales-inquiry request failed",n),{ok:!1,error:n instanceof Error?n.message:String(n)}}}function vv({open:e,onClose:t,initialSeatEstimate:n}){const[r,l]=h.useState("form"),[o,i]=h.useState(""),[u,s]=h.useState(""),[a,v]=h.useState(""),[m,p]=h.useState(n!=null?String(n):""),[x,S]=h.useState(""),[g,P]=h.useState(null),[f,c]=h.useState(null);function d(){l("form"),i(""),s(""),v(""),p(n!=null?String(n):""),S(""),P(null),c(null)}function w(){d(),t()}async function C(){if(P(null),!o.trim()||!o.includes("@")){P("Please enter a valid email address.");return}l("submitting");const N=m.trim()?parseInt(m,10):null,k=await hv({email:o.trim(),name:u.trim()||void 0,company:a.trim()||void 0,seatCountEstimate:N!=null&&Number.isFinite(N)&&N>0?N:void 0,message:x.trim()||void 0});k.ok?(c(k.inquiryId),l("success")):(P(k.error),l("error"))}return y.jsxs($f,{open:e,onClose:w,title:r==="success"?"Thanks — we got it":"Contact sales",description:r==="success"?"We received your inquiry. A human will reply from support@wcagcheckr.com.":"For Team plans larger than 15 seats. Email is the only required field — leave the rest blank if you want.",children:[r==="success"&&y.jsx(yv,{inquiryId:f,email:o,onClose:w}),r==="error"&&y.jsx(gv,{message:g,onRetry:()=>{P(null),l("form")},onClose:w}),(r==="form"||r==="submitting")&&y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{children:[y.jsxs("label",{htmlFor:"sales-email",className:"block text-[11px] font-medium mb-1",children:["Email ",y.jsx("span",{className:"text-rose-700",children:"*"})]}),y.jsx("input",{id:"sales-email",type:"email",autoComplete:"email",value:o,onChange:N=>i(N.target.value),placeholder:"you@company.com",className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]}),y.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-name",className:"block text-[11px] font-medium mb-1",children:"Name"}),y.jsx("input",{id:"sales-name",type:"text",autoComplete:"name",value:u,onChange:N=>s(N.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-company",className:"block text-[11px] font-medium mb-1",children:"Company"}),y.jsx("input",{id:"sales-company",type:"text",autoComplete:"organization",value:a,onChange:N=>v(N.target.value),className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-seats",className:"block text-[11px] font-medium mb-1",children:"Roughly how many seats?"}),y.jsx("input",{id:"sales-seats",type:"number",min:1,max:1e5,inputMode:"numeric",value:m,onChange:N=>p(N.target.value),placeholder:"e.g. 50",className:"w-32 text-xs border border-slate-300 rounded px-2 py-1.5",disabled:r==="submitting"})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"sales-message",className:"block text-[11px] font-medium mb-1",children:"Anything else? (optional)"}),y.jsx("textarea",{id:"sales-message",value:x,onChange:N=>S(N.target.value),placeholder:"Compliance timeline, procurement quirks, ICP questions — whatever's useful for our reply.",rows:4,className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5 resize-y",disabled:r==="submitting"})]}),g&&y.jsx("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-rose-900",children:g}),y.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[y.jsx("button",{type:"button",onClick:w,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",disabled:r==="submitting",children:"Cancel"}),y.jsx("button",{type:"button",onClick:C,disabled:r==="submitting"||!o.trim(),className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:r==="submitting"?"Sending…":"Send inquiry"})]})]})]})}function yv({inquiryId:e,email:t,onClose:n}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded p-3 text-emerald-900",children:[y.jsx("p",{className:"font-semibold",children:"✓ Inquiry received."}),y.jsxs("p",{className:"mt-1 text-[11px]",children:["We'll reply to ",y.jsx("strong",{children:t})," within a couple of business days.",e!=null&&y.jsxs(y.Fragment,{children:[" ","Reference #",y.jsx("code",{className:"font-mono",children:e}),"."]})]})]}),y.jsx("div",{className:"flex justify-end",children:y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Close"})})]})}function gv({message:e,onRetry:t,onClose:n}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-3 text-rose-900",children:[y.jsx("p",{className:"font-semibold",children:"✗ Couldn't send your inquiry."}),y.jsx("p",{className:"mt-1 text-[11px]",children:e??"Unknown error."}),y.jsxs("p",{className:"mt-2 text-[11px]",children:["If this keeps happening, email"," ",y.jsx("a",{href:"mailto:support@wcagcheckr.com",className:"underline",children:"support@wcagcheckr.com"})," ","directly."]})]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Close"}),y.jsx("button",{onClick:t,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Try again"})]})]})}const wv="pk_live_LT0oTyV8a5uI7dOcJIY849aq";function xv(e){return[{code:"team",seats:5,monthlyUsd:e.team.fiveSeatMonthlyUsd,yearlyUsd:e.team.fiveSeatYearlyUsd},{code:"team-15",seats:15,monthlyUsd:e.team.fifteenSeatMonthlyUsd,yearlyUsd:e.team.fifteenSeatYearlyUsd}]}function Wv({open:e,onClose:t,initialPlan:n="solo"}){const[r,l]=h.useState("form"),[o,i]=h.useState(n),[u,s]=h.useState("month"),[a,v]=h.useState("team"),[m,p]=h.useState("month"),[x,S]=h.useState(!1),[g,P]=h.useState(""),[f,c]=h.useState(!1),[d,w]=h.useState(null),[C,N]=h.useState(null),k=h.useRef(null),R=h.useRef(null),M=h.useRef(null);function L(){return o==="team"?m==="year"?a==="team-15"?"team-15-yearly":"team-yearly":a:u==="year"?"solo-yearly":u==="single-month"?"solo-single-month":"solo"}function J(){l("form"),w(null),P(""),i(n),s("month"),v("team"),p("month"),c(!1),N(null),k.current=null,R.current=null}function de(){J(),t()}h.useEffect(()=>{if(r!=="paying")return;function X(Ke){if(!M.current||Ke.source!==M.current.contentWindow)return;const je=Ke.data;if(!(!je||typeof je.type!="string"))switch(je.type){case"ready":M.current.contentWindow&&k.current&&M.current.contentWindow.postMessage({type:"init",clientSecret:k.current,publishableKey:wv},"*");break;case"mounted":break;case"complete":l("success");break;case"error":w(je.message??"Checkout failed inside Stripe iframe."),l("error");break}}return window.addEventListener("message",X),()=>window.removeEventListener("message",X)},[r]),h.useEffect(()=>{if(r!=="success"||C)return;const X=R.current;if(!X)return;let Ke=!1,je=0;const Nn=20,_=1500;async function j(){if(!Ke){je++;try{const F=await(await fetch(`https://api.wcagcheckr.com/v1/products/wcagcheckr/checkout-status?session_id=${encodeURIComponent(X)}`)).json().catch(()=>null);if(Ke)return;if((F==null?void 0:F.state)==="ready"){N(F.licenseToken);return}}catch{}je<Nn&&!Ke&&setTimeout(j,_)}}return j(),()=>{Ke=!0}},[r,C]);async function Pt(){if(w(null),!g.trim()||!g.includes("@")){w("Please enter a valid email address.");return}c(!0);try{const X=await sv({planCode:L(),email:g.trim(),uiMode:"embedded"});if(!X.ok){w(X.error),l("error");return}if(X.mode!=="embedded"){w("Server returned the wrong checkout mode."),l("error");return}if(X.stub){l("stub");return}k.current=X.clientSecret,R.current=X.sessionId??null,l("paying")}catch(X){w(X instanceof Error?X.message:String(X)),l("error")}finally{c(!1)}}return y.jsxs($f,{open:e,onClose:de,title:r==="success"?"Payment complete":r==="paying"?"Complete your payment":"Upgrade your plan",description:r==="success"?"Your subscription is active. Copy your license token below and paste it into Settings → License to activate the extension.":r==="paying"?"Your card is processed by Stripe — we never see it. Your license token will appear here when payment finishes.":"Pick a plan and enter your email — payment happens here, no new tab. Your license token will appear on the success screen.",children:[r==="success"&&y.jsx(Nv,{email:g,licenseToken:C,onClose:de}),r==="stub"&&y.jsx(Pv,{onClose:de}),r==="error"&&y.jsx(_v,{message:d,onRetry:()=>{w(null),l("form")},onClose:de}),r==="paying"&&y.jsxs("div",{className:"space-y-3",children:[y.jsx("iframe",{ref:M,title:"Stripe checkout",src:"https://api.wcagcheckr.com/v1/products/wcagcheckr/checkout-embed",className:"w-full min-h-[540px] border-0"}),y.jsx("div",{className:"flex justify-end",children:y.jsx("button",{type:"button",onClick:()=>{k.current=null,l("form")},className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"← Back to plan selection"})})]}),r==="form"&&y.jsx(Sv,{planFamily:o,setPlanFamily:i,soloInterval:u,setSoloInterval:s,teamSeatTier:a,setTeamSeatTier:v,teamInterval:m,setTeamInterval:p,email:g,setEmail:P,errorMessage:d,submitting:f,onSubmit:Pt,onCancel:de,onContactSales:()=>S(!0)}),y.jsx(vv,{open:x,onClose:()=>S(!1),initialSeatEstimate:20})]})}function Sv({planFamily:e,setPlanFamily:t,soloInterval:n,setSoloInterval:r,teamSeatTier:l,setTeamSeatTier:o,teamInterval:i,setTeamInterval:u,email:s,setEmail:a,errorMessage:v,submitting:m,onSubmit:p,onCancel:x,onContactSales:S}){const g=fv(),P=xv(g),f=P.find(w=>w.code===l)??P[0],c=i==="year"?f.yearlyUsd:f.monthlyUsd,d=i==="year"?"/yr":"/mo";return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("fieldset",{className:"space-y-2",children:[y.jsx("legend",{className:"text-[11px] font-medium uppercase tracking-wide text-slate-500",children:"Plan"}),y.jsxs("label",{className:`flex items-start gap-2 p-2 rounded border cursor-pointer transition-colors ${e==="solo"?"border-brand-500 bg-brand-50/40":"border-slate-200 hover:bg-slate-50"}`,children:[y.jsx("input",{type:"radio",name:"plan-family",value:"solo",checked:e==="solo",onChange:()=>t("solo"),className:"mt-0.5"}),y.jsxs("span",{className:"flex-1",children:[y.jsx("span",{className:"block font-medium",children:"Solo"}),y.jsx("span",{className:"block text-[11px] text-slate-500 mt-0.5",children:"Single user. Unlimited components, baselines, full state matrix, all exports, forensic anchoring."}),e==="solo"&&y.jsx(Cv,{value:n,onChange:r,solo:g.solo})]})]}),y.jsxs("label",{className:`flex items-start gap-2 p-2 rounded border cursor-pointer transition-colors ${e==="team"?"border-brand-500 bg-brand-50/40":"border-slate-200 hover:bg-slate-50"}`,children:[y.jsx("input",{type:"radio",name:"plan-family",value:"team",checked:e==="team",onChange:()=>t("team"),className:"mt-0.5"}),y.jsxs("span",{className:"flex-1",children:[y.jsxs("span",{className:"block font-medium",children:["Team — $",c,d,y.jsxs("span",{className:"text-[11px] text-slate-500 font-normal",children:[" ","· ",f.seats," seats"]})]}),y.jsx("span",{className:"block text-[11px] text-slate-500 mt-0.5",children:"Everything in Solo, plus baseline cloud-sync across teammates."}),e==="team"&&y.jsxs(y.Fragment,{children:[y.jsx(kv,{value:l,onChange:o,teamTiers:P}),y.jsx(Ev,{value:i,onChange:u,activeTeam:f}),y.jsxs("p",{className:"text-[11px] text-slate-500 mt-2",children:["Need more than 15 seats?"," ",y.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),S()},className:"text-brand-600 hover:underline underline-offset-2",children:"Talk to us →"})]})]})]})]})]}),y.jsxs("div",{children:[y.jsx("label",{htmlFor:"checkout-email",className:"block text-[11px] font-medium mb-1",children:"Email (where we send your license token)"}),y.jsx("input",{id:"checkout-email",type:"email",autoComplete:"email",value:s,onChange:w=>a(w.target.value),placeholder:"you@example.com",className:"w-full text-xs border border-slate-300 rounded px-2 py-1.5"})]}),v&&y.jsx("div",{className:"bg-rose-50 border border-rose-200 rounded p-2 text-rose-900",children:v}),y.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[y.jsx("button",{onClick:x,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Cancel"}),y.jsx("button",{onClick:p,disabled:m||!s.trim(),className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 disabled:opacity-50",children:m?"Preparing checkout…":"Continue →"})]})]})}function kv({value:e,onChange:t,teamTiers:n}){return y.jsx("div",{role:"radiogroup","aria-label":"Team seat count",className:"mt-2 inline-flex rounded border border-slate-300 overflow-hidden text-[11px] bg-white",onClick:r=>r.stopPropagation(),children:n.map(r=>{const l=r.code===e,o=(r.monthlyUsd/r.seats).toFixed(2);return y.jsxs("button",{type:"button",role:"radio","aria-checked":l,onClick:()=>t(r.code),className:l?"px-2.5 py-1 bg-brand-500 text-white":"px-2.5 py-1 text-slate-700 hover:bg-slate-50",title:`$${o} per seat per month at ${r.seats} seats`,children:[r.seats," seats · $",r.monthlyUsd,"/mo"]},r.code)})})}function Ev({value:e,onChange:t,activeTeam:n}){return y.jsxs("div",{role:"radiogroup","aria-label":"Team billing interval",className:"mt-2 inline-flex flex-wrap rounded border border-slate-300 overflow-hidden text-[11px] bg-white",onClick:r=>r.stopPropagation(),children:[y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="month",onClick:()=>t("month"),className:e==="month"?"px-2.5 py-1 bg-brand-500 text-white border-r border-slate-300 last:border-r-0":"px-2.5 py-1 text-slate-700 hover:bg-slate-50 border-r border-slate-300 last:border-r-0",children:["Monthly · $",n.monthlyUsd,"/mo"]}),y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="year",onClick:()=>t("year"),className:e==="year"?"px-2.5 py-1 bg-brand-500 text-white":"px-2.5 py-1 text-slate-700 hover:bg-slate-50",children:["Yearly · $",n.yearlyUsd,"/yr"," ",y.jsxs("span",{className:e==="year"?"text-emerald-100 font-medium":"text-emerald-700 font-medium",children:["(save ",Wf(n.monthlyUsd,n.yearlyUsd),"%)"]})]})]})}function Cv({value:e,onChange:t,solo:n}){return y.jsxs("div",{role:"radiogroup","aria-label":"Solo billing interval",className:"mt-2 inline-flex flex-wrap rounded border border-slate-300 overflow-hidden text-[11px] bg-white",onClick:r=>r.stopPropagation(),children:[y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="month",onClick:()=>t("month"),className:e==="month"?"px-2.5 py-1 bg-brand-500 text-white border-r border-slate-300 last:border-r-0":"px-2.5 py-1 text-slate-700 hover:bg-slate-50 border-r border-slate-300 last:border-r-0",children:["Monthly · $",n.monthlyUsd,"/mo"]}),y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="year",onClick:()=>t("year"),className:e==="year"?"px-2.5 py-1 bg-brand-500 text-white border-r border-slate-300 last:border-r-0":"px-2.5 py-1 text-slate-700 hover:bg-slate-50 border-r border-slate-300 last:border-r-0",children:["Yearly · $",n.yearlyUsd,"/yr"," ",y.jsxs("span",{className:e==="year"?"text-emerald-100 font-medium":"text-emerald-700 font-medium",children:["(save ",Wf(n.monthlyUsd,n.yearlyUsd),"%)"]})]}),y.jsxs("button",{type:"button",role:"radio","aria-checked":e==="single-month",onClick:()=>t("single-month"),className:e==="single-month"?"px-2.5 py-1 bg-brand-500 text-white":"px-2.5 py-1 text-slate-700 hover:bg-slate-50",title:"One-time payment for 30 days of access — no recurring charge. Buy again whenever you need it.",children:["Single month · $",n.singleMonthUsd," ",y.jsx("span",{className:e==="single-month"?"text-amber-100":"text-amber-700",children:"(no recurring)"})]})]})}function Nv({email:e,licenseToken:t,onClose:n}){const[r,l]=h.useState(!1);async function o(){if(t)try{await navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}const[i,u]=h.useState(null);async function s(){if(t){u(null);try{const a=await Bf({type:"LICENSE_SET_REQUEST",token:t});if(!a.seatClaim.ok&&a.seatClaim.reason==="cap-reached"){u(`Activated, but the license is at its seat capacity (${a.seatClaim.seatsUsed} of ${a.seatClaim.seatsTotal} seats). Release a seat on another device from Settings → License, then re-activate here.`);return}if(a.seatClaim.ok&&a.seatClaim.overCapacity){u(`Activated. Note: this license is currently OVER its seat cap (${a.seatClaim.seatsUsed} of ${a.seatClaim.seatsTotal}). Release a seat or upgrade the plan.`),setTimeout(()=>n(),1500);return}n()}catch{}}}return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded p-3 text-emerald-900",children:[y.jsx("p",{className:"font-semibold",children:"✓ Payment received."}),y.jsxs("p",{className:"mt-1 text-[11px]",children:["Subscription active for ",y.jsx("strong",{children:e}),".",t===null?" Issuing your license — this usually takes a few seconds…":" Your license token is ready below."]})]}),t===null?y.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-slate-600",children:[y.jsx("span",{className:"inline-block w-3 h-3 border-2 border-brand-500 border-t-transparent rounded-full animate-spin motion-reduce:animate-none","aria-hidden":"true"}),"Waiting for license server to finish issuing…"]}):y.jsxs("div",{className:"space-y-2",children:[y.jsx("label",{className:"block text-[11px] font-medium uppercase tracking-wide text-slate-500",children:"License token"}),y.jsxs("div",{className:"flex items-stretch gap-1",children:[y.jsx("code",{className:"flex-1 font-mono text-[11px] bg-slate-100 border border-slate-200 rounded px-2 py-1.5 select-all break-all","aria-label":"Your license token",children:t}),y.jsx("button",{type:"button",onClick:o,className:"text-[11px] px-2 py-1.5 border border-slate-300 rounded bg-white hover:bg-slate-50 shrink-0",title:"Copy token to clipboard",children:r?"Copied ✓":"Copy"})]}),y.jsx("p",{className:"text-[11px] text-slate-500",children:"Save this somewhere safe. (Email delivery is coming — until then, this screen is the only place it'll show.)"})]}),i&&y.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded p-2 text-[11px] text-amber-900",children:i}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Close"}),t&&y.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",title:"Save this token to the extension's settings and activate your plan immediately",children:"Activate now →"})]})]})}function Pv({onClose:e}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded p-3 text-amber-900",children:"Checkout is not yet activated. The product owner needs to finish Stripe setup. Please email support — your interest is noted!"}),y.jsx("div",{className:"flex justify-end",children:y.jsx("button",{onClick:e,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded",children:"OK"})})]})}function _v({message:e,onRetry:t,onClose:n}){return y.jsxs("div",{className:"space-y-3 text-xs",children:[y.jsxs("div",{className:"bg-rose-50 border border-rose-200 rounded p-3 text-rose-900",children:[y.jsx("p",{className:"font-semibold",children:"✗ Checkout couldn't start."}),y.jsx("p",{className:"mt-1 text-[11px]",children:e??"Unknown error."})]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:n,className:"text-xs px-3 py-1.5 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",children:"Close"}),y.jsx("button",{onClick:t,className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Try again"})]})]})}export{Iv as A,Wv as C,$f as M,rt as P,id as R,xm as a,Ht as b,gm as c,af as d,So as e,xt as f,Nm as g,pr as h,Hl as i,y as j,fv as k,Lv as l,Ov as m,$v as n,Fv as o,Uv as p,Av as q,h as r,Mv as s,zv as t,lv as u,Wf as y};
|