@yuktishaalaa/yuktai 4.1.2 → 4.1.4
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 +27 -27
- package/dist/index.mjs +16 -16
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as mt}from"./chunk-3VGU4YGK.mjs";import{a as bt,b as Ae,c as Ce}from"./chunk-XQMQZMAH.mjs";function yt(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function _e(){try{let e=yt();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}async function io(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=yt();if(!t)throw new Error("Rewriter API not available");let o=await t.create({tone:"more-casual",format:"plain-text",length:"as-is",outputLanguage:"en"}),r=await o.rewrite(e,{context:"Rewrite this text in simple plain English. Use short sentences. Avoid jargon. Make it easy to understand for everyone."});return o.destroy(),{success:!0,original:e,rewritten:r.trim()}}catch(t){return{success:!1,original:e,rewritten:e,error:t instanceof Error?t.message:"Rewrite failed"}}}async function xt(){if(!await _e())return{fixed:0,error:"Chrome Built-in AI Rewriter not available. Enable via chrome://flags."};let t=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption"),o=0;for(let r of t){let a=r.innerText?.trim();if(!a||a.length<20||r.closest("[data-yuktai-panel]"))continue;let i=await io(a);i.success&&i.rewritten!==a&&(r.dataset.yuktaiOriginal=a,r.innerText=i.rewritten,o++)}return{fixed:o}}function ht(){let e=document.querySelectorAll("[data-yuktai-original]");for(let t of e){let o=t.dataset.yuktaiOriginal;o&&(t.innerText=o,delete t.dataset.yuktaiOriginal)}}var vt="yuktai-summary-box";function wt(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Ve(){try{let e=wt();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}function so(){let e=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, article, section"),t=[];for(let o of e){if(o.closest("[data-yuktai-panel]"))continue;let r=window.getComputedStyle(o);if(r.display==="none"||r.visibility==="hidden")continue;let a=o.innerText?.trim();a&&a.length>10&&t.push(a)}return t.join(" ").slice(0,5e3)}async function kt(){if(!await Ve())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=so();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let o=wt();if(!o)throw new Error("Summarizer API not available");let r=await o.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),a=await r.summarize(t,{context:"Summarise this page in 2-3 simple sentences for a screen reader user who wants to know if this page is relevant to them."});return r.destroy(),lo(a.trim()),{success:!0,summary:a.trim()}}catch(o){return{success:!1,summary:"",error:o instanceof Error?o.message:"Summary failed"}}}function lo(e){Te();let t=document.createElement("div");t.id=vt,t.setAttribute("data-yuktai-panel","true"),t.setAttribute("role","region"),t.setAttribute("aria-label","Page summary by yuktai"),t.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -19,7 +19,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
19
19
|
background: none; border: none; color: #ffffff;
|
|
20
20
|
font-size: 20px; cursor: pointer; padding: 0 4px;
|
|
21
21
|
line-height: 1; flex-shrink: 0;
|
|
22
|
-
`,r.addEventListener("click",
|
|
22
|
+
`,r.addEventListener("click",Te),t.appendChild(o),t.appendChild(r),document.body.prepend(t)}function Te(){let e=document.getElementById(vt);e&&e.remove()}var Fe=[{code:"en",label:"English"},{code:"hi",label:"Hindi"},{code:"es",label:"Spanish"},{code:"fr",label:"French"},{code:"de",label:"German"},{code:"it",label:"Italian"},{code:"pt",label:"Portuguese"},{code:"nl",label:"Dutch"},{code:"pl",label:"Polish"},{code:"ru",label:"Russian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"zh",label:"Chinese"},{code:"ar",label:"Arabic"},{code:"tr",label:"Turkish"},{code:"vi",label:"Vietnamese"},{code:"bn",label:"Bengali"},{code:"id",label:"Indonesian"}],Ee="en";function co(){let e=window;return e.Translator||e.translation||null}async function po(e){try{let t=window;if(!co())return!1;if(t.Translator&&typeof t.Translator.availability=="function")try{let r=await t.Translator.availability({sourceLanguage:"en",targetLanguage:e});return r==="readily"||r==="available"||r==="downloadable"||r==="after-download"}catch{}return t.Translator&&typeof t.Translator.canTranslate=="function"?await t.Translator.canTranslate({sourceLanguage:"en",targetLanguage:e})!=="no":t.translation&&typeof t.translation.canTranslate=="function"?await t.translation.canTranslate({sourceLanguage:"en",targetLanguage:e})!=="no":!1}catch{return!1}}async function uo(e){let t=window,o={sourceLanguage:"en",targetLanguage:e};if(t.Translator&&typeof t.Translator.create=="function")return await t.Translator.create(o);if(t.translation&&typeof t.translation.createTranslator=="function")return await t.translation.createTranslator(o);throw new Error("Translation API not available")}async function St(e){if(e===Ee)return{success:!0,language:e,fixed:0};if(e==="en")return je(),Ee="en",{success:!0,language:"en",fixed:0};if(!await po(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let o=await uo(e),r=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),a=0;for(let i of r){if(i.closest("[data-yuktai-panel]")||i.children.length>0)continue;let n=i.innerText?.trim();if(!n||n.length<2)continue;i.dataset.yuktaiTranslationOriginal||(i.dataset.yuktaiTranslationOriginal=n);let d=await o.translate(n);d&&d!==n&&(i.innerText=d,a++)}return typeof o.destroy=="function"&&o.destroy(),Ee=e,{success:!0,language:e,fixed:a}}catch(o){return{success:!1,language:e,fixed:0,error:o instanceof Error?o.message:"Translation failed"}}}function je(){let e=document.querySelectorAll("[data-yuktai-translation-original]");for(let t of e){let o=t.dataset.yuktaiTranslationOriginal;o&&(t.innerText=o,delete t.dataset.yuktaiTranslationOriginal)}Ee="en"}var fo=[{phrases:["go to main","skip to main","main content"],action:"focus-main",label:"Jump to main content"},{phrases:["go to navigation","go to nav","open menu"],action:"focus-nav",label:"Jump to navigation"},{phrases:["go to search","search","find"],action:"focus-search",label:"Jump to search"},{phrases:["scroll down","page down","next"],action:"scroll-down",label:"Scroll down"},{phrases:["scroll up","page up","back up"],action:"scroll-up",label:"Scroll up"},{phrases:["go back","previous page"],action:"go-back",label:"Go back"},{phrases:["click","press","select"],action:"click-focused",label:"Click focused element"},{phrases:["next item","tab forward","tab"],action:"tab-forward",label:"Move to next element"},{phrases:["previous item","tab back","shift tab"],action:"tab-back",label:"Move to previous element"},{phrases:["stop listening","stop voice","quiet"],action:"stop-voice",label:"Stop voice control"}],X=null,Re=!1,de=null;function Ye(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function go(e){let t=e.toLowerCase().trim();for(let o of fo)for(let r of o.phrases)if(t.includes(r))return{action:o.action,label:o.label};return null}function mo(e){switch(e){case"focus-main":{let t=document.querySelector("main, [role='main'], #main");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}));break}case"focus-nav":{let t=document.querySelector("nav, [role='navigation']");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}));break}case"focus-search":{let t=document.querySelector("input[type='search'], input[role='searchbox'], [aria-label*='search' i]");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}));break}case"scroll-down":{window.scrollBy({top:400,behavior:"smooth"});break}case"scroll-up":{window.scrollBy({top:-400,behavior:"smooth"});break}case"go-back":{window.history.back();break}case"click-focused":{let t=document.activeElement;t&&t!==document.body&&t.click();break}case"tab-forward":{let t=At(),o=t.indexOf(document.activeElement),r=t[o+1]||t[0];r&&r.focus();break}case"tab-back":{let t=At(),o=t.indexOf(document.activeElement),r=t[o-1]||t[t.length-1];r&&r.focus();break}case"stop-voice":{Ue();break}}}function At(){return Array.from(document.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>!e.closest("[data-yuktai-panel]"))}function Ct(e){if(!Ye())return!1;if(Re)return!0;e&&(de=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return X=new t,X.continuous=!0,X.interimResults=!1,X.lang="en-US",X.onresult=o=>{let r=o.results[o.results.length-1][0].transcript,a=go(r);if(a){mo(a.action);let i={success:!0,command:r,action:a.label};if(de&&de(i),a.action==="stop-voice")return}},X.onend=()=>{Re&&X?.start()},X.onerror=o=>{o.error!=="no-speech"&&de&&de({success:!1,command:"",action:"",error:`Voice error: ${o.error}`})},X.start(),Re=!0,bo(),!0}function Ue(){Re=!1,X&&(X.stop(),X=null),de=null,Et()}var Tt="yuktai-voice-indicator";function bo(){Et();let e=document.createElement("div");e.id=Tt,e.setAttribute("data-yuktai-panel","true"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","yuktai voice control is listening"),e.style.cssText=`
|
|
23
23
|
position: fixed;
|
|
24
24
|
bottom: 80px;
|
|
25
25
|
left: 50%;
|
|
@@ -49,7 +49,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
49
49
|
0%, 100% { opacity: 1; transform: scale(1); }
|
|
50
50
|
50% { opacity: 0.4; transform: scale(0.7); }
|
|
51
51
|
}
|
|
52
|
-
`,document.head.appendChild(r)}let o=document.createElement("span");o.textContent="Listening for commands...",e.appendChild(t),e.appendChild(o),document.body.appendChild(e)}function
|
|
52
|
+
`,document.head.appendChild(r)}let o=document.createElement("span");o.textContent="Listening for commands...",e.appendChild(t),e.appendChild(o),document.body.appendChild(e)}function Et(){let e=document.getElementById(Tt);e&&e.remove()}var yo=["button:not([aria-label]):not([aria-labelledby])","a:not([aria-label]):not([aria-labelledby])","input:not([aria-label]):not([aria-labelledby]):not([id])","select:not([aria-label]):not([aria-labelledby])","textarea:not([aria-label]):not([aria-labelledby])","[role='button']:not([aria-label])","[role='link']:not([aria-label])","[role='checkbox']:not([aria-label])","[role='tab']:not([aria-label])"].join(", ");function Ft(){let e=window;return e.Writer||e.ai?.writer||null}async function Ke(){try{let e=Ft();if(!e)return!1;if(typeof e.availability=="function"){let t=await e.availability();return t==="readily"||t==="available"||t==="downloadable"}return typeof e.capabilities=="function"?(await e.capabilities())?.available!=="no":typeof e.create=="function"}catch{return!1}}function xo(e){let t=[],o=e.innerText?.trim();o&&t.push(`element text: "${o}"`);let r=e.placeholder?.trim();r&&t.push(`placeholder: "${r}"`);let a=e.getAttribute("name")?.trim();a&&t.push(`name: "${a}"`);let i=e.getAttribute("type")?.trim();i&&t.push(`type: "${i}"`);let n=e.id;if(n){let u=document.querySelector(`label[for="${n}"]`);u&&t.push(`label: "${u.innerText?.trim()}"`)}let d=e.parentElement?.innerText?.trim().slice(0,60);d&&t.push(`parent context: "${d}"`),t.push(`tag: ${e.tagName.toLowerCase()}`);let g=e.getAttribute("role");return g&&t.push(`role: ${g}`),t.join(". ")}async function ho(e,t){let o=`
|
|
53
53
|
Generate a short, clear aria-label for an HTML element.
|
|
54
54
|
The label must be 2-6 words maximum.
|
|
55
55
|
The label must describe what the element does or what it is.
|
|
@@ -60,7 +60,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
60
60
|
${t}
|
|
61
61
|
|
|
62
62
|
Output only the label. Nothing else.
|
|
63
|
-
`.trim();return(await e.write(o)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function
|
|
63
|
+
`.trim();return(await e.write(o)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function Rt(){if(!await Ke())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(yo);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let o=Ft();if(!o)throw new Error("Writer API not available");let r=await o.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),a=0,i=[];for(let n of t){if(n.closest("[data-yuktai-panel]"))continue;let d=window.getComputedStyle(n);if(d.display==="none"||d.visibility==="hidden")continue;let g=xo(n),u=await ho(r,g);u&&u.length>0&&(n.dataset.yuktaiLabelOriginal=n.getAttribute("aria-label")||"",n.setAttribute("aria-label",u),a++,i.push({tag:n.tagName.toLowerCase(),label:u}))}return r.destroy(),{success:!0,fixed:a,elements:i}}catch(o){return{success:!1,fixed:0,elements:[],error:o instanceof Error?o.message:"Label generation failed"}}}function Pt(){let e=document.querySelectorAll("[data-yuktai-label-original]");for(let t of e){let o=t.dataset.yuktaiLabelOriginal;o?t.setAttribute("aria-label",o):t.removeAttribute("aria-label"),delete t.dataset.yuktaiLabelOriginal}}var Le=null,It=null;var Lt=null,Ze=null,B=null,ce=null,Pe=null,Qe=null,pe=null,Ie={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var zt=new Set(["input","select","textarea"]);var Xe={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function Je(e,t="polite"){if(typeof window>"u"||!pe?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.rate=1,o.pitch=1,o.volume=1;let r=window.speechSynthesis.getVoices();r.length>0&&(o.voice=r[0]),window.speechSynthesis.speak(o)}function Gt(e,t="info"){if(typeof document>"u")return;let r={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"}}[t];B||(B=document.createElement("div"),B.setAttribute("role","alert"),B.setAttribute("aria-live","assertive"),B.setAttribute("aria-atomic","true"),B.style.cssText=`
|
|
64
64
|
position: fixed;
|
|
65
65
|
top: 80px;
|
|
66
66
|
right: 16px;
|
|
@@ -79,14 +79,14 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
79
79
|
transition: transform 0.3s, opacity 0.3s;
|
|
80
80
|
transform: translateX(120%);
|
|
81
81
|
opacity: 0;
|
|
82
|
-
`,document.body.appendChild(
|
|
82
|
+
`,document.body.appendChild(B)),B.style.background=r.bg,B.style.border=`1px solid ${r.border}`,B.style.color="#fff",B.innerHTML=`
|
|
83
83
|
<span style="font-size:18px;font-weight:700">${r.icon}</span>
|
|
84
84
|
<span style="flex:1;line-height:1.4">${e}</span>
|
|
85
85
|
<button
|
|
86
86
|
onclick="this.parentElement.style.transform='translateX(120%)';this.parentElement.style.opacity='0'"
|
|
87
87
|
style="background:none;border:none;color:#fff;cursor:pointer;font-size:18px;padding:0;line-height:1"
|
|
88
88
|
aria-label="Close notification">\xD7</button>
|
|
89
|
-
`,window.innerWidth<=480&&(
|
|
89
|
+
`,window.innerWidth<=480&&(B.style.right="8px",B.style.left="8px",B.style.maxWidth="none",B.style.width="auto"),requestAnimationFrame(()=>{B&&(B.style.transform="translateX(0)",B.style.opacity="1")}),setTimeout(()=>{B&&(B.style.transform="translateX(120%)",B.style.opacity="0")},5e3)}function C(e,t="info",o=!0){Le&&(Le.textContent=e),Gt(e,t),o&&Je(e,t==="error"?"assertive":"polite")}function vo(){if(typeof document>"u"||Lt)return;let e=[{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']"}],t=document.createElement("div");t.setAttribute("data-yuktai-skip-bar","true"),t.setAttribute("role","navigation"),t.setAttribute("aria-label","Skip links"),t.style.cssText=`
|
|
90
90
|
position: fixed;
|
|
91
91
|
top: 0;
|
|
92
92
|
left: 0;
|
|
@@ -111,7 +111,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
111
111
|
white-space: nowrap;
|
|
112
112
|
border: 2px solid transparent;
|
|
113
113
|
transition: background 0.15s, border-color 0.15s;
|
|
114
|
-
`,d.addEventListener("focus",()=>{t.style.transform="translateY(0)"}),d.addEventListener("blur",()=>{setTimeout(()=>{t.matches(":focus-within")||(t.style.transform="translateY(-100%)")},2e3)}),d.addEventListener("click",
|
|
114
|
+
`,d.addEventListener("focus",()=>{t.style.transform="translateY(0)"}),d.addEventListener("blur",()=>{setTimeout(()=>{t.matches(":focus-within")||(t.style.transform="translateY(-100%)")},2e3)}),d.addEventListener("click",g=>{g.preventDefault(),n.focus(),n.scrollIntoView({behavior:"smooth",block:"start"}),C(`Jumped to ${a.replace("Skip to ","")}`,"info"),t.style.transform="translateY(-100%)"}),t.appendChild(d)}),!o)return;window.innerWidth<768&&(t.style.transform="translateY(0)",t.style.position="sticky"),window.addEventListener("resize",()=>{window.innerWidth<768&&(t.style.transform="translateY(0)")}),document.body.insertBefore(t,document.body.firstChild),Lt=t}function wo(){if(typeof document>"u"||document.querySelector("[data-yuktai-focus-style]"))return;let e=document.createElement("style");e.setAttribute("data-yuktai-focus-style","true"),e.textContent=`
|
|
115
115
|
|
|
116
116
|
/* \u2500\u2500 Focus indicator \u2014 WCAG 2.4.11 minimum 2px solid \u2500\u2500 */
|
|
117
117
|
[data-yuktai-a11y] *:focus-visible {
|
|
@@ -257,7 +257,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
257
257
|
width: auto !important;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
`,document.head.appendChild(e),document.documentElement.setAttribute("data-yuktai-a11y","true")}function ko(){typeof document>"u"||document.querySelector("[data-yuktai-kb-init]")||(document.documentElement.setAttribute("data-yuktai-kb-init","true"),document.addEventListener("keydown",e=>{let t=document.activeElement;if(!t)return;let o=t.getAttribute("role")||"";if(e.key==="Escape"){let r=t.closest("[role='dialog'],[role='alertdialog']");if(r){r.style.display="none",
|
|
260
|
+
`,document.head.appendChild(e),document.documentElement.setAttribute("data-yuktai-a11y","true")}function ko(){typeof document>"u"||document.querySelector("[data-yuktai-kb-init]")||(document.documentElement.setAttribute("data-yuktai-kb-init","true"),document.addEventListener("keydown",e=>{let t=document.activeElement;if(!t)return;let o=t.getAttribute("role")||"";if(e.key==="Escape"){let r=t.closest("[role='dialog'],[role='alertdialog']");if(r){r.style.display="none",C("Dialog closed","info");return}let a=t.closest("[role='menu'],[role='menubar']");a&&(a.style.display="none",C("Menu closed","info"))}if(o==="menuitem"||t.closest("[role='menu'],[role='menubar']")){let r=t.closest("[role='menu'],[role='menubar']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='menuitem']:not([disabled])")),i=a.indexOf(t);e.key==="ArrowDown"||e.key==="ArrowRight"?(e.preventDefault(),a[(i+1)%a.length]?.focus()):e.key==="ArrowUp"||e.key==="ArrowLeft"?(e.preventDefault(),a[(i-1+a.length)%a.length]?.focus()):e.key==="Home"?(e.preventDefault(),a[0]?.focus()):e.key==="End"&&(e.preventDefault(),a[a.length-1]?.focus())}if(o==="tab"||t.closest("[role='tablist']")){let r=t.closest("[role='tablist']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='tab']:not([disabled])")),i=a.indexOf(t);if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault();let n=a[(i+1)%a.length];n?.focus(),n?.click()}else if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault();let n=a[(i-1+a.length)%a.length];n?.focus(),n?.click()}}if(o==="option"||t.closest("[role='listbox']")){let r=t.closest("[role='listbox']");if(!r)return;let a=Array.from(r.querySelectorAll("[role='option']:not([aria-disabled='true'])")),i=a.indexOf(t);e.key==="ArrowDown"?(e.preventDefault(),a[(i+1)%a.length]?.focus()):e.key==="ArrowUp"?(e.preventDefault(),a[(i-1+a.length)%a.length]?.focus()):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t.setAttribute("aria-selected","true"),a.forEach(n=>{n!==t&&n.setAttribute("aria-selected","false")}),C(`Selected: ${t.textContent?.trim()}`,"success"))}e.altKey&&e.key==="a"&&(e.preventDefault(),So()),e.key==="Tab"&&pe?.speechEnabled&&setTimeout(()=>{let r=document.activeElement;if(!r)return;let a=r.getAttribute("aria-label")||r.getAttribute("title")||r.textContent?.trim()||r.tagName.toLowerCase(),i=r.getAttribute("role")||r.tagName.toLowerCase();Je(`${a}, ${i}`)},100)}))}function ze(e){let t=e.querySelectorAll('button:not([disabled]),a[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[role="button"]');if(t.length===0)return;let o=t[0],r=t[t.length-1];o.focus(),e.addEventListener("keydown",a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===o&&(a.preventDefault(),r.focus()):document.activeElement===r&&(a.preventDefault(),o.focus()))})}function So(){if(typeof document>"u")return;if(ce){ce.remove(),ce=null;return}let e=document.createElement("div");e.setAttribute("role","dialog"),e.setAttribute("aria-label","Keyboard shortcuts"),e.setAttribute("aria-modal","true"),e.setAttribute("data-yuktai-cheatsheet","true"),e.style.cssText=`
|
|
261
261
|
position: fixed;
|
|
262
262
|
top: 50%;
|
|
263
263
|
left: 50%;
|
|
@@ -287,7 +287,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
287
287
|
<span style="font-size:12px;color:#ccc;text-align:right;flex:1;margin-left:12px">${a}</span>
|
|
288
288
|
</div>
|
|
289
289
|
`).join("")}
|
|
290
|
-
`,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),ce=null}),e.addEventListener("keydown",r=>{r.key==="Escape"&&(e.remove(),ce=null)}),document.body.appendChild(e),ce=e,
|
|
290
|
+
`,e.querySelector("[data-yuktai-close]")?.addEventListener("click",()=>{e.remove(),ce=null}),e.addEventListener("keydown",r=>{r.key==="Escape"&&(e.remove(),ce=null)}),document.body.appendChild(e),ce=e,ze(e),C("Keyboard shortcuts opened. Press Escape to close.","info")}function Ao(e){if(typeof document>"u"||!pe?.showAuditBadge||typeof window<"u"&&!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1"))return;Ze&&Ze.remove();let t=e.score,o=t>=90?"#0f9d58":t>=70?"#f29900":"#d93025",r=t>=90?"\u267F":t>=70?"\u26A0":"\u2715",a=document.createElement("button");a.setAttribute("aria-label",`Accessibility score: ${t} out of 100`),a.setAttribute("data-yuktai-badge","true"),a.style.cssText=`
|
|
291
291
|
position: fixed;
|
|
292
292
|
bottom: 16px;
|
|
293
293
|
left: 16px;
|
|
@@ -306,7 +306,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
306
306
|
align-items: center;
|
|
307
307
|
gap: 6px;
|
|
308
308
|
transition: transform 0.15s;
|
|
309
|
-
`,a.innerHTML=`${r} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,a.addEventListener("click",()=>Co(e)),document.body.appendChild(a),
|
|
309
|
+
`,a.innerHTML=`${r} ${t}/100 <span style="font-weight:400;opacity:0.85">${e.details.length} issues</span>`,a.addEventListener("click",()=>Co(e)),document.body.appendChild(a),Ze=a}function Co(e){let t=document.querySelector("[data-yuktai-audit-details]");if(t){t.remove();return}let o=document.createElement("div");o.setAttribute("data-yuktai-audit-details","true"),o.setAttribute("role","dialog"),o.setAttribute("aria-label","Accessibility audit details"),o.style.cssText=`
|
|
310
310
|
position: fixed;
|
|
311
311
|
bottom: 56px;
|
|
312
312
|
left: 16px;
|
|
@@ -338,7 +338,7 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
338
338
|
</div>
|
|
339
339
|
`).join("")}
|
|
340
340
|
${e.details.length>20?`<div style="color:#888;padding:8px 0;text-align:center">+${e.details.length-20} more issues</div>`:""}
|
|
341
|
-
`,o.addEventListener("keydown",a=>{a.key==="Escape"&&o.remove()}),document.body.appendChild(o),
|
|
341
|
+
`,o.addEventListener("keydown",a=>{a.key==="Escape"&&o.remove()}),document.body.appendChild(o),ze(o)}function Nt(e){typeof document>"u"||(Qe&&clearTimeout(Qe),Qe=setTimeout(()=>{if(Pe)return;let t=document.createElement("div");t.setAttribute("role","alertdialog"),t.setAttribute("aria-label","Session timeout warning"),t.setAttribute("aria-modal","true"),t.setAttribute("data-yuktai-timeout","true"),t.style.cssText=`
|
|
342
342
|
position: fixed;
|
|
343
343
|
top: 50%;
|
|
344
344
|
left: 50%;
|
|
@@ -367,19 +367,19 @@ import{a as ft}from"./chunk-3VGU4YGK.mjs";import{a as mt,b as Se,c as Ae}from"./
|
|
|
367
367
|
No, sign out
|
|
368
368
|
</button>
|
|
369
369
|
</div>
|
|
370
|
-
`;let o=t.querySelector("[data-yuktai-extend]"),r=t.querySelector("[data-yuktai-dismiss]");o?.addEventListener("click",()=>{t.remove(),Pe=null,
|
|
370
|
+
`;let o=t.querySelector("[data-yuktai-extend]"),r=t.querySelector("[data-yuktai-dismiss]");o?.addEventListener("click",()=>{t.remove(),Pe=null,C("Session extended. You have more time.","success"),pe?.timeoutWarning&&Nt(pe.timeoutWarning)}),r?.addEventListener("click",()=>{t.remove(),Pe=null}),document.body.appendChild(t),Pe=t,ze(t),C("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function To(e){if(typeof document>"u")return;let t=document.documentElement;if(t.toggleAttribute("data-yuktai-high-contrast",!!e.highContrast),t.toggleAttribute("data-yuktai-dark",!!e.darkMode),t.toggleAttribute("data-yuktai-reduce-motion",!!e.reduceMotion),t.toggleAttribute("data-yuktai-large-targets",!!e.largeTargets),t.toggleAttribute("data-yuktai-keyboard",!!e.keyboardHints),t.toggleAttribute("data-yuktai-dyslexia",!!e.dyslexiaFont),e.localFont?document.body.style.fontFamily=`"${e.localFont}", system-ui, sans-serif`:e.dyslexiaFont||(document.body.style.fontFamily=""),e.fontSizeMultiplier&&e.fontSizeMultiplier!==1?document.documentElement.style.fontSize=`${e.fontSizeMultiplier*100}%`:document.documentElement.style.fontSize="",e.colorBlindMode&&e.colorBlindMode!=="none"){let o=e.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${Ie[e.colorBlindMode]})`;document.body.style.filter=o}else document.body.style.filter=""}function Eo(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function Mt(e){if(e){if(!await _e()){C("Plain English requires Chrome 127+","warning");return}C("Rewriting page in plain English...","info",!1);let o=await xt();C(o.error?`Plain English failed: ${o.error}`:`${o.fixed} sections rewritten in plain English`,o.error?"error":"success",!1)}else ht(),C("Original text restored","info",!1)}async function Bt(e){if(e){if(!await Ve()){C("Page summariser requires Chrome 127+","warning");return}C("Generating page summary...","info",!1);let o=await kt();C(o.error?`Summary failed: ${o.error}`:"Page summary added at top",o.error?"error":"success",!1)}else Te(),C("Page summary removed","info",!1)}async function Wt(e){if(e==="en"){je(),C("Page restored to English","info",!1);return}C(`Translating page to ${e}...`,"info",!1);let t=await St(e);C(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function Ht(e){if(e){if(!Ye()){C("Voice control not supported in this browser","warning");return}Ct(t=>{t.success&&C(`Voice: ${t.action}`,"info",!1)}),C("Voice control started. Say a command.","success",!1)}else Ue(),C("Voice control stopped","info",!1)}async function Dt(e){if(e){if(!await Ke()){C("Smart labels requires Chrome 127+","warning");return}C("Generating smart labels...","info",!1);let o=await Rt();C(o.error?`Smart labels failed: ${o.error}`:`${o.fixed} elements labelled`,o.error?"error":"success",!1)}else Pt(),C("Smart labels removed","info",!1)}function Fo(){if(typeof document>"u"||Le)return;let e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("aria-relevant","text"),e.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);",document.body.appendChild(e),Le=e}function Ro(){if(typeof document>"u"||It)return;let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",e.innerHTML=`
|
|
371
371
|
<defs>
|
|
372
|
-
<filter id="${
|
|
372
|
+
<filter id="${Ie.deuteranopia}">
|
|
373
373
|
<feColorMatrix type="matrix"
|
|
374
374
|
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"/>
|
|
375
375
|
</filter>
|
|
376
|
-
<filter id="${
|
|
376
|
+
<filter id="${Ie.protanopia}">
|
|
377
377
|
<feColorMatrix type="matrix"
|
|
378
378
|
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"/>
|
|
379
379
|
</filter>
|
|
380
|
-
<filter id="${
|
|
380
|
+
<filter id="${Ie.tritanopia}">
|
|
381
381
|
<feColorMatrix type="matrix"
|
|
382
382
|
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"/>
|
|
383
383
|
</filter>
|
|
384
384
|
</defs>
|
|
385
|
-
`,document.body.appendChild(e),Pt=e}function Ht(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((r,a)=>r+(t[a.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var J={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";pe=e,Eo(e),Ro(),Po(),wo(),ko(),e.showSkipLinks!==!1&&vo(),e.showPreferencePanel,To(e);let t=this.applyFixes(e);t.score=Ht(t),e.showAuditBadge&&Ao(t),e.timeoutWarning&&Dt(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Lt(!0),e.summarisePage&&await zt(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await Mt(e.translateLanguage),e.voiceControl&&await Wt(!0),e.smartLabels&&await Bt(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return S(o,t.score>=90?"success":"info",!1),`yuktai v4.0.0: ${o} Scanned ${t.scanned} elements in ${t.renderTime}ms.`},applyFixes(e){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let o=performance.now(),r=document.querySelectorAll("*");t.scanned=r.length;let a=(i,n,d,f)=>{t.details.push({tag:i,fix:n,severity:d,element:f.outerHTML.slice(0,100)}),t.fixed++};return r.forEach(i=>{let n=i,d=n.tagName.toLowerCase();if(d==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),a(d,'lang="en" added',"critical",n)),d==="meta"){let u=n.getAttribute("name"),k=n.getAttribute("content")||"";u==="viewport"&&k.includes("user-scalable=no")&&(n.setAttribute("content",k.replace("user-scalable=no","user-scalable=yes")),a(d,"user-scalable=yes restored","serious",n)),u==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(k)&&(n.setAttribute("content",k.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(d,"maximum-scale=5 restored","serious",n))}if(d==="main"&&!n.getAttribute("tabindex")&&(n.setAttribute("tabindex","-1"),n.getAttribute("id")||n.setAttribute("id","main-content")),d==="img"&&(n.hasAttribute("alt")||(n.setAttribute("alt",""),n.setAttribute("aria-hidden","true"),a(d,'alt="" aria-hidden="true"',"serious",n))),d==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!i.querySelector("title")&&(n.setAttribute("aria-hidden","true"),a(d,'aria-hidden="true" (decorative svg)',"minor",n)),n.getAttribute("focusable")||n.setAttribute("focusable","false")),d==="iframe"&&!n.getAttribute("title")&&!n.getAttribute("aria-label")&&(n.setAttribute("title","embedded content"),n.setAttribute("aria-label","embedded content"),a(d,"title + aria-label added","serious",n)),d==="button"){if(!n.innerText?.trim()&&!n.getAttribute("aria-label")){let u=n.getAttribute("title")||"button";n.setAttribute("aria-label",u),a(d,`aria-label="${u}" (empty button)`,"critical",n)}n.hasAttribute("disabled")&&!n.getAttribute("aria-disabled")&&(n.setAttribute("aria-disabled","true"),t.fixed++)}if(d==="a"){let u=n;!n.innerText?.trim()&&!n.getAttribute("aria-label")&&(n.setAttribute("aria-label",n.getAttribute("title")||"link"),a(d,"aria-label added (empty link)","critical",n)),u.target==="_blank"&&!u.rel?.includes("noopener")&&(u.rel="noopener noreferrer",t.fixed++)}if(It.has(d)){let u=n;if(!n.getAttribute("aria-label")&&!n.getAttribute("aria-labelledby")){let k=n.getAttribute("placeholder")||n.getAttribute("name")||d;n.setAttribute("aria-label",k),a(d,`aria-label="${k}"`,"serious",n)}if(n.hasAttribute("required")&&!n.getAttribute("aria-required")&&(n.setAttribute("aria-required","true"),t.fixed++),d==="input"&&!u.autocomplete){let k=u.name||"";u.type==="email"||k.includes("email")?u.autocomplete="email":u.type==="tel"||k.includes("tel")?u.autocomplete="tel":u.type==="password"&&(u.autocomplete="current-password"),t.fixed++}}d==="th"&&!n.getAttribute("scope")&&(n.setAttribute("scope",n.closest("thead")?"col":"row"),a(d,"scope added to <th>","moderate",n)),Ze[d]&&!n.getAttribute("role")&&(n.setAttribute("role",Ze[d]),a(d,`role="${Ze[d]}"`,"minor",n));let f=n.getAttribute("role")||"";f==="tab"&&!n.getAttribute("aria-selected")&&(n.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(f)&&!n.getAttribute("aria-live")&&(n.setAttribute("aria-live",f==="alert"?"assertive":"polite"),a(d,`aria-live added on role=${f}`,"moderate",n)),f==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),a(d,'aria-expanded="false" on combobox',"serious",n)),(f==="checkbox"||f==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),a(d,`aria-checked="false" on role=${f}`,"serious",n))}),t.renderTime=parseFloat((performance.now()-o).toFixed(2)),t},scan(){let e={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return e;let t=performance.now(),o=document.querySelectorAll("*");e.scanned=o.length;let r=(a,i,n,d)=>e.details.push({tag:a,fix:i,severity:n,element:d.outerHTML.slice(0,100)});return o.forEach(a=>{let i=a,n=i.tagName.toLowerCase();(n==="a"||n==="button")&&!i.innerText?.trim()&&!i.getAttribute("aria-label")&&r(n,"needs aria-label (empty)","critical",i),n==="img"&&!i.hasAttribute("alt")&&r(n,"needs alt text","serious",i),It.has(n)&&!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")&&r(n,"needs aria-label","serious",i),n==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&r(n,"iframe needs title","serious",i)}),e.fixed=e.details.length,e.score=Ht(e),e.renderTime=parseFloat((performance.now()-t).toFixed(2)),e},startObserver(e){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(e)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:S,speak:Qe,showVisualAlert:$t,trapFocus:Le,handlePlainEnglish:Lt,handleSummarisePage:zt,handleTranslate:Mt,handleVoiceControl:Wt,handleSmartLabels:Bt,SUPPORTED_LANGUAGES:Ee};import Zo,{useEffect as me,useState as B,useCallback as ge}from"react";import{forwardRef as Fo,useEffect as ze,useState as ie}from"react";import{jsx as s,jsxs as h}from"react/jsx-runtime";var Xe={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,localFont:"",darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0,plainEnglish:!1,summarisePage:!1,translateLanguage:"en",voiceControl:!1,smartLabels:!1},ue=[80,90,100,110,120,130],Io=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],Lo=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function zo(){let[e,t]=ie(typeof window<"u"?window.innerWidth:1024);return ze(()=>{let o=()=>t(window.innerWidth);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function Mo({checked:e,onChange:t,label:o,disabled:r=!1}){return h("label",{"aria-label":o,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:r?"not-allowed":"pointer",flexShrink:0,opacity:r?.4:1},children:[s("input",{type:"checkbox",checked:e,disabled:r,onChange:a=>t(a.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),s("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),s("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"18px",height:"18px",background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}function fe({label:e,color:t="#64748b",badge:o,concept:r}){return h("div",{style:{margin:"10px 18px 4px"},children:[h("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),o&&s("span",{style:{fontSize:"9px",fontWeight:500,padding:"1px 7px",borderRadius:"99px",background:"#f5f3ff",color:"#7c3aed",border:"0.5px solid #c4b5fd",whiteSpace:"nowrap"},children:o})]}),r&&s("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:r})]})}function ee({icon:e,label:t,desc:o,checked:r,onChange:a,disabled:i=!1,disabledReason:n,tip:d}){return h("div",{title:i?n:d,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[h("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[s("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:i?"#f1f5f9":"#f0fdfa",color:i?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),h("div",{style:{minWidth:0},children:[s("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:i?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),s("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:i?n:o})]})]}),s(Mo,{checked:r,onChange:a,label:`Toggle ${t}`,disabled:i})]})}function q(){return s("div",{style:{height:"1px",background:"#f1f5f9"}})}function be({steps:e}){return h("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[s("p",{style:{margin:"0 0 4px",fontSize:"9px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"How to use"}),e.map((t,o)=>h("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[o+1,". ",t]},o))]})}var Je=Fo(({position:e,settings:t,report:o,isActive:r,aiSupported:a,voiceSupported:i,set:n,onApply:d,onReset:f,onClose:u},k)=>{let{isMobile:b,isTablet:oe}=zo(),[_,j]=ie([]),[$,y]=ie(""),[D,E]=ie(""),[A,G]=ie(!1),[m,R]=ie(null),[M,H]=ie("idle");ze(()=>{let l=window;!!(l.LanguageModel||l.ai?.languageModel)&&a?R("gemini"):Se()&&R("transformers")},[a]),ze(()=>{if(m!=="transformers")return;let l=setInterval(()=>{H(Ae())},500);return()=>clearInterval(l)},[m]);let v=async()=>{if(!(!$.trim()||A)){if(!m){E("\u26A0\uFE0F No AI engine available on this device.");return}G(!0),E("");try{let l;m==="gemini"?l=await ft($):(H("loading"),l=await mt($),H("ready")),E(l.success&&l.answer?l.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(l.error||"No answer found on this page"))}catch{E("\u26A0\uFE0F Failed to get answer. Please try again.")}G(!1)}};ze(()=>{(async()=>{try{let Q=window;if(!Q.queryLocalFonts)return;let w=await Q.queryLocalFonts(),V=[...new Set(w.map(ae=>ae.family))].sort();j(V.slice(0,50))}catch{}})()},[]);let x=m==="gemini"?"Gemini Nano":m==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Z=m==="transformers"&&M==="loading"?"Loading AI model... (first time only)":"...",ne=b?{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px 16px 0 0",boxShadow:"0 -8px 32px rgba(0,0,0,0.12)",maxHeight:"90vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif",width:"100%"}:{position:"fixed",bottom:"84px",[e]:"24px",zIndex:9999,width:oe?"300px":"320px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",maxHeight:"80vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif"};return h("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:ne,children:[h("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[h("div",{children:[h("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[s("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),r&&s("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),s("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),s("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),s("button",{onClick:u,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"#94a3b8",fontSize:"20px",lineHeight:1,borderRadius:"6px",flexShrink:0,minWidth:b?"44px":"auto",minHeight:b?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),s(fe,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),s(be,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),s(ee,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:l=>n("autoFix",l),tip:"Fixes aria-label, alt text, roles on every element"}),s(q,{}),s(ee,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:l=>n("speechEnabled",l),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),s(q,{}),s(ee,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:l=>n("voiceControl",l),disabled:!i,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),s(q,{}),s(fe,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),s("div",{style:{margin:"4px 18px 6px",padding:"8px 10px",background:a?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${a?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:a?"#0f766e":"#7c3aed",lineHeight:1.5},children:a?"\u2705 Gemini Nano detected \u2014 AI features ready. Runs privately on your device.":"\u2699\uFE0F AI features need one-time setup \u2014 see guide below."}),!a&&h("div",{style:{margin:"0 18px 8px",padding:"10px 12px",background:"#fafafa",borderRadius:"8px",border:"0.5px solid #e2e8f0",fontSize:"11px",color:"#475569",lineHeight:1.7},children:[s("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),h("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",s("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),s("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),s("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:Lo.map(l=>h("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",l]},l))}),h("p",{style:{margin:"0 0 3px"},children:["3. Click ",s("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),h("p",{style:{margin:"0 0 3px"},children:["4. ",s("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://components"})," \u2192 Optimization Guide On Device Model \u2192 Check for update"]}),s("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),s(ee,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:l=>n("plainEnglish",l),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),s(q,{}),s(ee,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:l=>n("summarisePage",l),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),s(q,{}),s(ee,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:l=>n("smartLabels",l),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),s(q,{}),s(fe,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),s(be,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),s(ee,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:l=>n("highContrast",l),tip:"CSS filter: contrast()"}),s(q,{}),s(ee,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:l=>n("darkMode",l),tip:"CSS filter: invert + hue-rotate"}),s(q,{}),s(ee,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:l=>n("reduceMotion",l),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),s(q,{}),s(ee,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:l=>n("largeTargets",l),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),s(q,{}),h("div",{style:{padding:"10px 18px"},children:[s("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),s("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),s("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Io.map(l=>s("button",{onClick:()=>n("colorBlindMode",l.value),"aria-pressed":t.colorBlindMode===l.value,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.colorBlindMode===l.value?"#0d9488":"#e2e8f0"}`,background:t.colorBlindMode===l.value?"#f0fdfa":"#fff",color:t.colorBlindMode===l.value?"#0d9488":"#64748b",cursor:"pointer",minHeight:b?"36px":"auto"},children:l.label},l.value))})]}),s(q,{}),s(fe,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),s(be,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),s(ee,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:l=>n("dyslexiaFont",l),tip:"By Braille Institute \u2014 free and open source"}),s(q,{}),h("div",{style:{padding:"10px 18px"},children:[s("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),s("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),_.length>0?h("select",{value:t.localFont,onChange:l=>n("localFont",l.target.value),"aria-label":"Choose a font from your device",style:{width:"100%",padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"13px",color:"#0f172a",background:"#fff",cursor:"pointer",height:b?"44px":"36px"},children:[s("option",{value:"",children:"System default"}),_.map(l=>s("option",{value:l,style:{fontFamily:l},children:l},l))]}):s("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),s(q,{}),h("div",{style:{padding:"10px 18px 14px"},children:[h("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[h("div",{children:[s("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),s("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),h("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),h("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s("button",{onClick:()=>{let l=ue.indexOf(t.fontScale);l>0&&n("fontScale",ue[l-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale<=80?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),s("div",{style:{flex:1,display:"flex",gap:"3px"},children:ue.map(l=>s("button",{onClick:()=>n("fontScale",l),"aria-label":`Set text size to ${l}%`,style:{flex:1,height:"6px",borderRadius:"99px",border:"none",cursor:"pointer",padding:0,background:l<=t.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},l))}),s("button",{onClick:()=>{let l=ue.indexOf(t.fontScale);l<ue.length-1&&n("fontScale",ue[l+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:b?"44px":"30px",height:b?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale>=130?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),s(q,{}),s(fe,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),s(be,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),h("div",{style:{padding:"6px 18px 12px"},children:[s("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Ee.slice(0,b?8:18).map(l=>s("button",{onClick:()=>n("translateLanguage",l.code),"aria-pressed":t.translateLanguage===l.code,disabled:!a,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.translateLanguage===l.code?"#7c3aed":"#e2e8f0"}`,background:t.translateLanguage===l.code?"#f5f3ff":"#fff",color:t.translateLanguage===l.code?"#7c3aed":"#64748b",cursor:a?"pointer":"not-allowed",opacity:a?1:.5,minHeight:b?"36px":"auto"},children:l.label},l.code))}),!a&&s("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),s(q,{}),s(fe,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:x,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),s(be,{steps:["Type any question about this page","Press Ask or hit Enter",m==="transformers"?"Transformers.js answers \u2014 works on mobile, offline":"Gemini Nano reads page and answers privately","Zero cost. No data leaves your device."]}),h("div",{style:{margin:"0 18px 8px",padding:"6px 10px",background:m==="gemini"?"#f0fdfa":m==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${m==="gemini"?"#99f6e4":m==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:m==="gemini"?"#0f766e":m==="transformers"?"#7c3aed":"#94a3b8"},children:[m==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",m==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!m&&"\u23F3 Detecting AI engine...",m==="transformers"&&M==="loading"&&" \xB7 Loading model...",m==="transformers"&&M==="ready"&&" \xB7 Model ready \u2705"]}),h("div",{style:{padding:"0 18px 14px"},children:[h("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[s("input",{type:"text",value:$,onChange:l=>y(l.target.value),onKeyDown:l=>{l.key==="Enter"&&v()},placeholder:"e.g. What does this page do?",disabled:A||!m,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:m?"#fff":"#f8fafc",outline:"none",height:b?"44px":"36px"}}),s("button",{onClick:v,disabled:A||!$.trim()||!m,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:m&&$.trim()&&!A?"#0d9488":"#e2e8f0",color:m&&$.trim()&&!A?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:m&&$.trim()&&!A?"pointer":"not-allowed",flexShrink:0,height:b?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:A?Z:"Ask"})]}),D&&h("div",{role:"status","aria-live":"polite",style:{padding:"10px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[s("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),D,s("button",{onClick:()=>{E(""),y("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),o&&s("div",{role:"status",style:{margin:"0 14px 10px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:o.fixed>0?`\u2713 ${o.fixed} fixes \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms \xB7 Score: ${o.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms`}),h("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:b?"sticky":"relative",bottom:b?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[s("button",{onClick:f,style:{flex:1,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),s("button",{onClick:d,style:{flex:2,padding:b?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});Je.displayName="WidgetPanel";import{useState as ye,useCallback as Nt}from"react";var Wo={hotel:["hotel","resort","motel","inn","accommodation","lodge","stay","room","booking","hospitality"],ecommerce:["shop","store","ecommerce","e-commerce","sell","product","cart","buy","marketplace","retail"],restaurant:["restaurant","food","cafe","cafeteria","menu","dining","eat","cuisine","bistro","takeaway","delivery"],portfolio:["portfolio","freelance","personal","designer","developer","creative","showcase","work","hire me"],blog:["blog","article","post","write","news","magazine","journal","content"],saas:["saas","dashboard","app","software","platform","tool","analytics","admin","manage","crm"],government:["government","govt","portal","citizen","scheme","welfare","municipal","public","official"],healthcare:["hospital","clinic","doctor","health","medical","patient","appointment","pharmacy"],education:["school","college","university","course","learn","education","student","lms","training"],realestate:["real estate","property","house","flat","apartment","rent","buy property","listing"],landing:["landing","startup","launch","product launch","coming soon","waitlist"],generic:[]},Bo={hotel:["home","rooms","booking","about","contact"],ecommerce:["home","products","cart","checkout","about","contact"],restaurant:["home","menu","reservations","about","contact"],portfolio:["home","portfolio","about","contact"],blog:["home","blog","about","contact"],saas:["home","pricing","dashboard","auth","about","contact"],government:["home","services","about","contact","faq"],healthcare:["home","services","booking","team","about","contact"],education:["home","services","pricing","about","contact"],realestate:["home","products","about","contact"],landing:["home","pricing","about","contact"],generic:["home","about","services","contact"]},Ho={home:["home","homepage","main","landing"],about:["about","who we are","our story","company"],contact:["contact","reach us","get in touch","location"],services:["service","what we offer","solution","offering"],pricing:["pricing","price","plan","subscription","cost","fee"],blog:["blog","article","news","post"],auth:["login","register","signup","sign up","sign in","auth","account"],dashboard:["dashboard","admin","panel","manage","analytics"],gallery:["gallery","photo","image","portfolio"],products:["product","shop","store","item","catalogue"],cart:["cart","basket","shopping cart"],checkout:["checkout","payment","pay","order"],rooms:["room","suite","accommodation","stay"],booking:["booking","reserve","reservation","schedule","appointment"],menu:["menu","food","dish","cuisine"],reservations:["reservation","table booking","book table"],portfolio:["portfolio","work","project","case study"],team:["team","staff","member","people","who we are"],faq:["faq","question","answer","help","support"],terms:["terms","condition","legal"],privacy:["privacy","policy","gdpr","data"]},$o={Authentication:["login","register","auth","signup","sign in","account"],Payment:["payment","stripe","pay","checkout","billing"],Search:["search","filter","find"],"Dark mode":["dark mode","dark theme","night mode"],"Multi-language":["multilingual","multi language","translation","i18n"],SEO:["seo","search engine","meta","google"],Analytics:["analytics","tracking","stats","dashboard"],Email:["email","newsletter","contact form","notification"],Map:["map","location","address","google maps"],"Social media":["social","instagram","facebook","twitter","share"],"Image gallery":["gallery","photo","image","carousel"],"Booking system":["booking","reservation","appointment","schedule"],"Shopping cart":["cart","basket","shop","ecommerce"],"Blog/CMS":["blog","cms","content","article","post"]},Do={blue:["blue","navy","sky","ocean","corporate"],green:["green","nature","eco","environment","health","fresh"],purple:["purple","violet","luxury","creative","royal"],red:["red","bold","energy","passion","food"],orange:["orange","warm","friendly","fun"],teal:["teal","turquoise","modern","tech"],indigo:["indigo","professional","trust","finance","bank"],gray:["gray","minimal","clean","simple","neutral"]},Go={hotel:"indigo",ecommerce:"blue",restaurant:"red",portfolio:"purple",blog:"gray",saas:"teal",government:"blue",healthcare:"green",education:"indigo",realestate:"orange",landing:"purple",generic:"blue"};function No(e){let t=[/(?:for|called|named|company|business|brand)\s+["']?([A-Z][a-zA-Z\s]{1,30})["']?/i,/["']([A-Z][a-zA-Z\s]{1,30})["']/,/^([A-Z][a-zA-Z]+(?:\s[A-Z][a-zA-Z]+)?)/m];for(let o of t){let r=e.match(o);if(r?.[1]){let a=r[1].trim();if(a.length>2&&a.length<40)return a}}return"My Business"}function Oo(e){let t=e.toLowerCase(),o="generic",r=0;for(let[a,i]of Object.entries(Wo)){let n=0;for(let d of i)t.includes(d)&&n++;n>r&&(r=n,o=a)}return o}function qo(e,t){let o=e.toLowerCase(),r=new Set(Bo[t]);for(let[a,i]of Object.entries(Ho))for(let n of i)if(o.includes(n)){r.add(a);break}return r.add("home"),r.add("contact"),Array.from(r)}function _o(e){let t=e.toLowerCase(),o=[];for(let[r,a]of Object.entries($o))for(let i of a)if(t.includes(i)){o.push(r);break}return o}function Vo(e,t){let o=e.toLowerCase();for(let[r,a]of Object.entries(Do))for(let i of a)if(o.includes(i))return r;return Go[t]}function Gt(e){let t=Oo(e),o=qo(e,t),r=_o(e),a=Vo(e,t);return{siteName:No(e),websiteType:t,pages:o,features:r,theme:a,description:e.slice(0,200)}}import{Fragment as Ko,jsx as g,jsxs as F}from"react/jsx-runtime";var jo=["Hotel booking website for Grand Palace Hotels with rooms, booking and payment","E-commerce store for organic food products with cart and checkout","Restaurant website for Spice Garden with menu and table reservations","Portfolio website for a freelance designer with gallery and contact","SaaS dashboard for project management with pricing and auth","Government portal for citizen services with FAQ and contact"],Yo={home:"\u{1F3E0}",about:"\u2139\uFE0F",contact:"\u{1F4EC}",services:"\u2699\uFE0F",pricing:"\u{1F4B0}",blog:"\u{1F4DD}",auth:"\u{1F510}",dashboard:"\u{1F4CA}",gallery:"\u{1F5BC}\uFE0F",products:"\u{1F6D2}",cart:"\u{1F6CD}\uFE0F",checkout:"\u{1F4B3}",rooms:"\u{1F6CF}\uFE0F",booking:"\u{1F4C5}",menu:"\u{1F37D}\uFE0F",reservations:"\u{1FA91}",portfolio:"\u{1F4BC}",team:"\u{1F465}",faq:"\u2753",terms:"\u{1F4C4}",privacy:"\u{1F512}"},Uo={hotel:"\u{1F3E8}",ecommerce:"\u{1F6D2}",restaurant:"\u{1F37D}\uFE0F",portfolio:"\u{1F4BC}",blog:"\u{1F4DD}",saas:"\u26A1",government:"\u{1F3DB}\uFE0F",healthcare:"\u{1F3E5}",education:"\u{1F393}",realestate:"\u{1F3E0}",landing:"\u{1F680}",generic:"\u{1F310}"};function et({position:e,onClose:t}){let[o,r]=ye("input"),[a,i]=ye(""),[n,d]=ye(null),[f,u]=ye(0),[k,b]=ye(""),oe=Nt(()=>{if(!a.trim())return;let y=Gt(a);d(y),r("preview")},[a]),_=Nt(async()=>{if(n){r("generating"),u(0),b("");try{let y=[{msg:"Parsing requirement...",pct:15},{msg:"Loading templates...",pct:30},{msg:"Generating pages...",pct:55},{msg:"Building components...",pct:70},{msg:"Creating styles...",pct:85},{msg:"Packaging ZIP...",pct:95}];for(let E of y)u(E.pct),await new Promise(A=>setTimeout(A,200));let{generateZip:D}=await import("./zip-generator-D5EXBBNS.mjs");await D(n),u(100),r("done")}catch(y){b(y instanceof Error?y.message:"Generation failed. Please try again."),r("preview")}}},[n]),j=()=>{r("input"),i(""),d(null),u(0),b("")},$={position:"fixed",bottom:"204px",[e]:"24px",zIndex:9999,width:"340px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.14)",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"75vh",overflowY:"auto"};return F("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:$,children:[F("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[F("div",{children:[g("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),g("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),g("button",{onClick:t,"aria-label":"Close vibe coder",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",padding:"2px"},children:"\xD7"})]}),o==="input"&&F("div",{style:{padding:"14px 16px"},children:[g("p",{style:{margin:"0 0 10px",fontSize:"11px",color:"#64748b"},children:"Describe your business website in plain English. The plugin will generate a complete Next.js project for you."}),g("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),g("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:jo.slice(0,3).map(y=>g("button",{onClick:()=>i(y),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:y},y))}),g("textarea",{value:a,onChange:y=>i(y.target.value),placeholder:"e.g. I need a hotel booking website with rooms, search, and payment for Grand Palace Hotels",rows:4,"aria-label":"Describe your website",style:{width:"100%",padding:"10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5}}),g("button",{onClick:oe,disabled:!a.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:a.trim()?"#f59e0b":"#e2e8f0",color:a.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:a.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&F("div",{style:{padding:"14px 16px"},children:[k&&F("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",k]}),F("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[F("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[g("span",{style:{fontSize:"1.5rem"},children:Uo[n.websiteType]||"\u{1F310}"}),F("div",{children:[g("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),F("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),F("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),g("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(y=>F("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[Yo[y]||"\u{1F4C4}"," ",y]},y))}),n.features.length>0&&F(Ko,{children:[g("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),g("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(y=>g("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:y},y))})]})]}),F("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[g("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),F("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",g("br",{}),"\u2705 Tailwind CSS + CSS Modules",g("br",{}),"\u2705 TypeScript configured",g("br",{}),"\u2705 Navbar + Footer components",g("br",{}),"\u2705 All ",n.pages.length," pages ready",g("br",{}),"\u2705 Mobile responsive",g("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),F("div",{style:{display:"flex",gap:"8px"},children:[g("button",{onClick:j,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"\u2190 Edit"}),g("button",{onClick:_,style:{flex:2,padding:"9px",borderRadius:"8px",border:"none",background:"#f59e0b",color:"#fff",fontSize:"13px",fontWeight:700,cursor:"pointer"},children:"\u2B07\uFE0F Generate & Download ZIP"})]})]}),o==="generating"&&F("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[g("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),g("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),g("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem"},children:f<30?"Parsing requirement...":f<55?"Loading templates...":f<70?"Generating pages...":f<85?"Building components...":f<95?"Creating styles...":"Packaging ZIP..."}),g("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:g("div",{style:{height:"100%",width:`${f}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),F("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[f,"%"]})]}),o==="done"&&n&&F("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[g("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),F("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),g("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem",lineHeight:1.6},children:"Your ZIP is downloading. Unzip it and run:"}),["npm install","npm run dev"].map(y=>g("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:F("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",y]})},y)),g("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),F("div",{style:{display:"flex",gap:"8px"},children:[g("button",{onClick:j,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"New Project"}),g("button",{onClick:_,style:{flex:1,padding:"9px",borderRadius:"8px",border:"none",background:"#f59e0b",color:"#fff",fontSize:"12px",fontWeight:700,cursor:"pointer"},children:"\u2B07\uFE0F Download Again"})]})]})]})}import{Fragment as Xo,jsx as C,jsxs as te}from"react/jsx-runtime";async function Qo(){try{if(typeof window>"u")return!1;let e=window;if(e.LanguageModel)try{if(typeof e.LanguageModel.availability=="function"){let o=await e.LanguageModel.availability();if(o==="readily"||o==="available"||o==="downloadable")return!0}else return!0}catch{}if(e.Summarizer)try{let o=await e.Summarizer.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}if(e.Rewriter)try{let o=await e.Rewriter.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}if(e.Writer)try{let o=await e.Writer.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}let t=e.ai||globalThis.ai;if(t){if(t.languageModel?.availability)try{let o=await t.languageModel.availability();if(o==="readily"||o==="available")return!0}catch{}if(t.languageModel&&typeof t.languageModel.create=="function"||t.summarizer||t.rewriter||t.writer||t.languageModel)return!0}return!!(e.Translator||e.translation?.canTranslate)}catch{return!1}}function tt({position:e="left",children:t,config:o={},showRag:r=!1,showAgent:a=!1}){let[i,n]=B(!1),[d,f]=B(Xe),[u,k]=B(null),[b,oe]=B(!1),[_,j]=B(!1),[$,y]=B(!1),D=Zo.useRef(null),[E,A]=B(!1),[G,m]=B(""),[R,M]=B(""),[H,v]=B(!1),[x,Z]=B(null),[ne,l]=B("idle"),[Q,w]=B(!1),[V,ae]=B(""),[Ge,le]=B(""),[p,W]=B(!1),[Y,N]=B([]),[I,it]=B(null),eo=24,st=84,lt=r?144:84,cn=204,[he,Ne]=B(!1);me(()=>{if(typeof window>"u")return;let c=window;!!(c.LanguageModel||c.ai?.languageModel)&&_?(Z("gemini"),it("gemini")):Se()&&(Z("transformers"),it("transformers"))},[_]),me(()=>{if(x!=="transformers")return;let c=setInterval(()=>l(Ae()),500);return()=>clearInterval(c)},[x]);let dt=ge(async()=>{if(!(!G.trim()||H)){if(!x){M("\u26A0\uFE0F No AI engine available.");return}v(!0),M("");try{let c;if(x==="gemini"){let{askPage:P}=await import("./rag-MKBAGH6J.mjs");c=await P(G)}else{l("loading");let{askPageWithTransformers:P}=await import("./transformers-rag-HW4QKA5T.mjs");c=await P(G),l("ready")}M(c.success&&c.answer?c.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(c.error||"No answer found."))}catch{M("\u26A0\uFE0F Something went wrong.")}v(!1)}},[G,H,x]),ct=ge(async()=>{if(!V.trim()||p)return;if(!I){le("\u26A0\uFE0F No AI engine available.");return}W(!0),N([]),le("");let{runAgent:c}=await import("./agent-JGLAYQMX.mjs");await c(V,I,P=>{N(re=>[...re,P.text])}),W(!1),le("done")},[V,p,I]);me(()=>{if(typeof window>"u")return;let P=setTimeout(async()=>{let re=window,ro=await Qo();j(ro),y(!!(re.SpeechRecognition||re.webkitSpeechRecognition))},800);return()=>clearTimeout(P)},[]),me(()=>{if(!(typeof window>"u"))try{let c=localStorage.getItem("yuktai-a11y-prefs");c&&f(P=>({...P,...JSON.parse(c)}))}catch{}},[]);let pt=ge(async c=>{let P={enabled:!0,highContrast:c.highContrast,darkMode:c.darkMode,reduceMotion:c.reduceMotion,largeTargets:c.largeTargets,speechEnabled:c.speechEnabled,autoFix:c.autoFix,dyslexiaFont:c.dyslexiaFont,localFont:c.localFont,fontSizeMultiplier:c.fontScale/100,colorBlindMode:c.colorBlindMode,showAuditBadge:c.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:c.plainEnglish,summarisePage:c.summarisePage,translateLanguage:c.translateLanguage,voiceControl:c.voiceControl,smartLabels:c.smartLabels,...o};await J.execute(P),k(J.applyFixes(P)),oe(!0)},[o]),to=ge(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(d))}catch{}await pt(d),n(!1)},[d,pt]),oo=ge(()=>{f(Xe);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let c=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(P=>c.removeAttribute(P)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",k(null),oe(!1)},[]),no=ge((c,P)=>{f(re=>({...re,[c]:P}))},[]);me(()=>{let c=P=>{P.key==="Escape"&&(i&&n(!1),E&&A(!1),Q&&w(!1),he&&Ne(!1))};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i,E,Q]),me(()=>{i&&D.current&&J.trapFocus(D.current)},[i]);let ve=(c,P,re)=>({position:"fixed",bottom:`${c}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:P,color:"#fff",border:"none",cursor:"pointer",fontSize:"22px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s, background 0.2s"}),we=c=>{c.currentTarget.style.transform="scale(1.08)"},ke=c=>{c.currentTarget.style.transform="scale(1)"},ut=x==="gemini"?"Gemini Nano \xB7 On device":x==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",ao=x==="transformers"&&ne==="loading"?"Loading model...":"...";return te(Xo,{children:[t,a&&C("button",{style:ve(204,he?"#d97706":"#f59e0b",he),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{Ne(c=>!c),w(!1),A(!1),n(!1)},onMouseEnter:we,onMouseLeave:ke,children:"\u26A1"}),a&&he&&C(et,{position:e,onClose:()=>Ne(!1)}),a&&C("button",{style:ve(lt,Q?"#059669":"#10b981",Q),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":Q,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{w(c=>!c),A(!1),n(!1)},onMouseEnter:we,onMouseLeave:ke,children:"\u{1F916}"}),a&&Q&&te("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${lt+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px",maxHeight:"70vh",overflowY:"auto"},children:[te("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[te("div",{children:[C("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),C("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:I==="gemini"?"Gemini Nano \xB7 On device":I==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),C("button",{onClick:()=>w(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),C("p",{style:{margin:"0 0 8px",fontSize:"11px",color:"#64748b"},children:"Tell me what you want to do on this page. I will guide you step by step."}),C("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:["Fill this form","Find contact info","What is this page?","Guide me to apply"].map(c=>C("button",{onClick:()=>ae(c),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:c},c))}),te("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[C("input",{type:"text",value:V,onChange:c=>ae(c.target.value),onKeyDown:c=>{c.key==="Enter"&&ct()},placeholder:"e.g. Help me fill this form",disabled:p||!I,"aria-label":"Tell the agent what to do",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:I?"#fff":"#f8fafc",outline:"none",height:"36px"}}),C("button",{onClick:ct,disabled:p||!V.trim()||!I,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:I&&V.trim()&&!p?"#10b981":"#e2e8f0",color:I&&V.trim()&&!p?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:I&&V.trim()&&!p?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:p?"...":"Go"})]}),Y.length>0&&te("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[Y.map((c,P)=>C("p",{style:{margin:"0 0 2px"},children:c},P)),Ge==="done"&&C("button",{onClick:()=>{N([]),ae(""),le("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!I&&C("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),r&&C("button",{style:ve(st,E?"#7c3aed":"#6d28d9",E),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":E,title:`\u{1F4AC} Ask this page \xB7 ${ut}`,onClick:()=>{A(c=>!c),n(!1),w(!1)},onMouseEnter:we,onMouseLeave:ke,children:"\u{1F4AC}"}),r&&E&&te("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${st+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px"},children:[te("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[te("div",{children:[C("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),C("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:ut}),x==="transformers"&&ne==="loading"&&C("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),x==="transformers"&&ne==="ready"&&C("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),C("button",{onClick:()=>A(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),te("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[C("input",{type:"text",value:G,onChange:c=>m(c.target.value),onKeyDown:c=>{c.key==="Enter"&&dt()},placeholder:"e.g. What does this page do?",disabled:H||!x,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:x?"#fff":"#f8fafc",outline:"none",height:"36px"}}),C("button",{onClick:dt,disabled:H||!G.trim()||!x,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:x&&G.trim()&&!H?"#7c3aed":"#e2e8f0",color:x&&G.trim()&&!H?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:x&&G.trim()&&!H?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:H?ao:"Ask"})]}),R&&te("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[C("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),R,C("button",{onClick:()=>{M(""),m("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!x&&C("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),C("button",{style:ve(eo,b?"#0d9488":"#1a73e8",i),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":i,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(c=>!c),A(!1),w(!1)},onMouseEnter:we,onMouseLeave:ke,children:"\u267F"}),i&&C(Je,{ref:D,position:e,settings:d,report:u,isActive:b,aiSupported:_,voiceSupported:$,set:no,onApply:to,onReset:oo,onClose:()=>n(!1)})]})}var Me={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};var We={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};var se=class{plugins=new Map;register(t,o){if(!o||typeof o.execute!="function")throw new Error(`Invalid plugin: ${t}`);this.plugins.set(t,o)}use(t){return this.plugins.get(t)}async run(t,o){try{let r=this.use(t);if(!r)throw new Error(`Plugin not found: ${t}`);return await r.execute(o)}catch(r){throw console.error(`[YuktAI Runtime Error in ${t}]:`,r),r}}getPlugins(){return Array.from(this.plugins.keys())}};import{useState as nn,useCallback as rt}from"react";import{useState as xe,useMemo as ot,useCallback as nt,useEffect as Ot}from"react";function Jo(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function at(e){let{data:t,columns:o,pagination:r=!0,mobileBreakpoint:a=768}=e,[i,n]=xe(null),[d,f]=xe(""),[u,k]=xe(1),[b,oe]=xe(Jo(r)),[_,j]=xe(!1);Ot(()=>{if(typeof window>"u")return;let R=()=>{j(window.innerWidth<a)};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[a]);let $=nt(R=>{n(M=>!M||M.key!==R?{key:R,direction:"asc"}:M.direction==="asc"?{key:R,direction:"desc"}:null),k(1)},[]),y=nt(()=>n(null),[]),D=ot(()=>{if(!d.trim())return t;let R=d.toLowerCase().trim();return t.filter(M=>o.some(H=>{let v=M[H.key];return v==null?!1:String(v).toLowerCase().includes(R)}))},[t,d,o]),E=ot(()=>{if(!i)return D;let R=[...D].sort((M,H)=>{let v=M[i.key],x=H[i.key];if(v===x)return 0;if(v==null)return 1;if(x==null)return-1;if(typeof v=="number"&&typeof x=="number")return v-x;if(v instanceof Date&&x instanceof Date)return v.getTime()-x.getTime();let Z=String(v),ne=String(x);return Z.localeCompare(ne,void 0,{sensitivity:"base",numeric:!0})});return i.direction==="desc"?R.reverse():R},[D,i]),A=Math.max(1,Math.ceil(E.length/b)),G=ot(()=>{if(r===!1)return E;let R=(u-1)*b;return E.slice(R,R+b)},[E,u,b,r]),m=nt(()=>{n(null),f(""),k(1)},[]);return Ot(()=>{u>A&&k(A)},[u,A]),{displayedData:G,totalCount:t.length,filteredCount:E.length,sort:i,toggleSort:$,clearSort:y,searchQuery:d,setSearchQuery:f,page:u,pageSize:b,totalPages:A,setPage:k,setPageSize:oe,isMobile:_,reset:m}}import{jsx as en}from"react/jsx-runtime";function O({size:e=20,color:t="currentColor",strokeWidth:o=2.5,label:r,children:a,...i}){return en("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!r?"true":void 0,"aria-label":r,role:r?"img":void 0,focusable:"false",...i,children:a})}import{jsx as qt,jsxs as tn}from"react/jsx-runtime";function Be(e){return tn(O,{...e,children:[qt("path",{d:"M12 19V5"}),qt("path",{d:"m5 12 7-7 7 7"})]})}import{jsx as _t,jsxs as on}from"react/jsx-runtime";function He(e){return on(O,{...e,children:[_t("path",{d:"M12 5v14"}),_t("path",{d:"m5 12 7 7 7-7"})]})}import{jsx as Vt}from"react/jsx-runtime";function $e(e){return Vt(O,{...e,children:Vt("path",{d:"m15 18-6-6 6-6"})})}import{jsx as jt}from"react/jsx-runtime";function De(e){return jt(O,{...e,children:jt("path",{d:"m9 18 6-6-6-6"})})}import{jsx as z,jsxs as K}from"react/jsx-runtime";var an={default:{container:{background:"#FFFFFF",color:"#0F172A",fontFamily:"system-ui, -apple-system, sans-serif"},header:{background:"#F8FAFC",color:"#475569",borderBottom:"1px solid #E2E8F0"},row:{borderBottom:"1px solid #F1F5F9"},rowHover:{background:"#F8FAFC"},cell:{color:"#0F172A"},button:{background:"#0D9488",color:"#FFFFFF"},border:"#E2E8F0"},"high-contrast":{container:{background:"#000000",color:"#FFFFFF",fontFamily:"system-ui, sans-serif",fontWeight:600},header:{background:"#000000",color:"#FFFF00",borderBottom:"2px solid #FFFFFF",fontWeight:700},row:{borderBottom:"1px solid #FFFFFF"},rowHover:{background:"#1A1A1A"},cell:{color:"#FFFFFF"},button:{background:"#FFFF00",color:"#000000",border:"2px solid #FFFFFF"},border:"#FFFFFF"},dark:{container:{background:"#0F172A",color:"#F1F5F9",fontFamily:"system-ui, sans-serif"},header:{background:"#1E293B",color:"#94A3B8",borderBottom:"1px solid #334155"},row:{borderBottom:"1px solid #1E293B"},rowHover:{background:"#1E293B"},cell:{color:"#F1F5F9"},button:{background:"#14B8A6",color:"#0F172A"},border:"#334155"},"color-blind":{container:{background:"#FFFFFF",color:"#0F172A",fontFamily:"system-ui, sans-serif"},header:{background:"#F8FAFC",color:"#475569",borderBottom:"1px solid #E2E8F0"},row:{borderBottom:"1px solid #F1F5F9"},rowHover:{background:"#F8FAFC"},cell:{color:"#0F172A"},button:{background:"#1F2937",color:"#FFFFFF"},border:"#E2E8F0"},dyslexia:{container:{background:"#FDF6E3",color:"#3D3424",fontFamily:"'Atkinson Hyperlegible', system-ui, sans-serif",letterSpacing:"0.3px",lineHeight:1.7},header:{background:"#FAF0D7",color:"#5C4F37",borderBottom:"1px solid #D7CFB8",letterSpacing:"0.5px"},row:{borderBottom:"1px solid #ECE0C2"},rowHover:{background:"#FAF0D7"},cell:{color:"#3D3424"},button:{background:"#92400E",color:"#FDF6E3"},border:"#D7CFB8"}},U={search:"Search...",noData:"No data to display",loading:"Loading...",rowsSelected:"rows selected",page:"Page",of:"of",showing:"Showing",to:"to",results:"results",prev:"Previous",next:"Next"};function rn(e){let{data:t,columns:o,view:r="auto",mobileBreakpoint:a=768,theme:i="default",pagination:n=!0,search:d=!0,selectable:f=!1,selectedKeys:u=[],rowKey:k,loading:b=!1,empty:oe,onSelectionChange:_,onRowClick:j,onSortChange:$,className:y}=e,[D,E]=nn(u),{displayedData:A,filteredCount:G,sort:m,toggleSort:R,searchQuery:M,setSearchQuery:H,page:v,pageSize:x,totalPages:Z,setPage:ne,isMobile:l}=at({data:t,columns:o,pagination:n,mobileBreakpoint:a}),Q=r==="card"||r==="auto"&&l,w=an[i],V=o.filter(p=>!(l&&p.hiddenOnMobile)),ae=rt((p,W)=>k&&p[k]!==void 0?String(p[k]):p.id!==void 0?String(p.id):String(W),[k]),Ge=rt(p=>{R(p),$?.(m)},[R,$,m]),le=rt(p=>{E(W=>{let Y=W.includes(p)?W.filter(N=>N!==p):[...W,p];return _?.(Y),Y})},[_]);return b?z("div",{role:"status","aria-live":"polite",style:{...w.container,padding:"2rem",textAlign:"center",borderRadius:8,border:`1px solid ${w.border}`},children:U.loading}):t.length===0?z("div",{role:"status",style:{...w.container,padding:"2rem",textAlign:"center",borderRadius:8,border:`1px solid ${w.border}`},children:oe??U.noData}):K("div",{className:y,style:{...w.container,borderRadius:8,border:`1px solid ${w.border}`,overflow:"hidden"},"data-yuktai-grid":!0,"data-theme":i,children:[d&&K("div",{style:{...w.header,padding:"12px 16px",display:"flex",gap:12,alignItems:"center"},children:[z("input",{type:"search",value:M,onChange:p=>H(p.target.value),placeholder:U.search,"aria-label":U.search,style:{flex:1,padding:"8px 12px",fontSize:14,border:`1px solid ${w.border}`,borderRadius:6,background:"transparent",color:"inherit",minHeight:44}}),f&&D.length>0&&K("span",{style:{fontSize:13,color:"inherit"},children:[D.length," ",U.rowsSelected]})]}),Q?z("div",{role:"list",style:{padding:8},children:A.map((p,W)=>{let Y=ae(p,W);return z("div",{role:"listitem",onClick:()=>j?.(p,W),style:{padding:12,marginBottom:8,border:`1px solid ${w.border}`,borderRadius:8,background:"transparent",cursor:j?"pointer":"default",minHeight:44},tabIndex:0,children:V.map(N=>K("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:13},children:[K("span",{style:{fontWeight:500,opacity:.7},children:[N.label,":"]}),z("span",{style:w.cell,children:N.render?N.render(p[N.key],p,W):String(p[N.key]??"")})]},N.key))},Y)})}):z("div",{style:{overflowX:"auto"},children:K("table",{role:"grid",style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[z("thead",{children:K("tr",{role:"row",children:[f&&z("th",{style:{...w.header,padding:"10px 14px",width:44},children:z("input",{type:"checkbox","aria-label":"Select all",checked:D.length===A.length&&A.length>0,onChange:p=>{p.target.checked?E(A.map((W,Y)=>ae(W,Y))):E([])},style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),V.map(p=>z("th",{role:"columnheader","aria-sort":m?.key===p.key?m.direction==="asc"?"ascending":"descending":"none",onClick:()=>p.sortable!==!1&&Ge(p.key),style:{...w.header,padding:"10px 14px",textAlign:p.align??"left",cursor:p.sortable!==!1?"pointer":"default",userSelect:"none",width:p.width,fontWeight:500,fontSize:12,textTransform:"uppercase",letterSpacing:"0.5px"},children:K("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[p.label,m?.key===p.key&&(m.direction==="asc"?z(Be,{size:14}):z(He,{size:14}))]})},p.key))]})}),z("tbody",{children:A.map((p,W)=>{let Y=ae(p,W),N=D.includes(Y);return K("tr",{role:"row","aria-selected":N,onClick:()=>j?.(p,W),style:{...w.row,cursor:j?"pointer":"default",background:N?w.rowHover.background:"transparent"},children:[f&&z("td",{style:{padding:"10px 14px"},children:z("input",{type:"checkbox","aria-label":`Select row ${W+1}`,checked:N,onChange:()=>le(Y),onClick:I=>I.stopPropagation(),style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),V.map(I=>z("td",{role:"gridcell",style:{...w.cell,padding:"10px 14px",textAlign:I.align??"left"},children:I.render?I.render(p[I.key],p,W):String(p[I.key]??"")},I.key))]},Y)})})]})}),n!==!1&&Z>1&&K("div",{style:{...w.header,padding:"10px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${w.border}`,borderBottom:"none",fontSize:13,flexWrap:"wrap",gap:8},children:[K("span",{children:[U.showing," ",(v-1)*x+1," ",U.to," ",Math.min(v*x,G)," ",U.of," ",G," ",U.results]}),K("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[z("button",{onClick:()=>ne(v-1),disabled:v===1,"aria-label":U.prev,style:{...w.button,padding:"6px 12px",border:`1px solid ${w.border}`,borderRadius:4,cursor:v===1?"not-allowed":"pointer",opacity:v===1?.5:1,minHeight:44,minWidth:44,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:z($e,{size:18})}),K("span",{style:{padding:"0 8px"},children:[U.page," ",v," ",U.of," ",Z]}),z("button",{onClick:()=>ne(v+1),disabled:v===Z,"aria-label":U.next,style:{...w.button,padding:"6px 12px",border:`1px solid ${w.border}`,borderRadius:4,cursor:v===Z?"not-allowed":"pointer",opacity:v===Z?.5:1,minHeight:44,minWidth:44,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:z(De,{size:18})})]})]})]})}import{jsx as Yt,jsxs as sn}from"react/jsx-runtime";function Ut(e){return sn(O,{...e,children:[Yt("circle",{cx:"11",cy:"11",r:"7"}),Yt("path",{d:"m20 20-4-4"})]})}import{jsx as Kt}from"react/jsx-runtime";function Zt(e){return Kt(O,{...e,children:Kt("path",{d:"M5 12.5 10 17.5 19.5 7"})})}import{jsx as Qt,jsxs as ln}from"react/jsx-runtime";function Xt(e){return ln(O,{...e,children:[Qt("path",{d:"M18 6 6 18"}),Qt("path",{d:"m6 6 12 12"})]})}function dn(){if(typeof globalThis>"u")return new se;if(!globalThis.__yuktai_runtime__){let e=new se;e.register(J.name,J),e.register(Me.name,Me),e.register(We.name,We),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Jt=typeof window<"u"?dn():new se,pr={wcagPlugin:J,list(){return Jt.getPlugins()},use(e){return Jt.use(e)},fix(e){return J.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return J.scan()}};export{Zt as CheckIcon,$e as ChevronLeftIcon,De as ChevronRightIcon,Xt as CloseIcon,O as IconBase,se as Runtime,Ut as SearchIcon,He as SortDownIcon,Be as SortUpIcon,pr as YuktAI,tt as YuktAIWrapper,rn as YuktaiGrid,Me as aiPlugin,tt as default,at as useGrid,We as voicePlugin,J as wcag,J as wcagPlugin};
|
|
385
|
+
`,document.body.appendChild(e),It=e}function $t(e){let t={critical:20,serious:10,moderate:5,minor:2},o=e.details.reduce((r,a)=>r+(t[a.severity]||0),0);return Math.max(0,Math.min(100,100-o))}var J={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";pe=e,Eo(e),Fo(),Ro(),wo(),ko(),e.showSkipLinks!==!1&&vo(),e.showPreferencePanel,To(e);let t=this.applyFixes(e);t.score=$t(t),e.showAuditBadge&&Ao(t),e.timeoutWarning&&Nt(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Mt(!0),e.summarisePage&&await Bt(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await Wt(e.translateLanguage),e.voiceControl&&await Ht(!0),e.smartLabels&&await Dt(!0);let o=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return C(o,t.score>=90?"success":"info",!1),`yuktai v4.0.0: ${o} Scanned ${t.scanned} elements in ${t.renderTime}ms.`},applyFixes(e){let t={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return t;let o=performance.now(),r=document.querySelectorAll("*");t.scanned=r.length;let a=(i,n,d,g)=>{t.details.push({tag:i,fix:n,severity:d,element:g.outerHTML.slice(0,100)}),t.fixed++};return r.forEach(i=>{let n=i,d=n.tagName.toLowerCase();if(d==="html"&&!n.getAttribute("lang")&&(n.setAttribute("lang","en"),a(d,'lang="en" added',"critical",n)),d==="meta"){let u=n.getAttribute("name"),A=n.getAttribute("content")||"";u==="viewport"&&A.includes("user-scalable=no")&&(n.setAttribute("content",A.replace("user-scalable=no","user-scalable=yes")),a(d,"user-scalable=yes restored","serious",n)),u==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(A)&&(n.setAttribute("content",A.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(d,"maximum-scale=5 restored","serious",n))}if(d==="main"&&!n.getAttribute("tabindex")&&(n.setAttribute("tabindex","-1"),n.getAttribute("id")||n.setAttribute("id","main-content")),d==="img"&&(n.hasAttribute("alt")||(n.setAttribute("alt",""),n.setAttribute("aria-hidden","true"),a(d,'alt="" aria-hidden="true"',"serious",n))),d==="svg"&&(!n.getAttribute("aria-hidden")&&!n.getAttribute("aria-label")&&!i.querySelector("title")&&(n.setAttribute("aria-hidden","true"),a(d,'aria-hidden="true" (decorative svg)',"minor",n)),n.getAttribute("focusable")||n.setAttribute("focusable","false")),d==="iframe"&&!n.getAttribute("title")&&!n.getAttribute("aria-label")&&(n.setAttribute("title","embedded content"),n.setAttribute("aria-label","embedded content"),a(d,"title + aria-label added","serious",n)),d==="button"){if(!n.innerText?.trim()&&!n.getAttribute("aria-label")){let u=n.getAttribute("title")||"button";n.setAttribute("aria-label",u),a(d,`aria-label="${u}" (empty button)`,"critical",n)}n.hasAttribute("disabled")&&!n.getAttribute("aria-disabled")&&(n.setAttribute("aria-disabled","true"),t.fixed++)}if(d==="a"){let u=n;!n.innerText?.trim()&&!n.getAttribute("aria-label")&&(n.setAttribute("aria-label",n.getAttribute("title")||"link"),a(d,"aria-label added (empty link)","critical",n)),u.target==="_blank"&&!u.rel?.includes("noopener")&&(u.rel="noopener noreferrer",t.fixed++)}if(zt.has(d)){let u=n;if(!n.getAttribute("aria-label")&&!n.getAttribute("aria-labelledby")){let A=n.getAttribute("placeholder")||n.getAttribute("name")||d;n.setAttribute("aria-label",A),a(d,`aria-label="${A}"`,"serious",n)}if(n.hasAttribute("required")&&!n.getAttribute("aria-required")&&(n.setAttribute("aria-required","true"),t.fixed++),d==="input"&&!u.autocomplete){let A=u.name||"";u.type==="email"||A.includes("email")?u.autocomplete="email":u.type==="tel"||A.includes("tel")?u.autocomplete="tel":u.type==="password"&&(u.autocomplete="current-password"),t.fixed++}}d==="th"&&!n.getAttribute("scope")&&(n.setAttribute("scope",n.closest("thead")?"col":"row"),a(d,"scope added to <th>","moderate",n)),Xe[d]&&!n.getAttribute("role")&&(n.setAttribute("role",Xe[d]),a(d,`role="${Xe[d]}"`,"minor",n));let g=n.getAttribute("role")||"";g==="tab"&&!n.getAttribute("aria-selected")&&(n.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(g)&&!n.getAttribute("aria-live")&&(n.setAttribute("aria-live",g==="alert"?"assertive":"polite"),a(d,`aria-live added on role=${g}`,"moderate",n)),g==="combobox"&&!n.getAttribute("aria-expanded")&&(n.setAttribute("aria-expanded","false"),a(d,'aria-expanded="false" on combobox',"serious",n)),(g==="checkbox"||g==="radio")&&!n.getAttribute("aria-checked")&&(n.setAttribute("aria-checked","false"),a(d,`aria-checked="false" on role=${g}`,"serious",n))}),t.renderTime=parseFloat((performance.now()-o).toFixed(2)),t},scan(){let e={fixed:0,scanned:0,renderTime:0,score:100,details:[]};if(typeof document>"u")return e;let t=performance.now(),o=document.querySelectorAll("*");e.scanned=o.length;let r=(a,i,n,d)=>e.details.push({tag:a,fix:i,severity:n,element:d.outerHTML.slice(0,100)});return o.forEach(a=>{let i=a,n=i.tagName.toLowerCase();(n==="a"||n==="button")&&!i.innerText?.trim()&&!i.getAttribute("aria-label")&&r(n,"needs aria-label (empty)","critical",i),n==="img"&&!i.hasAttribute("alt")&&r(n,"needs alt text","serious",i),zt.has(n)&&!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")&&r(n,"needs aria-label","serious",i),n==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&r(n,"iframe needs title","serious",i)}),e.fixed=e.details.length,e.score=$t(e),e.renderTime=parseFloat((performance.now()-t).toFixed(2)),e},startObserver(e){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(e)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},announce:C,speak:Je,showVisualAlert:Gt,trapFocus:ze,handlePlainEnglish:Mt,handleSummarisePage:Bt,handleTranslate:Wt,handleVoiceControl:Ht,handleSmartLabels:Dt,SUPPORTED_LANGUAGES:Fe};import Zo,{useEffect as ge,useState as H,useCallback as me}from"react";import{forwardRef as Po,useEffect as Me,useState as ie}from"react";import{jsx as s,jsxs as k}from"react/jsx-runtime";var et={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100,localFont:"",darkMode:!1,largeTargets:!1,speechEnabled:!1,colorBlindMode:"none",showAuditBadge:!1,timeoutWarning:void 0,plainEnglish:!1,summarisePage:!1,translateLanguage:"en",voiceControl:!1,smartLabels:!1},ue=[80,90,100,110,120,130],Io=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],Lo=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function zo(){let[e,t]=ie(typeof window<"u"?window.innerWidth:1024);return Me(()=>{let o=()=>t(window.innerWidth);return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function Mo({checked:e,onChange:t,label:o,disabled:r=!1}){return k("label",{"aria-label":o,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:r?"not-allowed":"pointer",flexShrink:0,opacity:r?.4:1},children:[s("input",{type:"checkbox",checked:e,disabled:r,onChange:a=>t(a.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),s("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),s("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"18px",height:"18px",background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}function fe({label:e,color:t="#64748b",badge:o,concept:r}){return k("div",{style:{margin:"10px 18px 4px"},children:[k("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),o&&s("span",{style:{fontSize:"9px",fontWeight:500,padding:"1px 7px",borderRadius:"99px",background:"#f5f3ff",color:"#7c3aed",border:"0.5px solid #c4b5fd",whiteSpace:"nowrap"},children:o})]}),r&&s("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:r})]})}function te({icon:e,label:t,desc:o,checked:r,onChange:a,disabled:i=!1,disabledReason:n,tip:d}){return k("div",{title:i?n:d,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[k("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[s("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:i?"#f1f5f9":"#f0fdfa",color:i?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),k("div",{style:{minWidth:0},children:[s("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:i?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),s("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:i?n:o})]})]}),s(Mo,{checked:r,onChange:a,label:`Toggle ${t}`,disabled:i})]})}function V(){return s("div",{style:{height:"1px",background:"#f1f5f9"}})}function ye({steps:e}){return k("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[s("p",{style:{margin:"0 0 4px",fontSize:"9px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"How to use"}),e.map((t,o)=>k("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[o+1,". ",t]},o))]})}var tt=Po(({position:e,settings:t,report:o,isActive:r,aiSupported:a,voiceSupported:i,set:n,onApply:d,onReset:g,onClose:u},A)=>{let{isMobile:x,isTablet:ne}=zo(),[j,K]=ie([]),[D,h]=ie(""),[$,F]=ie(""),[S,G]=ie(!1),[m,R]=ie(null),[L,W]=ie("idle");Me(()=>{let l=window;!!(l.LanguageModel||l.ai?.languageModel)&&a?R("gemini"):Ae()&&R("transformers")},[a]),Me(()=>{if(m!=="transformers")return;let l=setInterval(()=>{W(Ce())},500);return()=>clearInterval(l)},[m]);let v=async()=>{if(!(!D.trim()||S)){if(!m){F("\u26A0\uFE0F No AI engine available on this device.");return}G(!0),F("");try{let l;m==="gemini"?l=await mt(D):(W("loading"),l=await bt(D),W("ready")),F(l.success&&l.answer?l.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(l.error||"No answer found on this page"))}catch{F("\u26A0\uFE0F Failed to get answer. Please try again.")}G(!1)}};Me(()=>{(async()=>{try{let Q=window;if(!Q.queryLocalFonts)return;let f=await Q.queryLocalFonts(),Y=[...new Set(f.map(re=>re.family))].sort();K(Y.slice(0,50))}catch{}})()},[]);let w=m==="gemini"?"Gemini Nano":m==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Z=m==="transformers"&&L==="loading"?"Loading AI model... (first time only)":"...",ee=x?{position:"fixed",bottom:0,left:0,right:0,zIndex:9999,background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px 16px 0 0",boxShadow:"0 -8px 32px rgba(0,0,0,0.12)",maxHeight:"90vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif",width:"100%"}:{position:"fixed",bottom:"84px",[e]:"24px",zIndex:9999,width:ne?"300px":"320px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",maxHeight:"80vh",overflowY:"auto",fontFamily:"system-ui,-apple-system,sans-serif"};return k("div",{ref:A,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:ee,children:[k("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[k("div",{children:[k("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[s("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),r&&s("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),s("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),s("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),s("button",{onClick:u,"aria-label":"Close accessibility panel",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"#94a3b8",fontSize:"20px",lineHeight:1,borderRadius:"6px",flexShrink:0,minWidth:x?"44px":"auto",minHeight:x?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),s(fe,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),s(ye,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),s(te,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:l=>n("autoFix",l),tip:"Fixes aria-label, alt text, roles on every element"}),s(V,{}),s(te,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:l=>n("speechEnabled",l),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),s(V,{}),s(te,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:l=>n("voiceControl",l),disabled:!i,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),s(V,{}),s(fe,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),s("div",{style:{margin:"4px 18px 6px",padding:"8px 10px",background:a?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${a?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:a?"#0f766e":"#7c3aed",lineHeight:1.5},children:a?"\u2705 Gemini Nano detected \u2014 AI features ready. Runs privately on your device.":"\u2699\uFE0F AI features need one-time setup \u2014 see guide below."}),!a&&k("div",{style:{margin:"0 18px 8px",padding:"10px 12px",background:"#fafafa",borderRadius:"8px",border:"0.5px solid #e2e8f0",fontSize:"11px",color:"#475569",lineHeight:1.7},children:[s("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),k("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",s("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),s("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),s("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:Lo.map(l=>k("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",l]},l))}),k("p",{style:{margin:"0 0 3px"},children:["3. Click ",s("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),k("p",{style:{margin:"0 0 3px"},children:["4. ",s("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://components"})," \u2192 Optimization Guide On Device Model \u2192 Check for update"]}),s("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),s(te,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:l=>n("plainEnglish",l),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),s(V,{}),s(te,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:l=>n("summarisePage",l),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),s(V,{}),s(te,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:l=>n("smartLabels",l),disabled:!a,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),s(V,{}),s(fe,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),s(ye,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),s(te,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:l=>n("highContrast",l),tip:"CSS filter: contrast()"}),s(V,{}),s(te,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:l=>n("darkMode",l),tip:"CSS filter: invert + hue-rotate"}),s(V,{}),s(te,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:l=>n("reduceMotion",l),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),s(V,{}),s(te,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:l=>n("largeTargets",l),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),s(V,{}),k("div",{style:{padding:"10px 18px"},children:[s("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),s("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),s("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Io.map(l=>s("button",{onClick:()=>n("colorBlindMode",l.value),"aria-pressed":t.colorBlindMode===l.value,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.colorBlindMode===l.value?"#0d9488":"#e2e8f0"}`,background:t.colorBlindMode===l.value?"#f0fdfa":"#fff",color:t.colorBlindMode===l.value?"#0d9488":"#64748b",cursor:"pointer",minHeight:x?"36px":"auto"},children:l.label},l.value))})]}),s(V,{}),s(fe,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),s(ye,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),s(te,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:l=>n("dyslexiaFont",l),tip:"By Braille Institute \u2014 free and open source"}),s(V,{}),k("div",{style:{padding:"10px 18px"},children:[s("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),s("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),j.length>0?k("select",{value:t.localFont,onChange:l=>n("localFont",l.target.value),"aria-label":"Choose a font from your device",style:{width:"100%",padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"13px",color:"#0f172a",background:"#fff",cursor:"pointer",height:x?"44px":"36px"},children:[s("option",{value:"",children:"System default"}),j.map(l=>s("option",{value:l,style:{fontFamily:l},children:l},l))]}):s("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),s(V,{}),k("div",{style:{padding:"10px 18px 14px"},children:[k("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[k("div",{children:[s("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),s("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),k("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),k("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s("button",{onClick:()=>{let l=ue.indexOf(t.fontScale);l>0&&n("fontScale",ue[l-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:x?"44px":"30px",height:x?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale<=80?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),s("div",{style:{flex:1,display:"flex",gap:"3px"},children:ue.map(l=>s("button",{onClick:()=>n("fontScale",l),"aria-label":`Set text size to ${l}%`,style:{flex:1,height:"6px",borderRadius:"99px",border:"none",cursor:"pointer",padding:0,background:l<=t.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},l))}),s("button",{onClick:()=>{let l=ue.indexOf(t.fontScale);l<ue.length-1&&n("fontScale",ue[l+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:x?"44px":"30px",height:x?"44px":"30px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",cursor:t.fontScale>=130?"not-allowed":"pointer",fontSize:"16px",color:t.fontScale>=130?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),s(V,{}),s(fe,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),s(ye,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),k("div",{style:{padding:"6px 18px 12px"},children:[s("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Fe.slice(0,x?8:18).map(l=>s("button",{onClick:()=>n("translateLanguage",l.code),"aria-pressed":t.translateLanguage===l.code,disabled:!a,style:{padding:"4px 10px",borderRadius:"20px",fontSize:"11px",fontWeight:500,border:`1px solid ${t.translateLanguage===l.code?"#7c3aed":"#e2e8f0"}`,background:t.translateLanguage===l.code?"#f5f3ff":"#fff",color:t.translateLanguage===l.code?"#7c3aed":"#64748b",cursor:a?"pointer":"not-allowed",opacity:a?1:.5,minHeight:x?"36px":"auto"},children:l.label},l.code))}),!a&&s("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),s(V,{}),s(fe,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:w,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),s(ye,{steps:["Type any question about this page","Press Ask or hit Enter",m==="transformers"?"Transformers.js answers \u2014 works on mobile, offline":"Gemini Nano reads page and answers privately","Zero cost. No data leaves your device."]}),k("div",{style:{margin:"0 18px 8px",padding:"6px 10px",background:m==="gemini"?"#f0fdfa":m==="transformers"?"#f5f3ff":"#f8fafc",borderRadius:"8px",border:`0.5px solid ${m==="gemini"?"#99f6e4":m==="transformers"?"#c4b5fd":"#e2e8f0"}`,fontSize:"10px",color:m==="gemini"?"#0f766e":m==="transformers"?"#7c3aed":"#94a3b8"},children:[m==="gemini"&&"\u2705 Using Gemini Nano \u2014 on device, private, instant",m==="transformers"&&"\u2705 Using Transformers.js \u2014 works on mobile and all browsers",!m&&"\u23F3 Detecting AI engine...",m==="transformers"&&L==="loading"&&" \xB7 Loading model...",m==="transformers"&&L==="ready"&&" \xB7 Model ready \u2705"]}),k("div",{style:{padding:"0 18px 14px"},children:[k("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[s("input",{type:"text",value:D,onChange:l=>h(l.target.value),onKeyDown:l=>{l.key==="Enter"&&v()},placeholder:"e.g. What does this page do?",disabled:S||!m,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:m?"#fff":"#f8fafc",outline:"none",height:x?"44px":"36px"}}),s("button",{onClick:v,disabled:S||!D.trim()||!m,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:m&&D.trim()&&!S?"#0d9488":"#e2e8f0",color:m&&D.trim()&&!S?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:m&&D.trim()&&!S?"pointer":"not-allowed",flexShrink:0,height:x?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:S?Z:"Ask"})]}),$&&k("div",{role:"status","aria-live":"polite",style:{padding:"10px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[s("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),$,s("button",{onClick:()=>{F(""),h("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),o&&s("div",{role:"status",style:{margin:"0 14px 10px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:"8px",fontSize:"12px",color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:o.fixed>0?`\u2713 ${o.fixed} fixes \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms \xB7 Score: ${o.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${o.scanned} nodes \xB7 ${o.renderTime}ms`}),k("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:x?"sticky":"relative",bottom:x?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[s("button",{onClick:g,style:{flex:1,padding:x?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),s("button",{onClick:d,style:{flex:2,padding:x?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});tt.displayName="WidgetPanel";import{useState as xe,useCallback as qt}from"react";var Bo={hotel:["hotel","resort","motel","inn","accommodation","lodge","stay","room","booking","hospitality"],ecommerce:["shop","store","ecommerce","e-commerce","sell","product","cart","buy","marketplace","retail"],restaurant:["restaurant","food","cafe","cafeteria","menu","dining","eat","cuisine","bistro","takeaway","delivery"],portfolio:["portfolio","freelance","personal","designer","developer","creative","showcase","work","hire me"],blog:["blog","article","post","write","news","magazine","journal","content"],saas:["saas","dashboard","app","software","platform","tool","analytics","admin","manage","crm"],government:["government","govt","portal","citizen","scheme","welfare","municipal","public","official"],healthcare:["hospital","clinic","doctor","health","medical","patient","appointment","pharmacy"],education:["school","college","university","course","learn","education","student","lms","training"],realestate:["real estate","property","house","flat","apartment","rent","buy property","listing"],landing:["landing","startup","launch","product launch","coming soon","waitlist"],generic:[]},Wo={hotel:["home","rooms","booking","about","contact"],ecommerce:["home","products","cart","checkout","about","contact"],restaurant:["home","menu","reservations","about","contact"],portfolio:["home","portfolio","about","contact"],blog:["home","blog","about","contact"],saas:["home","pricing","dashboard","auth","about","contact"],government:["home","services","about","contact","faq"],healthcare:["home","services","booking","team","about","contact"],education:["home","services","pricing","about","contact"],realestate:["home","products","about","contact"],landing:["home","pricing","about","contact"],generic:["home","about","services","contact"]},Ho={home:["home","homepage","main","landing"],about:["about","who we are","our story","company"],contact:["contact","reach us","get in touch","location"],services:["service","what we offer","solution","offering"],pricing:["pricing","price","plan","subscription","cost","fee"],blog:["blog","article","news","post"],auth:["login","register","signup","sign up","sign in","auth","account"],dashboard:["dashboard","admin","panel","manage","analytics"],gallery:["gallery","photo","image","portfolio"],products:["product","shop","store","item","catalogue"],cart:["cart","basket","shopping cart"],checkout:["checkout","payment","pay","order"],rooms:["room","suite","accommodation","stay"],booking:["booking","reserve","reservation","schedule","appointment"],menu:["menu","food","dish","cuisine"],reservations:["reservation","table booking","book table"],portfolio:["portfolio","work","project","case study"],team:["team","staff","member","people","who we are"],faq:["faq","question","answer","help","support"],terms:["terms","condition","legal"],privacy:["privacy","policy","gdpr","data"]},Do={Authentication:["login","register","auth","signup","sign in","account"],Payment:["payment","stripe","pay","checkout","billing"],Search:["search","filter","find"],"Dark mode":["dark mode","dark theme","night mode"],"Multi-language":["multilingual","multi language","translation","i18n"],SEO:["seo","search engine","meta","google"],Analytics:["analytics","tracking","stats","dashboard"],Email:["email","newsletter","contact form","notification"],Map:["map","location","address","google maps"],"Social media":["social","instagram","facebook","twitter","share"],"Image gallery":["gallery","photo","image","carousel"],"Booking system":["booking","reservation","appointment","schedule"],"Shopping cart":["cart","basket","shop","ecommerce"],"Blog/CMS":["blog","cms","content","article","post"]},$o={blue:["blue","navy","sky","ocean","corporate"],green:["green","nature","eco","environment","health","fresh"],purple:["purple","violet","luxury","creative","royal"],red:["red","bold","energy","passion","food"],orange:["orange","warm","friendly","fun"],teal:["teal","turquoise","modern","tech"],indigo:["indigo","professional","trust","finance","bank"],gray:["gray","minimal","clean","simple","neutral"]},Go={hotel:"indigo",ecommerce:"blue",restaurant:"red",portfolio:"purple",blog:"gray",saas:"teal",government:"blue",healthcare:"green",education:"indigo",realestate:"orange",landing:"purple",generic:"blue"};function No(e){let t=[/(?:for|called|named|company|business|brand)\s+["']?([A-Z][a-zA-Z\s]{1,30})["']?/i,/["']([A-Z][a-zA-Z\s]{1,30})["']/,/^([A-Z][a-zA-Z]+(?:\s[A-Z][a-zA-Z]+)?)/m];for(let o of t){let r=e.match(o);if(r?.[1]){let a=r[1].trim();if(a.length>2&&a.length<40)return a}}return"My Business"}function Oo(e){let t=e.toLowerCase(),o="generic",r=0;for(let[a,i]of Object.entries(Bo)){let n=0;for(let d of i)t.includes(d)&&n++;n>r&&(r=n,o=a)}return o}function qo(e,t){let o=e.toLowerCase(),r=new Set(Wo[t]);for(let[a,i]of Object.entries(Ho))for(let n of i)if(o.includes(n)){r.add(a);break}return r.add("home"),r.add("contact"),Array.from(r)}function _o(e){let t=e.toLowerCase(),o=[];for(let[r,a]of Object.entries(Do))for(let i of a)if(t.includes(i)){o.push(r);break}return o}function Vo(e,t){let o=e.toLowerCase();for(let[r,a]of Object.entries($o))for(let i of a)if(o.includes(i))return r;return Go[t]}function Ot(e){let t=Oo(e),o=qo(e,t),r=_o(e),a=Vo(e,t);return{siteName:No(e),websiteType:t,pages:o,features:r,theme:a,description:e.slice(0,200)}}import{Fragment as Ko,jsx as y,jsxs as I}from"react/jsx-runtime";var jo=["Hotel booking website for Grand Palace Hotels with rooms, booking and payment","E-commerce store for organic food products with cart and checkout","Restaurant website for Spice Garden with menu and table reservations","Portfolio website for a freelance designer with gallery and contact","SaaS dashboard for project management with pricing and auth","Government portal for citizen services with FAQ and contact"],Yo={home:"\u{1F3E0}",about:"\u2139\uFE0F",contact:"\u{1F4EC}",services:"\u2699\uFE0F",pricing:"\u{1F4B0}",blog:"\u{1F4DD}",auth:"\u{1F510}",dashboard:"\u{1F4CA}",gallery:"\u{1F5BC}\uFE0F",products:"\u{1F6D2}",cart:"\u{1F6CD}\uFE0F",checkout:"\u{1F4B3}",rooms:"\u{1F6CF}\uFE0F",booking:"\u{1F4C5}",menu:"\u{1F37D}\uFE0F",reservations:"\u{1FA91}",portfolio:"\u{1F4BC}",team:"\u{1F465}",faq:"\u2753",terms:"\u{1F4C4}",privacy:"\u{1F512}"},Uo={hotel:"\u{1F3E8}",ecommerce:"\u{1F6D2}",restaurant:"\u{1F37D}\uFE0F",portfolio:"\u{1F4BC}",blog:"\u{1F4DD}",saas:"\u26A1",government:"\u{1F3DB}\uFE0F",healthcare:"\u{1F3E5}",education:"\u{1F393}",realestate:"\u{1F3E0}",landing:"\u{1F680}",generic:"\u{1F310}"};function ot({position:e,onClose:t}){let[o,r]=xe("input"),[a,i]=xe(""),[n,d]=xe(null),[g,u]=xe(0),[A,x]=xe(""),ne=qt(()=>{if(!a.trim())return;let h=Ot(a);d(h),r("preview")},[a]),j=qt(async()=>{if(n){r("generating"),u(0),x("");try{let h=[{msg:"Parsing requirement...",pct:15},{msg:"Loading templates...",pct:30},{msg:"Generating pages...",pct:55},{msg:"Building components...",pct:70},{msg:"Creating styles...",pct:85},{msg:"Packaging ZIP...",pct:95}];for(let F of h)u(F.pct),await new Promise(S=>setTimeout(S,200));let{generateZip:$}=await import("./zip-generator-D5EXBBNS.mjs");await $(n),u(100),r("done")}catch(h){x(h instanceof Error?h.message:"Generation failed. Please try again."),r("preview")}}},[n]),K=()=>{r("input"),i(""),d(null),u(0),x("")},D={position:"fixed",bottom:"204px",[e]:"24px",zIndex:9999,width:"340px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.14)",fontFamily:"system-ui,-apple-system,sans-serif",maxHeight:"75vh",overflowY:"auto"};return I("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:D,children:[I("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between",position:"sticky",top:0,background:"#fff",zIndex:1},children:[I("div",{children:[y("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),y("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),y("button",{onClick:t,"aria-label":"Close vibe coder",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",padding:"2px"},children:"\xD7"})]}),o==="input"&&I("div",{style:{padding:"14px 16px"},children:[y("p",{style:{margin:"0 0 10px",fontSize:"11px",color:"#64748b"},children:"Describe your business website in plain English. The plugin will generate a complete Next.js project for you."}),y("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),y("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:jo.slice(0,3).map(h=>y("button",{onClick:()=>i(h),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:h},h))}),y("textarea",{value:a,onChange:h=>i(h.target.value),placeholder:"e.g. I need a hotel booking website with rooms, search, and payment for Grand Palace Hotels",rows:4,"aria-label":"Describe your website",style:{width:"100%",padding:"10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5}}),y("button",{onClick:ne,disabled:!a.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:a.trim()?"#f59e0b":"#e2e8f0",color:a.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:a.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),o==="preview"&&n&&I("div",{style:{padding:"14px 16px"},children:[A&&I("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",A]}),I("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[I("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[y("span",{style:{fontSize:"1.5rem"},children:Uo[n.websiteType]||"\u{1F310}"}),I("div",{children:[y("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:n.siteName}),I("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[n.websiteType," website \xB7 ",n.theme," theme"]})]})]}),I("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",n.pages.length,")"]}),y("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.pages.map(h=>I("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[Yo[h]||"\u{1F4C4}"," ",h]},h))}),n.features.length>0&&I(Ko,{children:[y("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),y("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:n.features.map(h=>y("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:h},h))})]})]}),I("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[y("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),I("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",y("br",{}),"\u2705 Tailwind CSS + CSS Modules",y("br",{}),"\u2705 TypeScript configured",y("br",{}),"\u2705 Navbar + Footer components",y("br",{}),"\u2705 All ",n.pages.length," pages ready",y("br",{}),"\u2705 Mobile responsive",y("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),I("div",{style:{display:"flex",gap:"8px"},children:[y("button",{onClick:K,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"\u2190 Edit"}),y("button",{onClick:j,style:{flex:2,padding:"9px",borderRadius:"8px",border:"none",background:"#f59e0b",color:"#fff",fontSize:"13px",fontWeight:700,cursor:"pointer"},children:"\u2B07\uFE0F Generate & Download ZIP"})]})]}),o==="generating"&&I("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[y("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),y("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),y("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem"},children:g<30?"Parsing requirement...":g<55?"Loading templates...":g<70?"Generating pages...":g<85?"Building components...":g<95?"Creating styles...":"Packaging ZIP..."}),y("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:y("div",{style:{height:"100%",width:`${g}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),I("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[g,"%"]})]}),o==="done"&&n&&I("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[y("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),I("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[n.siteName," downloaded!"]}),y("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem",lineHeight:1.6},children:"Your ZIP is downloading. Unzip it and run:"}),["npm install","npm run dev"].map(h=>y("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:I("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",h]})},h)),y("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),I("div",{style:{display:"flex",gap:"8px"},children:[y("button",{onClick:K,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"New Project"}),y("button",{onClick:j,style:{flex:1,padding:"9px",borderRadius:"8px",border:"none",background:"#f59e0b",color:"#fff",fontSize:"12px",fontWeight:700,cursor:"pointer"},children:"\u2B07\uFE0F Download Again"})]})]})]})}import{Fragment as Xo,jsx as T,jsxs as oe}from"react/jsx-runtime";async function Qo(){try{if(typeof window>"u")return!1;let e=window;if(e.LanguageModel)try{if(typeof e.LanguageModel.availability=="function"){let o=await e.LanguageModel.availability();if(o==="readily"||o==="available"||o==="downloadable")return!0}else return!0}catch{}if(e.Summarizer)try{let o=await e.Summarizer.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}if(e.Rewriter)try{let o=await e.Rewriter.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}if(e.Writer)try{let o=await e.Writer.availability?.();if(!o||o==="readily"||o==="available")return!0}catch{}let t=e.ai||globalThis.ai;if(t){if(t.languageModel?.availability)try{let o=await t.languageModel.availability();if(o==="readily"||o==="available")return!0}catch{}if(t.languageModel&&typeof t.languageModel.create=="function"||t.summarizer||t.rewriter||t.writer||t.languageModel)return!0}return!!(e.Translator||e.translation?.canTranslate)}catch{return!1}}function nt({position:e="left",children:t,config:o={},showRag:r=!1,showAgent:a=!1}){let[i,n]=H(!1),[d,g]=H(et),[u,A]=H(null),[x,ne]=H(!1),[j,K]=H(!1),[D,h]=H(!1),$=Zo.useRef(null),[F,S]=H(!1),[G,m]=H(""),[R,L]=H(""),[W,v]=H(!1),[w,Z]=H(null),[ee,l]=H("idle"),[Q,f]=H(!1),[Y,re]=H(""),[Oe,le]=H(""),[p,z]=H(!1),[N,q]=H([]),[M,lt]=H(null),eo=24,dt=84,ct=r?144:84,un=204,[ve,qe]=H(!1);ge(()=>{if(typeof window>"u")return;let c=window;!!(c.LanguageModel||c.ai?.languageModel)&&j?(Z("gemini"),lt("gemini")):Ae()&&(Z("transformers"),lt("transformers"))},[j]),ge(()=>{if(w!=="transformers")return;let c=setInterval(()=>l(Ce()),500);return()=>clearInterval(c)},[w]);let pt=me(async()=>{if(!(!G.trim()||W)){if(!w){L("\u26A0\uFE0F No AI engine available.");return}v(!0),L("");try{let c;if(w==="gemini"){let{askPage:P}=await import("./rag-MKBAGH6J.mjs");c=await P(G)}else{l("loading");let{askPageWithTransformers:P}=await import("./transformers-rag-HW4QKA5T.mjs");c=await P(G),l("ready")}L(c.success&&c.answer?c.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(c.error||"No answer found."))}catch{L("\u26A0\uFE0F Something went wrong.")}v(!1)}},[G,W,w]),ut=me(async()=>{if(!Y.trim()||p)return;if(!M){le("\u26A0\uFE0F No AI engine available.");return}z(!0),q([]),le("");let{runAgent:c}=await import("./agent-JGLAYQMX.mjs");await c(Y,M,P=>{q(ae=>[...ae,P.text])}),z(!1),le("done")},[Y,p,M]);ge(()=>{if(typeof window>"u")return;let P=setTimeout(async()=>{let ae=window,ao=await Qo();K(ao),h(!!(ae.SpeechRecognition||ae.webkitSpeechRecognition))},800);return()=>clearTimeout(P)},[]),ge(()=>{if(!(typeof window>"u"))try{let c=localStorage.getItem("yuktai-a11y-prefs");c&&g(P=>({...P,...JSON.parse(c)}))}catch{}},[]);let ft=me(async c=>{let P={enabled:!0,highContrast:c.highContrast,darkMode:c.darkMode,reduceMotion:c.reduceMotion,largeTargets:c.largeTargets,speechEnabled:c.speechEnabled,autoFix:c.autoFix,dyslexiaFont:c.dyslexiaFont,localFont:c.localFont,fontSizeMultiplier:c.fontScale/100,colorBlindMode:c.colorBlindMode,showAuditBadge:c.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:c.plainEnglish,summarisePage:c.summarisePage,translateLanguage:c.translateLanguage,voiceControl:c.voiceControl,smartLabels:c.smartLabels,...o};await J.execute(P),A(J.applyFixes(P)),ne(!0)},[o]),to=me(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(d))}catch{}await ft(d),n(!1)},[d,ft]),oo=me(()=>{g(et);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let c=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(P=>c.removeAttribute(P)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",A(null),ne(!1)},[]),no=me((c,P)=>{g(ae=>({...ae,[c]:P}))},[]);ge(()=>{let c=P=>{P.key==="Escape"&&(i&&n(!1),F&&S(!1),Q&&f(!1),ve&&qe(!1))};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i,F,Q]),ge(()=>{i&&$.current&&J.trapFocus($.current)},[i]);let we=(c,P,ae)=>({position:"fixed",bottom:`${c}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:P,color:"#fff",border:"none",cursor:"pointer",fontSize:"22px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s, background 0.2s"}),ke=c=>{c.currentTarget.style.transform="scale(1.08)"},Se=c=>{c.currentTarget.style.transform="scale(1)"},gt=w==="gemini"?"Gemini Nano \xB7 On device":w==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",ro=w==="transformers"&&ee==="loading"?"Loading model...":"...";return oe(Xo,{children:[t,a&&T("button",{style:we(204,ve?"#d97706":"#f59e0b",ve),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{qe(c=>!c),f(!1),S(!1),n(!1)},onMouseEnter:ke,onMouseLeave:Se,children:"\u26A1"}),a&&ve&&T(ot,{position:e,onClose:()=>qe(!1)}),a&&T("button",{style:we(ct,Q?"#059669":"#10b981",Q),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":Q,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{f(c=>!c),S(!1),n(!1)},onMouseEnter:ke,onMouseLeave:Se,children:"\u{1F916}"}),a&&Q&&oe("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${ct+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px",maxHeight:"70vh",overflowY:"auto"},children:[oe("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[oe("div",{children:[T("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),T("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:M==="gemini"?"Gemini Nano \xB7 On device":M==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),T("button",{onClick:()=>f(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),T("p",{style:{margin:"0 0 8px",fontSize:"11px",color:"#64748b"},children:"Tell me what you want to do on this page. I will guide you step by step."}),T("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:["Fill this form","Find contact info","What is this page?","Guide me to apply"].map(c=>T("button",{onClick:()=>re(c),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:c},c))}),oe("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[T("input",{type:"text",value:Y,onChange:c=>re(c.target.value),onKeyDown:c=>{c.key==="Enter"&&ut()},placeholder:"e.g. Help me fill this form",disabled:p||!M,"aria-label":"Tell the agent what to do",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:M?"#fff":"#f8fafc",outline:"none",height:"36px"}}),T("button",{onClick:ut,disabled:p||!Y.trim()||!M,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:M&&Y.trim()&&!p?"#10b981":"#e2e8f0",color:M&&Y.trim()&&!p?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:M&&Y.trim()&&!p?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:p?"...":"Go"})]}),N.length>0&&oe("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[N.map((c,P)=>T("p",{style:{margin:"0 0 2px"},children:c},P)),Oe==="done"&&T("button",{onClick:()=>{q([]),re(""),le("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!M&&T("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),r&&T("button",{style:we(dt,F?"#7c3aed":"#6d28d9",F),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":F,title:`\u{1F4AC} Ask this page \xB7 ${gt}`,onClick:()=>{S(c=>!c),n(!1),f(!1)},onMouseEnter:ke,onMouseLeave:Se,children:"\u{1F4AC}"}),r&&F&&oe("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${dt+64}px`,[e]:"24px",zIndex:9999,width:"300px",maxWidth:"calc(100vw - 48px)",background:"#fff",border:"1px solid #e2e8f0",borderRadius:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)",fontFamily:"system-ui,-apple-system,sans-serif",padding:"14px"},children:[oe("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[oe("div",{children:[T("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),T("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:gt}),w==="transformers"&&ee==="loading"&&T("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),w==="transformers"&&ee==="ready"&&T("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),T("button",{onClick:()=>S(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),oe("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[T("input",{type:"text",value:G,onChange:c=>m(c.target.value),onKeyDown:c=>{c.key==="Enter"&&pt()},placeholder:"e.g. What does this page do?",disabled:W||!w,"aria-label":"Ask a question about this page",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",fontSize:"12px",color:"#0f172a",background:w?"#fff":"#f8fafc",outline:"none",height:"36px"}}),T("button",{onClick:pt,disabled:W||!G.trim()||!w,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:w&&G.trim()&&!W?"#7c3aed":"#e2e8f0",color:w&&G.trim()&&!W?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:w&&G.trim()&&!W?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:W?ro:"Ask"})]}),R&&oe("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[T("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),R,T("button",{onClick:()=>{L(""),m("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!w&&T("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),T("button",{style:we(eo,x?"#0d9488":"#1a73e8",i),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":i,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{n(c=>!c),S(!1),f(!1)},onMouseEnter:ke,onMouseLeave:Se,children:"\u267F"}),i&&T(tt,{ref:$,position:e,settings:d,report:u,isActive:x,aiSupported:j,voiceSupported:D,set:no,onApply:to,onReset:oo,onClose:()=>n(!1)})]})}var Be={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};var We={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};var se=class{plugins=new Map;register(t,o){if(!o||typeof o.execute!="function")throw new Error(`Invalid plugin: ${t}`);this.plugins.set(t,o)}use(t){return this.plugins.get(t)}async run(t,o){try{let r=this.use(t);if(!r)throw new Error(`Plugin not found: ${t}`);return await r.execute(o)}catch(r){throw console.error(`[YuktAI Runtime Error in ${t}]:`,r),r}}getPlugins(){return Array.from(this.plugins.keys())}};import{useState as an,useCallback as st}from"react";import{useState as he,useMemo as rt,useCallback as at,useEffect as _t}from"react";function Jo(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function it(e){let{data:t,columns:o,pagination:r=!0,mobileBreakpoint:a=768}=e,[i,n]=he(null),[d,g]=he(""),[u,A]=he(1),[x,ne]=he(Jo(r)),[j,K]=he(!1);_t(()=>{if(typeof window>"u")return;let R=()=>{K(window.innerWidth<a)};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[a]);let D=at(R=>{n(L=>!L||L.key!==R?{key:R,direction:"asc"}:L.direction==="asc"?{key:R,direction:"desc"}:null),A(1)},[]),h=at(()=>n(null),[]),$=rt(()=>{if(!d.trim())return t;let R=d.toLowerCase().trim();return t.filter(L=>o.some(W=>{let v=L[W.key];return v==null?!1:String(v).toLowerCase().includes(R)}))},[t,d,o]),F=rt(()=>{if(!i)return $;let R=[...$].sort((L,W)=>{let v=L[i.key],w=W[i.key];if(v===w)return 0;if(v==null)return 1;if(w==null)return-1;if(typeof v=="number"&&typeof w=="number")return v-w;if(v instanceof Date&&w instanceof Date)return v.getTime()-w.getTime();let Z=String(v),ee=String(w);return Z.localeCompare(ee,void 0,{sensitivity:"base",numeric:!0})});return i.direction==="desc"?R.reverse():R},[$,i]),S=Math.max(1,Math.ceil(F.length/x)),G=rt(()=>{if(r===!1)return F;let R=(u-1)*x;return F.slice(R,R+x)},[F,u,x,r]),m=at(()=>{n(null),g(""),A(1)},[]);return _t(()=>{u>S&&A(S)},[u,S]),{displayedData:G,totalCount:t.length,filteredCount:F.length,sort:i,toggleSort:D,clearSort:h,searchQuery:d,setSearchQuery:g,page:u,pageSize:x,totalPages:S,setPage:A,setPageSize:ne,isMobile:j,reset:m}}import{jsx as en}from"react/jsx-runtime";function _({size:e=20,color:t="currentColor",strokeWidth:o=2.5,label:r,children:a,...i}){return en("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!r?"true":void 0,"aria-label":r,role:r?"img":void 0,focusable:"false",...i,children:a})}import{jsx as Vt,jsxs as tn}from"react/jsx-runtime";function He(e){return tn(_,{...e,children:[Vt("circle",{cx:"11",cy:"11",r:"7"}),Vt("path",{d:"m20 20-4-4"})]})}import{jsx as jt,jsxs as on}from"react/jsx-runtime";function De(e){return on(_,{...e,children:[jt("path",{d:"M12 19V5"}),jt("path",{d:"m5 12 7-7 7 7"})]})}import{jsx as Yt,jsxs as nn}from"react/jsx-runtime";function $e(e){return nn(_,{...e,children:[Yt("path",{d:"M12 5v14"}),Yt("path",{d:"m5 12 7 7 7-7"})]})}import{jsx as Ut}from"react/jsx-runtime";function Ge(e){return Ut(_,{...e,children:Ut("path",{d:"m15 18-6-6 6-6"})})}import{jsx as Kt}from"react/jsx-runtime";function Ne(e){return Kt(_,{...e,children:Kt("path",{d:"m9 18 6-6-6-6"})})}import{jsx as Zt,jsxs as rn}from"react/jsx-runtime";function be(e){return rn(_,{...e,children:[Zt("path",{d:"M18 6 6 18"}),Zt("path",{d:"m6 6 12 12"})]})}import{Fragment as cn,jsx as b,jsxs as O}from"react/jsx-runtime";var sn={default:{container:{background:"#FFFFFF",color:"#0F172A",fontFamily:"system-ui, -apple-system, sans-serif"},header:{background:"#F8FAFC",color:"#475569",borderBottom:"1px solid #E2E8F0"},row:{borderBottom:"1px solid #F1F5F9"},rowHover:{background:"#F8FAFC"},cell:{color:"#0F172A"},button:{background:"#FFFFFF",color:"#0F172A"},pageBtn:{background:"#FFFFFF",color:"#475569",border:"1px solid #E2E8F0"},pageBtnActive:{background:"#0D9488",color:"#FFFFFF",border:"1px solid #0D9488"},border:"#E2E8F0",accent:"#0D9488",muted:"#94A3B8"},"high-contrast":{container:{background:"#000000",color:"#FFFFFF",fontFamily:"system-ui, sans-serif",fontWeight:600},header:{background:"#000000",color:"#FFFF00",borderBottom:"2px solid #FFFFFF",fontWeight:700},row:{borderBottom:"1px solid #FFFFFF"},rowHover:{background:"#1A1A1A"},cell:{color:"#FFFFFF"},button:{background:"#000000",color:"#FFFFFF"},pageBtn:{background:"#000000",color:"#FFFFFF",border:"2px solid #FFFFFF"},pageBtnActive:{background:"#FFFF00",color:"#000000",border:"2px solid #FFFF00"},border:"#FFFFFF",accent:"#FFFF00",muted:"#CCCCCC"},dark:{container:{background:"#0F172A",color:"#F1F5F9",fontFamily:"system-ui, sans-serif"},header:{background:"#1E293B",color:"#94A3B8",borderBottom:"1px solid #334155"},row:{borderBottom:"1px solid #1E293B"},rowHover:{background:"#1E293B"},cell:{color:"#F1F5F9"},button:{background:"#1E293B",color:"#F1F5F9"},pageBtn:{background:"#1E293B",color:"#94A3B8",border:"1px solid #334155"},pageBtnActive:{background:"#14B8A6",color:"#0F172A",border:"1px solid #14B8A6"},border:"#334155",accent:"#14B8A6",muted:"#64748B"},"color-blind":{container:{background:"#FFFFFF",color:"#0F172A",fontFamily:"system-ui, sans-serif"},header:{background:"#F8FAFC",color:"#475569",borderBottom:"1px solid #E2E8F0"},row:{borderBottom:"1px solid #F1F5F9"},rowHover:{background:"#F8FAFC"},cell:{color:"#0F172A"},button:{background:"#FFFFFF",color:"#0F172A"},pageBtn:{background:"#FFFFFF",color:"#475569",border:"1px solid #E2E8F0"},pageBtnActive:{background:"#1F2937",color:"#FFFFFF",border:"1px solid #1F2937"},border:"#E2E8F0",accent:"#1F2937",muted:"#94A3B8"},dyslexia:{container:{background:"#FDF6E3",color:"#3D3424",fontFamily:"'Atkinson Hyperlegible', system-ui, sans-serif",letterSpacing:"0.3px",lineHeight:1.7},header:{background:"#FAF0D7",color:"#5C4F37",borderBottom:"1px solid #D7CFB8",letterSpacing:"0.5px"},row:{borderBottom:"1px solid #ECE0C2"},rowHover:{background:"#FAF0D7"},cell:{color:"#3D3424"},button:{background:"#FDF6E3",color:"#3D3424"},pageBtn:{background:"#FDF6E3",color:"#5C4F37",border:"1px solid #D7CFB8"},pageBtnActive:{background:"#92400E",color:"#FDF6E3",border:"1px solid #92400E"},border:"#D7CFB8",accent:"#92400E",muted:"#8B7960"}},U={search:"Search...",clearSearch:"Clear search",noData:"No data to display",noResults:"No matching results",tryAgain:"Try a different search term",loading:"Loading...",rowsSelected:"rows selected",page:"Page",of:"of",showing:"Showing",to:"to",results:"results",first:"First page",last:"Last page",prev:"Previous page",next:"Next page"};function ln(e,t){return t<=7?Array.from({length:t},(o,r)=>r+1):e<=4?[1,2,3,4,5,"...",t]:e>=t-3?[1,"...",t-4,t-3,t-2,t-1,t]:[1,"...",e-1,e,e+1,"...",t]}function dn(e){let{data:t,columns:o,view:r="auto",mobileBreakpoint:a=768,theme:i="default",pagination:n=!0,search:d=!0,selectable:g=!1,selectedKeys:u=[],rowKey:A,loading:x=!1,empty:ne,onSelectionChange:j,onRowClick:K,onSortChange:D,className:h}=e,[$,F]=an(u),{displayedData:S,filteredCount:G,sort:m,toggleSort:R,searchQuery:L,setSearchQuery:W,page:v,pageSize:w,totalPages:Z,setPage:ee,isMobile:l}=it({data:t,columns:o,pagination:n,mobileBreakpoint:a}),Q=r==="card"||r==="auto"&&l,f=sn[i],Y=o.filter(p=>!(l&&p.hiddenOnMobile)),re=st((p,z)=>A&&p[A]!==void 0?String(p[A]):p.id!==void 0?String(p.id):String(z),[A]),Oe=st(p=>{R(p),D?.(m)},[R,D,m]),le=st(p=>{F(z=>{let N=z.includes(p)?z.filter(q=>q!==p):[...z,p];return j?.(N),N})},[j]);return x?O("div",{role:"status","aria-live":"polite",style:{...f.container,padding:"3rem 2rem",textAlign:"center",borderRadius:8,border:`1px solid ${f.border}`},children:[b("div",{style:{display:"inline-block",width:32,height:32,border:`3px solid ${f.border}`,borderTopColor:f.accent,borderRadius:"50%",animation:"yuktai-spin 0.8s linear infinite",marginBottom:12}}),b("style",{children:"@keyframes yuktai-spin { to { transform: rotate(360deg); } }"}),b("div",{children:U.loading})]}):t.length===0?b("div",{role:"status",style:{...f.container,padding:"3rem 2rem",textAlign:"center",borderRadius:8,border:`1px solid ${f.border}`},children:ne??O(cn,{children:[b(be,{size:40,color:f.muted}),b("div",{style:{marginTop:8,fontSize:16,fontWeight:500},children:U.noData})]})}):O("div",{className:h,style:{...f.container,borderRadius:8,border:`1px solid ${f.border}`,overflow:"hidden"},"data-yuktai-grid":!0,"data-theme":i,children:[d&&O("div",{style:{...f.header,padding:"12px 16px",display:"flex",gap:12,alignItems:"center"},children:[O("div",{style:{flex:1,position:"relative",display:"flex",alignItems:"center"},children:[b("div",{style:{position:"absolute",left:12,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",color:f.muted},children:b(He,{size:18})}),b("input",{type:"search",value:L,onChange:p=>W(p.target.value),placeholder:U.search,"aria-label":U.search,style:{flex:1,width:"100%",padding:"10px 12px 10px 40px",fontSize:14,border:`1px solid ${f.border}`,borderRadius:8,background:"transparent",color:"inherit",minHeight:44,outline:"none",transition:"border-color 0.15s"},onFocus:p=>p.currentTarget.style.borderColor=f.accent,onBlur:p=>p.currentTarget.style.borderColor=f.border}),L&&b("button",{onClick:()=>W(""),"aria-label":U.clearSearch,style:{position:"absolute",right:8,background:"transparent",border:"none",cursor:"pointer",padding:4,display:"flex",alignItems:"center",color:f.muted,borderRadius:4},children:b(be,{size:16})})]}),g&&$.length>0&&O("span",{style:{fontSize:13,color:"inherit",whiteSpace:"nowrap"},children:[$.length," ",U.rowsSelected]})]}),S.length===0&&L?O("div",{style:{padding:"3rem 2rem",textAlign:"center",background:"transparent"},children:[b(be,{size:40,color:f.muted}),b("div",{style:{marginTop:8,fontSize:16,fontWeight:500},children:U.noResults}),b("div",{style:{marginTop:4,fontSize:13,color:f.muted},children:U.tryAgain}),b("button",{onClick:()=>W(""),style:{marginTop:16,padding:"8px 16px",background:f.accent,color:"#FFFFFF",border:"none",borderRadius:6,cursor:"pointer",fontSize:13,fontWeight:500},children:U.clearSearch})]}):Q?b("div",{role:"list",style:{padding:8},children:S.map((p,z)=>{let N=re(p,z);return b("div",{role:"listitem",onClick:()=>K?.(p,z),style:{padding:12,marginBottom:8,border:`1px solid ${f.border}`,borderRadius:8,background:"transparent",cursor:K?"pointer":"default",minHeight:44},tabIndex:0,children:Y.map(q=>O("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:13},children:[O("span",{style:{fontWeight:500,opacity:.7},children:[q.label,":"]}),b("span",{style:f.cell,children:q.render?q.render(p[q.key],p,z):String(p[q.key]??"")})]},q.key))},N)})}):b("div",{style:{overflowX:"auto"},children:O("table",{role:"grid",style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[b("thead",{children:O("tr",{role:"row",children:[g&&b("th",{style:{...f.header,padding:"10px 14px",width:44},children:b("input",{type:"checkbox","aria-label":"Select all",checked:$.length===S.length&&S.length>0,onChange:p=>{p.target.checked?F(S.map((z,N)=>re(z,N))):F([])},style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),Y.map(p=>b("th",{role:"columnheader","aria-sort":m?.key===p.key?m.direction==="asc"?"ascending":"descending":"none",onClick:()=>p.sortable!==!1&&Oe(p.key),style:{...f.header,padding:"10px 14px",textAlign:p.align??"left",cursor:p.sortable!==!1?"pointer":"default",userSelect:"none",width:p.width,fontWeight:500,fontSize:12,textTransform:"uppercase",letterSpacing:"0.5px"},children:O("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[p.label,m?.key===p.key&&(m.direction==="asc"?b(De,{size:14}):b($e,{size:14}))]})},p.key))]})}),b("tbody",{children:S.map((p,z)=>{let N=re(p,z),q=$.includes(N);return O("tr",{role:"row","aria-selected":q,onClick:()=>K?.(p,z),style:{...f.row,cursor:K?"pointer":"default",background:q?f.rowHover.background:"transparent"},children:[g&&b("td",{style:{padding:"10px 14px"},children:b("input",{type:"checkbox","aria-label":`Select row ${z+1}`,checked:q,onChange:()=>le(N),onClick:M=>M.stopPropagation(),style:{minWidth:20,minHeight:20,cursor:"pointer"}})}),Y.map(M=>b("td",{role:"gridcell",style:{...f.cell,padding:"12px 14px",textAlign:M.align??"left"},children:M.render?M.render(p[M.key],p,z):String(p[M.key]??"")},M.key))]},N)})})]})}),n!==!1&&Z>1&&S.length>0&&O("div",{style:{...f.header,padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${f.border}`,borderBottom:"none",fontSize:13,flexWrap:"wrap",gap:12},children:[O("span",{style:{color:f.muted},children:[U.showing," ",O("strong",{style:{color:"inherit"},children:[(v-1)*w+1,"\u2013",Math.min(v*w,G)]})," ",U.of," ",b("strong",{style:{color:"inherit"},children:G})]}),O("div",{style:{display:"flex",gap:4,alignItems:"center",flexWrap:"wrap"},children:[b("button",{onClick:()=>ee(v-1),disabled:v===1,"aria-label":U.prev,style:{...f.pageBtn,padding:"8px 12px",borderRadius:6,cursor:v===1?"not-allowed":"pointer",opacity:v===1?.4:1,minHeight:36,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},children:b(Ge,{size:16})}),ln(v,Z).map((p,z)=>{if(p==="...")return b("span",{style:{padding:"0 4px",color:f.muted,minWidth:24,textAlign:"center"},children:"\u2026"},`ellipsis-${z}`);let N=p===v;return b("button",{onClick:()=>ee(p),"aria-label":`${U.page} ${p}`,"aria-current":N?"page":void 0,style:{...N?f.pageBtnActive:f.pageBtn,minWidth:36,minHeight:36,padding:"8px 10px",borderRadius:6,cursor:"pointer",fontWeight:N?600:500,fontSize:13,transition:"all 0.15s"},children:p},p)}),b("button",{onClick:()=>ee(v+1),disabled:v===Z,"aria-label":U.next,style:{...f.pageBtn,padding:"8px 12px",borderRadius:6,cursor:v===Z?"not-allowed":"pointer",opacity:v===Z?.4:1,minHeight:36,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},children:b(Ne,{size:16})})]})]})]})}import{jsx as Qt}from"react/jsx-runtime";function Xt(e){return Qt(_,{...e,children:Qt("path",{d:"M5 12.5 10 17.5 19.5 7"})})}function pn(){if(typeof globalThis>"u")return new se;if(!globalThis.__yuktai_runtime__){let e=new se;e.register(J.name,J),e.register(Be.name,Be),e.register(We.name,We),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Jt=typeof window<"u"?pn():new se,ma={wcagPlugin:J,list(){return Jt.getPlugins()},use(e){return Jt.use(e)},fix(e){return J.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return J.scan()}};export{Xt as CheckIcon,Ge as ChevronLeftIcon,Ne as ChevronRightIcon,be as CloseIcon,_ as IconBase,se as Runtime,He as SearchIcon,$e as SortDownIcon,De as SortUpIcon,ma as YuktAI,nt as YuktAIWrapper,dn as YuktaiGrid,Be as aiPlugin,nt as default,it as useGrid,We as voicePlugin,J as wcag,J as wcagPlugin};
|