@wcag-checkr/ci 1.0.0-rc.21 → 1.0.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ErrorBoundary-DUrFJm2h.js → ErrorBoundary-ZGXN03_M.js} +3 -3
- package/dist/assets/ai-usage-log-Dj9Ub_DT.js +1 -0
- package/dist/assets/{content-script.ts-D0-ItOIg.js → content-script.ts-CW_Q6_SY.js} +34 -34
- package/dist/assets/{content-script.ts-loader-B-Xa5S-H.js → content-script.ts-loader-DwHC40QO.js} +1 -1
- package/dist/assets/{devtools-panel-CyMLmxwM.js → devtools-panel-DkZ0frVO.js} +1 -1
- package/dist/assets/{forensic-log-h-BhJJva.js → forensic-log-B1UCXZ23.js} +1 -1
- package/dist/assets/options-DW6q4XGj.js +6 -0
- package/dist/assets/service-worker.ts-ZrgLpEfv.js +715 -0
- package/dist/assets/{side-panel-BCkOAc7F.js → side-panel-ghCK2mYd.js} +1 -1
- package/dist/assets/{site-report-renderer-BxzO0FlE.js → site-report-renderer-CyHkM6hB.js} +1 -1
- package/dist/assets/state-PELIq3oj.js +1 -0
- package/dist/assets/{styles-C3k-Qle5.js → styles-C4Kq0zOO.js} +1 -1
- package/dist/assets/{styles-DP9v_aMy.css → styles-Cevp58mS.css} +1 -1
- package/dist/devtools/panel.html +6 -6
- package/dist/manifest.json +4 -4
- package/dist/options/options.html +5 -5
- 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/ai-usage-log-MwwSLQII.js +0 -1
- package/dist/assets/options-BdQyLYSd.js +0 -6
- package/dist/assets/service-worker.ts-BcYxqaRt.js +0 -715
- package/dist/assets/state-DFZV6oiO.js +0 -1
package/dist/assets/{content-script.ts-loader-B-Xa5S-H.js → content-script.ts-loader-DwHC40QO.js}
RENAMED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
(async () => {
|
|
6
6
|
const { onExecute } = await import(
|
|
7
7
|
/* @vite-ignore */
|
|
8
|
-
chrome.runtime.getURL("assets/content-script.ts-
|
|
8
|
+
chrome.runtime.getURL("assets/content-script.ts-CW_Q6_SY.js")
|
|
9
9
|
);
|
|
10
10
|
onExecute?.({ perf: { injectTime, loadTime: performance.now() - injectTime } });
|
|
11
11
|
})().catch(console.error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as o,R as e}from"./styles-
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{c as t,j as o,R as e}from"./styles-C4Kq0zOO.js";import{E as s,A as i}from"./ErrorBoundary-ZGXN03_M.js";import{i as m}from"./crash-reporter-Dc5lvxvY.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./state-PELIq3oj.js";import"./preload-helper-D7HrI6pR.js";import"./forensic-log-B1UCXZ23.js";m("devtools-panel");const r=document.getElementById("root");if(!r)throw new Error("devtools panel: #root not found");t(r).render(o.jsx(e.StrictMode,{children:o.jsx(s,{children:o.jsx(i,{})})}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as x,e as D,c as oe}from"./crash-reporter-Dc5lvxvY.js";import{c as B,T as re,
|
|
1
|
+
import{o as x,e as D,c as oe}from"./crash-reporter-Dc5lvxvY.js";import{c as B,T as re,d as X}from"./state-PELIq3oj.js";async function ct(){const e=await chrome.tabs.query({currentWindow:!0}),t=e.find(n=>n.active);if(t!=null&&t.id&&z(t.url))return t.id;const a=e.find(n=>n.id&&z(n.url));return(a==null?void 0:a.id)??null}function z(e){return typeof e=="string"&&/^https?:\/\//.test(e)}const I="license:cache",se=60*60*1e3,le=24*60*60*1e3,ce=7*24*60*60*1e3;async function T(){return(await chrome.storage.local.get(I))[I]??null}async function k(e){await chrome.storage.local.set({[I]:e})}async function A(){await chrome.storage.local.remove(I)}function de(e,t=Date.now()){const a=t-e.validatedAt;return a<se?"fresh":a<le?"stale":a<ce?"grace":"expired"}const p=oe("license-gate"),ue="https://api.wcagcheckr.com",Z="wcagcheckr",he=`${ue}/v1/products/${Z}/license/validate`,me=1e4,pe=`https://${Z}.com/upgrade`,R="trialStartedAt",L="licenseToken";async function ee(){let t=(await chrome.storage.local.get(R))[R];return t||(t=Date.now(),await chrome.storage.local.set({[R]:t})),t}function ge(e,t=Date.now()){return t-e>X*864e5}async function F(){return(await chrome.storage.local.get(L))[L]??null}async function fe(e){await chrome.storage.local.set({[L]:e})}async function C(e){const t=await fetch(he,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({token:e}),signal:AbortSignal.timeout(me)});if(!t.ok)throw new Error(`validate http ${t.status}`);return{type:"LICENSE_VALIDATE_RESPONSE",...await t.json()}}async function v(e){const t=await T();if(t&&t.token===e){const n=de(t);if(n==="fresh")return t.response;if(n==="stale")return C(e).then(i=>k({token:e,validatedAt:Date.now(),response:i})).catch(i=>p.warn("background refresh failed",i)),t.response;if(n==="grace")try{const i=await C(e);return await k({token:e,validatedAt:Date.now(),response:i}),i}catch(i){return p.warn("grace-period revalidation failed; using last-known-good",i),t.response}}const a=await C(e);return await k({token:e,validatedAt:Date.now(),response:a}),a}function be(e){return e==="solo"||e==="solo-yearly"||e==="solo-single-month"?"solo":e==="team"||e==="team-15"||e==="team-yearly"||e==="team-15-yearly"?"team":"free"}async function w(){const e=await F();if(e)try{const a=await v(e);if(a.valid&&a.plan)return be(a.plan)}catch(a){p.warn("validation failed, falling back",a)}const t=await ee();return ge(t)?"free":"trial"}async function ye(){const e=await T(),t=e==null?void 0:e.response.trialEndsAt;if(t){const i=new Date(t).getTime()-Date.now();return Math.max(0,Math.ceil(i/864e5))}const a=await ee(),n=X*864e5-(Date.now()-a);return Math.max(0,Math.ceil(n/864e5))}async function we(){const e=await T(),t=e==null?void 0:e.response.features;if(!t||typeof t!="object")return{};const a=t.seatsUsed,n=t.seatsTotal;return{seatsUsed:typeof a=="number"?a:void 0,seatsTotal:typeof n=="number"?n:void 0}}function ve(e,t){const a=re[e];switch(t){case"audit:multi-component":return a.maxComponents!==1;case"audit:state-matrix":return a.stateMatrix!=="default-only";case"storybook:auto-iterate":return a.storybookAutoIterate;case"export:json":return a.exportJson;case"export:sarif":return a.exportSarif;case"export:junit":return a.exportJunit;case"cloud-sync":return a.cloudSync}}function dt(){const e=[];e.push(x("TIER_GET",async i=>{i.forceRefresh&&await A();const r=await w(),o={type:"TIER_GET_RESPONSE",tier:r};if(r==="trial")o.trialDaysRemaining=await ye();else if(r==="team"){const{seatsUsed:s,seatsTotal:l}=await we();s!==void 0&&(o.seatsUsed=s),l!==void 0&&(o.seatsTotal=l)}if(r!=="trial"){const s=await T();if(s!=null&&s.response.valid&&s.response.plan){if(o.planCode=s.response.plan,s.response.plan==="solo-single-month"&&s.response.expiresAt){const l=new Date(s.response.expiresAt).getTime()-Date.now();o.licenseDaysRemaining=Math.max(0,Math.ceil(l/864e5))}s.response.pastDueSince&&(o.pastDue=!0)}}return o})),e.push(x("LICENSE_CHECK_REQUEST",async i=>{const r=await w(),o=ve(r,i.feature);return{type:"LICENSE_CHECK_RESPONSE",allowed:o,tier:r,reason:o?void 0:`${i.feature} requires a higher tier`,upgradeUrl:o?void 0:pe}})),e.push(x("LICENSE_VALIDATE_REQUEST",async i=>{try{if(i.forceRefresh){await A();const r=await v(i.token);return D({type:"LICENSE_CHANGED_EVENT",tier:await w()}),r}return await v(i.token)}catch(r){return p.error("validate failed",r),{type:"LICENSE_VALIDATE_RESPONSE",valid:!1,plan:null,email:null,status:null,expiresAt:null}}})),e.push(x("LICENSE_SET_REQUEST",async i=>{await fe(i.token),await A();let r=!1,o={ok:!1,reason:"not-attempted"};try{const l=await v(i.token);if(await k({token:i.token,validatedAt:Date.now(),response:l}),r=l.valid===!0,r){const c=await B(i.token);c.ok?o={ok:!0,seatsUsed:c.seatsUsed,seatsTotal:c.seatsTotal,overCapacity:c.overCapacity}:o=c}}catch(l){p.warn("validation after set failed",l)}const s=await w();return D({type:"LICENSE_CHANGED_EVENT",tier:s}),{type:"LICENSE_SET_RESPONSE",validated:r,seatClaim:o}})),(async()=>{try{const i=await F();i&&await B(i)}catch(i){p.debug("boot-time seat claim failed",i)}})();const t="license:periodic-refresh",a=60;chrome.alarms.get(t,i=>{i||chrome.alarms.create(t,{periodInMinutes:a})});const n=async i=>{if(i.name===t)try{const r=await F();if(!r)return;await A();const o=await v(r);await k({token:r,validatedAt:Date.now(),response:o}),D({type:"LICENSE_CHANGED_EVENT",tier:await w()}),p.debug("periodic license refresh complete")}catch(r){p.warn("periodic license refresh failed",r)}};return chrome.alarms.onAlarm.addListener(n),e.push(()=>chrome.alarms.onAlarm.removeListener(n)),p.info("handlers registered"),()=>e.forEach(i=>i())}const ke={"ai-alt-misleading":{summary:`The AI vision model judged this image's alt text is empty, misleading, or generic when the image is actually informative or functional. Use the AI assessment (shown above this recipe) to understand what the image depicts, then write descriptive alt text conveying its meaning to a screen-reader user. Use alt="" only when the image is genuinely decorative (a divider, a flourish, an icon next to text that already labels the action). Decorative is rare — when in doubt, describe.`,snippetLang:"html",snippet:`<!-- Failing — empty alt on an informational logo -->
|
|
2
2
|
<img src="/assets/logo.png" alt="">
|
|
3
3
|
|
|
4
4
|
<!-- Passing — descriptive alt -->
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import"./modulepreload-polyfill-B5Qt9EMX.js";import{a as q,R as D,u as W,j as e,b as X,r as i,d as me,P,e as L,f as he,g as Pe,h as Ue,i as R,C as $e,A as K,k as Oe,c as Ge}from"./styles-C4Kq0zOO.js";import{c as pe,r as w,o as Be,s as C,O as Z,a as Ke}from"./crash-reporter-Dc5lvxvY.js";import{T as Ve,P as _,r as He,D as Ye,l as Je,g as We,a as ze,b as ee}from"./state-PELIq3oj.js";import{c as qe,D as V,l as Qe,a as Xe}from"./ai-usage-log-Dj9Ub_DT.js";import"./_commonjsHelpers-Cpj98o6Y.js";function Ze(t){const s=t+"CollectionProvider",[a,n]=q(s),[o,u]=a(s,{collectionRef:{current:null},itemMap:new Map}),d=j=>{const{scope:p,children:c}=j,b=D.useRef(null),N=D.useRef(new Map).current;return e.jsx(o,{scope:p,itemMap:N,collectionRef:b,children:c})};d.displayName=s;const r=t+"CollectionSlot",x=X(r),l=D.forwardRef((j,p)=>{const{scope:c,children:b}=j,N=u(r,c),k=W(p,N.collectionRef);return e.jsx(x,{ref:k,children:b})});l.displayName=r;const m=t+"CollectionItemSlot",h="data-radix-collection-item",f=X(m),y=D.forwardRef((j,p)=>{const{scope:c,children:b,...N}=j,k=D.useRef(null),A=W(p,k),T=u(m,c);return D.useEffect(()=>(T.itemMap.set(k,{ref:k,...N}),()=>void T.itemMap.delete(k))),e.jsx(f,{[h]:"",ref:A,children:b})});y.displayName=m;function v(j){const p=u(t+"CollectionConsumer",j);return D.useCallback(()=>{const b=p.collectionRef.current;if(!b)return[];const N=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(p.itemMap.values()).sort((T,F)=>N.indexOf(T.ref.current)-N.indexOf(F.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:d,Slot:l,ItemSlot:y},v,n]}var et=i.createContext(void 0);function be(t){const s=i.useContext(et);return t||s||"ltr"}var H="rovingFocusGroup.onEntryFocus",tt={bubbles:!1,cancelable:!0},$="RovingFocusGroup",[z,fe,st]=Ze($),[at,ge]=q($,[st]),[nt,rt]=at($),ye=i.forwardRef((t,s)=>e.jsx(z.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(z.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(lt,{...t,ref:s})})}));ye.displayName=$;var lt=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,orientation:n,loop:o=!1,dir:u,currentTabStopId:d,defaultCurrentTabStopId:r,onCurrentTabStopIdChange:x,onEntryFocus:l,preventScrollOnEntryFocus:m=!1,...h}=t,f=i.useRef(null),y=W(s,f),v=be(u),[j,p]=he({prop:d,defaultProp:r??null,onChange:x,caller:$}),[c,b]=i.useState(!1),N=Pe(l),k=fe(a),A=i.useRef(!1),[T,F]=i.useState(0);return i.useEffect(()=>{const g=f.current;if(g)return g.addEventListener(H,N),()=>g.removeEventListener(H,N)},[N]),e.jsx(nt,{scope:a,orientation:n,dir:v,loop:o,currentTabStopId:j,onItemFocus:i.useCallback(g=>p(g),[p]),onItemShiftTab:i.useCallback(()=>b(!0),[]),onFocusableItemAdd:i.useCallback(()=>F(g=>g+1),[]),onFocusableItemRemove:i.useCallback(()=>F(g=>g-1),[]),children:e.jsx(P.div,{tabIndex:c||T===0?-1:0,"data-orientation":n,...h,ref:y,style:{outline:"none",...t.style},onMouseDown:L(t.onMouseDown,()=>{A.current=!0}),onFocus:L(t.onFocus,g=>{const S=!A.current;if(g.target===g.currentTarget&&S&&!c){const I=new CustomEvent(H,tt);if(g.currentTarget.dispatchEvent(I),!I.defaultPrevented){const E=k().filter(M=>M.focusable),Fe=E.find(M=>M.active),De=E.find(M=>M.id===j),Me=[Fe,De,...E].filter(Boolean).map(M=>M.ref.current);Ne(Me,m)}}A.current=!1}),onBlur:L(t.onBlur,()=>b(!1))})})}),ve="RovingFocusGroupItem",je=i.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:a,focusable:n=!0,active:o=!1,tabStopId:u,children:d,...r}=t,x=me(),l=u||x,m=rt(ve,a),h=m.currentTabStopId===l,f=fe(a),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:j}=m;return i.useEffect(()=>{if(n)return y(),()=>v()},[n,y,v]),e.jsx(z.ItemSlot,{scope:a,id:l,focusable:n,active:o,children:e.jsx(P.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...r,ref:s,onMouseDown:L(t.onMouseDown,p=>{n?m.onItemFocus(l):p.preventDefault()}),onFocus:L(t.onFocus,()=>m.onItemFocus(l)),onKeyDown:L(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){m.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const c=ct(p,m.orientation,m.dir);if(c!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let N=f().filter(k=>k.focusable).map(k=>k.ref.current);if(c==="last")N.reverse();else if(c==="prev"||c==="next"){c==="prev"&&N.reverse();const k=N.indexOf(p.currentTarget);N=m.loop?dt(N,k+1):N.slice(k+1)}setTimeout(()=>Ne(N))}}),children:typeof d=="function"?d({isCurrentTabStop:h,hasTabStop:j!=null}):d})})});je.displayName=ve;var ot={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function it(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function ct(t,s,a){const n=it(t.key,a);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return ot[n]}function Ne(t,s=!1){const a=document.activeElement;for(const n of t)if(n===a||(n.focus({preventScroll:s}),document.activeElement!==a))return}function dt(t,s){return t.map((a,n)=>t[(s+n)%t.length])}var ut=ye,xt=je,B="Tabs",[mt]=q(B,[ge]),ke=ge(),[ht,Q]=mt(B),Se=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:n,onValueChange:o,defaultValue:u,orientation:d="horizontal",dir:r,activationMode:x="automatic",...l}=t,m=be(r),[h,f]=he({prop:n,onChange:o,defaultProp:u??"",caller:B});return e.jsx(ht,{scope:a,baseId:me(),value:h,onValueChange:f,orientation:d,dir:m,activationMode:x,children:e.jsx(P.div,{dir:m,"data-orientation":d,...l,ref:s})})});Se.displayName=B;var Te="TabsList",we=i.forwardRef((t,s)=>{const{__scopeTabs:a,loop:n=!0,...o}=t,u=Q(Te,a),d=ke(a);return e.jsx(ut,{asChild:!0,...d,orientation:u.orientation,dir:u.dir,loop:n,children:e.jsx(P.div,{role:"tablist","aria-orientation":u.orientation,...o,ref:s})})});we.displayName=Te;var Ce="TabsTrigger",Ee=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:n,disabled:o=!1,...u}=t,d=Q(Ce,a),r=ke(a),x=Re(d.baseId,n),l=_e(d.baseId,n),m=n===d.value;return e.jsx(xt,{asChild:!0,...r,focusable:!o,active:m,children:e.jsx(P.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":l,"data-state":m?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:x,...u,ref:s,onMouseDown:L(t.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?d.onValueChange(n):h.preventDefault()}),onKeyDown:L(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&d.onValueChange(n)}),onFocus:L(t.onFocus,()=>{const h=d.activationMode!=="manual";!m&&!o&&h&&d.onValueChange(n)})})})});Ee.displayName=Ce;var Ie="TabsContent",Ae=i.forwardRef((t,s)=>{const{__scopeTabs:a,value:n,forceMount:o,children:u,...d}=t,r=Q(Ie,a),x=Re(r.baseId,n),l=_e(r.baseId,n),m=n===r.value,h=i.useRef(m);return i.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),e.jsx(Ue,{present:o||m,children:({present:f})=>e.jsx(P.div,{"data-state":m?"active":"inactive","data-orientation":r.orientation,role:"tabpanel","aria-labelledby":x,hidden:!f,id:l,tabIndex:0,...d,ref:s,style:{...t.style,animationDuration:h.current?"0s":void 0},children:f&&u})})});Ae.displayName=Ie;function Re(t,s){return`${t}-trigger-${s}`}function _e(t,s){return`${t}-content-${s}`}var pt=Se,bt=we,ft=Ee,O=Ae;const gt=["default","hover","focus","focus-visible","active","disabled"],yt=["light","dark","forced-colors-active","forced-colors-none"],vt=["ltr","rtl"];function jt({value:t,onChange:s}){function a(o,u){return o.includes(u)?o.filter(d=>d!==u):[...o,u]}function n(){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:gt,selected:t.pseudoStates,onToggle:o=>s({...t,pseudoStates:a(t.pseudoStates,o)})}),e.jsx(G,{label:"Themes",all:yt,selected:t.themes,onToggle:o=>s({...t,themes:a(t.themes,o)})}),e.jsx(G,{label:"Directions",all:vt,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:n()})," audits per component"]})]})}function G({label:t,all:s,selected:a,onToggle:n}){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 u=a.includes(o);return e.jsx("button",{type:"button",onClick:()=>n(o),className:u?"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 Nt({value:t,onChange:s}){const[a,n]=i.useState(""),[o,u]=i.useState("");function d(l){l.preventDefault();const m=a.trim(),h=o.trim();!m||!h||(s({...t,[m]:h}),n(""),u(""))}function r(l){const m={...t};delete m[l],s(m)}const x=Object.entries(t);return e.jsxs("div",{className:"space-y-3 border border-slate-200 rounded p-3 bg-white",children:[x.length===0?e.jsx("p",{className:"text-xs text-slate-500 italic",children:"no aliases"}):e.jsx("ul",{className:"space-y-1",children:x.map(([l,m])=>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:`${l} → ${m}`,children:[l," ",e.jsx("span",{className:"text-slate-500",children:"→"})," ",m]}),e.jsx("button",{onClick:()=>r(l),className:"text-slate-500 hover:text-red-600 shrink-0","aria-label":`Remove alias ${l}`,children:"×"})]},l))}),e.jsxs("form",{onSubmit:d,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:l=>n(l.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:l=>u(l.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 te=pe("billing-portal-client"),kt="https://api.wcagcheckr.com",St="wcagcheckr",Tt=15e3;async function wt(t){const s=`${kt}/v1/products/${St}/billing-portal`;try{const a=await fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(Tt)}),n=await a.json().catch(()=>null);return a.ok?n!=null&&n.url?{ok:!0,url:n.url}:{ok:!1,error:"malformed response — no url",status:a.status}:(te.warn(`billing portal HTTP ${a.status}`,n),{ok:!1,status:a.status,error:(n==null?void 0:n.hint)??(n==null?void 0:n.error)??`HTTP ${a.status}`})}catch(a){return te.warn("billing portal request failed",a),{ok:!1,error:a instanceof Error?a.message:String(a)}}}const se=pe("subscription-resume-client"),Ct="https://api.wcagcheckr.com",Et="wcagcheckr",It=1e4;async function At(t){try{const s=await fetch(`${Ct}/v1/products/${Et}/subscription/resume`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({licenseToken:t.licenseToken}),signal:AbortSignal.timeout(It)}),a=await s.json().catch(()=>null);return s.ok?{ok:!0,alreadyActive:(a==null?void 0:a.alreadyActive)===!0}:(se.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 se.warn("resume request failed",s),{ok:!1,error:s instanceof Error?s.message:String(s)}}}const Rt={trial:"Trial",free:"Free",solo:"Solo",team:"Team"},_t={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)"},Lt=new Set(["solo-single-month"]);function Ft(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 U(t){return t?_t[t]??t:"—"}function Y(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 Dt({tier:t,onTierChange:s}){const[a,n]=i.useState(null),[o,u]=i.useState(null),[d,r]=i.useState(!1),[x,l]=i.useState(""),[m,h]=i.useState(!1),[f,y]=i.useState(null),[v,j]=i.useState(!1),[p,c]=i.useState(!1),b=i.useCallback(async g=>{const I=(await chrome.storage.local.get("licenseToken")).licenseToken??null;if(n(I),!I){u(null);return}try{const E=await w({type:"LICENSE_VALIDATE_REQUEST",token:I,forceRefresh:(g==null?void 0:g.forceRefresh)===!0});u(E)}catch{u(null)}},[]);i.useEffect(()=>(b({forceRefresh:!0}),Be("LICENSE_CHANGED_EVENT",()=>{b()})),[b]);async function N(){if(x.trim()){h(!0),y(null);try{const g=await w({type:"LICENSE_SET_REQUEST",token:x.trim()}),S=await w({type:"LICENSE_VALIDATE_REQUEST",token:x.trim()});if(S.valid&&S.plan){const I=Ut(S.plan);s(I);let E=`Activated as ${U(S.plan)}.`;g.seatClaim.ok?g.seatClaim.overCapacity&&(E=`Activated as ${U(S.plan)}. Note: this license is currently OVER its seat cap (${g.seatClaim.seatsUsed} of ${g.seatClaim.seatsTotal} seats). Release one or upgrade.`):g.seatClaim.reason==="cap-reached"?E=`Activated as ${U(S.plan)}, BUT this license is at its seat capacity (${g.seatClaim.seatsUsed} of ${g.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.`:g.seatClaim.reason==="network"&&(E=`Activated as ${U(S.plan)}. (Seat-tracking ping failed — retrying in the background.)`),y(E),g.seatClaim.ok&&!g.seatClaim.overCapacity?R.polite(E):R.assertive(E),l(""),r(!1),await b()}else{const I="Token did not validate. Check the value and try again.";y(I),R.assertive(I)}}catch(g){const S=g instanceof Error?g.message:String(g);y(S),R.assertive(S)}finally{h(!1)}}}async function k(){if(a)try{await navigator.clipboard.writeText(a),j(!0),setTimeout(()=>j(!1),2e3)}catch{}}async function A(){if(window.confirm(`Remove the active license token from this extension?
|
|
2
|
+
|
|
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 He(a),await chrome.storage.local.remove("licenseToken"),n(null),u(null);try{const S=await w({type:"TIER_GET"});s(S.tier)}catch{s("free")}R.polite("License token removed.")}}const T=Ve[t],F=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:Rt[t]})]}),e.jsxs("ul",{className:"text-xs text-slate-600 space-y-1",children:[e.jsxs("li",{children:["Components:"," ",Number.isFinite(T.maxComponents)?T.maxComponents:"unlimited"]}),e.jsxs("li",{children:["Baselines:"," ",Number.isFinite(T.maxBaselines)?T.maxBaselines:"unlimited"]}),e.jsxs("li",{children:["State matrix: ",T.stateMatrix]}),e.jsxs("li",{children:["Storybook auto-iterate: ",T.storybookAutoIterate?"yes":"no"]}),e.jsxs("li",{children:["JSON export: ",T.exportJson?"yes":"no"]}),e.jsxs("li",{children:["SARIF / JUnit export: ",T.exportSarif?"yes":"no"]})]}),F&&o?e.jsx(Mt,{token:a,info:o,copied:v,onCopy:k,onRemove:A,onUseDifferent:()=>r(!0),onManageSubscription:async()=>{const g=await wt({licenseToken:a});g.ok?window.open(g.url,"_blank","noopener,noreferrer"):(y(`Couldn't open billing portal: ${g.error}`),R.assertive("Could not open billing portal."))},onResumeSubscription:async()=>{const g=await At({licenseToken:a});if(g.ok){const S=g.alreadyActive?"Subscription was already active — no change needed.":"Subscription resumed. Cancellation has been reversed.";y(S),R.polite(S),await b({forceRefresh:!0})}else y(`Couldn't resume subscription: ${g.error}`),R.assertive("Could not resume subscription.")},onRenew:()=>c(!0),message:f}):a?e.jsx(Pt,{token:a,onRemove:A,onUseDifferent:()=>r(!0)}):e.jsx(ae,{token:x,onTokenChange:l,submitting:m,message:f,onSubmit:N}),F&&d&&e.jsx(ae,{token:x,onTokenChange:l,submitting:m,message:f,onSubmit:N,replacing:!0,onCancel:()=>{r(!1),l(""),y(null)}}),!F&&(t==="trial"||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"}),": $",_.solo.monthlyUsd,"/mo (recurring) ·"," ","$",_.solo.yearlyUsd,"/yr (save ",Math.round(100-_.solo.yearlyUsd/(_.solo.monthlyUsd*12)*100),"%) ·"," ","$",_.solo.singleMonthUsd," single month (no recurring) · single user."]}),e.jsxs("p",{className:"text-xs text-slate-600",children:[e.jsx("strong",{children:"Team"}),": $",_.team.fiveSeatMonthlyUsd,"/mo for 5 seats ·"," ","$",_.team.fifteenSeatMonthlyUsd,"/mo for 15 seats."]}),e.jsx("button",{type:"button",onClick:()=>c(!0),className:"inline-block text-xs px-3 py-1 bg-brand-500 text-white rounded hover:bg-brand-600",children:"Upgrade →"})]}),e.jsx($e,{open:p,onClose:()=>c(!1)})]})}function Mt({token:t,info:s,copied:a,onCopy:n,onRemove:o,onUseDifferent:u,onManageSubscription:d,onResumeSubscription:r,onRenew:x,message:l}){const m=s.features,h=typeof(m==null?void 0:m.seatsUsed)=="number"?m.seatsUsed:null,f=typeof(m==null?void 0:m.seatsTotal)=="number"?m.seatsTotal:null,y=f!==null,v=h!==null&&f!==null&&h>f,j=h!==null&&f!==null&&h===f,p=s.plan?Lt.has(s.plan):!1,c=Ft(s.expiresAt),b=p&&c!==null&&c<=7;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:d,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:Y(s.expiresAt)}),", then this license stops working."]}),e.jsx("button",{type:"button",onClick:r,className:"text-[11px] font-medium underline-offset-2 hover:underline",children:"Resume subscription →"})]}),v&&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:f}),". New devices will be rejected. Release a seat from another device, or upgrade to a higher-seat plan via Manage subscription below."]}),j&&!v&&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:f})," 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:U(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:[Y(s.expiresAt),c!==null&&c>=0&&c<=14?e.jsx("span",{className:b?"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:c===0?"today":c===1?"1 day left":`${c} days left`}):null]}),s.trialEndsAt?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-slate-500",children:"Trial ends"}),e.jsx("dd",{children:Y(s.trialEndsAt)})]}):null,y?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-slate-500",children:"Seats"}),e.jsx("dd",{children:h!==null?`${h} of ${f} used`:`${f} 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:n,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:x,className:b?"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:b?`Renew now — $${_.solo.singleMonthUsd} →`:`Buy another month — $${_.solo.singleMonthUsd} →`}):e.jsx("button",{type:"button",onClick:d,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:u,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"})]}),l&&e.jsx("p",{className:"text-xs text-slate-600 pt-1",children:l})]})}function Pt({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 ae({token:t,onTokenChange:s,submitting:a,message:n,onSubmit:o,replacing:u,onCancel:d}){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:u?"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:r=>s(r.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…":u?"Replace":"Activate"}),u&&d&&e.jsx("button",{type:"button",onClick:d,className:"text-xs px-3 py-1 border border-slate-300 rounded text-slate-700 hover:bg-slate-50",children:"Cancel"})]}),n&&e.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Ut(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 $t=new Set(Ye.map(t=>t.id));function Ot({presets:t,onChange:s}){const[a,n]=i.useState({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1});function o(r){r.preventDefault();const x=a.id.trim();!x||t.some(l=>l.id===x)||(s([...t,{...a,id:x,label:a.label.trim()||`${x} (${a.width}×${a.height})`}]),n({id:"",label:"",width:1024,height:768,deviceScaleFactor:1,mobile:!1}))}function u(r){s(t.filter(x=>x.id!==r))}function d(r,x){s(t.map(l=>l.id===r?{...l,...x}:l))}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(r=>{const x=$t.has(r.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:r.id,children:[r.label,x&&e.jsx("span",{className:"text-slate-500 font-normal ml-1",children:"(default)"})]}),e.jsx("input",{type:"number",value:r.width,onChange:l=>d(r.id,{width:Number(l.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Width for ${r.label}`,min:1}),e.jsx("input",{type:"number",value:r.height,onChange:l=>d(r.id,{height:Number(l.target.value)||0}),className:"text-xs border border-slate-300 rounded px-1.5 py-1 w-full","aria-label":`Height for ${r.label}`,min:1}),e.jsxs("label",{className:"flex items-center gap-1 text-slate-600",children:[e.jsx("input",{type:"checkbox",checked:r.mobile,onChange:l=>d(r.id,{mobile:l.target.checked})}),"mobile"]}),x?e.jsx("span",{className:"w-4","aria-hidden":"true"}):e.jsx("button",{onClick:()=>u(r.id),className:"text-slate-500 hover:text-red-600","aria-label":`Remove ${r.label}`,children:"×"})]},r.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:r=>n({...a,id:r.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:r=>n({...a,label:r.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:r=>n({...a,width:Number(r.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:r=>n({...a,height:Number(r.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(r=>r.id===a.id.trim()),className:"text-xs px-3 py-1 bg-brand-500 text-white rounded disabled:opacity-50",children:"Add"})]})]})}function Gt({stateMatrix:t,componentIdAliases:s,onImport:a}){const n=i.useRef(null),[o,u]=i.useState(null);function d(){const x={schemaVersion:1,exportedAt:new Date().toISOString(),stateMatrix:t,componentIdAliases:s},l=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),m=URL.createObjectURL(l),h=document.createElement("a");h.href=m,h.download=`wcag-auditor-settings-${new Date().toISOString().slice(0,10)}.json`,h.click(),URL.revokeObjectURL(m),u("Exported.")}async function r(x){var l,m;u(null);try{const h=await x.text(),f=JSON.parse(h);if(f.schemaVersion!==1)throw new Error(`Unsupported schemaVersion: ${f.schemaVersion}`);if(!((l=f.stateMatrix)!=null&&l.pseudoStates)||!((m=f.stateMatrix)!=null&&m.breakpointPresets))throw new Error("stateMatrix is malformed");await C({type:"SETTINGS_SET",key:"stateMatrix",value:f.stateMatrix}),await C({type:"SETTINGS_SET",key:"componentIdAliases",value:f.componentIdAliases??{}}),a({stateMatrix:f.stateMatrix,componentIdAliases:f.componentIdAliases??{}}),u("Imported.")}catch(h){u(`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:d,className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Export settings"}),e.jsx("button",{onClick:()=>{var x;return(x=n.current)==null?void 0:x.click()},className:"text-xs px-3 py-1 bg-slate-100 hover:bg-slate-200 rounded",children:"Import settings…"}),e.jsx("input",{ref:n,type:"file",accept:"application/json,.json",className:"hidden",onChange:x=>{var m;const l=(m=x.target.files)==null?void 0:m[0];l&&r(l),x.target.value=""}})]}),o&&e.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Bt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(Z).then(n=>s(n[Z]===!0))},[]);async function a(){const n=!t;s(n),await Ke(n)}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 Kt(){const[t,s]=i.useState(null);i.useEffect(()=>{chrome.storage.local.get(K).then(n=>s(n[K]===!0))},[]);async function a(){const n=!t;s(n),await chrome.storage.local.set({[K]:n})}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)."})]})]})})}function Vt(){const[t,s]=i.useState(null),[a,n]=i.useState(!1);async function o(){const d=await chrome.storage.local.get(null),r=Object.keys(d).filter(x=>x.startsWith("auditCache:"));s(r.length)}i.useEffect(()=>{o()},[]);async function u(){n(!0);try{await qe(),await o()}finally{n(!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:u,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 ne="licenseToken";function re(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 n=Math.floor(a/60);if(n<24)return`${n}h ago`;const o=Math.floor(n/24);return o<30?`${o}d ago`:new Date(t).toLocaleDateString()}function Ht(t){return t.slice(0,8)+"…"}function Yt(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 Jt(){const[t,s]=i.useState(null),[a,n]=i.useState(null),[o,u]=i.useState(null),[d,r]=i.useState(0),[x,l]=i.useState(null),[m,h]=i.useState(!1),[f,y]=i.useState(null),v=i.useCallback(async()=>{h(!0),y(null);try{const c=(await chrome.storage.local.get(ne))[ne]??null;if(s(c),!c){n(null);return}const b=await Je(c);if(!b){y("Could not load seats — check network or license validity.");return}n(b.seats),u(b.seatsTotal),r(b.seatsUsed),l(await We())}finally{h(!1)}},[]);i.useEffect(()=>{v()},[v]);async function j(p){if(!t)return;const b=p===x?"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(b)){h(!0);try{if(!await ze(t,p)){y("Revoke failed — try again or check network.");return}await v()}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:[d," of ",o," used",d>o&&e.jsx("span",{className:"ml-2 text-amber-700",children:"(over capacity — release to bring under limit)"})]})]}),e.jsx("button",{onClick:v,disabled:m,className:"text-xs px-2 py-0.5 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:m?"Loading…":"Refresh"})]}),f&&e.jsx("p",{className:"text-xs text-red-700",children:f}),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:Ht(p.deviceId)}),p.deviceId===x&&e.jsx("span",{className:"ml-1 text-[10px] text-brand-700",children:"(this device)"})]}),e.jsx("td",{className:"py-1 text-slate-700",children:Yt(p.userAgent)}),e.jsx("td",{className:"py-1 text-slate-500",children:re(p.claimedAt)}),e.jsx("td",{className:"py-1 text-slate-500",children:re(p.lastSeenAt)}),e.jsx("td",{className:"py-1 text-right",children:e.jsx("button",{onClick:()=>j(p.deviceId),disabled:m,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 le="disabledRules";function Wt(){const[t,s]=i.useState(""),[a,n]=i.useState(!1),[o,u]=i.useState(null);i.useEffect(()=>{w({type:"SETTINGS_GET",key:le}).then(r=>{const x=Array.isArray(r.data)?r.data:[];s(x.join(`
|
|
4
|
+
`)),n(!0)})},[]);function d(r){const x=r.split(`
|
|
5
|
+
`).map(l=>l.trim()).filter(l=>l.length>0);C({type:"SETTINGS_SET",key:le,value:x}),u(Date.now())}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["Rule IDs to skip during audits. One per line. Use exact axe-core rule IDs (e.g.,"," ",e.jsx("code",{className:"bg-slate-100 text-slate-700 px-1 rounded",children:"color-contrast"}),","," ",e.jsx("code",{className:"bg-slate-100 text-slate-700 px-1 rounded",children:"region"}),","," ",e.jsx("code",{className:"bg-slate-100 text-slate-700 px-1 rounded",children:"landmark-one-main"}),")."]}),e.jsx("textarea",{value:t,onChange:r=>s(r.target.value),onBlur:r=>d(r.target.value),rows:6,spellCheck:!1,placeholder:`region
|
|
6
|
+
landmark-one-main`,className:"w-full text-xs font-mono border border-slate-300 rounded p-2 resize-y"}),o&&e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Saved at ",new Date(o).toLocaleTimeString(),"."]}),e.jsxs("p",{className:"text-[11px] text-slate-500",children:["Full rule list:"," ",e.jsx("a",{href:"https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md",target:"_blank",rel:"noreferrer",className:"text-brand-600 hover:underline",children:"axe-core/doc/rule-descriptions.md"})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const oe="githubRepoUrl",zt=/^https:\/\/github\.com\/[^/]+\/[^/]+\/?$/;function qt(){const[t,s]=i.useState(""),[a,n]=i.useState(!1),[o,u]=i.useState(null);i.useEffect(()=>{w({type:"SETTINGS_GET",key:oe}).then(r=>{const x=typeof r.data=="string"?r.data:"";s(x),n(!0)})},[]);function d(r){const x=r.trim().replace(/\/$/,"");if(x.length>0&&!zt.test(x+"/")){u("Expected format: https://github.com/owner/repo");return}u(null),C({type:"SETTINGS_SET",key:oe,value:x})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your repository URL to enable "File GitHub issue" buttons in the Delta view. Issues are opened in a new tab with title and body pre-filled — you confirm and submit on GitHub.'}),e.jsx("input",{type:"url",value:t,onChange:r=>s(r.target.value),onBlur:r=>d(r.target.value),placeholder:"https://github.com/owner/repo",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ie="jiraInstanceUrl",Qt=/^https:\/\/[^/]+\.atlassian\.net\/?$/;function Xt(){const[t,s]=i.useState(""),[a,n]=i.useState(!1),[o,u]=i.useState(null);i.useEffect(()=>{w({type:"SETTINGS_GET",key:ie}).then(r=>{const x=typeof r.data=="string"?r.data:"";s(x),n(!0)})},[]);function d(r){const x=r.trim().replace(/\/$/,"");if(x.length>0&&!Qt.test(x+"/")){u("Expected format: https://your-team.atlassian.net");return}u(null),C({type:"SETTINGS_SET",key:ie,value:x})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-slate-500",children:'Paste your Jira Cloud instance URL to enable "File Jira issue" in the Delta view. Issues open in a new tab pre-filled — you confirm and submit on Jira.'}),e.jsx("input",{type:"url",value:t,onChange:r=>s(r.target.value),onBlur:r=>d(r.target.value),placeholder:"https://your-team.atlassian.net",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),o&&e.jsx("p",{className:"text-[11px] text-rose-600",children:o})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ce="cloudSyncEnabled",de="cloudSyncEndpoint",Zt="https://api.wcagcheckr.com";function es(){const[t,s]=i.useState(!1),[a,n]=i.useState(Zt),[o,u]=i.useState(!1),[d,r]=i.useState(!1),[x,l]=i.useState(null);i.useEffect(()=>{Promise.all([w({type:"SETTINGS_GET",key:ce}),w({type:"SETTINGS_GET",key:de})]).then(([y,v])=>{s(y.data===!0),typeof v.data=="string"&&v.data&&n(v.data),u(!0)})},[]);function m(y){s(y),C({type:"SETTINGS_SET",key:ce,value:y})}function h(y){const v=y.trim().replace(/\/$/,"");n(v),C({type:"SETTINGS_SET",key:de,value:v})}async function f(){r(!0),l(null);try{const y="To pull baselines now, reload the extension at chrome://extensions. The service worker pulls on every start.";l(y),R.polite(y)}finally{r(!1)}}return o?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Sync baselines across devices via your license. Disabled by default — local-first storage means the extension works fully offline. Cloud is mirror, not source of truth on the local machine."}),e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:y=>m(y.target.checked)}),e.jsx("span",{children:"Enable cloud sync"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-slate-500 block mb-1",children:"Sync endpoint"}),e.jsx("input",{type:"url",value:a,onChange:y=>n(y.target.value),onBlur:y=>h(y.target.value),disabled:!t,className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5 disabled:bg-slate-50 disabled:text-slate-500"}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Default points at the WCAG Auditor cloud-sync VPS. Replace with your own server URL if you self-host the baseline endpoints."})]}),e.jsx("button",{type:"button",onClick:f,disabled:!t||d,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:d?"Pulling…":"Pull now"}),x&&e.jsx("p",{className:"text-[11px] text-slate-500",children:x})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}const ue="runsPerState";function ts(){const[t,s]=i.useState(1),[a,n]=i.useState(!1);i.useEffect(()=>{w({type:"SETTINGS_GET",key:ue}).then(u=>{const d=typeof u.data=="number"?u.data:1;s(d),n(!0)})},[]);function o(u){s(u),C({type:"SETTINGS_SET",key:ue,value:u})}return a?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["Real-world pages are non-deterministic — animations, third-party scripts, lazy-loaded content can produce different violation counts on identical re-runs. Higher run counts let the auditor classify violations as ",e.jsx("strong",{children:"stable"})," (seen in every run) vs"," ",e.jsx("strong",{children:"flaky"})," (only some runs). Tradeoff: each step costs an extra audit pass."]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{htmlFor:"reliability-runs-per-state",className:"text-xs text-slate-700",children:"Audit runs per state:"}),e.jsxs("select",{id:"reliability-runs-per-state",value:t,onChange:u=>o(Number(u.target.value)),className:"text-xs border border-slate-300 rounded px-2 py-1",children:[e.jsx("option",{value:1,children:"1 (fastest)"}),e.jsx("option",{value:2,children:"2 (balanced)"}),e.jsx("option",{value:3,children:"3 (most reliable)"})]})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function ss(){const[t,s]=i.useState("owner"),[a,n]=i.useState(!1);i.useEffect(()=>{w({type:"SETTINGS_GET",key:"userMode"}).then(u=>{const d=u.data;(d==="owner"||d==="dev")&&s(d),n(!0)})},[]);function o(u){s(u),C({type:"SETTINGS_SET",key:"userMode",value:u})}return a?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Switches the side panel between two surfaces. Owner mode is simpler and avoids jargon; developer mode shows the full feature set (visualizers, baselines, exports, AI fixit prompt)."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(xe,{active:t==="owner",icon:"🏪",label:"Site owner",desc:"Plain-language results, whole-site scan, send-to-developer report.",onClick:()=>o("owner")}),e.jsx(xe,{active:t==="dev",icon:"⚙️",label:"Developer / agency",desc:"Full feature surface — visualizers, exports, baselines, IGT, AI fixit prompt.",onClick:()=>o("dev")})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function xe({active:t,icon:s,label:a,desc:n,onClick:o}){return e.jsx("button",{type:"button",onClick:o,className:`text-left rounded p-3 border transition-colors ${t?"border-brand-500 bg-brand-50 ring-2 ring-brand-500/30":"border-slate-300 bg-white hover:border-slate-400 hover:bg-slate-50"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-lg","aria-hidden":"true",children:s}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-xs",children:a}),e.jsx("div",{className:"text-[11px] text-slate-500 leading-snug mt-0.5",children:n})]})]})})}const J="aiConfig";function as(){const[t,s]=i.useState(V),[a,n]=i.useState(!1),[o,u]=i.useState(!1),[d,r]=i.useState(null),[x,l]=i.useState(null),[m,h]=i.useState(!1);async function f(){r(await Qe(10))}i.useEffect(()=>{f()},[]);async function y(){h(!0),l(null);try{if(!t.apiKey){l({ok:!1,message:"No API key entered yet."});return}const c=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":t.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:t.model||"claude-haiku-4-5",max_tokens:5,messages:[{role:"user",content:"ok"}]})}),b=await c.json().catch(()=>null);if(!b){l({ok:!1,message:`Provider returned no JSON (HTTP ${c.status}).`});return}if("error"in b){l({ok:!1,message:`${b.error.type}: ${b.error.message}`});return}l({ok:!0,message:`Authenticated, account funded. Test call used ${b.usage.input_tokens}+${b.usage.output_tokens} tokens (~$0.0001).`})}catch(c){l({ok:!1,message:c instanceof Error?c.message:String(c)})}finally{h(!1)}}async function v(){typeof confirm=="function"&&!confirm("Clear the local AI usage log? Provider-side billing records are unaffected.")||(await Xe(),await f())}i.useEffect(()=>{w({type:"SETTINGS_GET",key:J}).then(c=>{const b=c.data;b&&s({...V,...b,enabledChecks:{...V.enabledChecks,...b.enabledChecks??{}}}),n(!0)})},[]);function j(c){const b={...t,...c};s(b),C({type:"SETTINGS_SET",key:J,value:b})}function p(c){const b={...t,enabledChecks:{...t.enabledChecks,...c}};s(b),C({type:"SETTINGS_SET",key:J,value:b})}return a?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-slate-600 leading-snug",children:"Adds vision-verified alt-text checking, heading-quality judgment, sensory-language detection, and ARIA semantic verification to every audit. Each check uses a small AI call against your configured provider; per-audit cost is hard-capped to prevent surprise bills."}),e.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:c=>j({enabled:c.target.checked})}),e.jsx("span",{children:e.jsx("strong",{children:"Enable AI augmentation"})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-provider",className:"block text-xs text-slate-500 mb-1",children:"Provider"}),e.jsxs("select",{id:"ai-provider",value:t.provider,onChange:c=>j({provider:c.target.value}),disabled:!t.enabled,className:"text-xs border border-slate-300 rounded px-2 py-1.5",children:[e.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),e.jsx("option",{value:"openai",children:"OpenAI (GPT) — coming soon"}),e.jsx("option",{value:"gemini",children:"Google (Gemini) — coming soon"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"ai-key",className:"block text-xs text-slate-500 mb-1",children:["API key",e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"stored locally; never sent anywhere except your chosen provider"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"ai-key",type:o?"text":"password",value:t.apiKey,onChange:c=>j({apiKey:c.target.value.trim()}),disabled:!t.enabled,placeholder:"sk-ant-…",className:"flex-1 text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),e.jsx("button",{type:"button",onClick:()=>u(!o),className:"text-[11px] px-2 border border-slate-300 rounded hover:bg-slate-50",children:o?"Hide":"Show"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-model",className:"block text-xs text-slate-500 mb-1",children:"Model override (optional)"}),e.jsx("input",{id:"ai-model",type:"text",value:t.model??"",onChange:c=>j({model:c.target.value.trim()}),disabled:!t.enabled,placeholder:"claude-3-5-sonnet-20241022 (default)",className:"w-full text-xs font-mono border border-slate-300 rounded px-2 py-1.5"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Leave blank for provider default. Use a haiku-class model for cheap-fast checks."})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ai-cap",className:"block text-xs text-slate-500 mb-1",children:"Per-audit cost cap (USD)"}),e.jsx("input",{id:"ai-cap",type:"number",step:.5,min:0,value:t.costCapUsd,onChange:c=>j({costCapUsd:Math.max(0,parseFloat(c.target.value)||0)}),disabled:!t.enabled,className:"w-32 text-xs border border-slate-300 rounded px-2 py-1.5"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:"Hard ceiling — once exceeded, remaining AI checks for the audit are skipped."})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Checks to run"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.altText,onChange:c=>p({altText:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Alt text"})," — verify every image's alt accurately describes it (vision call, ~$0.005 each)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.headings,onChange:c=>p({headings:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Headings"})," — judge whether headings describe their sections (text-only, cheap)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.sensory,onChange:c=>p({sensory:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Sensory language"}),' — flag instructions like "click the round button" (text-only, cheap)']})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.aria,onChange:c=>p({aria:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"ARIA semantics"})," — verify role= attributes match element behavior (more expensive; opt-in)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.imageOfText,onChange:c=>p({imageOfText:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Images of text"})," (WCAG 1.4.5) — flag banner / share-card / infographic images that bake text into the raster (vision; capped to ",t.imageOfTextMaxImages," largest images / audit)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.colorOnlyMeaning,onChange:c=>p({colorOnlyMeaning:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Color-only meaning"})," (WCAG 1.4.1) — flag status indicators / icons / instructions where only color conveys meaning (vision call)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.genericLinkText,onChange:c=>p({genericLinkText:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Generic link text"}),` (WCAG 2.4.4) — flag "click here"-style links where surrounding context doesn't clarify the destination (text-only, cheap)`]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.wallOfText,onChange:c=>p({wallOfText:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Wall of text"})," (WCAG 3.1.5) — flag long-form content with no subheadings, lists, or paragraph breaks (text-only, cheap)"]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t.enabledChecks.languageMismatch,onChange:c=>p({languageMismatch:c.target.checked}),disabled:!t.enabled}),e.jsxs("span",{children:[e.jsx("strong",{children:"Language mismatch"})," (WCAG 3.1.1 / 3.1.2) — flag content that doesn't match the declared ",e.jsx("code",{children:"lang"})," attribute (text-only, cheap)"]})]})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Connection test"}),e.jsx("p",{className:"text-[11px] text-slate-500 mb-2",children:"Fires a 5-token call to your provider to confirm the key authenticates and the account is funded. Costs ≈ $0.0001."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void y(),disabled:!t.apiKey||m,className:"text-xs px-3 py-1 border border-slate-300 rounded hover:bg-slate-50 disabled:opacity-50",children:m?"Testing…":"Test connection"}),x&&e.jsxs("span",{className:`text-[11px] ${x.ok?"text-emerald-700":"text-rose-700"}`,children:[x.ok?"✓ ":"✗ ",x.message]})]})]}),e.jsxs("fieldset",{className:"border border-slate-200 rounded p-3",children:[e.jsx("legend",{className:"text-xs font-medium px-1",children:"Local usage"}),e.jsxs("p",{className:"text-[11px] text-slate-500 mb-2",children:["Tracked locally per audit. Providers don't expose live balance via API, so check"," ",e.jsx("a",{href:"https://console.anthropic.com/settings/billing",target:"_blank",rel:"noopener noreferrer",className:"text-brand-700 underline",children:"console.anthropic.com → Plans & Billing"})," ","for your real balance."]}),d&&d.totalAudits===0&&e.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"No AI-augmented audits recorded yet."}),d&&d.totalAudits>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"All-time spent"}),e.jsxs("div",{className:"font-semibold text-slate-800",children:["$",d.totalSpentUsd.toFixed(4)]}),e.jsxs("div",{className:"text-[10px] text-slate-500",children:[d.totalAudits," audit",d.totalAudits===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"This month"}),e.jsxs("div",{className:"font-semibold text-slate-800",children:["$",d.spentThisMonthUsd.toFixed(4)]}),e.jsxs("div",{className:"text-[10px] text-slate-500",children:[d.auditsThisMonth," audit",d.auditsThisMonth===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded p-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"Avg / audit"}),e.jsx("div",{className:"font-semibold text-slate-800",children:d.averageCostUsd!=null?`$${d.averageCostUsd.toFixed(4)}`:"—"})]})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"text-[11px] cursor-pointer text-slate-600",children:"By check type"}),e.jsx("ul",{className:"mt-1 text-[11px] text-slate-700",children:Object.entries(d.byCheck).map(([c,b])=>e.jsxs("li",{className:"flex items-center justify-between py-0.5",children:[e.jsx("code",{className:"font-mono",children:c}),e.jsxs("span",{children:["$",(b??0).toFixed(4)]})]},c))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"text-[11px] cursor-pointer text-slate-600",children:"Recent audits (last 10)"}),e.jsxs("table",{className:"mt-1 w-full text-[11px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-slate-500 text-left",children:[e.jsx("th",{className:"py-0.5 pr-2 font-medium",children:"When"}),e.jsx("th",{className:"py-0.5 pr-2 font-medium",children:"Target"}),e.jsx("th",{className:"py-0.5 pr-2 font-medium text-right",children:"Cost"}),e.jsx("th",{className:"py-0.5 font-medium text-right",children:"Findings"})]})}),e.jsx("tbody",{children:d.recent.map((c,b)=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsx("td",{className:"py-0.5 pr-2 text-slate-600",children:new Date(c.at).toLocaleDateString()}),e.jsx("td",{className:"py-0.5 pr-2 text-slate-700 truncate max-w-[180px]",title:c.pageUrl,children:c.pageUrl}),e.jsxs("td",{className:"py-0.5 pr-2 text-right font-mono",children:["$",c.totalCostUsd.toFixed(4),c.capExceeded&&e.jsx("span",{className:"text-amber-700 ml-1",title:"Cost cap exceeded",children:"⚠"}),c.failureReason&&e.jsx("span",{className:"text-red-700 ml-1",title:`AI failure: ${c.failureReason}`,children:"✗"})]}),e.jsx("td",{className:"py-0.5 text-right",children:c.findingsCount})]},b))})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:()=>void v(),className:"text-[11px] text-slate-500 hover:text-rose-600 underline-offset-2 hover:underline",children:"Clear local usage log"})})]})]})]}):e.jsx("div",{className:"text-xs text-slate-500",children:"Loading…"})}function ns(){const[t,s]=i.useState(null),[a,n]=i.useState("trial");i.useEffect(()=>{w({type:"SETTINGS_GET_ALL"}).then(l=>{const m=l.data??{};s({stateMatrix:m.stateMatrix??ee,componentIdAliases:m.componentIdAliases??{}})}),w({type:"TIER_GET"}).then(l=>n(l.tier))},[]);function o(l){t&&(s({...t,stateMatrix:l}),C({type:"SETTINGS_SET",key:"stateMatrix",value:l}))}function u(l){if(!t)return;const m=new Set(l.map(f=>f.id)),h=t.stateMatrix.breakpoints.filter(f=>m.has(f));o({...t.stateMatrix,breakpointPresets:l,breakpoints:h.length>0?h:l[0]?[l[0].id]:[]})}function d(l){t&&(s({...t,componentIdAliases:l}),C({type:"SETTINGS_SET",key:"componentIdAliases",value:l}))}function r(){t&&(typeof confirm=="function"&&!confirm("Reset state matrix to defaults?")||o(ee))}if(!t)return e.jsx("div",{className:"p-8 text-sm text-slate-500",children:"Loading…"});const x=a==="free";return e.jsxs("div",{className:"max-w-2xl mx-auto p-3 sm:p-6 space-y-6 text-sm",children:[e.jsxs("header",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Settings"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Changes are saved automatically. Close this tab to return to the audit panel."})]}),e.jsx("button",{type:"button",onClick:()=>{window.close()},className:"text-xs px-3 py-1.5 bg-brand-500 text-white rounded hover:bg-brand-600 shrink-0",children:"Done"})]}),e.jsx("main",{"aria-label":"Settings",children:e.jsxs(pt,{defaultValue:"audit",className:"space-y-4",children:[e.jsx(bt,{className:"flex flex-wrap gap-1 border-b border-slate-200","aria-label":"Settings categories",children:[{value:"audit",label:"Audit"},{value:"integrations",label:"Integrations"},{value:"account",label:"Account"},{value:"advanced",label:"Advanced"}].map(l=>e.jsx(ft,{value:l.value,className:"text-xs px-3 py-1.5 text-slate-600 hover:text-slate-900 data-[state=active]:text-brand-700 data-[state=active]:border-b-2 data-[state=active]:border-brand-500 -mb-px",children:l.label},l.value))}),e.jsxs(O,{value:"audit",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"State matrix"}),e.jsx("button",{onClick:r,className:"text-xs text-slate-500 hover:text-slate-900",children:"Reset to defaults"})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Which states each audit covers. Larger matrix = more coverage but slower runs."}),x&&e.jsx("div",{className:"text-xs bg-amber-50 border border-amber-200 rounded p-2 text-amber-900",children:"Free tier audits the default state only — your matrix selections below will be ignored until you upgrade."}),e.jsx(jt,{value:t.stateMatrix,onChange:o})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Breakpoint presets"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Customize widths/heights and add your own breakpoints. Toggle which ones audit under in the State matrix section above."}),e.jsx(Ot,{presets:t.stateMatrix.breakpointPresets,onChange:u})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Audit reliability"}),e.jsx(ts,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Disabled rules"}),e.jsx(Wt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Component identity aliases"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Map two component IDs to the same canonical ID — useful when the same component is identified differently across pages."}),e.jsx(Nt,{value:t.componentIdAliases,onChange:d})]})]}),e.jsxs(O,{value:"integrations",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"GitHub issue tracker"}),e.jsx(qt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Jira issue tracker"}),e.jsx(Xt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Cloud sync (baselines)"}),e.jsx(es,{})]})]}),e.jsxs(O,{value:"account",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"User mode"}),e.jsx(ss,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"License"}),e.jsx(Dt,{tier:a,onTierChange:n})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Crash reporting"}),e.jsx(Bt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"AI augmentation"}),e.jsx(as,{})]})]}),e.jsxs(O,{value:"advanced",className:"space-y-8 pt-2",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Report download behavior"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Defense / evidence bundles default to a confirmation prompt before downloading. Power users who export many bundles can skip the prompt here."}),e.jsx(Kt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Performance"}),e.jsx(Vt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Team"}),e.jsx("p",{className:"text-xs text-slate-500",children:"For Team plans: see every device that's claimed a seat under this license, and revoke any of them. The license token itself authenticates this section — anyone with the token can manage seats."}),e.jsx(Jt,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Import / export"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Share matrix + alias config with your team, or back up before major changes."}),e.jsx(Gt,{stateMatrix:t.stateMatrix,componentIdAliases:t.componentIdAliases,onImport:l=>s(l)})]})]})]})}),e.jsx(Oe,{})]})}const Le=document.getElementById("root");if(!Le)throw new Error("options: #root not found");Ge(Le).render(e.jsx(D.StrictMode,{children:e.jsx(ns,{})}));
|