Aimobile / assets /AccessibilityAuditor-uF6Qx8UH.js
admin08077's picture
Upload 395 files
634008a verified
import{r as t,j as e}from"./react-B-lWpQRQ.js";import{at as N,L as w,S as v,M as S,aE as L,aF as R}from"./index-DyMS-nC-.js";import"./@google-xfXoiafW.js";import"./@braintree-DY5JYOZd.js";import"./react-dom-CU2yWD-Y.js";import"./scheduler-DYLXRpC5.js";import"./idb-Dob3nYDb.js";import"./axe-core-CA05Kxsw.js";import"./marked-CesSW9Du.js";import"./@mermaid-js-Ce0__7Tp.js";import"./langium-B_PGe6V2.js";import"./vscode-jsonrpc-2tvYB2ki.js";import"./chevrotain-D5DQZOif.js";import"./@chevrotain-DMYZVohV.js";import"./lodash-es-CKTcnrxn.js";import"./chevrotain-allstar-eFSt8-qu.js";import"./vscode-languageserver-types-NoPvPymt.js";import"./vscode-languageserver-textdocument-CKBVUiR3.js";import"./vscode-uri-CoxP0whD.js";const P=()=>{const[i,f]=t.useState("https://react.dev"),[g,b]=t.useState(""),[l,c]=t.useState(null),[a,m]=t.useState(!1),[x,u]=t.useState(null),[p,o]=t.useState({}),d=t.useRef(null),j=()=>{const s=i.startsWith("http")?i:`https://${i}`;b(s),m(!0),c(null),o({})},y=async()=>{if(a&&d.current)try{const s=await L(d.current.contentWindow.document);c(s)}catch(s){console.error(s),alert("Could not audit this page. This may be due to security restrictions (CORS).")}finally{m(!1)}},A=async s=>{const r=s.id;u(r);try{const h=await R(s);o(n=>({...n,[r]:h}))}catch{o(n=>({...n,[r]:"Could not get suggestion."}))}finally{u(null)}};return e.jsxs("div",{className:"h-full flex flex-col p-4 sm:p-6 lg:p-8 text-text-primary",children:[e.jsxs("header",{className:"mb-6",children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[e.jsx(N,{}),e.jsx("span",{className:"ml-3",children:"Automated Accessibility Auditor"})]}),e.jsx("p",{className:"text-text-secondary mt-1",children:"Audit a live URL for accessibility issues and get AI-powered fixes."})]}),e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("input",{type:"text",value:i,onChange:s=>f(s.target.value),placeholder:"https://example.com",className:"flex-grow p-2 border rounded"}),e.jsx("button",{onClick:j,disabled:a,className:"btn-primary px-6 py-2",children:a?"Auditing...":"Audit"})]}),e.jsxs("div",{className:"flex-grow grid grid-cols-1 lg:grid-cols-2 gap-6 min-h-0",children:[e.jsx("div",{className:"bg-background border-2 border-dashed border-border rounded-lg overflow-hidden",children:e.jsx("iframe",{ref:d,src:g,title:"Audit Target",className:"w-full h-full bg-white",onLoad:y,sandbox:"allow-scripts allow-same-origin"})}),e.jsxs("div",{className:"bg-surface p-4 border border-border rounded-lg flex flex-col",children:[e.jsx("h3",{className:"text-lg font-bold mb-2",children:"Audit Results"}),e.jsxs("div",{className:"flex-grow overflow-y-auto pr-2",children:[a&&e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsx(w,{})}),l&&(l.violations.length===0?e.jsx("p",{children:"No violations found!"}):l.violations.map((s,r)=>e.jsxs("div",{className:"p-3 mb-2 bg-background border border-border rounded",children:[e.jsx("p",{className:"font-bold text-red-600",children:s.help}),e.jsx("p",{className:"text-sm my-1",children:s.description}),e.jsxs("button",{onClick:()=>A(s),disabled:!!x,className:"text-xs flex items-center gap-1 text-primary font-semibold",children:[e.jsx(v,{})," ",x===s.id?"Getting fix...":"Ask AI for a fix"]}),p[s.id]&&e.jsx("div",{className:"mt-2 text-xs border-t pt-2",children:e.jsx(S,{content:p[s.id]})})]},s.id+r)))]})]})]})]})};export{P as AccessibilityAuditor};
//# sourceMappingURL=AccessibilityAuditor-uF6Qx8UH.js.map