@wcag-checkr/ci 1.0.23 → 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-CAo1EDqF.js → ErrorBoundary-Dz8MotbH.js} +42 -42
- package/dist/assets/{copy-ai-fixer-prompt-CoTMEYa8.js → copy-ai-fixer-prompt-zCj1CiZK.js} +2 -2
- package/dist/assets/{devtools-panel-BZ5-1wG6.js → devtools-panel-DZkip4u6.js} +1 -1
- package/dist/assets/{options-C7TJwA_a.js → options-DjXDOL93.js} +1 -1
- package/dist/assets/{parallel-tab-flow-B8XxnbrB.js → parallel-tab-flow-ichC6qRG.js} +1 -1
- package/dist/assets/{rubric-config-client-DhPZ3tGE.js → rubric-config-client-VuUmF7Y1.js} +1 -1
- package/dist/assets/{scheduled-audit-runner-Dek_J9pU.js → scheduled-audit-runner-BJXKsQZK.js} +124 -124
- package/dist/assets/service-worker.ts-GP6asxWi.js +2 -0
- package/dist/assets/side-panel-BcBA4SnN.js +4 -0
- package/dist/assets/{site-report-renderer-Bw9jYmSg.js → site-report-renderer-DelUUXsi.js} +1 -1
- package/dist/assets/{styles-Dg6rHpW6.js → styles-BsDacBC8.js} +1 -1
- package/dist/devtools/panel.html +4 -4
- package/dist/manifest.json +1 -1
- package/dist/options/options.html +2 -2
- package/dist/service-worker-loader.js +1 -1
- package/dist/side-panel/side-panel.html +6 -6
- package/package.json +1 -1
- package/dist/assets/service-worker.ts-BGN4N7Yn.js +0 -2
- package/dist/assets/side-panel-DvxfwgMS.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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b2 as p,b3 as g,b4 as $,b5 as v}from"./scheduled-audit-runner-BJXKsQZK.js";import{k as w,c as E,h as T}from"./crash-reporter-DAZnNefT.js";import"./preload-helper-D7HrI6pR.js";import"./diff-CECbooHD.js";import"./ai-usage-log-DVzy9AU1.js";const m=E("parallel-tab-flow");async function _(s){const n=performance.now(),a=p(s.matrix),o=Math.max(1,Math.min(s.parallelism??4,8)),i=[];for(let e=0;e<o;e++)i.push([]);a.forEach((e,b)=>{i[b%o].push(e)}),m.info(`parallel-tab audit starting: ${a.length} states across ${o} tabs (~${Math.ceil(a.length/o)} states/tab)`);const r=a.length;let t=0;a[0]&&w({type:"AUDIT_PROGRESS_EVENT",current:0,total:r,currentState:a[0]});const l=e=>{t++,w({type:"AUDIT_PROGRESS_EVENT",current:t,total:r,currentState:e})},d=i.map((e,b)=>e.length===0?Promise.resolve({results:[],failed:!1}):y(s.targetUrl,s.scope,e,b,s.cancel,l)),h=await Promise.all(d),c=[];let u=0,f=0;for(const e of h)e.failed?f++:u++,c.push(...e.results);return{results:c,parallelDurationMs:performance.now()-n,tabsCompleted:u,tabsFailed:f}}async function y(s,n,a,o,i,r){let t;const l=[];try{const d=await chrome.tabs.create({url:s,active:!1});if(!d.id)throw new Error("chrome.tabs.create returned no id");if(t=d.id,m.debug(`worker ${o}: opened tab ${t}`),await U(t),i.isCanceled())throw new Error("canceled");const h=await g(t,0);if(!h.ok)throw new Error(`content script unreachable: ${h.reason}`);for(let c=0;c<a.length&&!i.isCanceled();c++){const u=a[c];try{if(!(await $(t,u,n)).success){m.warn(`worker ${o} state ${c+1}/${a.length} drive failed`),r==null||r(u);continue}const e=await T(t,{type:"AUDIT_REQUEST",selector:n,currentState:u});e.success&&e.result&&l.push({...e.result,violations:e.result.violations})}catch(f){m.debug(`worker ${o} state ${c+1} error`,f)}finally{r==null||r(u)}}try{await v(t,n)}catch{}return{results:l,failed:!1}}catch(d){return m.warn(`worker ${o} failed`,d),{results:l,failed:!0}}finally{if(t!==void 0)try{await chrome.tabs.remove(t)}catch{}}}function U(s,n=3e4){return new Promise((a,o)=>{const i=setTimeout(()=>{chrome.tabs.onUpdated.removeListener(r),o(new Error(`tab ${s} load timed out after ${n}ms`))},n),r=(t,l)=>{t===s&&l.status==="complete"&&(clearTimeout(i),chrome.tabs.onUpdated.removeListener(r),a())};chrome.tabs.onUpdated.addListener(r),chrome.tabs.get(s).then(t=>{t.status==="complete"&&(clearTimeout(i),chrome.tabs.onUpdated.removeListener(r),a())})})}export{_ as runParallelTabAudit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as t,n as i,o as e,
|
|
1
|
+
import{m as t,n as i,o as e,aY as n}from"./scheduled-audit-runner-BJXKsQZK.js";import{c as o}from"./crash-reporter-DAZnNefT.js";const c=o("rubric-config-client"),f="wcagcheckr",u=`https://api.wcagcheckr.com/v1/products/${f}/rubrics`,h=1e4,s="rubric-config-refresh",d=60;async function R(){const r=await t();if(!r){e(null);return}if(i(r)==="expired"){c.warn("cached rubrics are expired (>7d); falling back to bundled defaults"),e(null);return}e(r.config)}async function g(){try{const r=await fetch(u,{signal:AbortSignal.timeout(h),headers:{accept:"application/json"}});if(!r.ok)throw new Error(`http ${r.status}`);const a=await r.json();await n({fetchedAt:Date.now(),config:a}),e(a),c.info("rubrics refreshed from server")}catch(r){c.warn("rubric refresh failed; keeping prior cache",r)}}function b(){chrome.alarms.create(s,{periodInMinutes:d}),chrome.alarms.onAlarm.addListener(r=>{r.name===s&&g()})}export{b as a,g as r,R as w};
|