@yuktishaalaa/yuktai 2.0.8 → 2.0.10

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/index.js CHANGED
@@ -1,12 +1,287 @@
1
- var h=null,E=null,M={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},W=new Set(["h1","h2","h3","h4","h5","h6"]),z=new Set(["input","select","textarea"]),q=new Set(["button","a","input","select","textarea","details","summary"]),V=new Set(["video","audio"]),U=new Set(["ul","ol","dl"]);var Z=new Set(["span","strong","em","b","i","u","s","small","mark","del","ins","sub","sup","abbr","cite","code","kbd","samp","var","time","q"]),$={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"},p={name:"yuktai-a11y",version:"1.0.0",observer:null,async execute(n){if(!n.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";let r=this.applyFixes(n);return n.autoFix&&this.startObserver(n),`yuktai-a11y: ${r.fixed} fixes applied across ${r.scanned} nodes in ${r.renderTime}ms.`},scan(){let n={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return n;let r=performance.now(),b=document.querySelectorAll("*");n.scanned=b.length;let f=(a,o,e,t)=>n.details.push({tag:a,fix:o,severity:e,element:t.outerHTML.slice(0,100)});return b.forEach(a=>{let o=a,e=o.tagName.toLowerCase();(e==="a"||e==="button")&&!o.innerText?.trim()&&!o.getAttribute("aria-label")&&f(e,"needs aria-label (empty)","critical",o),e==="img"&&!o.hasAttribute("alt")&&f(e,"needs alt text","serious",o),z.has(e)&&!o.getAttribute("aria-label")&&!o.getAttribute("aria-labelledby")&&f(e,"needs aria-label","serious",o),e==="iframe"&&!o.getAttribute("title")&&!o.getAttribute("aria-label")&&f(e,"iframe needs title","serious",o),V.has(e)&&!a.querySelector("track")&&!o.getAttribute("aria-label")&&f(e,"media needs captions/aria-label","serious",o),W.has(e)&&!o.innerText?.trim()&&!o.getAttribute("aria-label")&&f(e,"empty heading","moderate",o)}),n.fixed=n.details.length,n.renderTime=parseFloat((performance.now()-r).toFixed(2)),n},applyFixes(n){let r={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return r;let b=performance.now(),f=document.querySelectorAll("*");r.scanned=f.length;let a=(o,e,t,A)=>{r.details.push({tag:o,fix:e,severity:t,element:A.outerHTML.slice(0,100)}),r.fixed++};if(f.forEach(o=>{let e=o,t=e.tagName.toLowerCase();if(t==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(t,'lang="en" added to <html>',"critical",e)),t==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(t,`document.title set to "${document.title}"`,"serious",e)),t==="meta"){let i=e.getAttribute("name"),l=e.getAttribute("content")||"";i==="viewport"&&l.includes("user-scalable=no")&&(e.setAttribute("content",l.replace("user-scalable=no","user-scalable=yes")),a(t,"user-scalable=yes restored","serious",e)),i==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(l)&&(e.setAttribute("content",l.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(t,"maximum-scale=5 restored","serious",e))}if(t==="body"&&!document.querySelector("[data-yuktai-skip]")){let i=document.createElement("a");i.setAttribute("href","#main-content"),i.setAttribute("data-yuktai-skip","true"),i.setAttribute("aria-label","Skip to main content"),i.textContent="Skip to main content",i.style.cssText="position:fixed;top:-40px;left:0;background:#0d9488;color:#fff;padding:8px 16px;z-index:99999;font-family:system-ui;font-size:14px;border-radius:0 0 4px 0;text-decoration:none;transition:top 0.2s;",i.addEventListener("focus",()=>{i.style.top="0"}),i.addEventListener("blur",()=>{i.style.top="-40px"}),e.insertBefore(i,e.firstChild),a(t,"skip-to-content link injected","minor",e);let l=document.querySelector("main,[role='main']");l&&!l.getAttribute("tabindex")&&l.setAttribute("tabindex","-1")}if(W.has(t)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${t.toUpperCase()} section`),a(t,`aria-label="${t.toUpperCase()} section" (empty heading)`,"moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e.click())}),a(t,"tabindex=0 + keydown (clickable heading)","minor",e))),t==="p"&&e.getAttribute("dir")==="rtl"&&!e.getAttribute("lang")&&!document.documentElement.getAttribute("lang")&&(e.setAttribute("lang","ar"),a(t,'lang="ar" (rtl paragraph)',"moderate",e)),t==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(t,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(t,'alt="" (role=presentation)',"minor",e))),t==="area"&&!e.getAttribute("alt")){let i=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",i),a(t,`alt="${i}" on <area>`,"serious",e)}if(t==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!o.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let i=document.createElementNS("http://www.w3.org/2000/svg","title");i.textContent="graphic",e.prepend(i),e.setAttribute("role","img"),a(t,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(t,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(t==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(t,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(t,"aria-label added to canvas","serious",e))),(t==="object"||t==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${t} content`),a(t,`aria-label added to <${t}>`,"moderate",e)),t==="video"&&!o.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(t,"aria-label added (no captions track)","serious",e)),t==="audio"&&!o.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(t,"aria-label added to audio","serious",e)),t==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(t,'title + aria-label="embedded content"',"serious",e)),t==="figure"&&!o.querySelector("figcaption")&&!e.getAttribute("aria-label")){let l=o.querySelector("img")?.getAttribute("alt");l&&(e.setAttribute("aria-label",l),a(t,"aria-label from inner img alt","minor",e))}if(t==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let i=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",i),a(t,`aria-label="${i}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),r.fixed++)}if(t==="a"){let i=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let l=e.getAttribute("title")||"link";e.setAttribute("aria-label",l),a(t,`aria-label="${l}" (empty link)`,"critical",e)}if(i.target==="_blank"){i.rel?.includes("noopener")||(i.rel="noopener noreferrer",r.fixed++);let l=i.getAttribute("aria-label")||i.innerText?.trim()||"link";l.includes("opens in new window")||(i.setAttribute("aria-label",`${l} (opens in new window)`),a(t,"aria-label: new-window warning","moderate",e))}!i.href&&!i.getAttribute("role")&&!i.getAttribute("tabindex")&&(i.setAttribute("role","button"),i.setAttribute("tabindex","0"),a(t,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!q.has(t)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(t,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,r.fixed++),e.onkeydown||(e.onkeydown=i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e.click())})),z.has(t)){let i=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let l=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||t;e.setAttribute("aria-label",l),a(t,`aria-label="${l}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),r.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),r.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),r.fixed++),t==="input"&&!i.autocomplete){let l=i.name||"";i.type==="email"||l.includes("email")?(i.autocomplete="email",r.fixed++):i.type==="tel"||l.includes("tel")?(i.autocomplete="tel",r.fixed++):i.type==="password"?(i.autocomplete="current-password",r.fixed++):l.includes("firstname")||l.includes("fname")?(i.autocomplete="given-name",r.fixed++):l.includes("lastname")||l.includes("lname")?(i.autocomplete="family-name",r.fixed++):l==="name"||l.includes("fullname")?(i.autocomplete="name",r.fixed++):l.includes("zip")||l.includes("postal")?(i.autocomplete="postal-code",r.fixed++):l.includes("city")?(i.autocomplete="address-level2",r.fixed++):l.includes("country")&&(i.autocomplete="country",r.fixed++)}t==="input"&&i.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(t,"alt added to input[type=image]","serious",e)),t==="input"&&i.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",i.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",i.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",i.value||"50"),r.fixed++)}if(t==="fieldset"&&!o.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(t,'aria-label="form group" (no legend)',"moderate",e)),t==="label"){let i=e.getAttribute("for"),l=o.querySelector("input,select,textarea");!i&&!l&&!e.getAttribute("aria-label")&&a(t,"label not associated with any control","moderate",e)}if(t==="table"&&(!o.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(t,'role="grid" (no <th>)',"serious",e)),!o.querySelector("caption")&&!e.getAttribute("aria-label")&&!e.getAttribute("summary")&&(e.setAttribute("aria-label","data table"),a(t,'aria-label="data table" (no caption)',"moderate",e))),t==="th"&&!e.getAttribute("scope")){let i=e.closest("thead")!==null;e.setAttribute("scope",i?"col":"row"),a(t,`scope="${i?"col":"row"}"`,"moderate",e)}if(U.has(t)&&(e.getAttribute("role")==="presentation"&&(o.querySelectorAll("li").forEach(i=>{i.getAttribute("role")||i.setAttribute("role","presentation")}),r.fixed++),(t==="ul"||t==="ol")&&!e.getAttribute("aria-label"))){let i=e.closest("nav");i&&(e.setAttribute("aria-label",i.getAttribute("aria-label")||"navigation list"),a(t,"aria-label from parent nav","minor",e))}if(t==="dt"&&!e.getAttribute("aria-label")){let i=e.nextElementSibling;(!i||i.tagName.toLowerCase()!=="dd")&&(e.setAttribute("aria-label",e.innerText?.trim()||"term"),a(t,"aria-label on <dt> (no following <dd>)","minor",e))}if($[t]&&!e.getAttribute("role")&&(e.setAttribute("role",$[t]),a(t,`role="${$[t]}"`,"minor",e)),["nav","section","article","aside"].includes(t)){let i=o.parentElement?.querySelectorAll(t);if(i&&i.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let m=o.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();m&&(e.setAttribute("aria-label",m),a(t,"aria-label from inner heading","moderate",e))}}if(t==="details"&&!o.querySelector("summary")){let i=document.createElement("summary");i.textContent=e.getAttribute("aria-label")||"More details",e.prepend(i),a(t,"<summary> injected","moderate",e)}if(t==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(t,'aria-label="Toggle details" (empty summary)',"moderate",e)),t==="dialog"){let i=e.getAttribute("role");if(i&&i!=="dialog"&&(e.setAttribute("role","dialog"),a(t,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let m=o.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",m),a(t,"aria-label added to dialog","serious",e)}}if(t==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(t,"title added to <abbr>","minor",e)),t==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(t,`datetime="${e.innerText.trim()}" added`,"minor",e)),t==="mark"&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",`highlighted: ${e.innerText?.trim()?.slice(0,60)}`),a(t,"aria-label added to <mark>","minor",e)),t==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(t,"aria-label added to <meter>","moderate",e)),t==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(t,"aria-label added to <progress>","moderate",e));let i=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(i.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(i.max||1)),r.fixed++}let u=e.getAttribute("role")||"";if(u==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),r.fixed++),u==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(t,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),r.fixed++)),["alert","status","log","marquee"].includes(u)){if(!e.getAttribute("aria-live")){let i=u==="alert"?"assertive":"polite";e.setAttribute("aria-live",i),a(t,`aria-live="${i}" on role=${u}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),r.fixed++)}u==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),r.fixed++),(u==="menu"||u==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(t,'aria-label="menu"',"moderate",e)),u==="menuitem"&&e.tabIndex<0&&(e.tabIndex=-1,r.fixed++),u==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(t,'aria-label="listbox"',"moderate",e)),u==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),r.fixed++),u==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),r.fixed++),(u==="checkbox"||u==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(t,`aria-checked="false" on role=${u}`,"serious",e)),u==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(t,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),r.fixed++)),(u==="grid"||u==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(t,'aria-label="data grid"',"moderate",e)),u==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(t,'aria-label="tree"',"moderate",e)),u==="treeitem"&&o.querySelector('[role="group"]')&&!e.getAttribute("aria-expanded")&&(e.setAttribute("aria-expanded","false"),r.fixed++),u==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),r.fixed++);let d=!["html","head","meta","script","style","link","noscript"].includes(t);if(n.highContrast&&d&&!Z.has(t)&&(e.style.filter="contrast(1.15) brightness(1.05)"),n.reduceMotion&&d&&(e.style.transition="none",e.style.animation="none"),n.fontSizeMultiplier&&n.fontSizeMultiplier!==1&&d){let i=parseFloat(window.getComputedStyle(e).fontSize);!isNaN(i)&&i>0&&(e.style.fontSize=`${i*n.fontSizeMultiplier}px`)}if(n.colorBlindMode&&n.colorBlindMode!=="none"&&t==="body"){let i=n.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${M[n.colorBlindMode]})`;e.style.filter=i}n.keyboardHints&&(q.has(t)||e.tabIndex>=0)&&(e.style.outline="2px solid #007acc",e.style.outlineOffset="2px")}),n.colorBlindMode&&n.colorBlindMode!=="none"&&!E){let o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("aria-hidden","true"),o.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",o.innerHTML=`
2
- <defs>
3
- <filter id="${M.deuteranopia}">
4
- <feColorMatrix type="matrix" values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
5
- </filter>
6
- <filter id="${M.protanopia}">
7
- <feColorMatrix type="matrix" values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/>
8
- </filter>
9
- <filter id="${M.tritanopia}">
10
- <feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
11
- </filter>
12
- </defs>`,document.body.appendChild(o),E=o}return this.ensureLiveRegion(),r.renderTime=parseFloat((performance.now()-b).toFixed(2)),r},removeColorBlindSvg(){E?.remove(),E=null},startObserver(n){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(n)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},ensureLiveRegion(){if(typeof document>"u"||h)return;let n=document.createElement("div");n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(n),h=n},removeLiveRegion(){h?.remove(),h=null},announce(n){h&&(h.textContent=n)}};import{useState as w,useEffect as T,useRef as H,useCallback as B}from"react";import J,{forwardRef as Q}from"react";import{jsx as c,jsxs as g}from"react/jsx-runtime";var _={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},v=[80,90,100,110,120,130,140,150],N=[{id:"highContrast",label:"High contrast",description:"contrast(1.15) brightness on all nodes",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables all transitions & animations",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"MutationObserver on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing",icon:"Aa"}];function X({checked:n,onChange:r,label:b}){return g("label",{"aria-label":b,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[c("input",{type:"checkbox",checked:n,onChange:f=>r(f.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),c("span",{style:{position:"absolute",inset:0,borderRadius:99,background:n?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),c("span",{style:{position:"absolute",top:3,left:n?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var F=Q(({position:n,settings:r,report:b,isActive:f,set:a,onApply:o,onReset:e,onClose:t},A)=>g("div",{ref:A,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...n==="left"?{left:88}:{right:88},width:312,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif"},children:[g("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[g("div",{children:[g("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v1.0.0"}),f&&c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),c("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),c("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes \xB7 Open Source"})]}),c("button",{onClick:t,"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),c("div",{style:{padding:"6px 0"},children:N.map((d,i)=>g(J.Fragment,{children:[g("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[g("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[c("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:d.icon}),g("div",{children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:d.label}),c("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:d.description})]})]}),c(X,{checked:r[d.id],onChange:l=>a(d.id,l),label:`Toggle ${d.label}`})]}),i<N.length-1&&c("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},d.id))}),g("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[g("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),g("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[r.fontScale,"%"]})]}),g("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c("button",{onClick:()=>{let d=v.indexOf(r.fontScale);d>0&&a("fontScale",v[d-1])},disabled:r.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:r.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:r.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),c("div",{style:{flex:1,display:"flex",gap:3},children:v.map(d=>c("button",{onClick:()=>a("fontScale",d),"aria-label":`Set text size to ${d}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:d<=r.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},d))}),c("button",{onClick:()=>{let d=v.indexOf(r.fontScale);d<v.length-1&&a("fontScale",v[d+1])},disabled:r.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:r.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:r.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),b&&c("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:b.fixed>0?`\u2713 ${b.fixed} fixes applied \xB7 ${b.scanned} nodes \xB7 ${b.renderTime}ms`:`\u2713 0 fixes needed \xB7 ${b.scanned} nodes clean \xB7 ${b.renderTime}ms`}),g("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[c("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),c("button",{onClick:o,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));F.displayName="WidgetPanel";import{Fragment as O,jsx as C,jsxs as G}from"react/jsx-runtime";var R=null,S=null;function P({children:n,position:r="left"}){let[b,f]=w(!1),[a,o]=w(!1),[e,t]=w(_),[A,u]=w(null),[d,i]=w(!1),l=H(null),m=H(null);T(()=>f(!0),[]),T(()=>{if(R)return;let s=document.createElement("style");return s.innerHTML="*:focus-visible{outline:3px solid #0d9488!important;outline-offset:2px!important;box-shadow:0 0 0 5px rgba(13,148,136,.25)!important;}",document.head.appendChild(s),R=s,()=>{R?.remove(),R=null}},[]),T(()=>()=>{p.stopObserver(),p.removeLiveRegion(),p.removeColorBlindSvg()},[]),T(()=>{if(!a)return;let s=y=>{l.current&&!l.current.contains(y.target)&&m.current&&!m.current.contains(y.target)&&o(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[a]),T(()=>{let s=y=>{y.key==="Escape"&&a&&(o(!1),m.current?.focus())};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[a]);let Y=(s,y)=>t(k=>({...k,[s]:y})),K=B(async()=>{let s={enabled:!0,highContrast:e.highContrast,reduceMotion:e.reduceMotion,autoFix:e.autoFix},y=await p.execute(s);if(console.log("[yuktai-a11y]",y),u(p.applyFixes(s)),document.documentElement.style.fontSize=`${e.fontScale}%`,e.dyslexiaFont){if(!S){let k=document.createElement("style");k.textContent="body,body *{font-family:'Georgia',serif!important;letter-spacing:.06em!important;word-spacing:.12em!important;line-height:1.9!important;}",document.head.appendChild(k),S=k}}else S?.remove(),S=null;i(!0),o(!1),p.announce("yuktai-a11y active.")},[e]),j=B(async()=>{await p.execute({enabled:!1}),document.documentElement.style.fontSize="",S?.remove(),S=null,document.querySelectorAll("*").forEach(s=>{s.style.filter="",s.style.transition="",s.style.animation=""}),t(_),u(null),i(!1),p.announce("yuktai-a11y disabled.")},[]);return b?G(O,{children:[n,G("button",{ref:m,onClick:()=>o(s=>!s),"aria-label":"Open yuktai-a11y accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...r==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:d?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:s=>s.currentTarget.style.transform="scale(1.08)",onMouseLeave:s=>s.currentTarget.style.transform="scale(1)",onFocus:s=>s.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:s=>s.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[C("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",children:C("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),d&&C("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&C(F,{ref:l,position:r,settings:e,report:A,isActive:d,set:Y,onApply:K,onReset:j,onClose:()=>o(!1)})]}):C(O,{children:n})}var I={name:"ai.text",async execute(n){return`\u{1F916} YuktAI says: ${n}`}};var L={name:"voice.text",async execute(n){return!n||n.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${n}`}};var x=class{plugins=new Map;register(r,b){if(!b||typeof b.execute!="function")throw new Error(`Invalid plugin: ${r}`);this.plugins.set(r,b)}use(r){return this.plugins.get(r)}async run(r,b){try{let f=this.use(r);if(!f)throw new Error(`Plugin not found: ${r}`);return await f.execute(b)}catch(f){throw console.error(`[YuktAI Runtime Error in ${r}]:`,f),f}}getPlugins(){return Array.from(this.plugins.keys())}};function ee(){if(typeof globalThis>"u")return new x;if(!globalThis.__yuktai_runtime__){let n=new x;n.register(p.name,p),n.register(I.name,I),n.register(L.name,L),globalThis.__yuktai_runtime__=n}return globalThis.__yuktai_runtime__}var D=typeof window<"u"?ee():new x,we={wcagPlugin:p,list(){return D.getPlugins()},use(n){return D.use(n)},fix(n){return p.applyFixes({enabled:!0,autoFix:!0,...n})},scan(){return p.scan()}};export{x as Runtime,we as YuktAI,P as YuktAIWrapper,I as aiPlugin,P as default,L as voicePlugin,p as wcag,p as wcagPlugin};
1
+ var I=null,U=null,C=null,J=null,D=null,g=null,k=null,z=null,O=null,w=null,_={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},X=new Set(["h1","h2","h3","h4","h5","h6"]),Z=new Set(["input","select","textarea"]),me=new Set(["button","a","input","select","textarea","details","summary"]),ye=new Set(["video","audio"]),xe=new Set(["ul","ol","dl"]);var j={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function K(t,i="polite"){if(typeof window>"u"||!w?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(t);n.rate=1,n.pitch=1,n.volume=1;let s=window.speechSynthesis.getVoices();s.length>0&&(n.voice=s[0]),window.speechSynthesis.speak(n)}function ie(t,i="info"){if(typeof document>"u")return;let s={success:{bg:"#0f9d58",border:"#0a7a44",icon:"\u2713"},error:{bg:"#d93025",border:"#b52a1c",icon:"\u2715"},warning:{bg:"#f29900",border:"#c67c00",icon:"\u26A0"},info:{bg:"#1a73e8",border:"#1557b0",icon:"\u2139"}}[i];g||(g=document.createElement("div"),g.setAttribute("role","alert"),g.setAttribute("aria-live","assertive"),g.setAttribute("aria-atomic","true"),g.style.cssText=`
2
+ position:fixed;top:80px;right:16px;z-index:999999;
3
+ max-width:320px;width:calc(100% - 32px);
4
+ border-radius:8px;padding:12px 16px;
5
+ display:flex;align-items:center;gap:10px;
6
+ font-family:system-ui,sans-serif;font-size:14px;
7
+ box-shadow:0 4px 12px rgba(0,0,0,0.3);
8
+ transition:transform 0.3s,opacity 0.3s;
9
+ transform:translateX(120%);opacity:0;
10
+ `,document.body.appendChild(g)),g.style.background=s.bg,g.style.border=`1px solid ${s.border}`,g.style.color="#fff",g.innerHTML=`
11
+ <span style="font-size:18px;font-weight:700">${s.icon}</span>
12
+ <span style="flex:1;line-height:1.4">${t}</span>
13
+ <button onclick="this.parentElement.style.transform='translateX(120%)';this.parentElement.style.opacity='0'"
14
+ style="background:none;border:none;color:#fff;cursor:pointer;font-size:18px;padding:0;line-height:1"
15
+ aria-label="Close notification">\xD7</button>
16
+ `,requestAnimationFrame(()=>{g&&(g.style.transform="translateX(0)",g.style.opacity="1")}),setTimeout(()=>{g&&(g.style.transform="translateX(120%)",g.style.opacity="0")},5e3)}function p(t,i="info",n=!0){I&&(I.textContent=t),ie(t,i),n&&K(t,i==="error"?"assertive":"polite")}function he(){if(typeof document>"u"||J)return;let t=[{label:"Skip to main content",selector:"main,[role='main'],#main,#main-content"},{label:"Skip to navigation",selector:"nav,[role='navigation'],#nav,#navigation"},{label:"Skip to search",selector:"[role='search'],#search,input[type='search']"}],i=document.createElement("div");i.setAttribute("data-yuktai-skip-bar","true"),i.setAttribute("role","navigation"),i.setAttribute("aria-label","Skip links"),i.style.cssText=`
17
+ position:fixed;top:0;left:0;right:0;z-index:999999;
18
+ display:flex;gap:4px;padding:4px;
19
+ background:#111;
20
+ transform:translateY(-100%);
21
+ transition:transform 0.2s ease;
22
+ font-family:system-ui,sans-serif;
23
+ `;let n=!1;if(t.forEach(({label:a,selector:l})=>{let e=document.querySelector(l);if(!e)return;n=!0,e.getAttribute("tabindex")||e.setAttribute("tabindex","-1");let r=document.createElement("a");r.href="#",r.textContent=a,r.style.cssText=`
24
+ color:#fff;background:#1a73e8;
25
+ padding:8px 14px;border-radius:4px;
26
+ font-size:13px;font-weight:600;
27
+ text-decoration:none;white-space:nowrap;
28
+ border:2px solid transparent;
29
+ transition:background 0.15s,border-color 0.15s;
30
+ `,r.addEventListener("focus",()=>{i.style.transform="translateY(0)"}),r.addEventListener("blur",()=>{setTimeout(()=>{i.matches(":focus-within")||(i.style.transform="translateY(-100%)")},2e3)}),r.addEventListener("keydown",y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),e.focus(),e.scrollIntoView({behavior:"smooth",block:"start"}),p(`Jumped to ${a.replace("Skip to ","")}`,"info"),i.style.transform="translateY(-100%)")}),r.addEventListener("click",y=>{y.preventDefault(),e.focus(),e.scrollIntoView({behavior:"smooth",block:"start"}),p(`Jumped to ${a.replace("Skip to ","")}`,"info"),i.style.transform="translateY(-100%)"}),r.addEventListener("mouseover",()=>{r.style.background="#1557b0",r.style.borderColor="#fff"}),r.addEventListener("mouseout",()=>{r.style.background="#1a73e8",r.style.borderColor="transparent"}),i.appendChild(r)}),!n)return;window.innerWidth<768&&(i.style.transform="translateY(0)",i.style.position="sticky"),document.body.insertBefore(i,document.body.firstChild),J=i}function Ae(){if(typeof document>"u"||document.querySelector("[data-yuktai-focus-style]"))return;let t=document.createElement("style");t.setAttribute("data-yuktai-focus-style","true"),t.textContent=`
31
+ /* WCAG 2.4.11 \u2014 minimum 2px solid focus indicator */
32
+ [data-yuktai-a11y] *:focus-visible {
33
+ outline: 3px solid #1a73e8 !important;
34
+ outline-offset: 3px !important;
35
+ border-radius: 2px !important;
36
+ box-shadow: 0 0 0 6px rgba(26,115,232,0.15) !important;
37
+ }
38
+
39
+ /* High contrast focus */
40
+ [data-yuktai-high-contrast] *:focus-visible {
41
+ outline: 3px solid #ffff00 !important;
42
+ outline-offset: 3px !important;
43
+ box-shadow: 0 0 0 6px rgba(255,255,0,0.2) !important;
44
+ }
45
+
46
+ /* Keyboard hint mode */
47
+ [data-yuktai-keyboard] *:focus {
48
+ outline: 3px solid #ff6b35 !important;
49
+ outline-offset: 3px !important;
50
+ }
51
+
52
+ /* Remove default outline \u2014 replaced by above */
53
+ [data-yuktai-a11y] *:focus:not(:focus-visible) {
54
+ outline: none !important;
55
+ }
56
+
57
+ /* Large targets \u2014 WCAG 2.5.8 */
58
+ [data-yuktai-large-targets] button,
59
+ [data-yuktai-large-targets] a,
60
+ [data-yuktai-large-targets] input,
61
+ [data-yuktai-large-targets] select,
62
+ [data-yuktai-large-targets] [role="button"] {
63
+ min-height: 44px !important;
64
+ min-width: 44px !important;
65
+ }
66
+
67
+ /* Reduce motion \u2014 WCAG 2.3.3 */
68
+ [data-yuktai-reduce-motion] *,
69
+ [data-yuktai-reduce-motion] *::before,
70
+ [data-yuktai-reduce-motion] *::after {
71
+ animation-duration: 0.001ms !important;
72
+ transition-duration: 0.001ms !important;
73
+ }
74
+
75
+ /* High contrast mode */
76
+ [data-yuktai-high-contrast] {
77
+ filter: contrast(1.4) brightness(1.05) !important;
78
+ }
79
+
80
+ /* Dark mode */
81
+ [data-yuktai-dark] {
82
+ filter: invert(1) hue-rotate(180deg) !important;
83
+ }
84
+ [data-yuktai-dark] img,
85
+ [data-yuktai-dark] video,
86
+ [data-yuktai-dark] canvas {
87
+ filter: invert(1) hue-rotate(180deg) !important;
88
+ }
89
+
90
+ /* Skip link bar responsive */
91
+ @media (max-width: 768px) {
92
+ [data-yuktai-skip-bar] {
93
+ flex-wrap: wrap;
94
+ }
95
+ [data-yuktai-skip-bar] a {
96
+ font-size: 12px !important;
97
+ padding: 6px 10px !important;
98
+ }
99
+ }
100
+
101
+ /* Preference panel responsive */
102
+ @media (max-width: 480px) {
103
+ [data-yuktai-panel] {
104
+ width: 100% !important;
105
+ right: 0 !important;
106
+ bottom: 0 !important;
107
+ border-radius: 16px 16px 0 0 !important;
108
+ }
109
+ }
110
+
111
+ /* Link underline enforcement */
112
+ [data-yuktai-a11y] a:not([role]):not([class]) {
113
+ text-decoration: underline !important;
114
+ }
115
+ `,document.head.appendChild(t),document.documentElement.setAttribute("data-yuktai-a11y","true")}function ve(){typeof document>"u"||document.querySelector("[data-yuktai-kb-init]")||(document.documentElement.setAttribute("data-yuktai-kb-init","true"),document.addEventListener("keydown",t=>{let i=document.activeElement;if(!i)return;let n=i.getAttribute("role")||"";if(t.key==="Escape"){let s=i.closest("[role='dialog'],[role='alertdialog']");if(s){s.style.display="none";let l=s.getAttribute("data-yuktai-trigger");l&&document.querySelector(`[data-yuktai-id='${l}']`)?.focus(),p("Dialog closed","info");return}let a=i.closest("[role='menu'],[role='menubar']");a&&(a.style.display="none",p("Menu closed","info"))}if(n==="menuitem"||i.closest("[role='menu'],[role='menubar']")){let s=i.closest("[role='menu'],[role='menubar']");if(!s)return;let a=Array.from(s.querySelectorAll("[role='menuitem']:not([disabled])")),l=a.indexOf(i);t.key==="ArrowDown"||t.key==="ArrowRight"?(t.preventDefault(),a[(l+1)%a.length]?.focus()):t.key==="ArrowUp"||t.key==="ArrowLeft"?(t.preventDefault(),a[(l-1+a.length)%a.length]?.focus()):t.key==="Home"?(t.preventDefault(),a[0]?.focus()):t.key==="End"&&(t.preventDefault(),a[a.length-1]?.focus())}if(n==="tab"||i.closest("[role='tablist']")){let s=i.closest("[role='tablist']");if(!s)return;let a=Array.from(s.querySelectorAll("[role='tab']:not([disabled])")),l=a.indexOf(i);if(t.key==="ArrowRight"||t.key==="ArrowDown"){t.preventDefault();let e=a[(l+1)%a.length];e?.focus(),e?.click()}else if(t.key==="ArrowLeft"||t.key==="ArrowUp"){t.preventDefault();let e=a[(l-1+a.length)%a.length];e?.focus(),e?.click()}}if(n==="option"||i.closest("[role='listbox']")){let s=i.closest("[role='listbox']");if(!s)return;let a=Array.from(s.querySelectorAll("[role='option']:not([aria-disabled='true'])")),l=a.indexOf(i);t.key==="ArrowDown"?(t.preventDefault(),a[(l+1)%a.length]?.focus()):t.key==="ArrowUp"?(t.preventDefault(),a[(l-1+a.length)%a.length]?.focus()):(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),i.setAttribute("aria-selected","true"),a.forEach(e=>{e!==i&&e.setAttribute("aria-selected","false")}),p(`Selected: ${i.textContent?.trim()}`,"success"))}t.altKey&&t.key==="a"&&(t.preventDefault(),ae()),t.key==="Tab"&&w?.speechEnabled&&setTimeout(()=>{let s=document.activeElement;if(!s)return;let a=s.getAttribute("aria-label")||s.getAttribute("title")||s.textContent?.trim()||s.tagName.toLowerCase(),l=s.getAttribute("role")||s.tagName.toLowerCase();K(`${a}, ${l}`)},100)}))}function S(t){let i=t.querySelectorAll('button:not([disabled]),a[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[role="button"]');if(i.length===0)return;let n=i[0],s=i[i.length-1];n.focus(),t.addEventListener("keydown",a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===n&&(a.preventDefault(),s.focus()):document.activeElement===s&&(a.preventDefault(),n.focus()))})}function ae(){if(typeof document>"u")return;if(k){k.remove(),k=null;return}let t=document.createElement("div");t.setAttribute("role","dialog"),t.setAttribute("aria-label","Keyboard shortcuts"),t.setAttribute("aria-modal","true"),t.style.cssText=`
116
+ position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
117
+ z-index:999999;background:#1a1a2e;color:#fff;
118
+ border-radius:12px;padding:24px;width:320px;max-width:calc(100vw - 32px);
119
+ box-shadow:0 20px 60px rgba(0,0,0,0.5);
120
+ font-family:system-ui,sans-serif;
121
+ `;let i=[["Alt + A","Open/close this menu"],["Tab","Next focusable element"],["Shift+Tab","Previous focusable element"],["Enter","Activate button or link"],["Space","Check checkbox / scroll"],["Arrow keys","Navigate lists and menus"],["Escape","Close dialog or menu"],["Home","First item in list"],["End","Last item in list"]];t.innerHTML=`
122
+ <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:16px">
123
+ <h2 style="margin:0;font-size:16px;font-weight:700;color:#74c0fc">
124
+ \u2328 Keyboard shortcuts
125
+ </h2>
126
+ <button data-yuktai-close style="background:none;border:none;color:#aaa;cursor:pointer;font-size:20px;padding:0;line-height:1" aria-label="Close shortcuts">\xD7</button>
127
+ </div>
128
+ ${i.map(([s,a])=>`
129
+ <div style="display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px solid #2a2a4a">
130
+ <kbd style="background:#2a2a4a;color:#74c0fc;padding:3px 8px;border-radius:4px;font-size:12px;font-family:monospace;border:1px solid #3a3a6a">${s}</kbd>
131
+ <span style="font-size:12px;color:#ccc;text-align:right;flex:1;margin-left:12px">${a}</span>
132
+ </div>
133
+ `).join("")}
134
+ <p style="margin:12px 0 0;font-size:11px;color:#888;text-align:center">
135
+ Powered by @yuktai/a11y \xB7 Press Escape to close
136
+ </p>
137
+ `,t.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{t.remove(),k=null}),t.addEventListener("keydown",s=>{s.key==="Escape"&&(t.remove(),k=null)}),document.body.appendChild(t),k=t,S(t),p("Keyboard shortcuts opened. Press Escape to close.","info")}function ke(t){if(typeof document>"u"||!w?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;D&&D.remove();let i=t.score,n=i>=90?"#0f9d58":i>=70?"#f29900":"#d93025",s=i>=90?"\u267F":i>=70?"\u26A0":"\u2715",a=document.createElement("button");a.setAttribute("aria-label",`Accessibility score: ${i} out of 100. Click for details.`),a.setAttribute("data-yuktai-badge","true"),a.style.cssText=`
138
+ position:fixed;bottom:16px;left:16px;z-index:999998;
139
+ background:${n};color:#fff;
140
+ border:none;border-radius:20px;cursor:pointer;
141
+ padding:6px 12px;font-size:12px;font-weight:700;
142
+ font-family:system-ui,sans-serif;
143
+ box-shadow:0 2px 8px rgba(0,0,0,0.3);
144
+ display:flex;align-items:center;gap:6px;
145
+ transition:transform 0.15s;
146
+ `,a.innerHTML=`${s} ${i}/100 <span style="font-weight:400;opacity:0.85">${t.details.length} issues</span>`,a.addEventListener("mouseenter",()=>{a.style.transform="scale(1.05)"}),a.addEventListener("mouseleave",()=>{a.style.transform="scale(1)"}),a.addEventListener("click",()=>{we(t)}),document.body.appendChild(a),D=a}function we(t){let i=document.querySelector("[data-yuktai-audit-details]");if(i){i.remove();return}let n=document.createElement("div");n.setAttribute("data-yuktai-audit-details","true"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","Accessibility audit details"),n.style.cssText=`
147
+ position:fixed;bottom:56px;left:16px;z-index:999999;
148
+ background:#1a1a2e;color:#fff;border-radius:12px;
149
+ padding:16px;width:340px;max-width:calc(100vw - 32px);
150
+ max-height:60vh;overflow-y:auto;
151
+ box-shadow:0 8px 32px rgba(0,0,0,0.5);
152
+ font-family:system-ui,sans-serif;font-size:12px;
153
+ `;let s={critical:"#d93025",serious:"#f29900",moderate:"#1a73e8",minor:"#0f9d58"};n.innerHTML=`
154
+ <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px">
155
+ <strong style="font-size:14px;color:#74c0fc">Audit Report</strong>
156
+ <span style="color:#aaa">${t.fixed} fixed \xB7 ${t.renderTime}ms</span>
157
+ </div>
158
+ ${t.details.slice(0,20).map(a=>`
159
+ <div style="padding:6px 0;border-bottom:1px solid #2a2a4a">
160
+ <div style="display:flex;gap:6px;align-items:center">
161
+ <span style="background:${s[a.severity]};color:#fff;padding:1px 6px;border-radius:4px;font-size:10px;font-weight:700;text-transform:uppercase">${a.severity}</span>
162
+ <code style="color:#74c0fc">&lt;${a.tag}&gt;</code>
163
+ </div>
164
+ <div style="color:#ccc;margin-top:3px">${a.fix}</div>
165
+ </div>
166
+ `).join("")}
167
+ ${t.details.length>20?`<div style="color:#888;padding:8px 0;text-align:center">+${t.details.length-20} more issues</div>`:""}
168
+ `,n.addEventListener("keydown",a=>{a.key==="Escape"&&n.remove()}),document.body.appendChild(n),S(n)}function re(t){typeof document>"u"||(O&&clearTimeout(O),O=setTimeout(()=>{if(z)return;let i=document.createElement("div");i.setAttribute("role","alertdialog"),i.setAttribute("aria-label","Session timeout warning"),i.setAttribute("aria-modal","true"),i.setAttribute("data-yuktai-timeout","true"),i.style.cssText=`
169
+ position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
170
+ z-index:999999;background:#fff;color:#111;
171
+ border-radius:12px;padding:24px;width:320px;max-width:calc(100vw - 32px);
172
+ box-shadow:0 20px 60px rgba(0,0,0,0.4);
173
+ font-family:system-ui,sans-serif;border:2px solid #d93025;
174
+ `,i.innerHTML=`
175
+ <h2 style="margin:0 0 8px;font-size:18px;color:#d93025">\u23F1 Session timeout</h2>
176
+ <p style="margin:0 0 16px;font-size:14px;line-height:1.5;color:#444">
177
+ Your session will expire soon. Do you need more time?
178
+ </p>
179
+ <div style="display:flex;gap:8px">
180
+ <button data-yuktai-extend style="flex:1;padding:10px;background:#1a73e8;color:#fff;border:none;border-radius:8px;cursor:pointer;font-size:14px;font-weight:600">
181
+ Yes, more time
182
+ </button>
183
+ <button data-yuktai-dismiss style="flex:1;padding:10px;background:#f1f3f4;color:#111;border:none;border-radius:8px;cursor:pointer;font-size:14px">
184
+ No, sign out
185
+ </button>
186
+ </div>
187
+ `;let n=i.querySelector("[data-yuktai-extend]"),s=i.querySelector("[data-yuktai-dismiss]");n?.addEventListener("click",()=>{i.remove(),z=null,p("Session extended. You have more time.","success"),w?.timeoutWarning&&re(w.timeoutWarning)}),s?.addEventListener("click",()=>{i.remove(),z=null}),document.body.appendChild(i),z=i,S(i),p("Warning: Your session will expire soon. Do you need more time?","warning")},t*1e3))}function oe(t){if(typeof document>"u"||C)return;try{let a=localStorage.getItem("yuktai-a11y-prefs");if(a){let l=JSON.parse(a);Object.assign(t,l),L(t)}}catch{}let i=document.createElement("button");i.setAttribute("aria-label","Accessibility preferences"),i.setAttribute("aria-haspopup","dialog"),i.setAttribute("data-yuktai-pref-toggle","true"),i.style.cssText=`
188
+ position:fixed;bottom:16px;right:16px;z-index:999998;
189
+ width:48px;height:48px;border-radius:50%;
190
+ background:#1a73e8;color:#fff;border:none;
191
+ cursor:pointer;font-size:22px;
192
+ box-shadow:0 2px 12px rgba(0,0,0,0.3);
193
+ display:flex;align-items:center;justify-content:center;
194
+ transition:transform 0.15s,background 0.15s;
195
+ `,i.innerHTML="\u267F",i.addEventListener("mouseenter",()=>{i.style.transform="scale(1.1)",i.style.background="#1557b0"}),i.addEventListener("mouseleave",()=>{i.style.transform="scale(1)",i.style.background="#1a73e8"});let n=document.createElement("div");n.setAttribute("role","dialog"),n.setAttribute("aria-label","Accessibility preferences"),n.setAttribute("aria-modal","true"),n.setAttribute("data-yuktai-panel","true"),n.style.cssText=`
196
+ position:fixed;bottom:76px;right:16px;z-index:999999;
197
+ width:300px;max-width:calc(100vw - 32px);
198
+ background:#fff;border-radius:16px;
199
+ box-shadow:0 8px 32px rgba(0,0,0,0.2);
200
+ border:1px solid #e0e0e0;
201
+ font-family:system-ui,sans-serif;
202
+ overflow:hidden;display:none;
203
+ `;let s=[{icon:"\u{1F441}",title:"Vision",options:[{key:"highContrast",label:"High contrast",type:"toggle"},{key:"darkMode",label:"Dark mode",type:"toggle"},{key:"largeTargets",label:"Large text & targets",type:"toggle"}]},{icon:"\u{1F3A8}",title:"Colour blindness",options:[{key:"colorBlind_none",label:"None",type:"radio",group:"cb"},{key:"colorBlind_deuteranopia",label:"Deuteranopia",type:"radio",group:"cb"},{key:"colorBlind_protanopia",label:"Protanopia",type:"radio",group:"cb"},{key:"colorBlind_tritanopia",label:"Tritanopia",type:"radio",group:"cb"},{key:"colorBlind_achromatopsia",label:"Greyscale",type:"radio",group:"cb"}]},{icon:"\u2328",title:"Motor",options:[{key:"reduceMotion",label:"Reduce motion",type:"toggle"},{key:"largeTargets",label:"Large click targets",type:"toggle"}]},{icon:"\u{1F50A}",title:"Audio",options:[{key:"speechEnabled",label:"Speak on focus",type:"toggle"}]}];n.innerHTML=`
204
+ <div style="padding:16px 16px 8px;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;align-items:center">
205
+ <strong style="font-size:15px;color:#111">\u267F Accessibility</strong>
206
+ <button data-yuktai-panel-close style="background:none;border:none;cursor:pointer;font-size:20px;color:#666;padding:0;line-height:1" aria-label="Close preferences">\xD7</button>
207
+ </div>
208
+ <div style="padding:8px 0;max-height:60vh;overflow-y:auto">
209
+ ${s.map(a=>`
210
+ <div style="padding:8px 16px">
211
+ <div style="font-size:11px;font-weight:700;color:#888;letter-spacing:0.5px;text-transform:uppercase;margin-bottom:8px">
212
+ ${a.icon} ${a.title}
213
+ </div>
214
+ ${a.options.map(l=>`
215
+ <label style="display:flex;align-items:center;justify-content:space-between;padding:6px 0;cursor:pointer;gap:8px">
216
+ <span style="font-size:13px;color:#333">${l.label}</span>
217
+ ${l.type==="toggle"?`
218
+ <div data-yuktai-toggle="${l.key}" style="
219
+ width:40px;height:22px;border-radius:11px;
220
+ background:${P(t,l.key)?"#1a73e8":"#ccc"};
221
+ position:relative;cursor:pointer;transition:background 0.2s;flex-shrink:0;
222
+ ">
223
+ <div style="
224
+ position:absolute;top:2px;left:${P(t,l.key)?"20px":"2px"};
225
+ width:18px;height:18px;border-radius:50%;background:#fff;
226
+ transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.2);
227
+ "></div>
228
+ </div>
229
+ `:`
230
+ <input type="radio" name="yuktai-${l.group}" value="${l.key}"
231
+ ${Se(t,l.key)?"checked":""}
232
+ style="width:16px;height:16px;cursor:pointer;accent-color:#1a73e8"
233
+ />
234
+ `}
235
+ </label>
236
+ `).join("")}
237
+ </div>
238
+ `).join("")}
239
+ <div style="padding:8px 16px 4px">
240
+ <div style="font-size:11px;font-weight:700;color:#888;letter-spacing:0.5px;text-transform:uppercase;margin-bottom:8px">
241
+ \u2328 Keyboard
242
+ </div>
243
+ <button data-yuktai-show-keys style="
244
+ width:100%;padding:8px;background:#f8f9fa;border:1px solid #e0e0e0;
245
+ border-radius:8px;cursor:pointer;font-size:13px;color:#333;
246
+ display:flex;align-items:center;justify-content:center;gap:6px;
247
+ ">
248
+ Show keyboard shortcuts <kbd style="background:#e0e0e0;padding:1px 6px;border-radius:4px;font-size:11px">Alt+A</kbd>
249
+ </button>
250
+ </div>
251
+ </div>
252
+ <div style="padding:8px 16px 12px;border-top:1px solid #f0f0f0">
253
+ <button data-yuktai-reset style="
254
+ width:100%;padding:8px;background:#fff;border:1px solid #d93025;
255
+ border-radius:8px;cursor:pointer;font-size:12px;color:#d93025;font-weight:600;
256
+ ">Reset all preferences</button>
257
+ </div>
258
+ `,n.querySelectorAll("[data-yuktai-toggle]").forEach(a=>{a.addEventListener("click",()=>{let l=a.getAttribute("data-yuktai-toggle");t[l]=!P(t,l),ee(t),L(t),Q(t),p(`${l.replace(/([A-Z])/g," $1")} ${P(t,l)?"enabled":"disabled"}`,"info")})}),n.querySelectorAll("input[type='radio']").forEach(a=>{a.addEventListener("change",()=>{let l=a.value.replace("colorBlind_","");t.colorBlindMode=l,ee(t),L(t),p(`Colour blind mode: ${l}`,"info")})}),n.querySelector("[data-yuktai-show-keys]")?.addEventListener("click",()=>{ae()}),n.querySelector("[data-yuktai-reset]")?.addEventListener("click",()=>{localStorage.removeItem("yuktai-a11y-prefs"),t.highContrast=!1,t.darkMode=!1,t.reduceMotion=!1,t.largeTargets=!1,t.speechEnabled=!1,t.colorBlindMode="none",L(t),Q(t),p("Preferences reset to default","info")}),n.querySelector("[data-yuktai-panel-close]")?.addEventListener("click",()=>{n.style.display="none",i.focus(),p("Preferences closed","info")}),n.addEventListener("keydown",a=>{a.key==="Escape"&&(n.style.display="none",i.focus())}),i.addEventListener("click",()=>{let a=n.style.display!=="none";n.style.display=a?"none":"block",i.setAttribute("aria-expanded",String(!a)),a||(S(n),p("Accessibility preferences opened","info"))}),document.body.appendChild(i),document.body.appendChild(n),C=n}function Q(t){C&&(C.remove(),C=null),oe(t)}function P(t,i){return!!t[i]}function Se(t,i){let n=i.replace("colorBlind_","");return t.colorBlindMode===n}function ee(t){try{let i={highContrast:t.highContrast,darkMode:t.darkMode,reduceMotion:t.reduceMotion,largeTargets:t.largeTargets,speechEnabled:t.speechEnabled,colorBlindMode:t.colorBlindMode};localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(i))}catch{}}function L(t){if(typeof document>"u")return;let i=document.documentElement;i.toggleAttribute("data-yuktai-high-contrast",!!t.highContrast),i.toggleAttribute("data-yuktai-dark",!!t.darkMode),i.toggleAttribute("data-yuktai-reduce-motion",!!t.reduceMotion),i.toggleAttribute("data-yuktai-large-targets",!!t.largeTargets),i.toggleAttribute("data-yuktai-keyboard",!!t.keyboardHints);let n=document.body;if(t.colorBlindMode&&t.colorBlindMode!=="none"){let s=t.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${_[t.colorBlindMode]})`;n.style.filter=s}else n.style.filter=""}function Ee(){if(typeof document>"u"||I)return;let t=document.createElement("div");t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("aria-relevant","text"),t.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);",document.body.appendChild(t),I=t}function Te(){if(typeof document>"u"||U)return;let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",t.innerHTML=`
259
+ <defs>
260
+ <filter id="${_.deuteranopia}">
261
+ <feColorMatrix type="matrix" values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
262
+ </filter>
263
+ <filter id="${_.protanopia}">
264
+ <feColorMatrix type="matrix" values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/>
265
+ </filter>
266
+ <filter id="${_.tritanopia}">
267
+ <feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
268
+ </filter>
269
+ </defs>
270
+ `,document.body.appendChild(t),U=t}function te(t){let i={critical:20,serious:10,moderate:5,minor:2},n=t.details.reduce((s,a)=>s+(i[a.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var b={name:"yuktai-a11y",version:"2.0.0",observer:null,async execute(t){if(!t.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";w=t,Ee(),Te(),Ae(),ve(),t.showSkipLinks!==!1&&he(),t.showPreferencePanel!==!1&&oe(t),L(t);let i=this.applyFixes(t);i.score=te(i),t.showAuditBadge&&ke(i),t.timeoutWarning&&re(t.timeoutWarning),t.autoFix&&this.startObserver(t);let n=`${i.fixed} accessibility fixes applied. Score: ${i.score}/100.`;return p(n,i.score>=90?"success":"info",!1),`yuktai-a11y v2: ${n} Scanned ${i.scanned} elements in ${i.renderTime}ms.`},applyFixes(t){let i={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return i;let n=performance.now(),s=document.querySelectorAll("*");i.scanned=s.length;let a=(l,e,r,y)=>{i.details.push({tag:l,fix:e,severity:r,element:y.outerHTML.slice(0,100)}),i.fixed++};return s.forEach(l=>{let e=l,r=e.tagName.toLowerCase();if(r==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(r,'lang="en" added to <html>',"critical",e)),r==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(r,`document.title set to "${document.title}"`,"serious",e)),r==="meta"){let o=e.getAttribute("name"),d=e.getAttribute("content")||"";o==="viewport"&&d.includes("user-scalable=no")&&(e.setAttribute("content",d.replace("user-scalable=no","user-scalable=yes")),a(r,"user-scalable=yes restored","serious",e)),o==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(d)&&(e.setAttribute("content",d.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(r,"maximum-scale=5 restored","serious",e))}if(r==="main"&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),e.getAttribute("id")||e.setAttribute("id","main-content")),r==="body"&&document.querySelectorAll("video[autoplay]:not([muted])").forEach(o=>{o.muted=!0,a("video","autoplay video muted (deaf users)","serious",e)}),t.largeTargets&&(r==="button"||r==="a"||r==="input")){let o=e.getBoundingClientRect();o.width>0&&o.width<24&&(e.style.minWidth="44px",e.style.minHeight="44px",a(r,"min 44px touch target enforced","minor",e))}if(X.has(r)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${r.toUpperCase()} section`),a(r,"aria-label added (empty heading)","moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())}),a(r,"tabindex=0 + keydown (clickable heading)","minor",e))),r==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(r,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(r,'alt="" (role=presentation)',"minor",e))),r==="area"&&!e.getAttribute("alt")){let o=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",o),a(r,`alt="${o}" on <area>`,"serious",e)}if(r==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!l.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let o=document.createElementNS("http://www.w3.org/2000/svg","title");o.textContent="graphic",e.prepend(o),e.setAttribute("role","img"),a(r,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(r,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(r==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(r,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(r,"aria-label added to canvas","serious",e))),(r==="object"||r==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${r} content`),a(r,`aria-label added to <${r}>`,"moderate",e)),r==="video"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(r,"aria-label added (no captions track)","serious",e)),r==="audio"&&!l.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(r,"aria-label added to audio","serious",e)),r==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(r,'title + aria-label="embedded content"',"serious",e)),r==="figure"&&!l.querySelector("figcaption")&&!e.getAttribute("aria-label")){let d=l.querySelector("img")?.getAttribute("alt");d&&(e.setAttribute("aria-label",d),a(r,"aria-label from inner img alt","minor",e))}if(r==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let o=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",o),a(r,`aria-label="${o}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.getAttribute("data-yuktai-announced")||(e.setAttribute("data-yuktai-announced","true"),e.addEventListener("click",()=>{let o=e.getAttribute("aria-label")||e.textContent?.trim()||"button";setTimeout(()=>{p(`${o} activated`,"success",!1)},100)}))}if(r==="a"){let o=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let d=e.getAttribute("title")||"link";e.setAttribute("aria-label",d),a(r,`aria-label="${d}" (empty link)`,"critical",e)}if(o.target==="_blank"){o.rel?.includes("noopener")||(o.rel="noopener noreferrer",i.fixed++);let d=o.getAttribute("aria-label")||o.innerText?.trim()||"link";d.includes("opens in new window")||(o.setAttribute("aria-label",`${d} (opens in new window)`),a(r,"aria-label: new-window warning","moderate",e))}!o.href&&!o.getAttribute("role")&&!o.getAttribute("tabindex")&&(o.setAttribute("role","button"),o.setAttribute("tabindex","0"),a(r,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!me.has(r)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(r,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,i.fixed++),e.onkeydown||(e.onkeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())})),Z.has(r)){let o=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let d=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||r;e.setAttribute("aria-label",d),a(r,`aria-label="${d}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),i.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),i.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),i.fixed++),e.getAttribute("data-yuktai-validation")||(e.setAttribute("data-yuktai-validation","true"),e.addEventListener("invalid",()=>{let d=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field",x=e.validationMessage||"is invalid";p(`Error: ${d} ${x}`,"error")}),e.addEventListener("change",()=>{if(e.validity?.valid){let d=e.getAttribute("aria-label")||e.getAttribute("placeholder")||"Field";p(`${d} looks good`,"success",!1)}})),r==="input"&&!o.autocomplete){let d=o.name||"";o.type==="email"||d.includes("email")?(o.autocomplete="email",i.fixed++):o.type==="tel"||d.includes("tel")?(o.autocomplete="tel",i.fixed++):o.type==="password"?(o.autocomplete="current-password",i.fixed++):d.includes("firstname")||d.includes("fname")?(o.autocomplete="given-name",i.fixed++):d.includes("lastname")||d.includes("lname")?(o.autocomplete="family-name",i.fixed++):d==="name"||d.includes("fullname")?(o.autocomplete="name",i.fixed++):d.includes("zip")||d.includes("postal")?(o.autocomplete="postal-code",i.fixed++):d.includes("city")?(o.autocomplete="address-level2",i.fixed++):d.includes("country")&&(o.autocomplete="country",i.fixed++)}r==="input"&&o.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(r,"alt added to input[type=image]","serious",e)),r==="input"&&o.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",o.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",o.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",o.value||"50"),i.fixed++)}if(r==="fieldset"&&!l.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(r,'aria-label="form group" (no legend)',"moderate",e)),r==="table"&&(!l.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(r,'role="grid" (no <th>)',"serious",e)),!l.querySelector("caption")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","data table"),a(r,'aria-label="data table"',"moderate",e))),r==="th"&&!e.getAttribute("scope")){let o=e.closest("thead")!==null;e.setAttribute("scope",o?"col":"row"),a(r,`scope="${o?"col":"row"}"`,"moderate",e)}if(xe.has(r)&&(e.getAttribute("role")==="presentation"&&(l.querySelectorAll("li").forEach(o=>{o.getAttribute("role")||o.setAttribute("role","presentation")}),i.fixed++),(r==="ul"||r==="ol")&&!e.getAttribute("aria-label"))){let o=e.closest("nav");o&&(e.setAttribute("aria-label",o.getAttribute("aria-label")||"navigation list"),a(r,"aria-label from parent nav","minor",e))}if(j[r]&&!e.getAttribute("role")&&(e.setAttribute("role",j[r]),a(r,`role="${j[r]}"`,"minor",e)),["nav","section","article","aside"].includes(r)){let o=l.parentElement?.querySelectorAll(r);if(o&&o.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();x&&(e.setAttribute("aria-label",x),a(r,"aria-label from inner heading","moderate",e))}}if(r==="details"&&!l.querySelector("summary")){let o=document.createElement("summary");o.textContent=e.getAttribute("aria-label")||"More details",e.prepend(o),a(r,"<summary> injected","moderate",e)}if(r==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(r,'aria-label="Toggle details"',"moderate",e)),r==="dialog"){let o=e.getAttribute("role");if(o&&o!=="dialog"&&o!=="alertdialog"&&(e.setAttribute("role","dialog"),a(r,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let x=l.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",x),a(r,"aria-label added to dialog","serious",e)}e.getAttribute("data-yuktai-trap")||(e.setAttribute("data-yuktai-trap","true"),new MutationObserver(()=>{e.style.display!=="none"&&e.style.visibility!=="hidden"&&S(e)}).observe(e,{attributes:!0,attributeFilter:["style","open"]}))}if(r==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(r,"title added to <abbr>","minor",e)),r==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(r,`datetime="${e.innerText.trim()}" added`,"minor",e)),r==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(r,"aria-label added to <meter>","moderate",e)),r==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(r,"aria-label added to <progress>","moderate",e));let o=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(o.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(o.max||1)),i.fixed++}let c=e.getAttribute("role")||"";if(c==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),c==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(r,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),i.fixed++)),["alert","status","log","marquee"].includes(c)){if(!e.getAttribute("aria-live")){let o=c==="alert"?"assertive":"polite";e.setAttribute("aria-live",o),a(r,`aria-live="${o}" on role=${c}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),i.fixed++)}c==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),i.fixed++),(c==="menu"||c==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(r,'aria-label="menu"',"moderate",e)),c==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(r,'aria-label="listbox"',"moderate",e)),c==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),i.fixed++),c==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),i.fixed++),(c==="checkbox"||c==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(r,`aria-checked="false" on role=${c}`,"serious",e)),c==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(r,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),i.fixed++)),(c==="grid"||c==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(r,'aria-label="data grid"',"moderate",e)),c==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(r,'aria-label="tree"',"moderate",e)),c==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),i.fixed++)}),i.renderTime=parseFloat((performance.now()-n).toFixed(2)),i},scan(){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let i=performance.now(),n=document.querySelectorAll("*");t.scanned=n.length;let s=(a,l,e,r)=>t.details.push({tag:a,fix:l,severity:e,element:r.outerHTML.slice(0,100)});return n.forEach(a=>{let l=a,e=l.tagName.toLowerCase();(e==="a"||e==="button")&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"needs aria-label (empty)","critical",l),e==="img"&&!l.hasAttribute("alt")&&s(e,"needs alt text","serious",l),Z.has(e)&&!l.getAttribute("aria-label")&&!l.getAttribute("aria-labelledby")&&s(e,"needs aria-label","serious",l),e==="iframe"&&!l.getAttribute("title")&&!l.getAttribute("aria-label")&&s(e,"iframe needs title","serious",l),ye.has(e)&&!a.querySelector("track")&&!l.getAttribute("aria-label")&&s(e,"media needs captions/aria-label","serious",l),X.has(e)&&!l.innerText?.trim()&&!l.getAttribute("aria-label")&&s(e,"empty heading","moderate",l)}),t.fixed=t.details.length,t.score=te(t),t.renderTime=parseFloat((performance.now()-i).toFixed(2)),t},startObserver(t){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(t)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:p,speak:K,showVisualAlert:ie,trapFocus:S};import{useState as $,useEffect as R,useRef as le,useCallback as se}from"react";import Me,{forwardRef as Le}from"react";import{jsx as f,jsxs as m}from"react/jsx-runtime";var Y={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},E=[80,90,100,110,120,130,140,150],ne=[{id:"highContrast",label:"High contrast",description:"contrast(1.15) brightness on all nodes",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables all transitions & animations",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"MutationObserver on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing",icon:"Aa"}];function Ce({checked:t,onChange:i,label:n}){return m("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[f("input",{type:"checkbox",checked:t,onChange:s=>i(s.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),f("span",{style:{position:"absolute",inset:0,borderRadius:99,background:t?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),f("span",{style:{position:"absolute",top:3,left:t?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var G=Le(({position:t,settings:i,report:n,isActive:s,set:a,onApply:l,onReset:e,onClose:r},y)=>m("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...t==="left"?{left:88}:{right:88},width:312,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif"},children:[m("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[m("div",{children:[m("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[f("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v1.0.0"}),s&&f("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),f("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),f("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes \xB7 Open Source"})]}),f("button",{onClick:r,"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),f("div",{style:{padding:"6px 0"},children:ne.map((o,d)=>m(Me.Fragment,{children:[m("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[m("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[f("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:o.icon}),m("div",{children:[f("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:o.label}),f("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:o.description})]})]}),f(Ce,{checked:i[o.id],onChange:x=>a(o.id,x),label:`Toggle ${o.label}`})]}),d<ne.length-1&&f("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},o.id))}),m("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[m("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[f("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),m("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[i.fontScale,"%"]})]}),m("div",{style:{display:"flex",alignItems:"center",gap:8},children:[f("button",{onClick:()=>{let o=E.indexOf(i.fontScale);o>0&&a("fontScale",E[o-1])},disabled:i.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:i.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),f("div",{style:{flex:1,display:"flex",gap:3},children:E.map(o=>f("button",{onClick:()=>a("fontScale",o),"aria-label":`Set text size to ${o}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:o<=i.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},o))}),f("button",{onClick:()=>{let o=E.indexOf(i.fontScale);o<E.length-1&&a("fontScale",E[o+1])},disabled:i.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:i.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:i.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),n&&f("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:n.fixed>0?`\u2713 ${n.fixed} fixes applied \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms`:`\u2713 0 fixes needed \xB7 ${n.scanned} nodes clean \xB7 ${n.renderTime}ms`}),m("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[f("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),f("button",{onClick:l,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));G.displayName="WidgetPanel";import{Fragment as de,jsx as H,jsxs as ue}from"react/jsx-runtime";var W=null,T=null;function V({children:t,position:i="left"}){let[n,s]=$(!1),[a,l]=$(!1),[e,r]=$(Y),[y,c]=$(null),[o,d]=$(!1),x=le(null),v=le(null);R(()=>s(!0),[]),R(()=>{if(W)return;let u=document.createElement("style");return u.innerHTML=`
271
+ *:focus-visible {
272
+ outline: 3px solid #0d9488 !important;
273
+ outline-offset: 3px !important;
274
+ box-shadow: 0 0 0 6px rgba(13,148,136,.2) !important;
275
+ border-radius: 2px !important;
276
+ }
277
+ *:focus:not(:focus-visible) {
278
+ outline: none !important;
279
+ }
280
+ `,document.head.appendChild(u),W=u,()=>{W?.remove(),W=null}},[]),R(()=>()=>{b.stopObserver()},[]),R(()=>{if(!a)return;let u=h=>{x.current&&!x.current.contains(h.target)&&v.current&&!v.current.contains(h.target)&&(l(!1),v.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]),R(()=>{let u=h=>{h.key==="Escape"&&a&&(l(!1),v.current?.focus(),b.announce("Accessibility panel closed","info",!1))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[a]);let fe=(u,h)=>r(M=>({...M,[u]:h})),be=se(async()=>{let u={enabled:!0,highContrast:e.highContrast,darkMode:e.darkMode??!1,reduceMotion:e.reduceMotion,autoFix:e.autoFix,largeTargets:e.largeTargets??!1,speechEnabled:e.speechEnabled??!1,colorBlindMode:e.colorBlindMode??"none",showPreferencePanel:!1,showSkipLinks:!0,showAuditBadge:e.showAuditBadge??!1,timeoutWarning:e.timeoutWarning??void 0},h=await b.execute(u);console.log("[yuktai-a11y]",h);let M=b.applyFixes(u);c(M);let ge=Math.min(Math.max(e.fontScale??100,80),130);if(document.documentElement.style.fontSize=`${ge}%`,e.dyslexiaFont){if(!T){let q=document.createElement("link");q.rel="stylesheet",q.href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap",document.head.appendChild(q);let N=document.createElement("style");N.textContent=`
281
+ body, body * {
282
+ font-family: 'Atkinson Hyperlegible', Arial, sans-serif !important;
283
+ letter-spacing: 0.05em !important;
284
+ word-spacing: 0.1em !important;
285
+ line-height: 1.8 !important;
286
+ }
287
+ `,document.head.appendChild(N),T=N}}else T?.remove(),T=null;d(!0),l(!1),b.announce(`Accessibility active. ${M.fixed} fixes applied. Score: ${M.score}/100.`,"success")},[e]),pe=se(async()=>{await b.execute({enabled:!1}),document.documentElement.style.fontSize="",T?.remove(),T=null,document.querySelectorAll("*").forEach(u=>{u.style.filter="",u.style.transition="",u.style.animation=""}),r(Y),c(null),d(!1),b.announce("Accessibility reset to default.","info")},[]);return n?ue(de,{children:[t,ue("button",{ref:v,onClick:()=>{let u=!a;l(u),u&&b.announce("Accessibility panel opened","info",!1)},"aria-label":o?"Accessibility options \u2014 currently active. Click to change settings.":"Open accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...i==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:o?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:u=>u.currentTarget.style.transform="scale(1.08)",onMouseLeave:u=>u.currentTarget.style.transform="scale(1)",onFocus:u=>u.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:u=>u.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[H("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",focusable:"false",children:H("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),o&&H("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&H(G,{ref:x,position:i,settings:e,report:y,isActive:o,set:fe,onApply:be,onReset:pe,onClose:()=>{l(!1),v.current?.focus(),b.announce("Accessibility panel closed","info",!1)}})]}):H(de,{children:t})}var B={name:"ai.text",async execute(t){return`\u{1F916} YuktAI says: ${t}`}};var F={name:"voice.text",async execute(t){return!t||t.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${t}`}};var A=class{plugins=new Map;register(i,n){if(!n||typeof n.execute!="function")throw new Error(`Invalid plugin: ${i}`);this.plugins.set(i,n)}use(i){return this.plugins.get(i)}async run(i,n){try{let s=this.use(i);if(!s)throw new Error(`Plugin not found: ${i}`);return await s.execute(n)}catch(s){throw console.error(`[YuktAI Runtime Error in ${i}]:`,s),s}}getPlugins(){return Array.from(this.plugins.keys())}};function $e(){if(typeof globalThis>"u")return new A;if(!globalThis.__yuktai_runtime__){let t=new A;t.register(b.name,b),t.register(B.name,B),t.register(F.name,F),globalThis.__yuktai_runtime__=t}return globalThis.__yuktai_runtime__}var ce=typeof window<"u"?$e():new A,tt={wcagPlugin:b,list(){return ce.getPlugins()},use(t){return ce.use(t)},fix(t){return b.applyFixes({enabled:!0,autoFix:!0,...t})},scan(){return b.scan()}};export{A as Runtime,tt as YuktAI,V as YuktAIWrapper,B as aiPlugin,V as default,F as voicePlugin,b as wcag,b as wcagPlugin};