@yuktishaalaa/yuktai 5.0.0 → 5.0.1
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.d.mts +113 -31
- package/dist/index.d.ts +113 -31
- package/dist/index.js +26 -25
- package/dist/index.mjs +9 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}from"./chunk-XQMQZMAH.mjs";function dn(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function Lt(){try{let e=dn();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 Lo(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=dn();if(!t)throw new Error("Rewriter API not available");let n=await t.create({tone:"more-casual",format:"plain-text",length:"as-is",outputLanguage:"en"}),o=await n.rewrite(e,{context:"Rewrite this text in simple plain English. Use short sentences. Avoid jargon. Make it easy to understand for everyone."});return n.destroy(),{success:!0,original:e,rewritten:o.trim()}}catch(t){return{success:!1,original:e,rewritten:e,error:t instanceof Error?t.message:"Rewrite failed"}}}async function cn(){if(!await Lt())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"),n=0;for(let o of t){let r=o.innerText?.trim();if(!r||r.length<20||o.closest("[data-yuktai-panel]"))continue;let a=await Lo(r);a.success&&a.rewritten!==r&&(o.dataset.yuktaiOriginal=r,o.innerText=a.rewritten,n++)}return{fixed:n}}function un(){let e=document.querySelectorAll("[data-yuktai-original]");for(let t of e){let n=t.dataset.yuktaiOriginal;n&&(t.innerText=n,delete t.dataset.yuktaiOriginal)}}var pn="yuktai-summary-box";function fn(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Pt(){try{let e=fn();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 Po(){let e=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, article, section"),t=[];for(let n of e){if(n.closest("[data-yuktai-panel]"))continue;let o=window.getComputedStyle(n);if(o.display==="none"||o.visibility==="hidden")continue;let r=n.innerText?.trim();r&&r.length>10&&t.push(r)}return t.join(" ").slice(0,5e3)}async function gn(){if(!await Pt())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=Po();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let n=fn();if(!n)throw new Error("Summarizer API not available");let o=await n.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),r=await o.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 o.destroy(),
|
|
1
|
+
import{a as sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}from"./chunk-XQMQZMAH.mjs";function dn(){let e=window;return e.Rewriter||e.ai?.rewriter||null}async function Lt(){try{let e=dn();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 Lo(e){if(!e||e.trim().length<20)return{success:!1,original:e,rewritten:e,error:"Text too short"};try{let t=dn();if(!t)throw new Error("Rewriter API not available");let n=await t.create({tone:"more-casual",format:"plain-text",length:"as-is",outputLanguage:"en"}),o=await n.rewrite(e,{context:"Rewrite this text in simple plain English. Use short sentences. Avoid jargon. Make it easy to understand for everyone."});return n.destroy(),{success:!0,original:e,rewritten:o.trim()}}catch(t){return{success:!1,original:e,rewritten:e,error:t instanceof Error?t.message:"Rewrite failed"}}}async function cn(){if(!await Lt())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"),n=0;for(let o of t){let r=o.innerText?.trim();if(!r||r.length<20||o.closest("[data-yuktai-panel]"))continue;let a=await Lo(r);a.success&&a.rewritten!==r&&(o.dataset.yuktaiOriginal=r,o.innerText=a.rewritten,n++)}return{fixed:n}}function un(){let e=document.querySelectorAll("[data-yuktai-original]");for(let t of e){let n=t.dataset.yuktaiOriginal;n&&(t.innerText=n,delete t.dataset.yuktaiOriginal)}}var pn="yuktai-summary-box";function fn(){let e=window;return e.Summarizer||e.ai?.summarizer||null}async function Pt(){try{let e=fn();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 Po(){let e=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, article, section"),t=[];for(let n of e){if(n.closest("[data-yuktai-panel]"))continue;let o=window.getComputedStyle(n);if(o.display==="none"||o.visibility==="hidden")continue;let r=n.innerText?.trim();r&&r.length>10&&t.push(r)}return t.join(" ").slice(0,5e3)}async function gn(){if(!await Pt())return{success:!1,summary:"",error:"Chrome Built-in AI Summarizer not available. Enable via chrome://flags."};let t=Po();if(!t||t.length<100)return{success:!1,summary:"",error:"Not enough text on this page to summarise."};try{let n=fn();if(!n)throw new Error("Summarizer API not available");let o=await n.create({type:"tl;dr",format:"plain-text",length:"short",outputLanguage:"en"}),r=await o.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 o.destroy(),Mo(r.trim()),{success:!0,summary:r.trim()}}catch(n){return{success:!1,summary:"",error:n instanceof Error?n.message:"Summary failed"}}}function Mo(e){ut();let t=document.createElement("div");t.id=pn,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 sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}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
|
-
`,o.addEventListener("click",ut),t.appendChild(n),t.appendChild(o),document.body.prepend(t)}function ut(){let e=document.getElementById(pn);e&&e.remove()}var ft=[{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"}],pt="en";function
|
|
22
|
+
`,o.addEventListener("click",ut),t.appendChild(n),t.appendChild(o),document.body.prepend(t)}function ut(){let e=document.getElementById(pn);e&&e.remove()}var ft=[{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"}],pt="en";function Fo(){let e=window;return e.Translator||e.translation||null}async function No(e){try{let t=window;if(!Fo())return!1;if(t.Translator&&typeof t.Translator.availability=="function")try{let o=await t.Translator.availability({sourceLanguage:"en",targetLanguage:e});return o==="readily"||o==="available"||o==="downloadable"||o==="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 zo(e){let t=window,n={sourceLanguage:"en",targetLanguage:e};if(t.Translator&&typeof t.Translator.create=="function")return await t.Translator.create(n);if(t.translation&&typeof t.translation.createTranslator=="function")return await t.translation.createTranslator(n);throw new Error("Translation API not available")}async function mn(e){if(e===pt)return{success:!0,language:e,fixed:0};if(e==="en")return Mt(),pt="en",{success:!0,language:"en",fixed:0};if(!await No(e))return{success:!1,language:e,fixed:0,error:`Translation to ${e} not available. Enable via chrome://flags.`};try{let n=await zo(e),o=document.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, label, figcaption, span, a"),r=0;for(let a of o){if(a.closest("[data-yuktai-panel]")||a.children.length>0)continue;let i=a.innerText?.trim();if(!i||i.length<2)continue;a.dataset.yuktaiTranslationOriginal||(a.dataset.yuktaiTranslationOriginal=i);let s=await n.translate(i);s&&s!==i&&(a.innerText=s,r++)}return typeof n.destroy=="function"&&n.destroy(),pt=e,{success:!0,language:e,fixed:r}}catch(n){return{success:!1,language:e,fixed:0,error:n instanceof Error?n.message:"Translation failed"}}}function Mt(){let e=document.querySelectorAll("[data-yuktai-translation-original]");for(let t of e){let n=t.dataset.yuktaiTranslationOriginal;n&&(t.innerText=n,delete t.dataset.yuktaiTranslationOriginal)}pt="en"}var Wo=[{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"}],ye=null,gt=!1,Oe=null;function Ft(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function $o(e){let t=e.toLowerCase().trim();for(let n of Wo)for(let o of n.phrases)if(t.includes(o))return{action:n.action,label:n.label};return null}function Do(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=bn(),n=t.indexOf(document.activeElement),o=t[n+1]||t[0];o&&o.focus();break}case"tab-back":{let t=bn(),n=t.indexOf(document.activeElement),o=t[n-1]||t[t.length-1];o&&o.focus();break}case"stop-voice":{Nt();break}}}function bn(){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 yn(e){if(!Ft())return!1;if(gt)return!0;e&&(Oe=e);let t=window.SpeechRecognition||window.webkitSpeechRecognition;return ye=new t,ye.continuous=!0,ye.interimResults=!1,ye.lang="en-US",ye.onresult=n=>{let o=n.results[n.results.length-1][0].transcript,r=$o(o);if(r){Do(r.action);let a={success:!0,command:o,action:r.label};if(Oe&&Oe(a),r.action==="stop-voice")return}},ye.onend=()=>{gt&&ye?.start()},ye.onerror=n=>{n.error!=="no-speech"&&Oe&&Oe({success:!1,command:"",action:"",error:`Voice error: ${n.error}`})},ye.start(),gt=!0,Oo(),!0}function Nt(){gt=!1,ye&&(ye.stop(),ye=null),Oe=null,xn()}var hn="yuktai-voice-indicator";function Oo(){xn();let e=document.createElement("div");e.id=hn,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 sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}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(o)}let n=document.createElement("span");n.textContent="Listening for commands...",e.appendChild(t),e.appendChild(n),document.body.appendChild(e)}function xn(){let e=document.getElementById(hn);e&&e.remove()}var Bo=["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 wn(){let e=window;return e.Writer||e.ai?.writer||null}async function
|
|
52
|
+
`,document.head.appendChild(o)}let n=document.createElement("span");n.textContent="Listening for commands...",e.appendChild(t),e.appendChild(n),document.body.appendChild(e)}function xn(){let e=document.getElementById(hn);e&&e.remove()}var Bo=["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 wn(){let e=window;return e.Writer||e.ai?.writer||null}async function zt(){try{let e=wn();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 Ho(e){let t=[],n=e.innerText?.trim();n&&t.push(`element text: "${n}"`);let o=e.placeholder?.trim();o&&t.push(`placeholder: "${o}"`);let r=e.getAttribute("name")?.trim();r&&t.push(`name: "${r}"`);let a=e.getAttribute("type")?.trim();a&&t.push(`type: "${a}"`);let i=e.id;if(i){let b=document.querySelector(`label[for="${i}"]`);b&&t.push(`label: "${b.innerText?.trim()}"`)}let s=e.parentElement?.innerText?.trim().slice(0,60);s&&t.push(`parent context: "${s}"`),t.push(`tag: ${e.tagName.toLowerCase()}`);let c=e.getAttribute("role");return c&&t.push(`role: ${c}`),t.join(". ")}async function _o(e,t){let n=`
|
|
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 sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}from"./
|
|
|
60
60
|
${t}
|
|
61
61
|
|
|
62
62
|
Output only the label. Nothing else.
|
|
63
|
-
`.trim();return(await e.write(n)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function kn(){if(!await
|
|
63
|
+
`.trim();return(await e.write(n)).trim().replace(/^["']|["']$/g,"").replace(/\.$/,"").trim()}async function kn(){if(!await zt())return{success:!1,fixed:0,elements:[],error:"Chrome Built-in AI Writer not available. Enable via chrome://flags."};let t=document.querySelectorAll(Bo);if(t.length===0)return{success:!0,fixed:0,elements:[]};try{let n=wn();if(!n)throw new Error("Writer API not available");let o=await n.create({tone:"neutral",format:"plain-text",length:"short",outputLanguage:"en"}),r=0,a=[];for(let i of t){if(i.closest("[data-yuktai-panel]"))continue;let s=window.getComputedStyle(i);if(s.display==="none"||s.visibility==="hidden")continue;let c=Ho(i),b=await _o(o,c);b&&b.length>0&&(i.dataset.yuktaiLabelOriginal=i.getAttribute("aria-label")||"",i.setAttribute("aria-label",b),r++,a.push({tag:i.tagName.toLowerCase(),label:b}))}return o.destroy(),{success:!0,fixed:r,elements:a}}catch(n){return{success:!1,fixed:0,elements:[],error:n instanceof Error?n.message:"Label generation failed"}}}function vn(){let e=document.querySelectorAll("[data-yuktai-label-original]");for(let t of e){let n=t.dataset.yuktaiLabelOriginal;n?t.setAttribute("aria-label",n):t.removeAttribute("aria-label"),delete t.dataset.yuktaiLabelOriginal}}var yt=null,Sn=null;var Tn=null,Wt=null,oe=null,Be=null,mt=null,$t=null,He=null,bt={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"};var An=new Set(["input","select","textarea"]);var Dt={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"};function Ot(e,t="polite"){if(typeof window>"u"||!He?.speechEnabled||!window.speechSynthesis)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(e);n.rate=1,n.pitch=1,n.volume=1;let o=window.speechSynthesis.getVoices();o.length>0&&(n.voice=o[0]),window.speechSynthesis.speak(n)}function Pn(e,t="info"){if(typeof document>"u")return;let o={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];oe||(oe=document.createElement("div"),oe.setAttribute("role","alert"),oe.setAttribute("aria-live","assertive"),oe.setAttribute("aria-atomic","true"),oe.style.cssText=`
|
|
64
64
|
position: fixed;
|
|
65
65
|
top: 80px;
|
|
66
66
|
right: 16px;
|
|
@@ -338,7 +338,7 @@ import{a as sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}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
|
-
`,n.addEventListener("keydown",r=>{r.key==="Escape"&&n.remove()}),document.body.appendChild(n),ht(n)}function
|
|
341
|
+
`,n.addEventListener("keydown",r=>{r.key==="Escape"&&n.remove()}),document.body.appendChild(n),ht(n)}function Mn(e){typeof document>"u"||($t&&clearTimeout($t),$t=setTimeout(()=>{if(mt)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,7 +367,7 @@ import{a as sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}from"./
|
|
|
367
367
|
No, sign out
|
|
368
368
|
</button>
|
|
369
369
|
</div>
|
|
370
|
-
`;let n=t.querySelector("[data-yuktai-extend]"),o=t.querySelector("[data-yuktai-dismiss]");n?.addEventListener("click",()=>{t.remove(),mt=null,Y("Session extended. You have more time.","success"),He?.timeoutWarning&&
|
|
370
|
+
`;let n=t.querySelector("[data-yuktai-extend]"),o=t.querySelector("[data-yuktai-dismiss]");n?.addEventListener("click",()=>{t.remove(),mt=null,Y("Session extended. You have more time.","success"),He?.timeoutWarning&&Mn(He.timeoutWarning)}),o?.addEventListener("click",()=>{t.remove(),mt=null}),document.body.appendChild(t),mt=t,ht(t),Y("Warning: Your session will expire soon. Do you need more time?","warning")},e*1e3))}function Zo(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 n=e.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${bt[e.colorBlindMode]})`;document.body.style.filter=n}else document.body.style.filter=""}function Qo(e){try{let t=localStorage.getItem("yuktai-a11y-prefs");t&&Object.assign(e,JSON.parse(t))}catch{}}async function Cn(e){if(e){if(!await Lt()){Y("Plain English requires Chrome 127+","warning");return}Y("Rewriting page in plain English...","info",!1);let n=await cn();Y(n.error?`Plain English failed: ${n.error}`:`${n.fixed} sections rewritten in plain English`,n.error?"error":"success",!1)}else un(),Y("Original text restored","info",!1)}async function Rn(e){if(e){if(!await Pt()){Y("Page summariser requires Chrome 127+","warning");return}Y("Generating page summary...","info",!1);let n=await gn();Y(n.error?`Summary failed: ${n.error}`:"Page summary added at top",n.error?"error":"success",!1)}else ut(),Y("Page summary removed","info",!1)}async function In(e){if(e==="en"){Mt(),Y("Page restored to English","info",!1);return}Y(`Translating page to ${e}...`,"info",!1);let t=await mn(e);Y(t.error?`Translation failed: ${t.error}`:`Page translated to ${e}`,t.error?"error":"success",!1)}async function En(e){if(e){if(!Ft()){Y("Voice control not supported in this browser","warning");return}yn(t=>{t.success&&Y(`Voice: ${t.action}`,"info",!1)}),Y("Voice control started. Say a command.","success",!1)}else Nt(),Y("Voice control stopped","info",!1)}async function Gn(e){if(e){if(!await zt()){Y("Smart labels requires Chrome 127+","warning");return}Y("Generating smart labels...","info",!1);let n=await kn();Y(n.error?`Smart labels failed: ${n.error}`:`${n.fixed} elements labelled`,n.error?"error":"success",!1)}else vn(),Y("Smart labels removed","info",!1)}function Xo(){if(typeof document>"u"||yt)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),yt=e}function Jo(){if(typeof document>"u"||Sn)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
372
|
<filter id="${bt.deuteranopia}">
|
|
373
373
|
<feColorMatrix type="matrix"
|
|
@@ -382,13 +382,14 @@ import{a as sn}from"./chunk-3VGU4YGK.mjs";import{a as ln,b as dt,c as ct}from"./
|
|
|
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),Sn=e}function Ln(e){let t={critical:20,serious:10,moderate:5,minor:2},n=e.details.reduce((o,r)=>o+(t[r.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var he={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";He=e,Qo(e),Xo(),Jo(),Uo(),jo(),e.showSkipLinks!==!1&&qo(),e.showPreferencePanel,Zo(e);let t=this.applyFixes(e);t.score=Ln(t),e.showAuditBadge&&Yo(t),e.timeoutWarning&&Fn(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Cn(!0),e.summarisePage&&await Rn(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await In(e.translateLanguage),e.voiceControl&&await En(!0),e.smartLabels&&await Gn(!0);let n=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return Y(n,t.score>=90?"success":"info",!1),`yuktai v4.0.0: ${n} 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 n=performance.now(),o=document.querySelectorAll("*");t.scanned=o.length;let r=(a,i,s,c)=>{t.details.push({tag:a,fix:i,severity:s,element:c.outerHTML.slice(0,100)}),t.fixed++};return o.forEach(a=>{let i=a,s=i.tagName.toLowerCase();if(s==="html"&&!i.getAttribute("lang")&&(i.setAttribute("lang","en"),r(s,'lang="en" added',"critical",i)),s==="meta"){let b=i.getAttribute("name"),g=i.getAttribute("content")||"";b==="viewport"&&g.includes("user-scalable=no")&&(i.setAttribute("content",g.replace("user-scalable=no","user-scalable=yes")),r(s,"user-scalable=yes restored","serious",i)),b==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(g)&&(i.setAttribute("content",g.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),r(s,"maximum-scale=5 restored","serious",i))}if(s==="main"&&!i.getAttribute("tabindex")&&(i.setAttribute("tabindex","-1"),i.getAttribute("id")||i.setAttribute("id","main-content")),s==="img"&&(i.hasAttribute("alt")||(i.setAttribute("alt",""),i.setAttribute("aria-hidden","true"),r(s,'alt="" aria-hidden="true"',"serious",i))),s==="svg"&&(!i.getAttribute("aria-hidden")&&!i.getAttribute("aria-label")&&!a.querySelector("title")&&(i.setAttribute("aria-hidden","true"),r(s,'aria-hidden="true" (decorative svg)',"minor",i)),i.getAttribute("focusable")||i.setAttribute("focusable","false")),s==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&(i.setAttribute("title","embedded content"),i.setAttribute("aria-label","embedded content"),r(s,"title + aria-label added","serious",i)),s==="button"){if(!i.innerText?.trim()&&!i.getAttribute("aria-label")){let b=i.getAttribute("title")||"button";i.setAttribute("aria-label",b),r(s,`aria-label="${b}" (empty button)`,"critical",i)}i.hasAttribute("disabled")&&!i.getAttribute("aria-disabled")&&(i.setAttribute("aria-disabled","true"),t.fixed++)}if(s==="a"){let b=i;!i.innerText?.trim()&&!i.getAttribute("aria-label")&&(i.setAttribute("aria-label",i.getAttribute("title")||"link"),r(s,"aria-label added (empty link)","critical",i)),b.target==="_blank"&&!b.rel?.includes("noopener")&&(b.rel="noopener noreferrer",t.fixed++)}if(An.has(s)){let b=i;if(!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")){let g=i.getAttribute("placeholder")||i.getAttribute("name")||s;i.setAttribute("aria-label",g),r(s,`aria-label="${g}"`,"serious",i)}if(i.hasAttribute("required")&&!i.getAttribute("aria-required")&&(i.setAttribute("aria-required","true"),t.fixed++),s==="input"&&!b.autocomplete){let g=b.name||"";b.type==="email"||g.includes("email")?b.autocomplete="email":b.type==="tel"||g.includes("tel")?b.autocomplete="tel":b.type==="password"&&(b.autocomplete="current-password"),t.fixed++}}s==="th"&&!i.getAttribute("scope")&&(i.setAttribute("scope",i.closest("thead")?"col":"row"),r(s,"scope added to <th>","moderate",i)),Dt[s]&&!i.getAttribute("role")&&(i.setAttribute("role",Dt[s]),r(s,`role="${Dt[s]}"`,"minor",i));let c=i.getAttribute("role")||"";c==="tab"&&!i.getAttribute("aria-selected")&&(i.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(c)&&!i.getAttribute("aria-live")&&(i.setAttribute("aria-live",c==="alert"?"assertive":"polite"),r(s,`aria-live added on role=${c}`,"moderate",i)),c==="combobox"&&!i.getAttribute("aria-expanded")&&(i.setAttribute("aria-expanded","false"),r(s,'aria-expanded="false" on combobox',"serious",i)),(c==="checkbox"||c==="radio")&&!i.getAttribute("aria-checked")&&(i.setAttribute("aria-checked","false"),r(s,`aria-checked="false" on role=${c}`,"serious",i))}),t.renderTime=parseFloat((performance.now()-n).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(),n=document.querySelectorAll("*");e.scanned=n.length;let o=(r,a,i,s)=>e.details.push({tag:r,fix:a,severity:i,element:s.outerHTML.slice(0,100)});return n.forEach(r=>{let a=r,i=a.tagName.toLowerCase();(i==="a"||i==="button")&&!a.innerText?.trim()&&!a.getAttribute("aria-label")&&o(i,"needs aria-label (empty)","critical",a),i==="img"&&!a.hasAttribute("alt")&&o(i,"needs alt text","serious",a),An.has(i)&&!a.getAttribute("aria-label")&&!a.getAttribute("aria-labelledby")&&o(i,"needs aria-label","serious",a),i==="iframe"&&!a.getAttribute("title")&&!a.getAttribute("aria-label")&&o(i,"iframe needs title","serious",a)}),e.fixed=e.details.length,e.score=Ln(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:Y,speak:Ot,showVisualAlert:Pn,trapFocus:ht,handlePlainEnglish:Cn,handleSummarisePage:Rn,handleTranslate:In,handleVoiceControl:En,handleSmartLabels:Gn,SUPPORTED_LANGUAGES:ft};import wr,{useEffect as Ue,useState as re,useCallback as je}from"react";import{forwardRef as er,useEffect as xt,useState as Me}from"react";import{jsx as p,jsxs as _}from"react/jsx-runtime";var Bt={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},_e=[80,90,100,110,120,130],tr=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],nr=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function or(){let[e,t]=Me(typeof window<"u"?window.innerWidth:1024);return xt(()=>{let n=()=>t(window.innerWidth);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function rr({checked:e,onChange:t,label:n,disabled:o=!1}){return _("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:o?"not-allowed":"pointer",flexShrink:0,opacity:o?.4:1},children:[p("input",{type:"checkbox",checked:e,disabled:o,onChange:r=>t(r.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),p("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),p("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 qe({label:e,color:t="#64748b",badge:n,concept:o}){return _("div",{style:{margin:"10px 18px 4px"},children:[_("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),n&&p("span",{style:{fontSize:"9px",fontWeight:500,padding:"1px 7px",borderRadius:"99px",background:"#f5f3ff",color:"#7c3aed",border:"0.5px solid #c4b5fd",whiteSpace:"nowrap"},children:n})]}),o&&p("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:o})]})}function we({icon:e,label:t,desc:n,checked:o,onChange:r,disabled:a=!1,disabledReason:i,tip:s}){return _("div",{title:a?i:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[_("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[p("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:a?"#f1f5f9":"#f0fdfa",color:a?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),_("div",{style:{minWidth:0},children:[p("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:a?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),p("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:a?i:n})]})]}),p(rr,{checked:o,onChange:r,label:`Toggle ${t}`,disabled:a})]})}function ue(){return p("div",{style:{height:"1px",background:"#f1f5f9"}})}function Qe({steps:e}){return _("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[p("p",{style:{margin:"0 0 4px",fontSize:"9px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"How to use"}),e.map((t,n)=>_("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[n+1,". ",t]},n))]})}var Ht=er(({position:e,settings:t,report:n,isActive:o,aiSupported:r,voiceSupported:a,set:i,onApply:s,onReset:c,onClose:b},g)=>{let{isMobile:x,isTablet:I}=or(),[O,N]=Me([]),[E,T]=Me(""),[B,y]=Me(""),[v,C]=Me(!1),[m,P]=Me(null),[h,W]=Me("idle");xt(()=>{let l=window;!!(l.LanguageModel||l.ai?.languageModel)&&r?P("gemini"):dt()&&P("transformers")},[r]),xt(()=>{if(m!=="transformers")return;let l=setInterval(()=>{W(ct())},500);return()=>clearInterval(l)},[m]);let se=async()=>{if(!(!E.trim()||v)){if(!m){y("\u26A0\uFE0F No AI engine available on this device.");return}C(!0),y("");try{let l;m==="gemini"?l=await sn(E):(W("loading"),l=await ln(E),W("ready")),y(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{y("\u26A0\uFE0F Failed to get answer. Please try again.")}C(!1)}};xt(()=>{(async()=>{try{let X=window;if(!X.queryLocalFonts)return;let $=await X.queryLocalFonts(),H=[...new Set($.map(J=>J.family))].sort();N(H.slice(0,50))}catch{}})()},[]);let q=m==="gemini"?"Gemini Nano":m==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Q=m==="transformers"&&h==="loading"?"Loading AI model... (first time only)":"...",w=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:I?"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 _("div",{ref:g,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:w,children:[_("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:[_("div",{children:[_("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[p("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),o&&p("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),p("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),p("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),p("button",{onClick:b,"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"})]}),p(qe,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),p(Qe,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),p(we,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:l=>i("autoFix",l),tip:"Fixes aria-label, alt text, roles on every element"}),p(ue,{}),p(we,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:l=>i("speechEnabled",l),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),p(ue,{}),p(we,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:l=>i("voiceControl",l),disabled:!a,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),p(ue,{}),p(qe,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),p("div",{style:{margin:"4px 18px 6px",padding:"8px 10px",background:r?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${r?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:r?"#0f766e":"#7c3aed",lineHeight:1.5},children:r?"\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."}),!r&&_("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:[p("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),_("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",p("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),p("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),p("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:nr.map(l=>_("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",l]},l))}),_("p",{style:{margin:"0 0 3px"},children:["3. Click ",p("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),_("p",{style:{margin:"0 0 3px"},children:["4. ",p("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"]}),p("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),p(we,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:l=>i("plainEnglish",l),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),p(ue,{}),p(we,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:l=>i("summarisePage",l),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),p(ue,{}),p(we,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:l=>i("smartLabels",l),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),p(ue,{}),p(qe,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),p(Qe,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),p(we,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:l=>i("highContrast",l),tip:"CSS filter: contrast()"}),p(ue,{}),p(we,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:l=>i("darkMode",l),tip:"CSS filter: invert + hue-rotate"}),p(ue,{}),p(we,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:l=>i("reduceMotion",l),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),p(ue,{}),p(we,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:l=>i("largeTargets",l),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),p(ue,{}),_("div",{style:{padding:"10px 18px"},children:[p("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),p("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),p("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:tr.map(l=>p("button",{onClick:()=>i("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))})]}),p(ue,{}),p(qe,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),p(Qe,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),p(we,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:l=>i("dyslexiaFont",l),tip:"By Braille Institute \u2014 free and open source"}),p(ue,{}),_("div",{style:{padding:"10px 18px"},children:[p("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),p("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),O.length>0?_("select",{value:t.localFont,onChange:l=>i("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:[p("option",{value:"",children:"System default"}),O.map(l=>p("option",{value:l,style:{fontFamily:l},children:l},l))]}):p("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),p(ue,{}),_("div",{style:{padding:"10px 18px 14px"},children:[_("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[_("div",{children:[p("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),p("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),_("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),_("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p("button",{onClick:()=>{let l=_e.indexOf(t.fontScale);l>0&&i("fontScale",_e[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"}),p("div",{style:{flex:1,display:"flex",gap:"3px"},children:_e.map(l=>p("button",{onClick:()=>i("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))}),p("button",{onClick:()=>{let l=_e.indexOf(t.fontScale);l<_e.length-1&&i("fontScale",_e[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:"+"})]})]}),p(ue,{}),p(qe,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),p(Qe,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),_("div",{style:{padding:"6px 18px 12px"},children:[p("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:ft.slice(0,x?8:18).map(l=>p("button",{onClick:()=>i("translateLanguage",l.code),"aria-pressed":t.translateLanguage===l.code,disabled:!r,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:r?"pointer":"not-allowed",opacity:r?1:.5,minHeight:x?"36px":"auto"},children:l.label},l.code))}),!r&&p("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),p(ue,{}),p(qe,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:q,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),p(Qe,{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."]}),_("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"&&h==="loading"&&" \xB7 Loading model...",m==="transformers"&&h==="ready"&&" \xB7 Model ready \u2705"]}),_("div",{style:{padding:"0 18px 14px"},children:[_("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[p("input",{type:"text",value:E,onChange:l=>T(l.target.value),onKeyDown:l=>{l.key==="Enter"&&se()},placeholder:"e.g. What does this page do?",disabled:v||!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"}}),p("button",{onClick:se,disabled:v||!E.trim()||!m,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:m&&E.trim()&&!v?"#0d9488":"#e2e8f0",color:m&&E.trim()&&!v?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:m&&E.trim()&&!v?"pointer":"not-allowed",flexShrink:0,height:x?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:v?Q:"Ask"})]}),B&&_("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:[p("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),B,p("button",{onClick:()=>{y(""),T("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),n&&p("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:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms`}),_("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:[p("button",{onClick:c,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"}),p("button",{onClick:s,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"})]})]})});Ht.displayName="WidgetPanel";import{useState as Xe,useCallback as zn}from"react";var ir={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:[]},ar={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"]},sr={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"]},lr={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"]},dr={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"]},cr={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 ur(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 n of t){let o=e.match(n);if(o?.[1]){let r=o[1].trim();if(r.length>2&&r.length<40)return r}}return"My Business"}function pr(e){let t=e.toLowerCase(),n="generic",o=0;for(let[r,a]of Object.entries(ir)){let i=0;for(let s of a)t.includes(s)&&i++;i>o&&(o=i,n=r)}return n}function fr(e,t){let n=e.toLowerCase(),o=new Set(ar[t]);for(let[r,a]of Object.entries(sr))for(let i of a)if(n.includes(i)){o.add(r);break}return o.add("home"),o.add("contact"),Array.from(o)}function gr(e){let t=e.toLowerCase(),n=[];for(let[o,r]of Object.entries(lr))for(let a of r)if(t.includes(a)){n.push(o);break}return n}function mr(e,t){let n=e.toLowerCase();for(let[o,r]of Object.entries(dr))for(let a of r)if(n.includes(a))return o;return cr[t]}function Mn(e){let t=pr(e),n=fr(e,t),o=gr(e),r=mr(e,t);return{siteName:ur(e),websiteType:t,pages:n,features:o,theme:r,description:e.slice(0,200)}}import{Fragment as xr,jsx as z,jsxs as ee}from"react/jsx-runtime";var br=["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"],yr={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}"},hr={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 _t({position:e,onClose:t}){let[n,o]=Xe("input"),[r,a]=Xe(""),[i,s]=Xe(null),[c,b]=Xe(0),[g,x]=Xe(""),I=zn(()=>{if(!r.trim())return;let T=Mn(r);s(T),o("preview")},[r]),O=zn(async()=>{if(i){o("generating"),b(0),x("");try{let T=[{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 y of T)b(y.pct),await new Promise(v=>setTimeout(v,200));let{generateZip:B}=await import("./zip-generator-D5EXBBNS.mjs");await B(i),b(100),o("done")}catch(T){x(T instanceof Error?T.message:"Generation failed. Please try again."),o("preview")}}},[i]),N=()=>{o("input"),a(""),s(null),b(0),x("")},E={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 ee("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:E,children:[ee("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:[ee("div",{children:[z("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),z("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),z("button",{onClick:t,"aria-label":"Close vibe coder",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",padding:"2px"},children:"\xD7"})]}),n==="input"&&ee("div",{style:{padding:"14px 16px"},children:[z("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."}),z("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),z("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:br.slice(0,3).map(T=>z("button",{onClick:()=>a(T),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:T},T))}),z("textarea",{value:r,onChange:T=>a(T.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}}),z("button",{onClick:I,disabled:!r.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:r.trim()?"#f59e0b":"#e2e8f0",color:r.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:r.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),n==="preview"&&i&&ee("div",{style:{padding:"14px 16px"},children:[g&&ee("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",g]}),ee("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[ee("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[z("span",{style:{fontSize:"1.5rem"},children:hr[i.websiteType]||"\u{1F310}"}),ee("div",{children:[z("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:i.siteName}),ee("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[i.websiteType," website \xB7 ",i.theme," theme"]})]})]}),ee("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",i.pages.length,")"]}),z("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:i.pages.map(T=>ee("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[yr[T]||"\u{1F4C4}"," ",T]},T))}),i.features.length>0&&ee(xr,{children:[z("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),z("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:i.features.map(T=>z("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:T},T))})]})]}),ee("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[z("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),ee("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",z("br",{}),"\u2705 Tailwind CSS + CSS Modules",z("br",{}),"\u2705 TypeScript configured",z("br",{}),"\u2705 Navbar + Footer components",z("br",{}),"\u2705 All ",i.pages.length," pages ready",z("br",{}),"\u2705 Mobile responsive",z("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),ee("div",{style:{display:"flex",gap:"8px"},children:[z("button",{onClick:N,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"\u2190 Edit"}),z("button",{onClick:O,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"})]})]}),n==="generating"&&ee("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[z("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),z("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),z("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem"},children:c<30?"Parsing requirement...":c<55?"Loading templates...":c<70?"Generating pages...":c<85?"Building components...":c<95?"Creating styles...":"Packaging ZIP..."}),z("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:z("div",{style:{height:"100%",width:`${c}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),ee("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[c,"%"]})]}),n==="done"&&i&&ee("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[z("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),ee("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[i.siteName," downloaded!"]}),z("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(T=>z("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:ee("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",T]})},T)),z("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),ee("div",{style:{display:"flex",gap:"8px"},children:[z("button",{onClick:N,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"New Project"}),z("button",{onClick:O,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 vr,jsx as K,jsxs as ke}from"react/jsx-runtime";async function kr(){try{if(typeof window>"u")return!1;let e=window;if(e.LanguageModel)try{if(typeof e.LanguageModel.availability=="function"){let n=await e.LanguageModel.availability();if(n==="readily"||n==="available"||n==="downloadable")return!0}else return!0}catch{}if(e.Summarizer)try{let n=await e.Summarizer.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}if(e.Rewriter)try{let n=await e.Rewriter.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}if(e.Writer)try{let n=await e.Writer.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}let t=e.ai||globalThis.ai;if(t){if(t.languageModel?.availability)try{let n=await t.languageModel.availability();if(n==="readily"||n==="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 qt({position:e="left",children:t,config:n={},showRag:o=!1,showAgent:r=!1}){let[a,i]=re(!1),[s,c]=re(Bt),[b,g]=re(null),[x,I]=re(!1),[O,N]=re(!1),[E,T]=re(!1),B=wr.useRef(null),[y,v]=re(!1),[C,m]=re(""),[P,h]=re(""),[W,se]=re(!1),[q,Q]=re(null),[w,l]=re("idle"),[X,$]=re(!1),[H,J]=re(""),[ie,A]=re(""),[L,u]=re(!1),[k,U]=re([]),[G,ne]=re(null),le=24,ge=84,Ce=o?144:84,Xt=204,[me,We]=re(!1);Ue(()=>{if(typeof window>"u")return;let f=window;!!(f.LanguageModel||f.ai?.languageModel)&&O?(Q("gemini"),ne("gemini")):dt()&&(Q("transformers"),ne("transformers"))},[O]),Ue(()=>{if(q!=="transformers")return;let f=setInterval(()=>l(ct()),500);return()=>clearInterval(f)},[q]);let Ke=je(async()=>{if(!(!C.trim()||W)){if(!q){h("\u26A0\uFE0F No AI engine available.");return}se(!0),h("");try{let f;if(q==="gemini"){let{askPage:Z}=await import("./rag-MKBAGH6J.mjs");f=await Z(C)}else{l("loading");let{askPageWithTransformers:Z}=await import("./transformers-rag-HW4QKA5T.mjs");f=await Z(C),l("ready")}h(f.success&&f.answer?f.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(f.error||"No answer found."))}catch{h("\u26A0\uFE0F Something went wrong.")}se(!1)}},[C,W,q]),at=je(async()=>{if(!H.trim()||L)return;if(!G){A("\u26A0\uFE0F No AI engine available.");return}u(!0),U([]),A("");let{runAgent:f}=await import("./agent-JGLAYQMX.mjs");await f(H,G,Z=>{U(Ae=>[...Ae,Z.text])}),u(!1),A("done")},[H,L,G]);Ue(()=>{if(typeof window>"u")return;let Z=setTimeout(async()=>{let Ae=window,It=await kr();N(It),T(!!(Ae.SpeechRecognition||Ae.webkitSpeechRecognition))},800);return()=>clearTimeout(Z)},[]),Ue(()=>{if(!(typeof window>"u"))try{let f=localStorage.getItem("yuktai-a11y-prefs");f&&c(Z=>({...Z,...JSON.parse(f)}))}catch{}},[]);let Ie=je(async f=>{let Z={enabled:!0,highContrast:f.highContrast,darkMode:f.darkMode,reduceMotion:f.reduceMotion,largeTargets:f.largeTargets,speechEnabled:f.speechEnabled,autoFix:f.autoFix,dyslexiaFont:f.dyslexiaFont,localFont:f.localFont,fontSizeMultiplier:f.fontScale/100,colorBlindMode:f.colorBlindMode,showAuditBadge:f.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:f.plainEnglish,summarisePage:f.summarisePage,translateLanguage:f.translateLanguage,voiceControl:f.voiceControl,smartLabels:f.smartLabels,...n};await he.execute(Z),g(he.applyFixes(Z)),I(!0)},[n]),fe=je(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(s))}catch{}await Ie(s),i(!1)},[s,Ie]),Re=je(()=>{c(Bt);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let f=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(Z=>f.removeAttribute(Z)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",g(null),I(!1)},[]),Ze=je((f,Z)=>{c(Ae=>({...Ae,[f]:Z}))},[]);Ue(()=>{let f=Z=>{Z.key==="Escape"&&(a&&i(!1),y&&v(!1),X&&$(!1),me&&We(!1))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[a,y,X]),Ue(()=>{a&&B.current&&he.trapFocus(B.current)},[a]);let Fe=(f,Z,Ae)=>({position:"fixed",bottom:`${f}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:Z,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"}),$e=f=>{f.currentTarget.style.transform="scale(1.08)"},Ee=f=>{f.currentTarget.style.transform="scale(1)"},De=q==="gemini"?"Gemini Nano \xB7 On device":q==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",st=q==="transformers"&&w==="loading"?"Loading model...":"...";return ke(vr,{children:[t,r&&K("button",{style:Fe(204,me?"#d97706":"#f59e0b",me),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{We(f=>!f),$(!1),v(!1),i(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u26A1"}),r&&me&&K(_t,{position:e,onClose:()=>We(!1)}),r&&K("button",{style:Fe(Ce,X?"#059669":"#10b981",X),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":X,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{$(f=>!f),v(!1),i(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u{1F916}"}),r&&X&&ke("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${Ce+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:[ke("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[ke("div",{children:[K("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),K("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:G==="gemini"?"Gemini Nano \xB7 On device":G==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),K("button",{onClick:()=>$(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),K("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."}),K("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(f=>K("button",{onClick:()=>J(f),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:f},f))}),ke("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[K("input",{type:"text",value:H,onChange:f=>J(f.target.value),onKeyDown:f=>{f.key==="Enter"&&at()},placeholder:"e.g. Help me fill this form",disabled:L||!G,"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:G?"#fff":"#f8fafc",outline:"none",height:"36px"}}),K("button",{onClick:at,disabled:L||!H.trim()||!G,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:G&&H.trim()&&!L?"#10b981":"#e2e8f0",color:G&&H.trim()&&!L?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:G&&H.trim()&&!L?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:L?"...":"Go"})]}),k.length>0&&ke("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[k.map((f,Z)=>K("p",{style:{margin:"0 0 2px"},children:f},Z)),ie==="done"&&K("button",{onClick:()=>{U([]),J(""),A("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!G&&K("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),o&&K("button",{style:Fe(ge,y?"#7c3aed":"#6d28d9",y),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":y,title:`\u{1F4AC} Ask this page \xB7 ${De}`,onClick:()=>{v(f=>!f),i(!1),$(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u{1F4AC}"}),o&&y&&ke("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${ge+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:[ke("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[ke("div",{children:[K("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),K("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:De}),q==="transformers"&&w==="loading"&&K("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),q==="transformers"&&w==="ready"&&K("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),K("button",{onClick:()=>v(!1),"aria-label":"Close ask panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),ke("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[K("input",{type:"text",value:C,onChange:f=>m(f.target.value),onKeyDown:f=>{f.key==="Enter"&&Ke()},placeholder:"e.g. What does this page do?",disabled:W||!q,"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:q?"#fff":"#f8fafc",outline:"none",height:"36px"}}),K("button",{onClick:Ke,disabled:W||!C.trim()||!q,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:q&&C.trim()&&!W?"#7c3aed":"#e2e8f0",color:q&&C.trim()&&!W?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:q&&C.trim()&&!W?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:W?st:"Ask"})]}),P&&ke("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[K("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),P,K("button",{onClick:()=>{h(""),m("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!q&&K("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),K("button",{style:Fe(le,x?"#0d9488":"#1a73e8",a),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":a,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{i(f=>!f),v(!1),$(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u267F"}),a&&K(Ht,{ref:B,position:e,settings:s,report:b,isActive:x,aiSupported:O,voiceSupported:E,set:Ze,onApply:fe,onReset:Re,onClose:()=>i(!1)})]})}var wt={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};var kt={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};var ze=class{plugins=new Map;register(t,n){if(!n||typeof n.execute!="function")throw new Error(`Invalid plugin: ${t}`);this.plugins.set(t,n)}use(t){return this.plugins.get(t)}async run(t,n){try{let o=this.use(t);if(!o)throw new Error(`Plugin not found: ${t}`);return await o.execute(n)}catch(o){throw console.error(`[YuktAI Runtime Error in ${t}]:`,o),o}}getPlugins(){return Array.from(this.plugins.keys())}};import{useCallback as Zt,useEffect as Rt,useMemo as Ve,useState as Pe}from"react";import{useCallback as Ut,useEffect as Je,useMemo as Nn,useRef as Wn,useState as Ge}from"react";import{Fragment as Pr,jsx as M,jsxs as pe}from"react/jsx-runtime";var $n={"en-US":{title:"Grid AI Assistant",subtitle:"Ask about your data",ask:"Ask",placeholder:"Ask or type a command...",listening:"Listening...",send:"Send",close:"Close",open:"Open AI assistant",inputLanguage:"Input language",speakNow:"Speak your question",working:"Working on it\u2026",english:"English",telugu:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41",searchStarted:e=>`Searching for "${e}".`,sortedAscending:e=>`Sorted by ${e} in ascending order.`,sortedDescending:e=>`Sorted by ${e} in descending order.`,count:e=>`There are ${e} rows in the grid.`,highest:(e,t,n)=>`The highest ${e} is ${t}, held by ${n}.`,lowest:(e,t,n)=>`The lowest ${e} is ${t}, held by ${n}.`,average:(e,t)=>`The average ${e} is ${t}.`,total:(e,t)=>`The total ${e} is ${t}.`,noData:"There is no data to analyze.",noColumn:"I could not find a column to analyze.",noNumericData:e=>`There is no numeric data in ${e}.`,notFound:e=>`I could not find anything matching "${e}".`,needName:"Please provide a value to look up.",fallback:"I can search, sort, count, and analyze the grid data.",unsupportedVoice:"Voice input is not supported in this browser."},"te-IN":{title:"\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D AI \u0C38\u0C39\u0C3E\u0C2F\u0C15\u0C41\u0C21\u0C41",subtitle:"\u0C2E\u0C40 \u0C21\u0C47\u0C1F\u0C3E \u0C17\u0C41\u0C30\u0C3F\u0C02\u0C1A\u0C3F \u0C05\u0C21\u0C17\u0C02\u0C21\u0C3F",ask:"\u0C05\u0C21\u0C17\u0C02\u0C21\u0C3F",placeholder:"\u0C2A\u0C4D\u0C30\u0C36\u0C4D\u0C28 \u0C32\u0C47\u0C26\u0C3E \u0C06\u0C26\u0C47\u0C36\u0C02 \u0C1F\u0C48\u0C2A\u0C4D \u0C1A\u0C47\u0C2F\u0C02\u0C21\u0C3F...",listening:"\u0C35\u0C3F\u0C02\u0C1F\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41...",send:"\u0C2A\u0C02\u0C2A\u0C02\u0C21\u0C3F",close:"\u0C2E\u0C42\u0C38\u0C3F\u0C35\u0C47\u0C2F\u0C02\u0C21\u0C3F",open:"AI \u0C38\u0C39\u0C3E\u0C2F\u0C15\u0C41\u0C21\u0C3F\u0C28\u0C3F \u0C24\u0C46\u0C30\u0C35\u0C02\u0C21\u0C3F",inputLanguage:"\u0C07\u0C28\u0C4D\u200C\u0C2A\u0C41\u0C1F\u0C4D \u0C2D\u0C3E\u0C37",speakNow:"\u0C2E\u0C40 \u0C2A\u0C4D\u0C30\u0C36\u0C4D\u0C28 \u0C1A\u0C46\u0C2A\u0C4D\u0C2A\u0C02\u0C21\u0C3F",working:"\u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41\u2026",english:"English",telugu:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41",searchStarted:e=>`\u201C${e}\u201D \u0C15\u0C4B\u0C38\u0C02 \u0C36\u0C4B\u0C27\u0C3F\u0C38\u0C4D\u0C24\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41.`,sortedAscending:e=>`${e}\u0C28\u0C41 \u0C06\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C3E\u0C28\u0C41.`,sortedDescending:e=>`${e}\u0C28\u0C41 \u0C05\u0C35\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C3E\u0C28\u0C41.`,count:e=>`\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D\u200C\u0C32\u0C4B \u0C2E\u0C4A\u0C24\u0C4D\u0C24\u0C02 ${e} \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41 \u0C09\u0C28\u0C4D\u0C28\u0C3E\u0C2F\u0C3F.`,highest:(e,t,n)=>`\u0C05\u0C24\u0C4D\u0C2F\u0C27\u0C3F\u0C15 ${e} \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}. \u0C07\u0C26\u0C3F ${n}\u0C15\u0C41 \u0C38\u0C02\u0C2C\u0C02\u0C27\u0C3F\u0C02\u0C1A\u0C3F\u0C28\u0C26\u0C3F.`,lowest:(e,t,n)=>`\u0C05\u0C24\u0C4D\u0C2F\u0C32\u0C4D\u0C2A ${e} \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}. \u0C07\u0C26\u0C3F ${n}\u0C15\u0C41 \u0C38\u0C02\u0C2C\u0C02\u0C27\u0C3F\u0C02\u0C1A\u0C3F\u0C28\u0C26\u0C3F.`,average:(e,t)=>`${e} \u0C38\u0C17\u0C1F\u0C41 \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}.`,total:(e,t)=>`${e} \u0C2E\u0C4A\u0C24\u0C4D\u0C24\u0C02 \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}.`,noData:"\u0C35\u0C3F\u0C36\u0C4D\u0C32\u0C47\u0C37\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C21\u0C47\u0C1F\u0C3E \u0C32\u0C47\u0C26\u0C41.",noColumn:"\u0C35\u0C3F\u0C36\u0C4D\u0C32\u0C47\u0C37\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C24\u0C17\u0C3F\u0C28 \u0C15\u0C3E\u0C32\u0C2E\u0C4D \u0C15\u0C28\u0C2C\u0C21\u0C32\u0C47\u0C26\u0C41.",noNumericData:e=>`${e}\u0C32\u0C4B \u0C38\u0C02\u0C16\u0C4D\u0C2F\u0C3E \u0C38\u0C2E\u0C3E\u0C1A\u0C3E\u0C30\u0C02 \u0C32\u0C47\u0C26\u0C41.`,notFound:e=>`\u201C${e}\u201D\u0C15\u0C41 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C32\u0C47 \u0C38\u0C2E\u0C3E\u0C1A\u0C3E\u0C30\u0C02 \u0C15\u0C28\u0C2C\u0C21\u0C32\u0C47\u0C26\u0C41.`,needName:"\u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C12\u0C15 \u0C35\u0C3F\u0C32\u0C41\u0C35 \u0C07\u0C35\u0C4D\u0C35\u0C02\u0C21\u0C3F.",fallback:"\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D\u200C\u0C32\u0C4B \u0C36\u0C4B\u0C27\u0C28, \u0C15\u0C4D\u0C30\u0C2E\u0C2C\u0C26\u0C4D\u0C27\u0C40\u0C15\u0C30\u0C23, \u0C32\u0C46\u0C15\u0C4D\u0C15\u0C3F\u0C02\u0C2A\u0C41 \u0C2E\u0C30\u0C3F\u0C2F\u0C41 \u0C21\u0C47\u0C1F\u0C3E \u0C35\u0C3F\u0C36\u0C4D\u0C32\u0C47\u0C37\u0C23 \u0C1A\u0C47\u0C2F\u0C17\u0C32\u0C28\u0C41.",unsupportedVoice:"\u0C08 \u0C2C\u0C4D\u0C30\u0C4C\u0C1C\u0C30\u0C4D\u200C\u0C32\u0C4B \u0C35\u0C3E\u0C2F\u0C3F\u0C38\u0C4D \u0C07\u0C28\u0C4D\u200C\u0C2A\u0C41\u0C1F\u0C4D\u200C\u0C15\u0C41 \u0C2E\u0C26\u0C4D\u0C26\u0C24\u0C41 \u0C32\u0C47\u0C26\u0C41."}};function ve(e){return e.toLowerCase().trim().replace(/\s+/g," ")}function Sr(e,t){let n=ve(e);if(t==="te-IN")return/^(శోధించు|శోధించండి|వెతుకు|వెతకండి|చూపించు|చూపించండి|ఫిల్టర్)/.test(n)?{type:"search",payload:n.replace(/^(శోధించు|శోధించండి|వెతుకు|వెతకండి|చూపించు|చూపించండి|ఫిల్టర్)\s*/u,"").trim()||e}:/క్రమబద్ధీకర|అమర్చ|సార్ట్/.test(n)?{type:"sort",payload:{key:void 0,dir:/అవరోహణ|పెద్ద|అధిక|చివర/.test(n)?"desc":"asc"}}:/ఎన్ని|ఎంతమంది|లెక్క|మొత్తం వరుస|వరుసలు/.test(n)?{type:"question",payload:e}:/అత్యధిక|గరిష్ఠ|పెద్ద|ఎక్కువ/.test(n)?{type:"question",payload:e}:/అత్యల్ప|కనిష్ఠ|చిన్న|తక్కువ/.test(n)?{type:"question",payload:e}:/సగటు|సగటు విలువ/.test(n)?{type:"question",payload:e}:/మొత్తం|కలిపి/.test(n)?{type:"question",payload:e}:{type:"search",payload:e};if(/^(search|find|show|filter)/.test(n))return{type:"search",payload:n.replace(/^(search|find|show|filter)\s+(for\s+|by\s+)?/,"").trim()||e};if(/sort/.test(n)){let o=/desc|descending|high|higher|large|largest|top/.test(n);return{type:"sort",payload:{key:n.match(/(?:by|on)\s+([a-z0-9_-]+)/)?.[1],dir:o?"desc":"asc"}}}return/how many|count|highest|maximum|max|top|largest|lowest|minimum|min|smallest|bottom|average|avg|mean|sum|total|who|which|where|whose/.test(n)?{type:"question",payload:e}:{type:"search",payload:e}}function Dn(e,t){let n=ve(e);return t.find(o=>{let r=ve(o.key),a=ve(o.label);return n.includes(r)||n.includes(a)})}function vt(e,t){return e.toLocaleString(t==="te-IN"?"te-IN":"en-IN")}function Tr(e,t,n,o){let r=$n[o];if(t.length===0)return r.noData;let a=ve(e),i=n.filter(y=>y.type==="number"),s=Dn(e,n),c=s?.type==="number"?s:i[0],b=/how many|count|rows|ఎన్ని|ఎంతమంది|లెక్క|వరుసలు/.test(a);if(b)return r.count(t.length);if(/highest|maximum|max|top|largest|అత్యధిక|గరిష్ఠ|పెద్ద|ఎక్కువ/.test(a)){let y=s??c;if(!y)return r.noColumn;let v=t.map(h=>({row:h,value:Number(h[y.key])})).filter(h=>!Number.isNaN(h.value)).sort((h,W)=>W.value-h.value);if(v.length===0)return r.noNumericData(y.label);let C=v[0],m=n.find(h=>h.key==="name"||ve(h.label)==="name"),P=m?String(C.row[m.key]??""):o==="te-IN"?"\u0C08 \u0C35\u0C30\u0C41\u0C38":"this row";return r.highest(y.label,vt(C.value,o),P)}if(/lowest|minimum|min|smallest|bottom|అత్యల్ప|కనిష్ఠ|చిన్న|తక్కువ/.test(a)){let y=s??c;if(!y)return r.noColumn;let v=t.map(h=>({row:h,value:Number(h[y.key])})).filter(h=>!Number.isNaN(h.value)).sort((h,W)=>h.value-W.value);if(v.length===0)return r.noNumericData(y.label);let C=v[0],m=n.find(h=>h.key==="name"||ve(h.label)==="name"),P=m?String(C.row[m.key]??""):o==="te-IN"?"\u0C08 \u0C35\u0C30\u0C41\u0C38":"this row";return r.lowest(y.label,vt(C.value,o),P)}if(/average|avg|mean|సగటు/.test(a)){let y=s??c;if(!y)return r.noColumn;let v=t.map(m=>Number(m[y.key])).filter(m=>!Number.isNaN(m));if(v.length===0)return r.noNumericData(y.label);let C=v.reduce((m,P)=>m+P,0)/v.length;return r.average(y.label,vt(Math.round(C*100)/100,o))}if(/sum|total|మొత్తం|కలిపి/.test(a)&&!b){let y=s??c;if(!y)return r.noColumn;let v=t.map(m=>Number(m[y.key])).filter(m=>!Number.isNaN(m));if(v.length===0)return r.noNumericData(y.label);let C=v.reduce((m,P)=>m+P,0);return r.total(y.label,vt(C,o))}let N=a.match(/[\p{L}\p{N}_-]+/gu)??[],E=new Set(["who","what","which","where","whose","is","the","has","have","show","find","search","for","by","about"]),B=N.filter(y=>!E.has(y)).join(" ").trim();if(B){let y=t.find(v=>Object.values(v).some(C=>String(C??"").toLowerCase().includes(B.toLowerCase())));return y?n.map(v=>`${v.label}: ${String(y[v.key]??"")}`).join(o==="te-IN"?" \xB7 ":", "):r.notFound(B)}return r.fallback}function Ar(e,t){if(typeof window>"u"||!window.speechSynthesis)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(e);n.lang=t,n.rate=1,n.pitch=1,window.speechSynthesis.speak(n)}function Cr(e){let[t,n]=Ge(!1),[o,r]=Ge(""),[a,i]=Ge(!0),s=Wn(null);Je(()=>{if(typeof window>"u")return;let g=window.SpeechRecognition||window.webkitSpeechRecognition;if(!g){i(!1),s.current=null;return}let x=new g;return x.continuous=!1,x.interimResults=!1,x.lang=e,x.onresult=I=>{let O=I?.results?.[0]?.[0]?.transcript??"";r(O),n(!1)},x.onerror=()=>{n(!1)},x.onend=()=>{n(!1)},s.current=x,()=>{try{x.stop()}catch{}s.current=null}},[e]);let c=Ut(()=>{if(s.current){r(""),n(!0);try{s.current.start()}catch{n(!1)}}},[]),b=Ut(()=>{try{s.current?.stop()}catch{}n(!1)},[]);return{listening:t,transcript:o,supported:a,start:c,stop:b}}function Rr(){return pe("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M("circle",{cx:"11",cy:"11",r:"6.5"}),M("path",{d:"m16 16 5 5"})]})}function Ir(){return pe("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M("rect",{x:"8",y:"3",width:"8",height:"12",rx:"4"}),M("path",{d:"M5 11a7 7 0 0 0 14 0"}),M("path",{d:"M12 18v3"}),M("path",{d:"M8 21h8"})]})}function Er(){return pe("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M("path",{d:"m4 4 16 8-16 8 4-8-4-8Z"}),M("path",{d:"M8 12h12"})]})}function Gr(){return pe("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M("path",{d:"m6 6 12 12"}),M("path",{d:"m18 6-12 12"})]})}function Lr({data:e,columns:t,onSearch:n,onSort:o,theme:r="light",language:a="en-US",inputLanguage:i="en-US",embedded:s=!1,agent:c,onInputLanguageChange:b}){let g=$n[a],[x,I]=Ge(i);Je(()=>{I(i)},[i]);let[O,N]=Ge(!1),E=r==="dark",[T,B]=Ge(s),[y,v]=Ge(""),[C,m]=Ge([]),P=Wn(null),{listening:h,transcript:W,supported:se,start:q,stop:Q}=Cr(x),w=Nn(()=>({bg:E?"#0F172A":"#FFFFFF",surface:E?"#1E293B":"#F8FAFC",border:E?"#334155":"#E2E8F0",text:E?"#F1F5F9":"#0F172A",muted:E?"#94A3B8":"#64748B",accent:"#10B981",userMsg:E?"#334155":"#DBEAFE",aiMsg:E?"#1E293B":"#F0FDF4"}),[E]),l=Nn(()=>({role:"ai",text:a==="te-IN"?"\u0C2E\u0C40 \u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D \u0C21\u0C47\u0C1F\u0C3E \u0C17\u0C41\u0C30\u0C3F\u0C02\u0C1A\u0C3F \u0C2A\u0C4D\u0C30\u0C36\u0C4D\u0C28 \u0C05\u0C21\u0C17\u0C02\u0C21\u0C3F.":"Ask me about your grid data.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),[a]);Je(()=>{m(A=>A.length>0?A:[l])},[l]),Je(()=>{P.current?.scrollIntoView({behavior:"smooth"})},[C]);let X=()=>new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),$=Ut(async A=>{let L=A.trim();if(!L)return;m(k=>[...k,{role:"user",text:L,time:X()}]),v("");let u="";if(c){N(!0);try{u=(await c.ask(L)).message}catch{u=g.fallback}finally{N(!1)}}else{let k=Sr(L,a);if(k.type==="question")u=Tr(k.payload??L,e,t,a);else if(k.type==="search"){let U=String(k.payload??L);n?.(U),u=g.searchStarted(U)}else if(k.type==="sort"){let U=k.payload?.key,G=U?t.find(ne=>ve(ne.key)===ve(U)||ve(ne.label)===ve(U)):void 0;if(G||(G=Dn(L,t)),G&&o){let ne=k.payload?.dir==="desc"?"desc":"asc";o(String(G.key),ne),u=ne==="asc"?g.sortedAscending(G.label):g.sortedDescending(G.label)}else u=g.noColumn}}u||(u=g.fallback),m(k=>[...k,{role:"ai",text:u,time:X()}]),Ar(u,a)},[c,t,e,a,n,o,g]);Je(()=>{W&&$(W)},[W,$]);let H=()=>{$(y)},J=a==="te-IN"?["\u0C0E\u0C28\u0C4D\u0C28\u0C3F \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41","\u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F","\u0C15\u0C4D\u0C30\u0C2E\u0C02"]:["how many rows","search","sort"],ie=pe("div",{style:{width:s?"100%":360,maxWidth:s?"100%":"calc(100vw - 48px)",height:s?390:480,maxHeight:"70vh",background:w.bg,border:`1px solid ${w.border}`,borderRadius:s?12:16,boxShadow:s?"none":"0 20px 40px rgba(0,0,0,0.15)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[pe("div",{style:{padding:"12px 14px",background:w.accent,color:"#FFFFFF",display:"flex",alignItems:"center",gap:10},children:[M("div",{style:{width:34,height:34,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.18)",fontSize:17},children:"AI"}),pe("div",{style:{flex:1,minWidth:0},children:[M("div",{style:{fontWeight:700,fontSize:14},children:g.title}),M("div",{style:{fontSize:11,opacity:.9},children:g.subtitle})]}),!s&&M("button",{type:"button",onClick:()=>B(!1),"aria-label":g.close,title:g.close,style:{width:32,height:32,border:"none",borderRadius:8,background:"rgba(255,255,255,0.12)",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:M(Gr,{})})]}),pe("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${w.border}`,display:"flex",alignItems:"center",gap:8,background:w.surface},children:[M("span",{style:{fontSize:11,color:w.muted},children:g.inputLanguage}),pe("select",{value:x,onChange:A=>{let L=A.target.value;I(L),b?.(L)},disabled:h,"aria-label":g.inputLanguage,style:{padding:"5px 8px",borderRadius:7,border:`1px solid ${w.border}`,background:w.bg,color:w.text,fontSize:11},children:[M("option",{value:"en-US",children:g.english}),M("option",{value:"te-IN",children:g.telugu})]})]}),pe("div",{style:{flex:1,overflowY:"auto",padding:10,display:"flex",flexDirection:"column",gap:8},children:[C.map((A,L)=>pe("div",{style:{alignSelf:A.role==="user"?"flex-end":"flex-start",maxWidth:"88%",padding:"8px 11px",borderRadius:11,background:A.role==="user"?w.userMsg:w.aiMsg,color:w.text,fontSize:13,lineHeight:1.5},children:[M("div",{children:A.text}),M("div",{style:{marginTop:3,fontSize:10,opacity:.55,textAlign:"right"},children:A.time})]},`${A.time}-${L}`)),h&&M("div",{style:{alignSelf:"flex-end",padding:"8px 11px",borderRadius:11,background:E?"#3F1D2E":"#FEE2E2",color:E?"#FCA5A5":"#991B1B",fontSize:13},children:g.listening}),(O||c?.loading)&&M("div",{role:"status","aria-live":"polite",style:{alignSelf:"flex-start",padding:"8px 11px",borderRadius:11,background:w.aiMsg,color:w.muted,fontSize:13},children:g.working}),M("div",{ref:P})]}),M("div",{style:{padding:"7px 10px",borderTop:`1px solid ${w.border}`,display:"flex",gap:6,overflowX:"auto",flexShrink:0},children:J.map(A=>M("button",{type:"button",onClick:()=>$(A),style:{padding:"5px 9px",borderRadius:12,border:`1px solid ${w.border}`,background:w.surface,color:w.text,fontSize:10.5,cursor:"pointer",whiteSpace:"nowrap"},children:A},A))}),pe("div",{style:{padding:9,display:"flex",gap:6,borderTop:`1px solid ${w.border}`,background:w.surface},children:[pe("div",{style:{position:"relative",flex:1},children:[M(Rr,{}),M("input",{type:"text",value:y,onChange:A=>v(A.target.value),onKeyDown:A=>{A.key==="Enter"&&H()},placeholder:g.placeholder,"aria-label":g.ask,style:{width:"100%",boxSizing:"border-box",padding:"9px 10px 9px 34px",borderRadius:8,border:`1px solid ${w.border}`,background:w.bg,color:w.text,fontSize:12,outline:"none"}})]}),se?M("button",{type:"button",onClick:h?Q:q,"aria-label":h?g.listening:g.speakNow,title:h?g.listening:g.speakNow,style:{width:38,height:38,border:"none",borderRadius:8,background:h?"#EF4444":w.accent,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0},children:M(Ir,{})}):null,M("button",{type:"button",onClick:H,disabled:!y.trim(),"aria-label":g.send,title:g.send,style:{width:38,height:38,border:"none",borderRadius:8,background:y.trim()?w.accent:w.muted,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:y.trim()?"pointer":"not-allowed",opacity:y.trim()?1:.6,flexShrink:0},children:M(Er,{})})]})]});return s?M("div",{style:{width:"100%",minWidth:0},children:T?ie:pe("button",{type:"button",onClick:()=>B(!0),"aria-label":g.open,style:{minHeight:40,padding:"8px 13px",borderRadius:9,border:"1px solid #10B981",background:E?"#064E3B":"#ECFDF5",color:E?"#A7F3D0":"#047857",display:"inline-flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:12,fontWeight:600},children:[M("span",{"aria-hidden":"true",children:"AI"}),g.ask]})}):pe(Pr,{children:[!T&&M("button",{type:"button",onClick:()=>B(!0),"aria-label":g.open,title:g.title,style:{position:"fixed",bottom:24,right:24,zIndex:9998,width:56,height:56,borderRadius:28,background:w.accent,color:"#FFFFFF",border:"none",cursor:"pointer",boxShadow:"0 8px 20px rgba(16,185,129,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:14},children:"AI"}),T&&M("div",{style:{position:"fixed",bottom:90,right:24,zIndex:9997},children:ie}),M("style",{children:`
|
|
385
|
+
`,document.body.appendChild(e),Sn=e}function Ln(e){let t={critical:20,serious:10,moderate:5,minor:2},n=e.details.reduce((o,r)=>o+(t[r.severity]||0),0);return Math.max(0,Math.min(100,100-n))}var he={name:"yuktai-a11y",version:"4.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai: disabled.";He=e,Qo(e),Xo(),Jo(),Uo(),jo(),e.showSkipLinks!==!1&&qo(),e.showPreferencePanel,Zo(e);let t=this.applyFixes(e);t.score=Ln(t),e.showAuditBadge&&Yo(t),e.timeoutWarning&&Mn(e.timeoutWarning),e.autoFix&&this.startObserver(e),e.plainEnglish&&await Cn(!0),e.summarisePage&&await Rn(!0),e.translateLanguage&&e.translateLanguage!=="en"&&await In(e.translateLanguage),e.voiceControl&&await En(!0),e.smartLabels&&await Gn(!0);let n=`${t.fixed} fixes applied. Score: ${t.score}/100.`;return Y(n,t.score>=90?"success":"info",!1),`yuktai v4.0.0: ${n} 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 n=performance.now(),o=document.querySelectorAll("*");t.scanned=o.length;let r=(a,i,s,c)=>{t.details.push({tag:a,fix:i,severity:s,element:c.outerHTML.slice(0,100)}),t.fixed++};return o.forEach(a=>{let i=a,s=i.tagName.toLowerCase();if(s==="html"&&!i.getAttribute("lang")&&(i.setAttribute("lang","en"),r(s,'lang="en" added',"critical",i)),s==="meta"){let b=i.getAttribute("name"),g=i.getAttribute("content")||"";b==="viewport"&&g.includes("user-scalable=no")&&(i.setAttribute("content",g.replace("user-scalable=no","user-scalable=yes")),r(s,"user-scalable=yes restored","serious",i)),b==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(g)&&(i.setAttribute("content",g.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),r(s,"maximum-scale=5 restored","serious",i))}if(s==="main"&&!i.getAttribute("tabindex")&&(i.setAttribute("tabindex","-1"),i.getAttribute("id")||i.setAttribute("id","main-content")),s==="img"&&(i.hasAttribute("alt")||(i.setAttribute("alt",""),i.setAttribute("aria-hidden","true"),r(s,'alt="" aria-hidden="true"',"serious",i))),s==="svg"&&(!i.getAttribute("aria-hidden")&&!i.getAttribute("aria-label")&&!a.querySelector("title")&&(i.setAttribute("aria-hidden","true"),r(s,'aria-hidden="true" (decorative svg)',"minor",i)),i.getAttribute("focusable")||i.setAttribute("focusable","false")),s==="iframe"&&!i.getAttribute("title")&&!i.getAttribute("aria-label")&&(i.setAttribute("title","embedded content"),i.setAttribute("aria-label","embedded content"),r(s,"title + aria-label added","serious",i)),s==="button"){if(!i.innerText?.trim()&&!i.getAttribute("aria-label")){let b=i.getAttribute("title")||"button";i.setAttribute("aria-label",b),r(s,`aria-label="${b}" (empty button)`,"critical",i)}i.hasAttribute("disabled")&&!i.getAttribute("aria-disabled")&&(i.setAttribute("aria-disabled","true"),t.fixed++)}if(s==="a"){let b=i;!i.innerText?.trim()&&!i.getAttribute("aria-label")&&(i.setAttribute("aria-label",i.getAttribute("title")||"link"),r(s,"aria-label added (empty link)","critical",i)),b.target==="_blank"&&!b.rel?.includes("noopener")&&(b.rel="noopener noreferrer",t.fixed++)}if(An.has(s)){let b=i;if(!i.getAttribute("aria-label")&&!i.getAttribute("aria-labelledby")){let g=i.getAttribute("placeholder")||i.getAttribute("name")||s;i.setAttribute("aria-label",g),r(s,`aria-label="${g}"`,"serious",i)}if(i.hasAttribute("required")&&!i.getAttribute("aria-required")&&(i.setAttribute("aria-required","true"),t.fixed++),s==="input"&&!b.autocomplete){let g=b.name||"";b.type==="email"||g.includes("email")?b.autocomplete="email":b.type==="tel"||g.includes("tel")?b.autocomplete="tel":b.type==="password"&&(b.autocomplete="current-password"),t.fixed++}}s==="th"&&!i.getAttribute("scope")&&(i.setAttribute("scope",i.closest("thead")?"col":"row"),r(s,"scope added to <th>","moderate",i)),Dt[s]&&!i.getAttribute("role")&&(i.setAttribute("role",Dt[s]),r(s,`role="${Dt[s]}"`,"minor",i));let c=i.getAttribute("role")||"";c==="tab"&&!i.getAttribute("aria-selected")&&(i.setAttribute("aria-selected","false"),t.fixed++),["alert","status","log"].includes(c)&&!i.getAttribute("aria-live")&&(i.setAttribute("aria-live",c==="alert"?"assertive":"polite"),r(s,`aria-live added on role=${c}`,"moderate",i)),c==="combobox"&&!i.getAttribute("aria-expanded")&&(i.setAttribute("aria-expanded","false"),r(s,'aria-expanded="false" on combobox',"serious",i)),(c==="checkbox"||c==="radio")&&!i.getAttribute("aria-checked")&&(i.setAttribute("aria-checked","false"),r(s,`aria-checked="false" on role=${c}`,"serious",i))}),t.renderTime=parseFloat((performance.now()-n).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(),n=document.querySelectorAll("*");e.scanned=n.length;let o=(r,a,i,s)=>e.details.push({tag:r,fix:a,severity:i,element:s.outerHTML.slice(0,100)});return n.forEach(r=>{let a=r,i=a.tagName.toLowerCase();(i==="a"||i==="button")&&!a.innerText?.trim()&&!a.getAttribute("aria-label")&&o(i,"needs aria-label (empty)","critical",a),i==="img"&&!a.hasAttribute("alt")&&o(i,"needs alt text","serious",a),An.has(i)&&!a.getAttribute("aria-label")&&!a.getAttribute("aria-labelledby")&&o(i,"needs aria-label","serious",a),i==="iframe"&&!a.getAttribute("title")&&!a.getAttribute("aria-label")&&o(i,"iframe needs title","serious",a)}),e.fixed=e.details.length,e.score=Ln(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:Y,speak:Ot,showVisualAlert:Pn,trapFocus:ht,handlePlainEnglish:Cn,handleSummarisePage:Rn,handleTranslate:In,handleVoiceControl:En,handleSmartLabels:Gn,SUPPORTED_LANGUAGES:ft};import wr,{useEffect as Ue,useState as re,useCallback as je}from"react";import{forwardRef as er,useEffect as xt,useState as Fe}from"react";import{jsx as p,jsxs as _}from"react/jsx-runtime";var Bt={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},_e=[80,90,100,110,120,130],tr=[{value:"none",label:"None"},{value:"deuteranopia",label:"Deuteranopia"},{value:"protanopia",label:"Protanopia"},{value:"tritanopia",label:"Tritanopia"},{value:"achromatopsia",label:"Greyscale"}],nr=["Prompt API for Gemini Nano","Summarization API for Gemini Nano","Writer API for Gemini Nano","Rewriter API for Gemini Nano","Translation API"];function or(){let[e,t]=Fe(typeof window<"u"?window.innerWidth:1024);return xt(()=>{let n=()=>t(window.innerWidth);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),{isMobile:e<=480,isTablet:e>480&&e<=768}}function rr({checked:e,onChange:t,label:n,disabled:o=!1}){return _("label",{"aria-label":n,style:{position:"relative",display:"inline-flex",width:"40px",height:"24px",cursor:o?"not-allowed":"pointer",flexShrink:0,opacity:o?.4:1},children:[p("input",{type:"checkbox",checked:e,disabled:o,onChange:r=>t(r.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),p("span",{style:{position:"absolute",inset:0,borderRadius:"99px",background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),p("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 qe({label:e,color:t="#64748b",badge:n,concept:o}){return _("div",{style:{margin:"10px 18px 4px"},children:[_("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p("p",{style:{margin:0,fontSize:"10px",fontWeight:600,color:t,letterSpacing:"0.06em",textTransform:"uppercase"},children:e}),n&&p("span",{style:{fontSize:"9px",fontWeight:500,padding:"1px 7px",borderRadius:"99px",background:"#f5f3ff",color:"#7c3aed",border:"0.5px solid #c4b5fd",whiteSpace:"nowrap"},children:n})]}),o&&p("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8",fontStyle:"italic"},children:o})]})}function we({icon:e,label:t,desc:n,checked:o,onChange:r,disabled:a=!1,disabledReason:i,tip:s}){return _("div",{title:a?i:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:"12px"},children:[_("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[p("span",{"aria-hidden":"true",style:{width:"32px",height:"32px",borderRadius:"8px",background:a?"#f1f5f9":"#f0fdfa",color:a?"#94a3b8":"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",flexShrink:0,fontWeight:700},children:e}),_("div",{style:{minWidth:0},children:[p("p",{style:{margin:0,fontSize:"13px",fontWeight:500,color:a?"#94a3b8":"#0f172a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),p("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:a?i:n})]})]}),p(rr,{checked:o,onChange:r,label:`Toggle ${t}`,disabled:a})]})}function ue(){return p("div",{style:{height:"1px",background:"#f1f5f9"}})}function Qe({steps:e}){return _("div",{style:{margin:"0 18px 8px",padding:"8px 10px",background:"#f8fafc",borderRadius:"8px",border:"0.5px solid #e2e8f0"},children:[p("p",{style:{margin:"0 0 4px",fontSize:"9px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"How to use"}),e.map((t,n)=>_("p",{style:{margin:"0 0 2px",fontSize:"10px",color:"#475569"},children:[n+1,". ",t]},n))]})}var Ht=er(({position:e,settings:t,report:n,isActive:o,aiSupported:r,voiceSupported:a,set:i,onApply:s,onReset:c,onClose:b},g)=>{let{isMobile:w,isTablet:E}=or(),[O,W]=Fe([]),[G,A]=Fe(""),[B,y]=Fe(""),[S,R]=Fe(!1),[m,M]=Fe(null),[x,N]=Fe("idle");xt(()=>{let l=window;!!(l.LanguageModel||l.ai?.languageModel)&&r?M("gemini"):dt()&&M("transformers")},[r]),xt(()=>{if(m!=="transformers")return;let l=setInterval(()=>{N(ct())},500);return()=>clearInterval(l)},[m]);let se=async()=>{if(!(!G.trim()||S)){if(!m){y("\u26A0\uFE0F No AI engine available on this device.");return}R(!0),y("");try{let l;m==="gemini"?l=await sn(G):(N("loading"),l=await ln(G),N("ready")),y(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{y("\u26A0\uFE0F Failed to get answer. Please try again.")}R(!1)}};xt(()=>{(async()=>{try{let X=window;if(!X.queryLocalFonts)return;let $=await X.queryLocalFonts(),H=[...new Set($.map(J=>J.family))].sort();W(H.slice(0,50))}catch{}})()},[]);let q=m==="gemini"?"Gemini Nano":m==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",Q=m==="transformers"&&x==="loading"?"Loading AI model... (first time only)":"...",k=w?{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:E?"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 _("div",{ref:g,role:"dialog","aria-modal":"true","aria-label":"yuktai accessibility preferences","data-yuktai-panel":"true",style:k,children:[_("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:[_("div",{children:[_("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"4px",flexWrap:"wrap"},children:[p("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai"}),o&&p("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 7px",borderRadius:"99px",background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),p("p",{style:{margin:"0 0 1px",fontSize:"15px",fontWeight:600,color:"#0f172a"},children:"Accessibility"}),p("p",{style:{margin:0,fontSize:"11px",color:"#64748b"},children:"WCAG 2.2 \xB7 Open source \xB7 Zero cost \xB7 All devices"})]}),p("button",{onClick:b,"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:w?"44px":"auto",minHeight:w?"44px":"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),p(qe,{label:"\u267F Core Accessibility",concept:"Rule-based engine \u2014 works on all browsers and devices"}),p(Qe,{steps:["Toggle any feature on","Click Apply settings","Preferences saved automatically"]}),p(we,{icon:"\u{1F527}",label:"Auto-fix ARIA",desc:"Injects missing labels and roles automatically",checked:t.autoFix,onChange:l=>i("autoFix",l),tip:"Fixes aria-label, alt text, roles on every element"}),p(ue,{}),p(we,{icon:"\u{1F50A}",label:"Speak on focus",desc:"Browser reads elements aloud as you tab",checked:t.speechEnabled,onChange:l=>i("speechEnabled",l),tip:"Uses browser SpeechSynthesis \u2014 no install needed"}),p(ue,{}),p(we,{icon:"\u{1F399}\uFE0F",label:"Voice control",desc:"Say commands to navigate the page",checked:t.voiceControl,onChange:l=>i("voiceControl",l),disabled:!a,disabledReason:"Not supported in this browser",tip:'Say "scroll down", "go to main", "click"'}),p(ue,{}),p(qe,{label:"\u{1F916} AI Features",color:"#7c3aed",badge:"Gemini Nano",concept:"Large Language Model running privately on your device \u2014 Chrome 127+ only"}),p("div",{style:{margin:"4px 18px 6px",padding:"8px 10px",background:r?"#f0fdfa":"#f5f3ff",borderRadius:"8px",border:`0.5px solid ${r?"#99f6e4":"#c4b5fd"}`,fontSize:"10px",color:r?"#0f766e":"#7c3aed",lineHeight:1.5},children:r?"\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."}),!r&&_("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:[p("p",{style:{margin:"0 0 6px",fontWeight:600,color:"#0f172a",fontSize:"11px"},children:"\u{1F6E0} One-time setup \u2014 5 steps:"}),_("p",{style:{margin:"0 0 3px"},children:["1. Open Chrome \u2192 ",p("code",{style:{background:"#f1f5f9",padding:"1px 5px",borderRadius:"4px",fontSize:"10px",color:"#0d9488",fontFamily:"monospace"},children:"chrome://flags"})]}),p("p",{style:{margin:"0 0 3px"},children:"2. Enable each flag:"}),p("div",{style:{display:"flex",flexDirection:"column",gap:"2px",margin:"4px 0 6px 10px"},children:nr.map(l=>_("span",{style:{fontSize:"10px",color:"#7c3aed",fontFamily:"monospace"},children:["\u2192 ",l]},l))}),_("p",{style:{margin:"0 0 3px"},children:["3. Click ",p("strong",{style:{color:"#0f172a"},children:"Relaunch"})]}),_("p",{style:{margin:"0 0 3px"},children:["4. ",p("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"]}),p("p",{style:{margin:"0"},children:"5. Refresh \u2014 AI features unlock automatically \u2705"})]}),p(we,{icon:"\u{1F4DD}",label:"Plain English mode",desc:"Rewrites complex text in simple language",checked:t.plainEnglish,onChange:l=>i("plainEnglish",l),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: LLM text rewriting"}),p(ue,{}),p(we,{icon:"\u{1F4CB}",label:"Summarise page",desc:"3-sentence summary appears at top",checked:t.summarisePage,onChange:l=>i("summarisePage",l),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Abstractive summarisation"}),p(ue,{}),p(we,{icon:"\u{1F3F7}\uFE0F",label:"Smart aria-labels",desc:"AI generates meaningful labels for elements",checked:t.smartLabels,onChange:l=>i("smartLabels",l),disabled:!r,disabledReason:"Enable Gemini Nano \u2014 see setup above",tip:"AI concept: Context-aware label generation"}),p(ue,{}),p(qe,{label:"\u{1F441}\uFE0F Visual",concept:"CSS filter-based \u2014 works on all browsers and devices"}),p(Qe,{steps:["Toggle any visual mode","Changes apply instantly","Works on mobile and desktop"]}),p(we,{icon:"\u25D1",label:"High contrast",desc:"Boosts contrast for low vision users",checked:t.highContrast,onChange:l=>i("highContrast",l),tip:"CSS filter: contrast()"}),p(ue,{}),p(we,{icon:"\u{1F319}",label:"Dark mode",desc:"Inverts colours \u2014 easy on eyes at night",checked:t.darkMode,onChange:l=>i("darkMode",l),tip:"CSS filter: invert + hue-rotate"}),p(ue,{}),p(we,{icon:"\u23F8\uFE0F",label:"Reduce motion",desc:"Disables all animations",checked:t.reduceMotion,onChange:l=>i("reduceMotion",l),tip:"WCAG 2.3.3 \u2014 vestibular disorders"}),p(ue,{}),p(we,{icon:"\u{1F446}",label:"Large targets",desc:"44\xD744px minimum touch targets",checked:t.largeTargets,onChange:l=>i("largeTargets",l),tip:"WCAG 2.5.8 \u2014 motor impaired users"}),p(ue,{}),_("div",{style:{padding:"10px 18px"},children:[p("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F3A8} Colour blindness"}),p("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"SVG colour matrix filters \u2014 all devices"}),p("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:tr.map(l=>p("button",{onClick:()=>i("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:w?"36px":"auto"},children:l.label},l.value))})]}),p(ue,{}),p(qe,{label:"\u{1F524} Font",concept:"Browser Font API + CSS \u2014 Chrome 103+"}),p(Qe,{steps:["Toggle dyslexia font or pick from device","Adjust size with + / \u2212","Saved across visits"]}),p(we,{icon:"Aa",label:"Dyslexia-friendly font",desc:"Atkinson Hyperlegible \u2014 research-backed",checked:t.dyslexiaFont,onChange:l=>i("dyslexiaFont",l),tip:"By Braille Institute \u2014 free and open source"}),p(ue,{}),_("div",{style:{padding:"10px 18px"},children:[p("p",{style:{margin:"0 0 2px",fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F5A5}\uFE0F Local font"}),p("p",{style:{margin:"0 0 8px",fontSize:"10px",color:"#94a3b8"},children:"window.queryLocalFonts() \u2014 Chrome 103+"}),O.length>0?_("select",{value:t.localFont,onChange:l=>i("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:w?"44px":"36px"},children:[p("option",{value:"",children:"System default"}),O.map(l=>p("option",{value:l,style:{fontFamily:l},children:l},l))]}):p("p",{style:{margin:0,fontSize:"11px",color:"#94a3b8"},children:"Allow font access when Chrome prompts you."})]}),p(ue,{}),_("div",{style:{padding:"10px 18px 14px"},children:[_("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[_("div",{children:[p("p",{style:{margin:0,fontSize:"12px",fontWeight:500,color:"#0f172a"},children:"\u{1F4CF} Text size"}),p("p",{style:{margin:0,fontSize:"10px",color:"#94a3b8"},children:"Scales all text on the page"})]}),_("span",{style:{fontSize:"12px",fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:"99px"},children:[t.fontScale,"%"]})]}),_("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p("button",{onClick:()=>{let l=_e.indexOf(t.fontScale);l>0&&i("fontScale",_e[l-1])},disabled:t.fontScale<=80,"aria-label":"Decrease text size",style:{width:w?"44px":"30px",height:w?"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"}),p("div",{style:{flex:1,display:"flex",gap:"3px"},children:_e.map(l=>p("button",{onClick:()=>i("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))}),p("button",{onClick:()=>{let l=_e.indexOf(t.fontScale);l<_e.length-1&&i("fontScale",_e[l+1])},disabled:t.fontScale>=130,"aria-label":"Increase text size",style:{width:w?"44px":"30px",height:w?"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:"+"})]})]}),p(ue,{}),p(qe,{label:"\u{1F310} Translate",color:"#7c3aed",badge:"Gemini Nano",concept:"Chrome Translation API \u2014 on device, no internet after setup"}),p(Qe,{steps:["Enable Gemini Nano first","Pick your language","Full page translates instantly"]}),_("div",{style:{padding:"6px 18px 12px"},children:[p("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:ft.slice(0,w?8:18).map(l=>p("button",{onClick:()=>i("translateLanguage",l.code),"aria-pressed":t.translateLanguage===l.code,disabled:!r,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:r?"pointer":"not-allowed",opacity:r?1:.5,minHeight:w?"36px":"auto"},children:l.label},l.code))}),!r&&p("p",{style:{margin:"6px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano using the setup guide above."})]}),p(ue,{}),p(qe,{label:"\u{1F4AC} Ask This Page",color:"#0d9488",badge:q,concept:"RAG \u2014 Retrieval Augmented Generation. Works on all devices including mobile."}),p(Qe,{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."]}),_("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"&&x==="loading"&&" \xB7 Loading model...",m==="transformers"&&x==="ready"&&" \xB7 Model ready \u2705"]}),_("div",{style:{padding:"0 18px 14px"},children:[_("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[p("input",{type:"text",value:G,onChange:l=>A(l.target.value),onKeyDown:l=>{l.key==="Enter"&&se()},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:w?"44px":"36px"}}),p("button",{onClick:se,disabled:S||!G.trim()||!m,"aria-label":"Ask question",style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:m&&G.trim()&&!S?"#0d9488":"#e2e8f0",color:m&&G.trim()&&!S?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:m&&G.trim()&&!S?"pointer":"not-allowed",flexShrink:0,height:w?"44px":"36px",minWidth:"52px",transition:"background 0.2s"},children:S?Q:"Ask"})]}),B&&_("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:[p("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#0d9488"},children:"\u{1F4AC} Answer"}),B,p("button",{onClick:()=>{y(""),A("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]})]}),n&&p("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:n.fixed>0?`\u2713 ${n.fixed} fixes \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms \xB7 Score: ${n.score}/100`:`\u2713 0 auto-fixes needed \xB7 ${n.scanned} nodes \xB7 ${n.renderTime}ms`}),_("div",{style:{display:"flex",gap:"8px",padding:"12px 14px 14px",position:w?"sticky":"relative",bottom:w?0:"auto",background:"#fff",borderTop:"1px solid #f1f5f9"},children:[p("button",{onClick:c,style:{flex:1,padding:w?"12px 0":"8px 0",fontSize:"13px",fontWeight:500,borderRadius:"9px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),p("button",{onClick:s,style:{flex:2,padding:w?"12px 0":"8px 0",fontSize:"13px",fontWeight:600,borderRadius:"9px",border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})});Ht.displayName="WidgetPanel";import{useState as Xe,useCallback as Nn}from"react";var ir={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:[]},ar={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"]},sr={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"]},lr={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"]},dr={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"]},cr={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 ur(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 n of t){let o=e.match(n);if(o?.[1]){let r=o[1].trim();if(r.length>2&&r.length<40)return r}}return"My Business"}function pr(e){let t=e.toLowerCase(),n="generic",o=0;for(let[r,a]of Object.entries(ir)){let i=0;for(let s of a)t.includes(s)&&i++;i>o&&(o=i,n=r)}return n}function fr(e,t){let n=e.toLowerCase(),o=new Set(ar[t]);for(let[r,a]of Object.entries(sr))for(let i of a)if(n.includes(i)){o.add(r);break}return o.add("home"),o.add("contact"),Array.from(o)}function gr(e){let t=e.toLowerCase(),n=[];for(let[o,r]of Object.entries(lr))for(let a of r)if(t.includes(a)){n.push(o);break}return n}function mr(e,t){let n=e.toLowerCase();for(let[o,r]of Object.entries(dr))for(let a of r)if(n.includes(a))return o;return cr[t]}function Fn(e){let t=pr(e),n=fr(e,t),o=gr(e),r=mr(e,t);return{siteName:ur(e),websiteType:t,pages:n,features:o,theme:r,description:e.slice(0,200)}}import{Fragment as xr,jsx as z,jsxs as ee}from"react/jsx-runtime";var br=["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"],yr={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}"},hr={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 _t({position:e,onClose:t}){let[n,o]=Xe("input"),[r,a]=Xe(""),[i,s]=Xe(null),[c,b]=Xe(0),[g,w]=Xe(""),E=Nn(()=>{if(!r.trim())return;let A=Fn(r);s(A),o("preview")},[r]),O=Nn(async()=>{if(i){o("generating"),b(0),w("");try{let A=[{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 y of A)b(y.pct),await new Promise(S=>setTimeout(S,200));let{generateZip:B}=await import("./zip-generator-D5EXBBNS.mjs");await B(i),b(100),o("done")}catch(A){w(A instanceof Error?A.message:"Generation failed. Please try again."),o("preview")}}},[i]),W=()=>{o("input"),a(""),s(null),b(0),w("")},G={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 ee("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai Vibe Coder","data-yuktai-panel":"true",style:G,children:[ee("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:[ee("div",{children:[z("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:700,color:"#0f172a"},children:"\u26A1 Vibe Coder"}),z("p",{style:{margin:0,fontSize:"10px",color:"#64748b"},children:"Describe your website \u2192 Download Next.js ZIP"})]}),z("button",{onClick:t,"aria-label":"Close vibe coder",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",padding:"2px"},children:"\xD7"})]}),n==="input"&&ee("div",{style:{padding:"14px 16px"},children:[z("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."}),z("p",{style:{margin:"0 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Examples"}),z("div",{style:{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},children:br.slice(0,3).map(A=>z("button",{onClick:()=>a(A),style:{padding:"6px 10px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontSize:"10px",cursor:"pointer",textAlign:"left",lineHeight:1.4},children:A},A))}),z("textarea",{value:r,onChange:A=>a(A.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}}),z("button",{onClick:E,disabled:!r.trim(),style:{width:"100%",marginTop:"10px",padding:"10px",borderRadius:"8px",border:"none",background:r.trim()?"#f59e0b":"#e2e8f0",color:r.trim()?"#fff":"#94a3b8",fontSize:"13px",fontWeight:700,cursor:r.trim()?"pointer":"not-allowed",transition:"background 0.2s"},children:"Analyse Requirement \u2192"})]}),n==="preview"&&i&&ee("div",{style:{padding:"14px 16px"},children:[g&&ee("div",{style:{padding:"10px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",marginBottom:"12px",fontSize:"11px",color:"#dc2626"},children:["\u26A0\uFE0F ",g]}),ee("div",{style:{background:"#f8fafc",borderRadius:"10px",padding:"12px",marginBottom:"12px"},children:[ee("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[z("span",{style:{fontSize:"1.5rem"},children:hr[i.websiteType]||"\u{1F310}"}),ee("div",{children:[z("p",{style:{margin:0,fontSize:"13px",fontWeight:700,color:"#0f172a"},children:i.siteName}),ee("p",{style:{margin:0,fontSize:"10px",color:"#64748b",textTransform:"capitalize"},children:[i.websiteType," website \xB7 ",i.theme," theme"]})]})]}),ee("p",{style:{margin:"8px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:["Pages to generate (",i.pages.length,")"]}),z("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:i.pages.map(A=>ee("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f0fdf4",border:"1px solid #86efac",fontSize:"10px",color:"#166534",fontWeight:500},children:[yr[A]||"\u{1F4C4}"," ",A]},A))}),i.features.length>0&&ee(xr,{children:[z("p",{style:{margin:"10px 0 6px",fontSize:"10px",fontWeight:600,color:"#94a3b8",textTransform:"uppercase"},children:"Detected features"}),z("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:i.features.map(A=>z("span",{style:{padding:"2px 8px",borderRadius:"99px",background:"#f5f3ff",border:"1px solid #c4b5fd",fontSize:"10px",color:"#7c3aed",fontWeight:500},children:A},A))})]})]}),ee("div",{style:{margin:"0 0 12px",padding:"10px 12px",background:"#f0fdf4",borderRadius:"8px",border:"1px solid #86efac"},children:[z("p",{style:{margin:"0 0 4px",fontSize:"10px",fontWeight:700,color:"#166534"},children:"\u{1F4E6} What you get:"}),ee("p",{style:{margin:0,fontSize:"10px",color:"#166534",lineHeight:1.6},children:["\u2705 Complete Next.js 16 project",z("br",{}),"\u2705 Tailwind CSS + CSS Modules",z("br",{}),"\u2705 TypeScript configured",z("br",{}),"\u2705 Navbar + Footer components",z("br",{}),"\u2705 All ",i.pages.length," pages ready",z("br",{}),"\u2705 Mobile responsive",z("br",{}),"\u2705 npm run dev \u2192 works immediately"]})]}),ee("div",{style:{display:"flex",gap:"8px"},children:[z("button",{onClick:W,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"\u2190 Edit"}),z("button",{onClick:O,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"})]})]}),n==="generating"&&ee("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[z("p",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"\u26A1"}),z("p",{style:{fontSize:"13px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:"Generating your project..."}),z("p",{style:{fontSize:"11px",color:"#64748b",marginBottom:"1.5rem"},children:c<30?"Parsing requirement...":c<55?"Loading templates...":c<70?"Generating pages...":c<85?"Building components...":c<95?"Creating styles...":"Packaging ZIP..."}),z("div",{style:{height:"8px",background:"#e2e8f0",borderRadius:"99px",overflow:"hidden"},children:z("div",{style:{height:"100%",width:`${c}%`,background:"#f59e0b",borderRadius:"99px",transition:"width 0.3s ease"}})}),ee("p",{style:{marginTop:"0.5rem",fontSize:"10px",color:"#94a3b8"},children:[c,"%"]})]}),n==="done"&&i&&ee("div",{style:{padding:"2rem 16px",textAlign:"center"},children:[z("p",{style:{fontSize:"3rem",marginBottom:"0.75rem"},children:"\u2705"}),ee("p",{style:{fontSize:"14px",fontWeight:700,color:"#0f172a",marginBottom:"0.5rem"},children:[i.siteName," downloaded!"]}),z("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(A=>z("div",{style:{background:"#0f172a",borderRadius:"8px",padding:"8px 12px",marginBottom:"6px",textAlign:"left"},children:ee("code",{style:{fontSize:"12px",color:"#a7f3d0",fontFamily:"monospace"},children:["$ ",A]})},A)),z("p",{style:{fontSize:"11px",color:"#10b981",margin:"1rem 0",fontWeight:600},children:"Then open http://localhost:3000 \u{1F680}"}),ee("div",{style:{display:"flex",gap:"8px"},children:[z("button",{onClick:W,style:{flex:1,padding:"9px",borderRadius:"8px",border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"New Project"}),z("button",{onClick:O,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 vr,jsx as K,jsxs as ke}from"react/jsx-runtime";async function kr(){try{if(typeof window>"u")return!1;let e=window;if(e.LanguageModel)try{if(typeof e.LanguageModel.availability=="function"){let n=await e.LanguageModel.availability();if(n==="readily"||n==="available"||n==="downloadable")return!0}else return!0}catch{}if(e.Summarizer)try{let n=await e.Summarizer.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}if(e.Rewriter)try{let n=await e.Rewriter.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}if(e.Writer)try{let n=await e.Writer.availability?.();if(!n||n==="readily"||n==="available")return!0}catch{}let t=e.ai||globalThis.ai;if(t){if(t.languageModel?.availability)try{let n=await t.languageModel.availability();if(n==="readily"||n==="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 qt({position:e="left",children:t,config:n={},showRag:o=!1,showAgent:r=!1}){let[a,i]=re(!1),[s,c]=re(Bt),[b,g]=re(null),[w,E]=re(!1),[O,W]=re(!1),[G,A]=re(!1),B=wr.useRef(null),[y,S]=re(!1),[R,m]=re(""),[M,x]=re(""),[N,se]=re(!1),[q,Q]=re(null),[k,l]=re("idle"),[X,$]=re(!1),[H,J]=re(""),[ie,C]=re(""),[P,u]=re(!1),[v,U]=re([]),[L,ne]=re(null),le=24,ge=84,Ce=o?144:84,Xt=204,[me,We]=re(!1);Ue(()=>{if(typeof window>"u")return;let f=window;!!(f.LanguageModel||f.ai?.languageModel)&&O?(Q("gemini"),ne("gemini")):dt()&&(Q("transformers"),ne("transformers"))},[O]),Ue(()=>{if(q!=="transformers")return;let f=setInterval(()=>l(ct()),500);return()=>clearInterval(f)},[q]);let Ke=je(async()=>{if(!(!R.trim()||N)){if(!q){x("\u26A0\uFE0F No AI engine available.");return}se(!0),x("");try{let f;if(q==="gemini"){let{askPage:Z}=await import("./rag-MKBAGH6J.mjs");f=await Z(R)}else{l("loading");let{askPageWithTransformers:Z}=await import("./transformers-rag-HW4QKA5T.mjs");f=await Z(R),l("ready")}x(f.success&&f.answer?f.answer.replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/#+\s/g,"").trim():"\u26A0\uFE0F "+(f.error||"No answer found."))}catch{x("\u26A0\uFE0F Something went wrong.")}se(!1)}},[R,N,q]),at=je(async()=>{if(!H.trim()||P)return;if(!L){C("\u26A0\uFE0F No AI engine available.");return}u(!0),U([]),C("");let{runAgent:f}=await import("./agent-JGLAYQMX.mjs");await f(H,L,Z=>{U(Ae=>[...Ae,Z.text])}),u(!1),C("done")},[H,P,L]);Ue(()=>{if(typeof window>"u")return;let Z=setTimeout(async()=>{let Ae=window,It=await kr();W(It),A(!!(Ae.SpeechRecognition||Ae.webkitSpeechRecognition))},800);return()=>clearTimeout(Z)},[]),Ue(()=>{if(!(typeof window>"u"))try{let f=localStorage.getItem("yuktai-a11y-prefs");f&&c(Z=>({...Z,...JSON.parse(f)}))}catch{}},[]);let Ie=je(async f=>{let Z={enabled:!0,highContrast:f.highContrast,darkMode:f.darkMode,reduceMotion:f.reduceMotion,largeTargets:f.largeTargets,speechEnabled:f.speechEnabled,autoFix:f.autoFix,dyslexiaFont:f.dyslexiaFont,localFont:f.localFont,fontSizeMultiplier:f.fontScale/100,colorBlindMode:f.colorBlindMode,showAuditBadge:f.showAuditBadge,showSkipLinks:!0,showPreferencePanel:!1,plainEnglish:f.plainEnglish,summarisePage:f.summarisePage,translateLanguage:f.translateLanguage,voiceControl:f.voiceControl,smartLabels:f.smartLabels,...n};await he.execute(Z),g(he.applyFixes(Z)),E(!0)},[n]),fe=je(async()=>{try{localStorage.setItem("yuktai-a11y-prefs",JSON.stringify(s))}catch{}await Ie(s),i(!1)},[s,Ie]),Re=je(()=>{c(Bt);try{localStorage.removeItem("yuktai-a11y-prefs")}catch{}let f=document.documentElement;["data-yuktai-high-contrast","data-yuktai-dark","data-yuktai-reduce-motion","data-yuktai-large-targets","data-yuktai-keyboard","data-yuktai-dyslexia"].forEach(Z=>f.removeAttribute(Z)),document.body.style.filter="",document.body.style.fontFamily="",document.documentElement.style.fontSize="",g(null),E(!1)},[]),Ze=je((f,Z)=>{c(Ae=>({...Ae,[f]:Z}))},[]);Ue(()=>{let f=Z=>{Z.key==="Escape"&&(a&&i(!1),y&&S(!1),X&&$(!1),me&&We(!1))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[a,y,X]),Ue(()=>{a&&B.current&&he.trapFocus(B.current)},[a]);let Me=(f,Z,Ae)=>({position:"fixed",bottom:`${f}px`,[e]:"24px",zIndex:9998,width:"52px",height:"52px",borderRadius:"50%",background:Z,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"}),$e=f=>{f.currentTarget.style.transform="scale(1.08)"},Ee=f=>{f.currentTarget.style.transform="scale(1)"},De=q==="gemini"?"Gemini Nano \xB7 On device":q==="transformers"?"Transformers.js \xB7 All devices":"Detecting...",st=q==="transformers"&&k==="loading"?"Loading model...":"...";return ke(vr,{children:[t,r&&K("button",{style:Me(204,me?"#d97706":"#f59e0b",me),"aria-label":"Open Vibe Coder",title:"\u26A1 Vibe Coder \u2014 Generate Next.js project",onClick:()=>{We(f=>!f),$(!1),S(!1),i(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u26A1"}),r&&me&&K(_t,{position:e,onClose:()=>We(!1)}),r&&K("button",{style:Me(Ce,X?"#059669":"#10b981",X),"aria-label":"Open AI agent","aria-haspopup":"dialog","aria-expanded":X,title:"\u{1F916} AI Agent \u2014 guide me through this page",onClick:()=>{$(f=>!f),S(!1),i(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u{1F916}"}),r&&X&&ke("div",{role:"dialog","aria-modal":"true","aria-label":"yuktai AI Agent","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${Ce+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:[ke("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[ke("div",{children:[K("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F916} AI Agent"}),K("p",{style:{margin:0,fontSize:"10px",color:"#10b981"},children:L==="gemini"?"Gemini Nano \xB7 On device":L==="transformers"?"Transformers.js \xB7 All devices":"Detecting..."})]}),K("button",{onClick:()=>$(!1),"aria-label":"Close agent panel",style:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",fontSize:"18px",lineHeight:1,padding:"2px"},children:"\xD7"})]}),K("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."}),K("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(f=>K("button",{onClick:()=>J(f),style:{padding:"3px 8px",borderRadius:"20px",fontSize:"10px",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#64748b",cursor:"pointer"},children:f},f))}),ke("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[K("input",{type:"text",value:H,onChange:f=>J(f.target.value),onKeyDown:f=>{f.key==="Enter"&&at()},placeholder:"e.g. Help me fill this form",disabled:P||!L,"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:L?"#fff":"#f8fafc",outline:"none",height:"36px"}}),K("button",{onClick:at,disabled:P||!H.trim()||!L,"aria-label":"Run agent",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:L&&H.trim()&&!P?"#10b981":"#e2e8f0",color:L&&H.trim()&&!P?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:L&&H.trim()&&!P?"pointer":"not-allowed",height:"36px",minWidth:"52px",transition:"background 0.2s"},children:P?"...":"Go"})]}),v.length>0&&ke("div",{style:{padding:"10px 12px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:"8px",fontSize:"11px",color:"#166534",lineHeight:1.7},children:[v.map((f,Z)=>K("p",{style:{margin:"0 0 2px"},children:f},Z)),ie==="done"&&K("button",{onClick:()=>{U([]),J(""),C("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!L&&K("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Enable Gemini Nano via chrome://flags for best results."})]}),o&&K("button",{style:Me(ge,y?"#7c3aed":"#6d28d9",y),"aria-label":"Ask a question about this page","aria-haspopup":"dialog","aria-expanded":y,title:`\u{1F4AC} Ask this page \xB7 ${De}`,onClick:()=>{S(f=>!f),i(!1),$(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u{1F4AC}"}),o&&y&&ke("div",{role:"dialog","aria-modal":"true","aria-label":"Ask this page","data-yuktai-panel":"true",style:{position:"fixed",bottom:`${ge+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:[ke("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"10px"},children:[ke("div",{children:[K("p",{style:{margin:"0 0 2px",fontSize:"13px",fontWeight:600,color:"#0f172a"},children:"\u{1F4AC} Ask this page"}),K("p",{style:{margin:0,fontSize:"10px",color:"#7c3aed"},children:De}),q==="transformers"&&k==="loading"&&K("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#94a3b8"},children:"Downloading model \u2014 first time only"}),q==="transformers"&&k==="ready"&&K("p",{style:{margin:"2px 0 0",fontSize:"9px",color:"#10b981"},children:"Model ready \u2705 \u2014 works offline"})]}),K("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"})]}),ke("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[K("input",{type:"text",value:R,onChange:f=>m(f.target.value),onKeyDown:f=>{f.key==="Enter"&&Ke()},placeholder:"e.g. What does this page do?",disabled:N||!q,"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:q?"#fff":"#f8fafc",outline:"none",height:"36px"}}),K("button",{onClick:Ke,disabled:N||!R.trim()||!q,"aria-label":"Submit question",style:{padding:"8px 12px",borderRadius:"8px",border:"none",background:q&&R.trim()&&!N?"#7c3aed":"#e2e8f0",color:q&&R.trim()&&!N?"#fff":"#94a3b8",fontSize:"12px",fontWeight:600,cursor:q&&R.trim()&&!N?"pointer":"not-allowed",height:"36px",minWidth:"48px",transition:"background 0.2s"},children:N?st:"Ask"})]}),M&&ke("div",{style:{padding:"10px",background:"#f5f3ff",borderRadius:"8px",fontSize:"12px",color:"#4c1d95",lineHeight:1.6,maxHeight:"180px",overflowY:"auto"},children:[K("strong",{style:{display:"block",marginBottom:"4px",fontSize:"11px",color:"#7c3aed"},children:"\u{1F4AC} Answer"}),M,K("button",{onClick:()=>{x(""),m("")},style:{display:"block",marginTop:"6px",background:"none",border:"none",color:"#94a3b8",fontSize:"10px",cursor:"pointer",padding:0},children:"Clear"})]}),!q&&K("p",{style:{margin:"4px 0 0",fontSize:"10px",color:"#94a3b8"},children:"Detecting AI engine..."})]}),K("button",{style:Me(le,w?"#0d9488":"#1a73e8",a),"aria-label":"Open accessibility preferences","aria-haspopup":"dialog","aria-expanded":a,"data-yuktai-pref-toggle":"true",title:"\u267F Accessibility settings",onClick:()=>{i(f=>!f),S(!1),$(!1)},onMouseEnter:$e,onMouseLeave:Ee,children:"\u267F"}),a&&K(Ht,{ref:B,position:e,settings:s,report:b,isActive:w,aiSupported:O,voiceSupported:G,set:Ze,onApply:fe,onReset:Re,onClose:()=>i(!1)})]})}var wt={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};var kt={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};var Ne=class{plugins=new Map;register(t,n){if(!n||typeof n.execute!="function")throw new Error(`Invalid plugin: ${t}`);this.plugins.set(t,n)}use(t){return this.plugins.get(t)}async run(t,n){try{let o=this.use(t);if(!o)throw new Error(`Plugin not found: ${t}`);return await o.execute(n)}catch(o){throw console.error(`[YuktAI Runtime Error in ${t}]:`,o),o}}getPlugins(){return Array.from(this.plugins.keys())}};import{useCallback as Zt,useEffect as Rt,useMemo as Ve,useState as Pe}from"react";import{useCallback as Ut,useEffect as Je,useMemo as zn,useRef as Wn,useState as Ge}from"react";import{Fragment as Pr,jsx as h,jsxs as pe}from"react/jsx-runtime";var $n={"en-US":{title:"Grid AI Assistant",subtitle:"Ask about your data",ask:"Ask",placeholder:"Ask or type a command...",listening:"Listening...",send:"Send",close:"Close",open:"Open AI assistant",inputLanguage:"Input language",speakNow:"Speak your question",working:"Working on it\u2026",english:"English",telugu:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41",searchStarted:e=>`Searching for "${e}".`,sortedAscending:e=>`Sorted by ${e} in ascending order.`,sortedDescending:e=>`Sorted by ${e} in descending order.`,count:e=>`There are ${e} rows in the grid.`,highest:(e,t,n)=>`The highest ${e} is ${t}, held by ${n}.`,lowest:(e,t,n)=>`The lowest ${e} is ${t}, held by ${n}.`,average:(e,t)=>`The average ${e} is ${t}.`,total:(e,t)=>`The total ${e} is ${t}.`,noData:"There is no data to analyze.",noColumn:"I could not find a column to analyze.",noNumericData:e=>`There is no numeric data in ${e}.`,notFound:e=>`I could not find anything matching "${e}".`,needName:"Please provide a value to look up.",fallback:"I can search, sort, count, and analyze the grid data.",unsupportedVoice:"Voice input is not supported in this browser."},"te-IN":{title:"\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D AI \u0C38\u0C39\u0C3E\u0C2F\u0C15\u0C41\u0C21\u0C41",subtitle:"\u0C2E\u0C40 \u0C21\u0C47\u0C1F\u0C3E \u0C17\u0C41\u0C30\u0C3F\u0C02\u0C1A\u0C3F \u0C05\u0C21\u0C17\u0C02\u0C21\u0C3F",ask:"\u0C05\u0C21\u0C17\u0C02\u0C21\u0C3F",placeholder:"\u0C2A\u0C4D\u0C30\u0C36\u0C4D\u0C28 \u0C32\u0C47\u0C26\u0C3E \u0C06\u0C26\u0C47\u0C36\u0C02 \u0C1F\u0C48\u0C2A\u0C4D \u0C1A\u0C47\u0C2F\u0C02\u0C21\u0C3F...",listening:"\u0C35\u0C3F\u0C02\u0C1F\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41...",send:"\u0C2A\u0C02\u0C2A\u0C02\u0C21\u0C3F",close:"\u0C2E\u0C42\u0C38\u0C3F\u0C35\u0C47\u0C2F\u0C02\u0C21\u0C3F",open:"AI \u0C38\u0C39\u0C3E\u0C2F\u0C15\u0C41\u0C21\u0C3F\u0C28\u0C3F \u0C24\u0C46\u0C30\u0C35\u0C02\u0C21\u0C3F",inputLanguage:"\u0C07\u0C28\u0C4D\u200C\u0C2A\u0C41\u0C1F\u0C4D \u0C2D\u0C3E\u0C37",speakNow:"\u0C2E\u0C40 \u0C2A\u0C4D\u0C30\u0C36\u0C4D\u0C28 \u0C1A\u0C46\u0C2A\u0C4D\u0C2A\u0C02\u0C21\u0C3F",working:"\u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41\u2026",english:"English",telugu:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41",searchStarted:e=>`\u201C${e}\u201D \u0C15\u0C4B\u0C38\u0C02 \u0C36\u0C4B\u0C27\u0C3F\u0C38\u0C4D\u0C24\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41.`,sortedAscending:e=>`${e}\u0C28\u0C41 \u0C06\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C3E\u0C28\u0C41.`,sortedDescending:e=>`${e}\u0C28\u0C41 \u0C05\u0C35\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C3E\u0C28\u0C41.`,count:e=>`\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D\u200C\u0C32\u0C4B \u0C2E\u0C4A\u0C24\u0C4D\u0C24\u0C02 ${e} \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41 \u0C09\u0C28\u0C4D\u0C28\u0C3E\u0C2F\u0C3F.`,highest:(e,t,n)=>`\u0C05\u0C24\u0C4D\u0C2F\u0C27\u0C3F\u0C15 ${e} \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}. \u0C07\u0C26\u0C3F ${n}\u0C15\u0C41 \u0C38\u0C02\u0C2C\u0C02\u0C27\u0C3F\u0C02\u0C1A\u0C3F\u0C28\u0C26\u0C3F.`,lowest:(e,t,n)=>`\u0C05\u0C24\u0C4D\u0C2F\u0C32\u0C4D\u0C2A ${e} \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}. \u0C07\u0C26\u0C3F ${n}\u0C15\u0C41 \u0C38\u0C02\u0C2C\u0C02\u0C27\u0C3F\u0C02\u0C1A\u0C3F\u0C28\u0C26\u0C3F.`,average:(e,t)=>`${e} \u0C38\u0C17\u0C1F\u0C41 \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}.`,total:(e,t)=>`${e} \u0C2E\u0C4A\u0C24\u0C4D\u0C24\u0C02 \u0C35\u0C3F\u0C32\u0C41\u0C35 ${t}.`,noData:"\u0C35\u0C3F\u0C36\u0C4D\u0C32\u0C47\u0C37\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C21\u0C47\u0C1F\u0C3E \u0C32\u0C47\u0C26\u0C41.",noColumn:"\u0C35\u0C3F\u0C36\u0C4D\u0C32\u0C47\u0C37\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C24\u0C17\u0C3F\u0C28 \u0C15\u0C3E\u0C32\u0C2E\u0C4D \u0C15\u0C28\u0C2C\u0C21\u0C32\u0C47\u0C26\u0C41.",noNumericData:e=>`${e}\u0C32\u0C4B \u0C38\u0C02\u0C16\u0C4D\u0C2F\u0C3E \u0C38\u0C2E\u0C3E\u0C1A\u0C3E\u0C30\u0C02 \u0C32\u0C47\u0C26\u0C41.`,notFound:e=>`\u201C${e}\u201D\u0C15\u0C41 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C32\u0C47 \u0C38\u0C2E\u0C3E\u0C1A\u0C3E\u0C30\u0C02 \u0C15\u0C28\u0C2C\u0C21\u0C32\u0C47\u0C26\u0C41.`,needName:"\u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C12\u0C15 \u0C35\u0C3F\u0C32\u0C41\u0C35 \u0C07\u0C35\u0C4D\u0C35\u0C02\u0C21\u0C3F.",fallback:"\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D\u200C\u0C32\u0C4B \u0C36\u0C4B\u0C27\u0C28, \u0C15\u0C4D\u0C30\u0C2E\u0C2C\u0C26\u0C4D\u0C27\u0C40\u0C15\u0C30\u0C23, \u0C32\u0C46\u0C15\u0C4D\u0C15\u0C3F\u0C02\u0C2A\u0C41 \u0C2E\u0C30\u0C3F\u0C2F\u0C41 \u0C21\u0C47\u0C1F\u0C3E \u0C35\u0C3F\u0C36\u0C4D\u0C32\u0C47\u0C37\u0C23 \u0C1A\u0C47\u0C2F\u0C17\u0C32\u0C28\u0C41.",unsupportedVoice:"\u0C08 \u0C2C\u0C4D\u0C30\u0C4C\u0C1C\u0C30\u0C4D\u200C\u0C32\u0C4B \u0C35\u0C3E\u0C2F\u0C3F\u0C38\u0C4D \u0C07\u0C28\u0C4D\u200C\u0C2A\u0C41\u0C1F\u0C4D\u200C\u0C15\u0C41 \u0C2E\u0C26\u0C4D\u0C26\u0C24\u0C41 \u0C32\u0C47\u0C26\u0C41."}};function ve(e){return e.toLowerCase().trim().replace(/\s+/g," ")}function Sr(e,t){let n=ve(e);if(t==="te-IN")return/^(శోధించు|శోధించండి|వెతుకు|వెతకండి|చూపించు|చూపించండి|ఫిల్టర్)/.test(n)?{type:"search",payload:n.replace(/^(శోధించు|శోధించండి|వెతుకు|వెతకండి|చూపించు|చూపించండి|ఫిల్టర్)\s*/u,"").trim()||e}:/క్రమబద్ధీకర|అమర్చ|సార్ట్/.test(n)?{type:"sort",payload:{key:void 0,dir:/అవరోహణ|పెద్ద|అధిక|చివర/.test(n)?"desc":"asc"}}:/ఎన్ని|ఎంతమంది|లెక్క|మొత్తం వరుస|వరుసలు/.test(n)?{type:"question",payload:e}:/అత్యధిక|గరిష్ఠ|పెద్ద|ఎక్కువ/.test(n)?{type:"question",payload:e}:/అత్యల్ప|కనిష్ఠ|చిన్న|తక్కువ/.test(n)?{type:"question",payload:e}:/సగటు|సగటు విలువ/.test(n)?{type:"question",payload:e}:/మొత్తం|కలిపి/.test(n)?{type:"question",payload:e}:{type:"search",payload:e};if(/^(search|find|show|filter)/.test(n))return{type:"search",payload:n.replace(/^(search|find|show|filter)\s+(for\s+|by\s+)?/,"").trim()||e};if(/sort/.test(n)){let o=/desc|descending|high|higher|large|largest|top/.test(n);return{type:"sort",payload:{key:n.match(/(?:by|on)\s+([a-z0-9_-]+)/)?.[1],dir:o?"desc":"asc"}}}return/how many|count|highest|maximum|max|top|largest|lowest|minimum|min|smallest|bottom|average|avg|mean|sum|total|who|which|where|whose/.test(n)?{type:"question",payload:e}:{type:"search",payload:e}}function Dn(e,t){let n=ve(e);return t.find(o=>{let r=ve(o.key),a=ve(o.label);return n.includes(r)||n.includes(a)})}function vt(e,t){return e.toLocaleString(t==="te-IN"?"te-IN":"en-IN")}function Tr(e,t,n,o){let r=$n[o];if(t.length===0)return r.noData;let a=ve(e),i=n.filter(y=>y.type==="number"),s=Dn(e,n),c=s?.type==="number"?s:i[0],b=/how many|count|rows|ఎన్ని|ఎంతమంది|లెక్క|వరుసలు/.test(a);if(b)return r.count(t.length);if(/highest|maximum|max|top|largest|అత్యధిక|గరిష్ఠ|పెద్ద|ఎక్కువ/.test(a)){let y=s??c;if(!y)return r.noColumn;let S=t.map(x=>({row:x,value:Number(x[y.key])})).filter(x=>!Number.isNaN(x.value)).sort((x,N)=>N.value-x.value);if(S.length===0)return r.noNumericData(y.label);let R=S[0],m=n.find(x=>x.key==="name"||ve(x.label)==="name"),M=m?String(R.row[m.key]??""):o==="te-IN"?"\u0C08 \u0C35\u0C30\u0C41\u0C38":"this row";return r.highest(y.label,vt(R.value,o),M)}if(/lowest|minimum|min|smallest|bottom|అత్యల్ప|కనిష్ఠ|చిన్న|తక్కువ/.test(a)){let y=s??c;if(!y)return r.noColumn;let S=t.map(x=>({row:x,value:Number(x[y.key])})).filter(x=>!Number.isNaN(x.value)).sort((x,N)=>x.value-N.value);if(S.length===0)return r.noNumericData(y.label);let R=S[0],m=n.find(x=>x.key==="name"||ve(x.label)==="name"),M=m?String(R.row[m.key]??""):o==="te-IN"?"\u0C08 \u0C35\u0C30\u0C41\u0C38":"this row";return r.lowest(y.label,vt(R.value,o),M)}if(/average|avg|mean|సగటు/.test(a)){let y=s??c;if(!y)return r.noColumn;let S=t.map(m=>Number(m[y.key])).filter(m=>!Number.isNaN(m));if(S.length===0)return r.noNumericData(y.label);let R=S.reduce((m,M)=>m+M,0)/S.length;return r.average(y.label,vt(Math.round(R*100)/100,o))}if(/sum|total|మొత్తం|కలిపి/.test(a)&&!b){let y=s??c;if(!y)return r.noColumn;let S=t.map(m=>Number(m[y.key])).filter(m=>!Number.isNaN(m));if(S.length===0)return r.noNumericData(y.label);let R=S.reduce((m,M)=>m+M,0);return r.total(y.label,vt(R,o))}let W=a.match(/[\p{L}\p{N}_-]+/gu)??[],G=new Set(["who","what","which","where","whose","is","the","has","have","show","find","search","for","by","about"]),B=W.filter(y=>!G.has(y)).join(" ").trim();if(B){let y=t.find(S=>Object.values(S).some(R=>String(R??"").toLowerCase().includes(B.toLowerCase())));return y?n.map(S=>`${S.label}: ${String(y[S.key]??"")}`).join(o==="te-IN"?" \xB7 ":", "):r.notFound(B)}return r.fallback}function Ar(e,t){if(typeof window>"u"||!window.speechSynthesis)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(e);n.lang=t,n.rate=1,n.pitch=1,window.speechSynthesis.speak(n)}function Cr(e){let[t,n]=Ge(!1),[o,r]=Ge(""),[a,i]=Ge(!0),s=Wn(null);Je(()=>{if(typeof window>"u")return;let g=window.SpeechRecognition||window.webkitSpeechRecognition;if(!g){i(!1),s.current=null;return}let w=new g;return w.continuous=!1,w.interimResults=!1,w.lang=e,w.onresult=E=>{let O=E?.results?.[0]?.[0]?.transcript??"";r(O),n(!1)},w.onerror=()=>{n(!1)},w.onend=()=>{n(!1)},s.current=w,()=>{try{w.stop()}catch{}s.current=null}},[e]);let c=Ut(()=>{if(s.current){r(""),n(!0);try{s.current.start()}catch{n(!1)}}},[]),b=Ut(()=>{try{s.current?.stop()}catch{}n(!1)},[]);return{listening:t,transcript:o,supported:a,start:c,stop:b}}function Rr(){return pe("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h("circle",{cx:"11",cy:"11",r:"6.5"}),h("path",{d:"m16 16 5 5"})]})}function Ir(){return pe("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h("rect",{x:"8",y:"3",width:"8",height:"12",rx:"4"}),h("path",{d:"M5 11a7 7 0 0 0 14 0"}),h("path",{d:"M12 18v3"}),h("path",{d:"M8 21h8"})]})}function Er(){return pe("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h("path",{d:"m4 4 16 8-16 8 4-8-4-8Z"}),h("path",{d:"M8 12h12"})]})}function Gr(){return pe("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h("path",{d:"m6 6 12 12"}),h("path",{d:"m18 6-12 12"})]})}function Lr({data:e,columns:t,onSearch:n,onSort:o,theme:r="light",language:a="en-US",inputLanguage:i="en-US",embedded:s=!1,agent:c,onInputLanguageChange:b}){let g=$n[a],[w,E]=Ge(i);Je(()=>{E(i)},[i]);let[O,W]=Ge(!1),G=r==="dark",[A,B]=Ge(s),[y,S]=Ge(""),[R,m]=Ge([]),M=Wn(null),{listening:x,transcript:N,supported:se,start:q,stop:Q}=Cr(w),k=zn(()=>({bg:G?"#0F172A":"#FFFFFF",surface:G?"#1E293B":"#F8FAFC",border:G?"#334155":"#E2E8F0",text:G?"#F1F5F9":"#0F172A",muted:G?"#94A3B8":"#64748B",accent:"#10B981",userMsg:G?"#334155":"#DBEAFE",aiMsg:G?"#1E293B":"#F0FDF4"}),[G]),l=zn(()=>({role:"ai",text:a==="te-IN"?"\u0C2E\u0C40 \u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D \u0C21\u0C47\u0C1F\u0C3E \u0C17\u0C41\u0C30\u0C3F\u0C02\u0C1A\u0C3F \u0C2A\u0C4D\u0C30\u0C36\u0C4D\u0C28 \u0C05\u0C21\u0C17\u0C02\u0C21\u0C3F.":"Ask me about your grid data.",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),[a]);Je(()=>{m(C=>C.length>0?C:[l])},[l]),Je(()=>{M.current?.scrollIntoView({behavior:"smooth"})},[R]);let X=()=>new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),$=Ut(async C=>{let P=C.trim();if(!P)return;m(v=>[...v,{role:"user",text:P,time:X()}]),S("");let u="";if(c){W(!0);try{u=(await c.ask(P)).message}catch{u=g.fallback}finally{W(!1)}}else{let v=Sr(P,a);if(v.type==="question")u=Tr(v.payload??P,e,t,a);else if(v.type==="search"){let U=String(v.payload??P);n?.(U),u=g.searchStarted(U)}else if(v.type==="sort"){let U=v.payload?.key,L=U?t.find(ne=>ve(ne.key)===ve(U)||ve(ne.label)===ve(U)):void 0;if(L||(L=Dn(P,t)),L&&o){let ne=v.payload?.dir==="desc"?"desc":"asc";o(String(L.key),ne),u=ne==="asc"?g.sortedAscending(L.label):g.sortedDescending(L.label)}else u=g.noColumn}}u||(u=g.fallback),m(v=>[...v,{role:"ai",text:u,time:X()}]),Ar(u,a)},[c,t,e,a,n,o,g]);Je(()=>{N&&$(N)},[N,$]);let H=()=>{$(y)},J=a==="te-IN"?["\u0C0E\u0C28\u0C4D\u0C28\u0C3F \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41","\u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F","\u0C15\u0C4D\u0C30\u0C2E\u0C02"]:["how many rows","search","sort"],ie=pe("div",{style:{width:s?"100%":360,maxWidth:s?"100%":"calc(100vw - 48px)",height:s?390:480,maxHeight:"70vh",background:k.bg,border:`1px solid ${k.border}`,borderRadius:s?12:16,boxShadow:s?"none":"0 20px 40px rgba(0,0,0,0.15)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[pe("div",{style:{padding:"12px 14px",background:k.accent,color:"#FFFFFF",display:"flex",alignItems:"center",gap:10},children:[h("div",{style:{width:34,height:34,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.18)",fontSize:17},children:"AI"}),pe("div",{style:{flex:1,minWidth:0},children:[h("div",{style:{fontWeight:700,fontSize:14},children:g.title}),h("div",{style:{fontSize:11,opacity:.9},children:g.subtitle})]}),!s&&h("button",{type:"button",onClick:()=>B(!1),"aria-label":g.close,title:g.close,style:{width:32,height:32,border:"none",borderRadius:8,background:"rgba(255,255,255,0.12)",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:h(Gr,{})})]}),pe("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${k.border}`,display:"flex",alignItems:"center",gap:8,background:k.surface},children:[h("span",{style:{fontSize:11,color:k.muted},children:g.inputLanguage}),pe("select",{value:w,onChange:C=>{let P=C.target.value;E(P),b?.(P)},disabled:x,"aria-label":g.inputLanguage,style:{padding:"5px 8px",borderRadius:7,border:`1px solid ${k.border}`,background:k.bg,color:k.text,fontSize:11},children:[h("option",{value:"en-US",children:"English (US)"}),h("option",{value:"en-IN",children:"English (India)"}),h("option",{value:"as-IN",children:"Assamese"}),h("option",{value:"bn-IN",children:"Bengali"}),h("option",{value:"brx-IN",children:"Bodo"}),h("option",{value:"doi-IN",children:"Dogri"}),h("option",{value:"gu-IN",children:"Gujarati"}),h("option",{value:"hi-IN",children:"Hindi"}),h("option",{value:"kn-IN",children:"Kannada"}),h("option",{value:"ks-IN",children:"Kashmiri"}),h("option",{value:"kok-IN",children:"Konkani"}),h("option",{value:"mai-IN",children:"Maithili"}),h("option",{value:"ml-IN",children:"Malayalam"}),h("option",{value:"mni-IN",children:"Manipuri"}),h("option",{value:"mr-IN",children:"Marathi"}),h("option",{value:"ne-IN",children:"Nepali"}),h("option",{value:"or-IN",children:"Odia"}),h("option",{value:"pa-IN",children:"Punjabi"}),h("option",{value:"sa-IN",children:"Sanskrit"}),h("option",{value:"sat-IN",children:"Santali"}),h("option",{value:"sd-IN",children:"Sindhi"}),h("option",{value:"ta-IN",children:"Tamil"}),h("option",{value:"te-IN",children:"Telugu"}),h("option",{value:"ur-IN",children:"Urdu"})]})]}),pe("div",{style:{flex:1,overflowY:"auto",padding:10,display:"flex",flexDirection:"column",gap:8},children:[R.map((C,P)=>pe("div",{style:{alignSelf:C.role==="user"?"flex-end":"flex-start",maxWidth:"88%",padding:"8px 11px",borderRadius:11,background:C.role==="user"?k.userMsg:k.aiMsg,color:k.text,fontSize:13,lineHeight:1.5},children:[h("div",{children:C.text}),h("div",{style:{marginTop:3,fontSize:10,opacity:.55,textAlign:"right"},children:C.time})]},`${C.time}-${P}`)),x&&h("div",{style:{alignSelf:"flex-end",padding:"8px 11px",borderRadius:11,background:G?"#3F1D2E":"#FEE2E2",color:G?"#FCA5A5":"#991B1B",fontSize:13},children:g.listening}),(O||c?.loading)&&h("div",{role:"status","aria-live":"polite",style:{alignSelf:"flex-start",padding:"8px 11px",borderRadius:11,background:k.aiMsg,color:k.muted,fontSize:13},children:g.working}),h("div",{ref:M})]}),h("div",{style:{padding:"7px 10px",borderTop:`1px solid ${k.border}`,display:"flex",gap:6,overflowX:"auto",flexShrink:0},children:J.map(C=>h("button",{type:"button",onClick:()=>$(C),style:{padding:"5px 9px",borderRadius:12,border:`1px solid ${k.border}`,background:k.surface,color:k.text,fontSize:10.5,cursor:"pointer",whiteSpace:"nowrap"},children:C},C))}),pe("div",{style:{padding:9,display:"flex",gap:6,borderTop:`1px solid ${k.border}`,background:k.surface},children:[pe("div",{style:{position:"relative",flex:1},children:[h(Rr,{}),h("input",{type:"text",value:y,onChange:C=>S(C.target.value),onKeyDown:C=>{C.key==="Enter"&&H()},placeholder:g.placeholder,"aria-label":g.ask,style:{width:"100%",boxSizing:"border-box",padding:"9px 10px 9px 34px",borderRadius:8,border:`1px solid ${k.border}`,background:k.bg,color:k.text,fontSize:12,outline:"none"}})]}),se?h("button",{type:"button",onClick:x?Q:q,"aria-label":x?g.listening:g.speakNow,title:x?g.listening:g.speakNow,style:{width:38,height:38,border:"none",borderRadius:8,background:x?"#EF4444":k.accent,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0},children:h(Ir,{})}):null,h("button",{type:"button",onClick:H,disabled:!y.trim(),"aria-label":g.send,title:g.send,style:{width:38,height:38,border:"none",borderRadius:8,background:y.trim()?k.accent:k.muted,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:y.trim()?"pointer":"not-allowed",opacity:y.trim()?1:.6,flexShrink:0},children:h(Er,{})})]})]});return s?h("div",{style:{width:"100%",minWidth:0},children:A?ie:pe("button",{type:"button",onClick:()=>B(!0),"aria-label":g.open,style:{minHeight:40,padding:"8px 13px",borderRadius:9,border:"1px solid #10B981",background:G?"#064E3B":"#ECFDF5",color:G?"#A7F3D0":"#047857",display:"inline-flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:12,fontWeight:600},children:[h("span",{"aria-hidden":"true",children:"AI"}),g.ask]})}):pe(Pr,{children:[!A&&h("button",{type:"button",onClick:()=>B(!0),"aria-label":g.open,title:g.title,style:{position:"fixed",bottom:24,right:24,zIndex:9998,width:56,height:56,borderRadius:28,background:k.accent,color:"#FFFFFF",border:"none",cursor:"pointer",boxShadow:"0 8px 20px rgba(16,185,129,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:14},children:"AI"}),A&&h("div",{style:{position:"fixed",bottom:90,right:24,zIndex:9997},children:ie}),h("style",{children:`
|
|
386
386
|
@keyframes yuktai-ai-pulse {
|
|
387
387
|
0%, 100% {
|
|
388
388
|
transform: scale(1);
|
|
389
389
|
}
|
|
390
|
+
|
|
390
391
|
50% {
|
|
391
392
|
transform: scale(1.05);
|
|
392
393
|
}
|
|
393
394
|
}
|
|
394
|
-
`})]})}var jt=Lr;import{useCallback as rt,useEffect as Dr,useRef as Yt,useState as Tt}from"react";var Fr={en:{found:e=>`${e} row(s) found.`,count:e=>`${e} row(s).`,columns:"Grid columns retrieved.",rowFound:"Row found.",notFound:e=>`Row "${e}" not found.`,noneFound:"None of the given rows were found.",highlighted:e=>`${e} row(s) highlighted.`,selected:e=>`Row "${e}" selected.`,opened:e=>`Row "${e}" opened.`,notSupported:e=>`This grid does not support "${e}".`,emptyQuery:"Please enter something to search.",noIds:"No row IDs were given.",unknownColumn:e=>`Unknown column "${e}".`,badOperator:e=>`Unknown filter operator "${e}".`,badValue:"The filter value is not valid for this column.",filtered:e=>`Filter applied: ${e} row(s) match.`,filtersCleared:"All filters cleared.",sorted:(e,t)=>`Sorted by ${e} (${t==="asc"?"ascending":"descending"}).`,sortCleared:"Sorting cleared.",internal:"Something went wrong while running this action."},te:{found:e=>`${e} \u0C35\u0C30\u0C41\u0C38(\u0C32\u0C41) \u0C26\u0C4A\u0C30\u0C3F\u0C15\u0C3E\u0C2F\u0C3F.`,count:e=>`\u0C2E\u0C4A\u0C24\u0C4D\u0C24\u0C02 ${e} \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41.`,columns:"\u0C15\u0C3E\u0C32\u0C2E\u0C4D\u200C\u0C32 \u0C35\u0C3F\u0C35\u0C30\u0C3E\u0C32\u0C41.",rowFound:"\u0C35\u0C30\u0C41\u0C38 \u0C26\u0C4A\u0C30\u0C3F\u0C15\u0C3F\u0C02\u0C26\u0C3F.",notFound:e=>`"${e}" \u0C35\u0C30\u0C41\u0C38 \u0C26\u0C4A\u0C30\u0C15\u0C32\u0C47\u0C26\u0C41.`,noneFound:"\u0C07\u0C1A\u0C4D\u0C1A\u0C3F\u0C28 \u0C35\u0C30\u0C41\u0C38\u0C32\u0C47\u0C35\u0C40 \u0C26\u0C4A\u0C30\u0C15\u0C32\u0C47\u0C26\u0C41.",highlighted:e=>`${e} \u0C35\u0C30\u0C41\u0C38(\u0C32\u0C41) \u0C39\u0C48\u0C32\u0C48\u0C1F\u0C4D \u0C1A\u0C47\u0C36\u0C3E\u0C28\u0C41.`,selected:e=>`"${e}" \u0C0E\u0C02\u0C1A\u0C41\u0C15\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41.`,opened:e=>`"${e}" \u0C24\u0C46\u0C30\u0C3F\u0C1A\u0C3E\u0C28\u0C41.`,notSupported:e=>`\u0C08 \u0C2A\u0C1F\u0C4D\u0C1F\u0C3F\u0C15\u0C32\u0C4B "${e}" \u0C38\u0C4C\u0C15\u0C30\u0C4D\u0C2F\u0C02 \u0C32\u0C47\u0C26\u0C41.`,emptyQuery:"\u0C35\u0C46\u0C24\u0C15\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C0F\u0C26\u0C48\u0C28\u0C3E \u0C30\u0C3E\u0C2F\u0C02\u0C21\u0C3F.",noIds:"\u0C35\u0C30\u0C41\u0C38 ID\u0C32\u0C41 \u0C07\u0C35\u0C4D\u0C35\u0C32\u0C47\u0C26\u0C41.",unknownColumn:e=>`"${e}" \u0C05\u0C28\u0C47 \u0C15\u0C3E\u0C32\u0C2E\u0C4D \u0C32\u0C47\u0C26\u0C41.`,badOperator:e=>`"${e}" \u0C05\u0C28\u0C47 \u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D \u0C35\u0C3F\u0C27\u0C3E\u0C28\u0C02 \u0C32\u0C47\u0C26\u0C41.`,badValue:"\u0C08 \u0C15\u0C3E\u0C32\u0C2E\u0C4D\u200C\u0C15\u0C3F \u0C08 \u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D \u0C35\u0C3F\u0C32\u0C41\u0C35 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C26\u0C41.",filtered:e=>`\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D \u0C35\u0C47\u0C36\u0C3E\u0C28\u0C41: ${e} \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C2F\u0C3E\u0C2F\u0C3F.`,filtersCleared:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C28\u0C4D\u0C28\u0C40 \u0C24\u0C40\u0C38\u0C47\u0C36\u0C3E\u0C28\u0C41.",sorted:(e,t)=>`${e} \u0C2A\u0C4D\u0C30\u0C15\u0C3E\u0C30\u0C02 \u0C15\u0C4D\u0C30\u0C2E\u0C02 (${t==="asc"?"\u0C06\u0C30\u0C4B\u0C39\u0C23":"\u0C05\u0C35\u0C30\u0C4B\u0C39\u0C23"}).`,sortCleared:"\u0C15\u0C4D\u0C30\u0C2E\u0C02 \u0C24\u0C40\u0C38\u0C47\u0C36\u0C3E\u0C28\u0C41.",internal:"\u0C08 \u0C2A\u0C28\u0C3F \u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C41\u0C02\u0C21\u0C17\u0C3E \u0C38\u0C2E\u0C38\u0C4D\u0C2F \u0C35\u0C1A\u0C4D\u0C1A\u0C3F\u0C02\u0C26\u0C3F."}};function xe(e){return Fr[e.locale??"en"]}function Se(e,t){return{success:!0,message:e,data:t}}function te(e,t){return{success:!1,message:t,error:{code:e}}}var Bn=["contains","equals","startsWith","endsWith","greaterThan","lessThan","between"];function et(e,t="id"){let n=e?.[t];return n==null?"":String(n)}function Ne(e){return String(e??"").normalize("NFC").toLowerCase().trim()}function Hn(e){if(typeof e=="number")return Number.isFinite(e)?e:null;let t=String(e??"").trim();if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:null}function _n(e){if(e instanceof Date)return e.getTime();let t=new Date(String(e??"")).getTime();return Number.isFinite(t)?t:null}function qn(e){return(Array.isArray(e)?e:typeof e=="string"?e.split(","):[]).map(n=>String(n).trim()).filter(Boolean)}function Vt(e,t){let n=Ne(t);return e.columns.find(o=>Ne(o.key)===n||Ne(o.label)===n)}function St(e,t){return e.data.find(n=>et(n,e.rowKey)===t)}function Mr(e,t){return e[t]}function zr(e,t,n){let o=Mr(e,n.key),r=n.type??"text";if(r==="number"||r==="date"){let s=r==="number"?Hn:_n,c=s(o);if(c===null)return!1;if(t.operator==="between"){let[g,x]=t.value,I=s(g),O=s(x);return I!==null&&O!==null&&c>=Math.min(I,O)&&c<=Math.max(I,O)}let b=s(t.value);if(b===null)return!1;switch(t.operator){case"equals":return c===b;case"greaterThan":return c>b;case"lessThan":return c<b;default:break}}let a=Ne(o),i=Ne(t.value);switch(t.operator){case"equals":return a===i;case"startsWith":return a.startsWith(i);case"endsWith":return a.endsWith(i);case"contains":return a.includes(i);default:return!1}}function Nr(e,t){let n=t.type??"text",o=n==="date"?_n:Hn;return e.operator==="between"?n==="text"||!Array.isArray(e.value)||e.value.length!==2?!1:o(e.value[0])!==null&&o(e.value[1])!==null:e.operator==="greaterThan"||e.operator==="lessThan"?n!=="text"&&o(e.value)!==null:!Array.isArray(e.value)&&String(e.value).trim()!==""}function tt(e,t,n){return n.length?Un({data:e,columns:t},n):e}function nt(e){return e.map(t=>({key:String(t.key),label:t.label,type:t.type==="number"?"number":t.type==="date"?"date":"text"}))}function Un(e,t){return e.data.filter(n=>t.every(o=>{let r=Vt(e,o.key);return r?zr(n,o,r):!0}))}function jn(e,t){let n=xe(e),o=Ne(t);if(!o)return te("INVALID_INPUT",n.emptyQuery);let r=e.data.filter(i=>e.columns.some(s=>Ne(i[s.key]).includes(o))),a=r.map(i=>et(i,e.rowKey)).filter(Boolean);return e.onHighlightRows?.(a),Se(n.found(r.length),r)}function Vn(e){return Se(xe(e).count(e.data.length),e.data.length)}function Yn(e){return Se(xe(e).columns,e.columns)}function Kn(e,t){let n=xe(e),o=String(t??"").trim();if(!o)return te("INVALID_INPUT",n.noIds);let r=St(e,o);return r?Se(n.rowFound,r):te("NOT_FOUND",n.notFound(o))}function Zn(e,t){let n=xe(e),o=qn(t);if(o.length===0)return te("INVALID_INPUT",n.noIds);if(!e.onHighlightRows)return te("NOT_SUPPORTED",n.notSupported("highlight"));let r=o.filter(a=>St(e,a)!==void 0);return r.length===0?te("NOT_FOUND",n.noneFound):(e.onHighlightRows(r),Se(n.highlighted(r.length),r))}function Qn(e,t){let n=xe(e),o=String(t??"").trim();return o?e.onSelectRow?St(e,o)?(e.onSelectRow(o),Se(n.selected(o),o)):te("NOT_FOUND",n.notFound(o)):te("NOT_SUPPORTED",n.notSupported("select")):te("INVALID_INPUT",n.noIds)}function Xn(e,t){let n=xe(e),o=String(t??"").trim();return o?e.onOpenRow?St(e,o)?(e.onOpenRow(o),Se(n.opened(o),o)):te("NOT_FOUND",n.notFound(o)):te("NOT_SUPPORTED",n.notSupported("open")):te("INVALID_INPUT",n.noIds)}function Jn(e,t){let n=xe(e),o=Vt(e,t?.key??"");if(!o)return te("INVALID_INPUT",n.unknownColumn(String(t?.key??"")));if(!Bn.includes(t.operator))return te("INVALID_INPUT",n.badOperator(String(t.operator)));let r={...t,key:o.key};if(!Nr(r,o))return te("INVALID_INPUT",n.badValue);if(!e.onFiltersChange)return te("NOT_SUPPORTED",n.notSupported("filter"));let a=[...(e.filters??[]).filter(s=>s.key!==o.key),r],i=Un(e,a).length;return e.onFiltersChange(a),Se(n.filtered(i),{filters:a,count:i})}function eo(e){let t=xe(e);return e.onFiltersChange?(e.onFiltersChange([]),Se(t.filtersCleared,[])):te("NOT_SUPPORTED",t.notSupported("clear filters"))}function to(e,t,n="asc"){let o=xe(e),r=Vt(e,t);if(!r)return te("INVALID_INPUT",o.unknownColumn(String(t)));if(n!=="asc"&&n!=="desc")return te("INVALID_INPUT",o.badValue);if(!e.onSortChange)return te("NOT_SUPPORTED",o.notSupported("sort"));let a={key:r.key,direction:n};return e.onSortChange(a),Se(o.sorted(r.label,n),a)}function no(e){let t=xe(e);return e.onSortChange?(e.onSortChange(null),Se(t.sortCleared,null)):te("NOT_SUPPORTED",t.notSupported("clear sort"))}var Wr={search:"Search all columns for text. Matching rows are highlighted.",count:"Count the rows currently in the grid.",columns:"List the grid's columns with their keys, labels and types.",get_row:"Get one row by its ID.",highlight:"Highlight one or more rows by ID without filtering the grid.",select:"Select one row by ID.",open:"Open one row by ID to show its full details.",filter:"Filter the grid by one column. Replaces any existing filter on that column.",clear_filters:"Remove all filters.",sort:"Sort the grid by one column, ascending or descending.",clear_sort:"Remove sorting."},On={en:{search:"Search",count:"Count",columns:"Columns",get_row:"Get row",highlight:"Highlight",select:"Select",open:"Open",filter:"Filter",clear_filters:"Clear filters",sort:"Sort",clear_sort:"Clear sort"},te:{search:"\u0C35\u0C46\u0C24\u0C41\u0C15\u0C41",count:"\u0C32\u0C46\u0C15\u0C4D\u0C15",columns:"\u0C15\u0C3E\u0C32\u0C2E\u0C4D\u200C\u0C32\u0C41",get_row:"\u0C35\u0C30\u0C41\u0C38 \u0C1A\u0C42\u0C2A\u0C41",highlight:"\u0C39\u0C48\u0C32\u0C48\u0C1F\u0C4D",select:"\u0C0E\u0C02\u0C1A\u0C41\u0C15\u0C4B",open:"\u0C24\u0C46\u0C30\u0C41\u0C35\u0C41",filter:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D",clear_filters:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C41 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C3F",sort:"\u0C15\u0C4D\u0C30\u0C2E\u0C02",clear_sort:"\u0C15\u0C4D\u0C30\u0C2E\u0C02 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C3F"}};async function $r(e,t){try{return t()}catch{return te("INTERNAL",xe(e).internal)}}function ot(e,t={}){let n=t.name??"yuktai_grid",o=On[e.locale??"en"],r=c=>t.descriptions?.[c]??Wr[c],a={id:{type:"string",description:"Row ID"}},i=e.columns.map(c=>c.key);return[{id:"search",available:!0,schema:{type:"object",properties:{query:{type:"string"}},required:["query"]},run:c=>jn(e,String(c.query??""))},{id:"count",available:!0,schema:{type:"object",properties:{}},run:()=>Vn(e)},{id:"columns",available:!0,schema:{type:"object",properties:{}},run:()=>Yn(e)},{id:"get_row",available:!0,schema:{type:"object",properties:a,required:["id"]},run:c=>Kn(e,String(c.id??""))},{id:"highlight",available:!!e.onHighlightRows,schema:{type:"object",properties:{ids:{type:"array",items:{type:"string"},description:"Row IDs"}},required:["ids"]},run:c=>Zn(e,qn(c.ids))},{id:"select",available:!!e.onSelectRow,schema:{type:"object",properties:a,required:["id"]},run:c=>Qn(e,String(c.id??""))},{id:"open",available:!!e.onOpenRow,schema:{type:"object",properties:a,required:["id"]},run:c=>Xn(e,String(c.id??""))},{id:"filter",available:!!e.onFiltersChange,schema:{type:"object",properties:{key:{type:"string",enum:i},operator:{type:"string",enum:Bn},value:{description:"Text or number; for 'between' an array of two numbers or dates"}},required:["key","operator","value"]},run:c=>Jn(e,{key:String(c.key??""),operator:String(c.operator??""),value:c.value})},{id:"clear_filters",available:!!e.onFiltersChange,schema:{type:"object",properties:{}},run:()=>eo(e)},{id:"sort",available:!!e.onSortChange,schema:{type:"object",properties:{key:{type:"string",enum:i},direction:{type:"string",enum:["asc","desc"]}},required:["key"]},run:c=>to(e,String(c.key??""),c.direction==="desc"?"desc":"asc")},{id:"clear_sort",available:!!e.onSortChange,schema:{type:"object",properties:{}},run:()=>no(e)}].filter(c=>c.available).map(c=>({name:`${n}_${c.id}`,title:On.en[c.id],description:r(c.id),label:o[c.id],inputSchema:c.schema,execute:b=>$r(e,()=>c.run(b??{}))}))}var Or={en:{done:"Done.",toolMissing:e=>`The action "${e}" is not available here.`,missingInput:e=>`Missing: ${e}.`,notUnderstood:"Sorry, I didn't understand. Try: a word to search, \u201Csort by <column>\u201D, or \u201Cclear filters\u201D.",noMatch:e=>`Nothing matched "${e}".`,failed:"Something went wrong while running this action."},te:{done:"\u0C2A\u0C42\u0C30\u0C4D\u0C24\u0C2F\u0C3F\u0C02\u0C26\u0C3F.",toolMissing:e=>`"${e}" \u0C38\u0C4C\u0C15\u0C30\u0C4D\u0C2F\u0C02 \u0C07\u0C15\u0C4D\u0C15\u0C21 \u0C05\u0C02\u0C26\u0C41\u0C2C\u0C3E\u0C1F\u0C41\u0C32\u0C4B \u0C32\u0C47\u0C26\u0C41.`,missingInput:e=>`\u0C07\u0C35\u0C3F \u0C15\u0C3E\u0C35\u0C3E\u0C32\u0C3F: ${e}.`,notUnderstood:"\u0C15\u0C4D\u0C37\u0C2E\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F, \u0C05\u0C30\u0C4D\u0C25\u0C02 \u0C15\u0C3E\u0C32\u0C47\u0C26\u0C41. \u0C07\u0C32\u0C3E \u0C2A\u0C4D\u0C30\u0C2F\u0C24\u0C4D\u0C28\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F: \u0C35\u0C46\u0C24\u0C15\u0C3E\u0C32\u0C4D\u0C38\u0C3F\u0C28 \u0C2A\u0C26\u0C02, \u201C<\u0C15\u0C3E\u0C32\u0C2E\u0C4D> \u0C2A\u0C4D\u0C30\u0C15\u0C3E\u0C30\u0C02 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u201D, \u0C32\u0C47\u0C26\u0C3E \u201C\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C41 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C3F\u201D.",noMatch:e=>`"${e}" \u0C15\u0C3F \u0C0F\u0C2E\u0C40 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C32\u0C47\u0C26\u0C41.`,failed:"\u0C08 \u0C2A\u0C28\u0C3F \u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C41\u0C02\u0C21\u0C17\u0C3E \u0C38\u0C2E\u0C38\u0C4D\u0C2F \u0C35\u0C1A\u0C4D\u0C1A\u0C3F\u0C02\u0C26\u0C3F."}},oo=e=>e.normalize("NFC").toLowerCase().trim(),Le={clearFilters:/\b(clear|remove|reset)\b.*\bfilters?\b|ఫిల్టర్.*(తీసే|తొలగ)/i,clearSort:/\b(clear|remove|reset)\b.*\bsort(ing)?\b|క్రమం.*(తీసే|తొలగ)/i,count:/^\s*(how many|count)\b|ఎన్ని|లెక్క/i,sort:/\bsort\b|\border by\b|క్రమ|అమర్చ|సార్ట్/i,desc:/\b(desc|descending|z\s*-\s*a|highest|largest|most)\b|అవరోహణ|తగ్గే|పెద్ద|అధిక|చివర|ఎక్కువ నుండి/i,openEn:/^\s*open\s+(.+?)\s*$/i,openTe:/^\s*(.+?)\s*(తెరువు|తెరవండి|తెరవు)\s*$/,searchFiller:/^\s*(search(\s+for)?|find|show(\s+me)?|filter(\s+by)?|look\s+for|వెతుకు|వెతకండి|శోధించు|శోధించండి|చూపించు|చూపించండి)\s+|\s+(వెతుకు|వెతకండి|శోధించు|శోధించండి|చూపించు|చూపించండి)\s*$/gi};function Br(e,t){let n=oo(e),o=null;for(let r of t)for(let a of[r.label,r.key]){let i=oo(a);i&&n.includes(i)&&(!o||i.length>o.len)&&(o={key:r.key,len:i.length})}return o?.key??null}function io(e,t){let n=(e??"").trim();if(!n)return null;if(Le.clearFilters.test(n))return{kind:"tool",tool:"clear_filters",input:{}};if(Le.clearSort.test(n))return{kind:"tool",tool:"clear_sort",input:{}};if(Le.count.test(n))return{kind:"tool",tool:"count",input:{}};if(Le.sort.test(n)){let a=Br(n,t.columns);return a?{kind:"tool",tool:"sort",input:{key:a,direction:Le.desc.test(n)?"desc":"asc"}}:null}let o=n.match(Le.openEn)??n.match(Le.openTe);if(o?.[1])return{kind:"open",text:o[1].trim()};let r=n.replace(Le.searchFiller,"").trim();return r?{kind:"tool",tool:"search",input:{query:r}}:null}function Hr(e){return!!e&&typeof e=="object"&&typeof e.success=="boolean"&&typeof e.message=="string"}function _r(e,t){let n=e.inputSchema?.required;return Array.isArray(n)?n.map(String).filter(o=>t[o]===void 0||t[o]===null||String(t[o]).trim()===""):[]}function qr(e,t){let n=e.find(r=>r.name===t);if(n)return n;let o=e.filter(r=>r.name.endsWith(`_${t}`)).sort((r,a)=>r.name.length-a.name.length);if(o.length!==0&&!(o.length>1&&o[0].name.length===o[1].name.length))return o[0]}function ro(e){return e.normalize("NFC").trim().toLocaleLowerCase()}function Ur(e,t){let n=ro(e);return t.find(o=>o.phrases.some(r=>{let a=ro(r);return a.length>0&&n.includes(a)}))}function At({tools:e,data:t=[],onResult:n,onError:o,locale:r="en",columns:a=[],rowKey:i="id",parseIntent:s,customRules:c=[],historyLimit:b=20}){let g=Or[r],[x,I]=Tt(0),[O,N]=Tt(null),[E,T]=Tt(null),[B,y]=Tt([]),v=Yt({tools:e,data:t,onResult:n,onError:o,columns:a,rowKey:i,parseIntent:s,customRules:c,historyLimit:b,m:g,locale:r});v.current={tools:e,data:t,onResult:n,onError:o,columns:a,rowKey:i,parseIntent:s,customRules:c,historyLimit:b,m:g,locale:r};let C=Yt(!0),m=Yt(0);Dr(()=>(C.current=!0,()=>{C.current=!1}),[]);let P=rt((Q,w,l,X,$)=>{C.current&&($===m.current&&N(l),y(H=>[...H,{id:$,tool:Q,input:w,result:l,source:X,at:Date.now()}].slice(-v.current.historyLimit)))},[]),h=rt(async(Q,w,l)=>{let{tools:X,onResult:$,onError:H,m:J}=v.current,ie=++m.current,A=qr(X,Q);if(!A){let u={success:!1,message:J.toolMissing(Q),error:{code:"NOT_SUPPORTED"}},k=new Error(u.message);return C.current&&T(k),H?.(k),P(Q,w,u,l,ie),u}let L=_r(A,w);if(L.length){let u={success:!1,message:J.missingInput(L.join(", ")),error:{code:"INVALID_INPUT"},tool:A.name};return P(A.name,w,u,l,ie),$?.(u),u}C.current&&I(u=>u+1);try{let u=await A.execute(w),k=Hr(u)?{...u,tool:A.name}:{success:!0,message:J.done,data:u,tool:A.name};return C.current&&k.success&&T(null),P(A.name,w,k,l,ie),$?.(k),k}catch(u){let k=u instanceof Error?u:new Error(String(u)),U={success:!1,message:J.failed,error:{code:"INTERNAL"},tool:A.name};return C.current&&T(k),H?.(k),P(A.name,w,U,l,ie),U}finally{C.current&&I(u=>Math.max(0,u-1))}},[P]),W=rt((Q,w={})=>h(Q,w??{},"tool"),[h]),se=rt(async Q=>{let{columns:w,locale:l,parseIntent:X,customRules:$,data:H,m:J,rowKey:ie}=v.current,A=Ur(Q,$??[]);if(A){let G={input:Q,data:H,columns:w};try{let le={success:!0,message:await A.execute(G),tool:`rule:${A.name}`};return P(`rule:${A.name}`,{text:Q},le,"ask",++m.current),v.current.onResult?.(le),le}catch(ne){let le=ne instanceof Error?ne:new Error(String(ne)),ge={success:!1,message:J.failed,error:{code:"INTERNAL"},tool:`rule:${A.name}`};return C.current&&T(le),v.current.onError?.(le),P(`rule:${A.name}`,{text:Q},ge,"ask",++m.current),ge}}let u=(X??io)(Q,{columns:w,locale:l});if(!u){let G={success:!1,message:J.notUnderstood,error:{code:"NOT_UNDERSTOOD"}};return P("ask",{text:Q},G,"ask",++m.current),G}if(u.kind==="tool")return h(u.tool,u.input,"ask");let k=await h("search",{query:u.text},"ask"),U=Array.isArray(k.data)?k.data:[];if(!k.success)return k;if(U.length===0){let G={success:!1,message:J.noMatch(u.text),error:{code:"NOT_FOUND"},tool:k.tool};return P("open",{text:u.text},G,"ask",++m.current),G}return h("open",{id:et(U[0],ie)},"ask")},[P,h]),q=rt(()=>{y([]),N(null),T(null)},[]);return{loading:x>0,tools:e,executeTool:W,ask:se,lastResult:O,lastError:E,history:B,clearHistory:q}}var jr=At;import{useEffect as Vr,useMemo as Yr,useRef as Kt}from"react";function Kr(e){return JSON.stringify(e.map(t=>[t.name,t.title,t.description,t.inputSchema]))}function Zr({tools:e,data:t=[],columns:n=[],rowKey:o,locale:r,onSelectRow:a,onHighlightRows:i,onOpenRow:s,name:c="yuktai_grid",descriptions:b,onStatusChange:g}){let x=Yr(()=>e||ot({data:t,columns:n,rowKey:o,locale:r,onSelectRow:a,onHighlightRows:i,onOpenRow:s},{name:c,descriptions:b}),[e,t,n,o,r,a,i,s,c,b]),I=Kt(x);I.current=x;let O=Kt(g);O.current=g;let N=Kt(Promise.resolve()),E=Kr(x);return Vr(()=>{let T=m=>O.current?.(m),B=typeof document<"u"?document.modelContext:void 0;if(!B?.registerTool){T({state:"unsupported",registered:[],errors:[]});return}let y=new AbortController,v=I.current,C=N.current.then(async()=>{if(y.signal.aborted)return;T({state:"registering",registered:[],errors:[]});let m=[],P=[];for(let h of v){if(y.signal.aborted)return;try{await B.registerTool({name:h.name,title:h.title,description:h.description,inputSchema:h.inputSchema,execute:W=>{let se=I.current.find(q=>q.name===h.name);return se?se.execute(W??{}):{success:!1,message:`Tool "${h.name}" is no longer available.`,error:{code:"NOT_SUPPORTED"}}}},{signal:y.signal}),m.push(h.name)}catch(W){P.push({tool:h.name,message:W instanceof Error?W.message:String(W)})}}y.signal.aborted||T({state:P.length===0?"ready":m.length>0?"partial":"error",registered:m,errors:P})});return N.current=C.catch(()=>{}),()=>y.abort()},[E]),null}var Ct=Zr;import{jsx as R,jsxs as ae}from"react/jsx-runtime";var Qr={"en-US":{search:"Search...",searchAria:"Search grid",rows:"rows",row:"row",loading:"Loading...",noData:"No data found.",selectRow:"Select row",pageSize:"Page size",page:"Page",of:"of",previous:"Previous",next:"Next",yes:"Yes",no:"No",sortAscending:"Sort ascending",sortDescending:"Sort descending",filtersActive:e=>`${e} filter(s) applied`,clearFilters:"Clear filters"},"te-IN":{search:"\u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F...",searchAria:"\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D\u200C\u0C32\u0C4B \u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F",rows:"\u0C35\u0C30\u0C41\u0C38\u0C32\u0C41",row:"\u0C35\u0C30\u0C41\u0C38",loading:"\u0C32\u0C4B\u0C21\u0C4D \u0C05\u0C35\u0C41\u0C24\u0C4B\u0C02\u0C26\u0C3F...",noData:"\u0C21\u0C47\u0C1F\u0C3E \u0C15\u0C28\u0C2C\u0C21\u0C32\u0C47\u0C26\u0C41.",selectRow:"\u0C35\u0C30\u0C41\u0C38\u0C28\u0C41 \u0C0E\u0C02\u0C1A\u0C41\u0C15\u0C4B\u0C02\u0C21\u0C3F",pageSize:"\u0C2A\u0C47\u0C1C\u0C40 \u0C2A\u0C30\u0C3F\u0C2E\u0C3E\u0C23\u0C02",page:"\u0C2A\u0C47\u0C1C\u0C40",of:"\u0C32\u0C4B",previous:"\u0C35\u0C46\u0C28\u0C41\u0C15\u0C15\u0C41",next:"\u0C2E\u0C41\u0C02\u0C26\u0C41\u0C15\u0C41",yes:"\u0C05\u0C35\u0C41\u0C28\u0C41",no:"\u0C15\u0C3E\u0C26\u0C41",sortAscending:"\u0C06\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C02\u0C21\u0C3F",sortDescending:"\u0C05\u0C35\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C02\u0C21\u0C3F",filtersActive:e=>`${e} \u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D(\u0C32\u0C41) \u0C35\u0C47\u0C36\u0C3E\u0C30\u0C41`,clearFilters:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C41 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C02\u0C21\u0C3F"}};function Xr({size:e=20,color:t="currentColor",strokeWidth:n=2.4}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[R("circle",{cx:"11",cy:"11",r:"6.5"}),R("path",{d:"m16 16 5 5"})]})}function Jr({size:e=18,color:t="currentColor",strokeWidth:n=2.4,label:o}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":o?void 0:!0,"aria-label":o,role:o?"img":void 0,children:[o?R("title",{children:o}):null,R("path",{d:"m6 15 6-6 6 6"})]})}function ei({size:e=18,color:t="currentColor",strokeWidth:n=2.4,label:o}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":o?void 0:!0,"aria-label":o,role:o?"img":void 0,children:[o?R("title",{children:o}):null,R("path",{d:"m6 9 6 6 6-6"})]})}function ti({size:e=20,color:t="currentColor",strokeWidth:n=2.4}){return R("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:R("path",{d:"m15 18-6-6 6-6"})})}function ni({size:e=20,color:t="currentColor",strokeWidth:n=2.4}){return R("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:R("path",{d:"m9 18 6-6-6-6"})})}function ao({size:e=18,color:t="currentColor",strokeWidth:n=2.4}){return R("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:R("path",{d:"m5 12 4 4L19 6"})})}function oi({data:e,columns:t,rowKey:n="id",view:o="auto",mobileBreakpoint:r=768,theme:a="default",locale:i="en-US",ai:s=!1,search:c=!0,selectable:b=!1,selectedKeys:g=[],onSelectionChange:x,pagination:I,loading:O=!1,highlightIds:N=[],highlightColor:E="#fff3a3",autoScrollToHighlight:T=!1,onRowClick:B,onSortChange:y,empty:v,className:C="",inputLanguage:m,toolName:P="yuktai_grid",toolDescriptions:h,webmcp:W=!1,onWebMCPStatusChange:se,onAgentResult:q,customRules:Q=[]}){let w=i==="te-IN"?"te-IN":"en-US",l=Qr[w],X=s===!0||typeof s=="object"&&s!==null,$=I!==!1&&I!==void 0,H=typeof I=="object"?I.pageSize??20:20,J=typeof I=="object"&&I.sizeOptions&&I.sizeOptions.length>0?I.sizeOptions:[10,20,50,100],[ie,A]=Pe(""),[L,u]=Pe(1),[k,U]=Pe(H),[G,ne]=Pe(),[le,ge]=Pe("asc"),[Ce,Xt]=Pe(!1),[me,We]=Pe([]),[Ke,at]=Pe([]),Ie=Ve(()=>nt(t.map(d=>({key:String(d.key),label:d.label,type:d.type}))),[t]);Rt(()=>{U(H),u(1)},[H]),Rt(()=>{let d=()=>{Xt(window.innerWidth<=r)};return d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}},[r]);let fe=Ve(()=>{let d=[...e];if(ie.trim()){let S=ie.trim().toLowerCase();d=d.filter(D=>t.some(F=>String(D[F.key]??"").toLowerCase().includes(S)))}return me.length&&(d=tt(d,Ie,me)),G&&d.sort((S,D)=>{let F=S[G],be=D[G];if(F==null&&be==null)return 0;if(F==null)return 1;if(be==null)return-1;if(typeof F=="number"&&typeof be=="number")return le==="asc"?F-be:be-F;let de=String(F).localeCompare(String(be),i,{numeric:!0,sensitivity:"base"});return le==="asc"?de:-de}),d},[e,t,ie,me,Ie,G,le,i]),Re=$?Math.max(1,Math.ceil(fe.length/k)):1;Rt(()=>{L>Re&&u(Re)},[L,Re]);let Ze=Ve(()=>{let d=[...N.map(String),...Ke];return Array.from(new Set(d))},[N,Ke]);Rt(()=>{if(!T)return;let d=Ze[0];if(d==null)return;let S=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(String(d)):String(d).replace(/["\\]/g,"\\$&");document.querySelector(`[data-yuktai-row-id="${S}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},[Ze,T,L]);let Fe=Ve(()=>{if(!$)return fe;let d=(L-1)*k;return fe.slice(d,d+k)},[fe,$,L,k]),$e=o==="card"||o==="auto"&&Ce,Ee=d=>String(d[n]??""),De=d=>g.some(S=>String(S)===d),st=d=>Ze.some(S=>String(S)===d),f=d=>{if(!b)return;let S=Ee(d),D=De(S)?g.filter(F=>String(F)!==S):[...g,S];x?.(D)},Z=d=>{if(d.sortable===!1)return;let S=String(d.key),D=G===S&&le==="asc"?"desc":"asc";ne(S),ge(D),u(1),y?.({key:S,direction:D})},Ae=d=>{A(d),u(1)},It=(d,S)=>{let D=t.find(F=>String(F.key)===d||F.label.toLowerCase()===d.toLowerCase());D&&(ne(String(D.key)),ge(S),u(1),y?.({key:String(D.key),direction:S}))},Et=w==="te-IN"?"te":"en",Jt=Zt(d=>{d?(ne(d.key),ge(d.direction)):(ne(void 0),ge("asc")),u(1),y?.(d)},[y]),en=Zt(d=>{We(d),u(1)},[]),tn=Zt(d=>{if(at(d),$&&d.length){let S=fe.findIndex(D=>String(D[n]??"")===d[0]);S>=0&&u(Math.floor(S/k)+1)}},[$,fe,n,k]),Gt=Ve(()=>ot({data:e,columns:Ie,rowKey:String(n),locale:Et,filters:me,onHighlightRows:tn,onFiltersChange:en,onSortChange:Jt,onOpenRow:B?d=>{let S=fe.findIndex(F=>String(F[n]??"")===d),D=S>=0?fe[S]:e.find(F=>String(F[n]??"")===d);D&&B(D,Math.max(S,0))}:void 0,onSelectRow:b&&x?d=>{g.some(S=>String(S)===d)||x([...g.map(String),d])}:void 0},{name:P,descriptions:h}),[e,Ie,n,Et,me,tn,en,Jt,B,fe,b,x,g,P,h]),lt=At({tools:Gt,data:e,locale:Et,columns:Ie,rowKey:String(n),customRules:Q,onResult:q}),nn=Ve(()=>Gt.map(d=>({...d,execute:S=>lt.executeTool(d.name,S)})),[Gt,lt.executeTool]),Io=()=>{We([]),u(1)},on=(d,S,D)=>{if(S.render)return S.render(d[S.key],d,D);let F=d[S.key];if(F==null)return"";if(S.type==="date"){let be=new Date(String(F));if(!Number.isNaN(be.getTime()))return be.toLocaleDateString(i)}return S.type==="boolean"?F?l.yes:l.no:String(F)},V=a==="dark",rn={width:"100%",overflow:"hidden",border:a==="high-contrast"?"2px solid #000000":V?"1px solid #334155":"1px solid #e2e8f0",borderRadius:12,background:V?"#0f172a":"#ffffff",color:V?"#f8fafc":"#0f172a",fontFamily:a==="dyslexia"?"Arial, sans-serif":void 0},Eo={padding:12,display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",borderBottom:V?"1px solid #334155":"1px solid #e2e8f0"},an=d=>({width:40,height:40,minWidth:40,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:8,border:V?"1px solid #475569":"1px solid #cbd5e1",background:d?V?"#1e293b":"#f8fafc":V?"#1e293b":"#ffffff",color:d?"#94a3b8":V?"#f8fafc":"#0f172a",cursor:d?"not-allowed":"pointer",opacity:d?.55:1});if(O)return ae("div",{className:C,style:rn,children:[W&&R(Ct,{tools:nn,onStatusChange:se}),R("div",{style:{padding:32,textAlign:"center"},children:l.loading})]});let Go=t.map(d=>({key:String(d.key),label:d.label,type:d.type==="number"?"number":d.type==="date"?"date":"text"}));return ae("div",{className:C,style:rn,children:[W&&R(Ct,{tools:nn,onStatusChange:se}),(c||X||me.length>0)&&ae("div",{style:Eo,children:[c&&ae("div",{style:{position:"relative",width:"100%",maxWidth:420},children:[R("div",{style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",color:V?"#cbd5e1":"#64748b",pointerEvents:"none"},children:R(Xr,{size:19})}),R("input",{value:ie,onChange:d=>{A(d.target.value),u(1)},placeholder:l.search,"aria-label":l.searchAria,style:{width:"100%",padding:"10px 12px 10px 40px",borderRadius:8,border:V?"1px solid #475569":"1px solid #cbd5e1",background:V?"#1e293b":"#ffffff",color:V?"#ffffff":"#0f172a",outline:"none",boxSizing:"border-box"}})]}),me.length>0&&ae("button",{type:"button",onClick:Io,title:l.clearFilters,style:{padding:"6px 10px",borderRadius:999,border:V?"1px solid #475569":"1px solid #cbd5e1",background:V?"#1e293b":"#f1f5f9",color:"inherit",fontSize:12,cursor:"pointer"},children:[l.filtersActive(me.length)," \u2715"]}),ae("div",{style:{marginLeft:"auto",fontSize:13,opacity:.7,whiteSpace:"nowrap"},children:[fe.length," ",fe.length===1?l.row:l.rows]}),X&&R(jt,{data:e,columns:Go,onSearch:Ae,onSort:It,theme:V?"dark":"light",language:w,inputLanguage:m??w,agent:{ask:lt.ask,loading:lt.loading},embedded:!0})]}),fe.length===0?R("div",{style:{padding:40,textAlign:"center",opacity:.7},children:v??l.noData}):$e?R("div",{style:{display:"grid",gap:12,padding:12},children:Fe.map((d,S)=>{let D=Ee(d),F=De(D),be=st(D);return ae("div",{"data-yuktai-row-id":D,onClick:()=>B?.(d,S),style:{padding:14,borderRadius:10,border:V?"1px solid #334155":"1px solid #e2e8f0",background:be?E:F?V?"#1e3a5f":"#eff6ff":V?"#1e293b":"#ffffff",cursor:B?"pointer":"default"},children:[b&&R("button",{type:"button",onClick:de=>{de.stopPropagation(),f(d)},"aria-label":`${l.selectRow} ${D}`,"aria-pressed":F,style:{width:32,height:32,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,marginBottom:10,borderRadius:7,border:F?"1px solid #2563eb":"1px solid #cbd5e1",background:F?"#2563eb":"transparent",color:F?"#ffffff":"currentColor",cursor:"pointer"},children:F&&R(ao,{size:17})}),t.map(de=>ae("div",{style:{display:"flex",gap:8,padding:"5px 0",alignItems:"flex-start"},children:[R("strong",{style:{minWidth:100,opacity:.7},children:de.label}),R("span",{children:on(d,de,S)})]},String(de.key)))]},D)})}):R("div",{style:{width:"100%",overflowX:"auto"},children:ae("table",{style:{width:"100%",borderCollapse:"collapse"},children:[R("thead",{children:ae("tr",{children:[b&&R("th",{style:{padding:10,borderBottom:V?"1px solid #334155":"1px solid #e2e8f0",width:52}}),t.filter(d=>!(Ce&&d.hiddenOnMobile)).map(d=>{let S=G===String(d.key);return R("th",{onClick:()=>Z(d),style:{padding:10,textAlign:d.align??"left",borderBottom:V?"1px solid #334155":"1px solid #e2e8f0",whiteSpace:"nowrap",cursor:d.sortable===!1?"default":"pointer",width:d.width,userSelect:"none"},children:ae("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[d.label,S&&(le==="asc"?R(Jr,{size:17,label:l.sortAscending}):R(ei,{size:17,label:l.sortDescending}))]})},String(d.key))})]})}),R("tbody",{children:Fe.map((d,S)=>{let D=Ee(d),F=De(D),be=st(D);return ae("tr",{"data-yuktai-row-id":D,onClick:()=>B?.(d,S),style:{background:be?E:F?V?"#1e3a5f":"#eff6ff":"transparent",cursor:B?"pointer":"default"},children:[b&&R("td",{style:{padding:10,borderBottom:V?"1px solid #334155":"1px solid #e2e8f0"},children:R("button",{type:"button",onClick:de=>{de.stopPropagation(),f(d)},"aria-label":`${l.selectRow} ${D}`,"aria-pressed":F,style:{width:28,height:28,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:6,border:F?"1px solid #2563eb":V?"1px solid #64748b":"1px solid #cbd5e1",background:F?"#2563eb":"transparent",color:F?"#ffffff":"currentColor",cursor:"pointer"},children:F&&R(ao,{size:16})})}),t.filter(de=>!(Ce&&de.hiddenOnMobile)).map(de=>R("td",{style:{padding:10,textAlign:de.align??"left",borderBottom:V?"1px solid #334155":"1px solid #e2e8f0"},children:on(d,de,S)},String(de.key)))]},D)})})]})}),$&&ae("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",padding:12,borderTop:V?"1px solid #334155":"1px solid #e2e8f0"},children:[ae("span",{style:{fontSize:13,opacity:.7},children:[l.page," ",L," ",l.of," ",Re]}),ae("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[typeof I=="object"&&I.showSizeChanger&&R("select",{value:k,onChange:d=>{let S=Number(d.target.value);!Number.isFinite(S)||S<=0||(U(S),u(1))},"aria-label":l.pageSize,style:{minHeight:40,padding:"7px 10px",borderRadius:8,border:V?"1px solid #475569":"1px solid #cbd5e1",background:V?"#1e293b":"#ffffff",color:V?"#ffffff":"#0f172a"},children:J.map(d=>R("option",{value:d,children:d},d))}),R("button",{type:"button",disabled:L<=1,onClick:()=>u(d=>Math.max(1,d-1)),"aria-label":l.previous,title:l.previous,style:an(L<=1),children:R(ti,{size:20})}),R("button",{type:"button",disabled:L>=Re,onClick:()=>u(d=>Math.min(Re,d+1)),"aria-label":l.next,title:l.next,style:an(L>=Re),children:R(ni,{size:20})})]})]})]})}import{useState as Ye,useMemo as it,useCallback as Te,useEffect as Qt}from"react";function so(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function lo(e){return String(e??"").normalize("NFC").toLowerCase().trim()}function co(e){return e==null||typeof e=="string"&&e.trim()===""}function uo(e){if(typeof e=="number")return Number.isFinite(e)?e:null;let t=String(e??"").trim();if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:null}function po(e){let t=e instanceof Date?e.getTime():new Date(String(e)).getTime();return Number.isFinite(t)?t:null}function ri(e,t,n,o){if(n==="number"||typeof e=="number"&&typeof t=="number"){let r=uo(e),a=uo(t);if(r!==null&&a!==null)return r-a}if(n==="date"||e instanceof Date&&t instanceof Date){let r=po(e),a=po(t);if(r!==null&&a!==null)return r-a}return typeof e=="boolean"&&typeof t=="boolean"?e===t?0:e?1:-1:String(e).localeCompare(String(t),o,{sensitivity:"base",numeric:!0})}function ii(e){let{data:t,columns:n,pagination:o=!0,mobileBreakpoint:r=768,locale:a,initialFilters:i=[]}=e,[s,c]=Ye(null),[b,g]=Ye(""),[x,I]=Ye(i),[O,N]=Ye(1),[E,T]=Ye(so(o)),[B,y]=Ye(!1),v=so(o);Qt(()=>{T(v),N(1)},[v]),Qt(()=>{if(typeof window>"u")return;let u=()=>{y(window.innerWidth<=r)};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[r]);let C=it(()=>nt(n.map(u=>({key:String(u.key),label:u.label,type:u.type}))),[n]),m=Te(u=>{c(k=>!k||k.key!==u?{key:u,direction:"asc"}:k.direction==="asc"?{key:u,direction:"desc"}:null),N(1)},[]),P=Te(u=>{c(u&&u.direction?u:null),N(1)},[]),h=Te(()=>{c(null),N(1)},[]),W=Te(u=>{g(u),N(1)},[]),se=Te(u=>{I(u),N(1)},[]),q=Te(u=>{I(k=>[...k.filter(U=>U.key!==u.key),u]),N(1)},[]),Q=Te(u=>{I(k=>k.filter(U=>U.key!==u)),N(1)},[]),w=Te(()=>{I([]),N(1)},[]),l=Te(u=>{T(Math.max(1,Math.floor(u)||1)),N(1)},[]),X=it(()=>{let u=lo(b);return u?t.filter(k=>n.some(U=>{let G=k[U.key];return G==null?!1:lo(G).includes(u)})):t},[t,b,n]),$=it(()=>tt(X,C,x),[X,C,x]),H=it(()=>{if(!s||!s.direction)return $;let u=n.find(U=>String(U.key)===s.key),k=s.direction==="desc"?-1:1;return[...$].sort((U,G)=>{let ne=U[s.key],le=G[s.key],ge=co(ne),Ce=co(le);return ge&&Ce?0:ge?1:Ce?-1:k*ri(ne,le,u?.type,a)})},[$,s,n,a]),J=Math.max(1,Math.ceil(H.length/E)),ie=it(()=>{if(o===!1)return H;let u=(O-1)*E;return H.slice(u,u+E)},[H,O,E,o]);Qt(()=>{O>J&&N(J)},[O,J]);let A=Te(u=>N(Math.min(Math.max(1,Math.floor(u)||1),J)),[J]),L=Te(()=>{c(null),g(""),I([]),N(1)},[]);return{displayedData:ie,rows:H,totalCount:t.length,filteredCount:H.length,sort:s,toggleSort:m,setSort:P,clearSort:h,searchQuery:b,setSearchQuery:W,filters:x,setFilters:se,setFilter:q,removeFilter:Q,clearFilters:w,page:O,pageSize:E,totalPages:J,setPage:A,setPageSize:l,isMobile:B,reset:L}}import{jsx as ai}from"react/jsx-runtime";function ce({size:e=20,color:t="currentColor",strokeWidth:n=2.5,label:o,children:r,...a}){return ai("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!o?"true":void 0,"aria-label":o,role:o?"img":void 0,focusable:"false",...a,children:r})}import{jsx as fo,jsxs as si}from"react/jsx-runtime";function go(e){return si(ce,{...e,children:[fo("circle",{cx:"11",cy:"11",r:"7"}),fo("path",{d:"m20 20-4-4"})]})}import{jsx as mo,jsxs as li}from"react/jsx-runtime";function bo(e){return li(ce,{...e,children:[mo("path",{d:"M12 19V5"}),mo("path",{d:"m5 12 7-7 7 7"})]})}import{jsx as yo,jsxs as di}from"react/jsx-runtime";function ho(e){return di(ce,{...e,children:[yo("path",{d:"M12 5v14"}),yo("path",{d:"m5 12 7 7 7-7"})]})}import{jsx as xo}from"react/jsx-runtime";function wo(e){return xo(ce,{...e,children:xo("path",{d:"m15 18-6-6 6-6"})})}import{jsx as ko}from"react/jsx-runtime";function vo(e){return ko(ce,{...e,children:ko("path",{d:"m9 18 6-6-6-6"})})}import{jsx as So}from"react/jsx-runtime";function To(e){return So(ce,{...e,children:So("path",{d:"M5 12.5 10 17.5 19.5 7"})})}import{jsx as Ao,jsxs as ci}from"react/jsx-runtime";function Co(e){return ci(ce,{...e,children:[Ao("path",{d:"M18 6 6 18"}),Ao("path",{d:"m6 6 12 12"})]})}function ui(){if(typeof globalThis>"u")return new ze;if(!globalThis.__yuktai_runtime__){let e=new ze;e.register(he.name,he),e.register(wt.name,wt),e.register(kt.name,kt),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Ro=typeof window<"u"?ui():new ze,Es={wcagPlugin:he,list(){return Ro.getPlugins()},use(e){return Ro.use(e)},fix(e){return he.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return he.scan()}};export{To as CheckIcon,wo as ChevronLeftIcon,vo as ChevronRightIcon,Co as CloseIcon,ce as IconBase,ze as Runtime,go as SearchIcon,ho as SortDownIcon,bo as SortUpIcon,Es as YuktAI,qt as YuktAIWrapper,oi as YuktaiGrid,jt as YuktaiGridAI,jr as YuktaiGridAgent,Ct as YuktaiGridWebMCP,wt as aiPlugin,tt as applyGridFilters,eo as clearFilters,no as clearSort,Vn as countGrid,ot as createGridTools,qt as default,Jn as filterGrid,Yn as getColumns,Kn as getRow,et as getRowId,Zn as highlightRows,Xn as openRow,io as parseGridIntent,jn as searchGrid,Qn as selectRow,to as sortGrid,nt as toGridToolColumns,ii as useGrid,At as useYuktaiGridAgent,kt as voicePlugin,he as wcag,he as wcagPlugin};
|
|
395
|
+
`})]})}var jt=Lr;import{useCallback as rt,useEffect as Dr,useRef as Yt,useState as Tt}from"react";var Mr={en:{found:e=>`${e} row(s) found.`,count:e=>`${e} row(s).`,columns:"Grid columns retrieved.",rowFound:"Row found.",notFound:e=>`Row "${e}" not found.`,noneFound:"None of the given rows were found.",highlighted:e=>`${e} row(s) highlighted.`,selected:e=>`Row "${e}" selected.`,opened:e=>`Row "${e}" opened.`,notSupported:e=>`This grid does not support "${e}".`,emptyQuery:"Please enter something to search.",noIds:"No row IDs were given.",unknownColumn:e=>`Unknown column "${e}".`,badOperator:e=>`Unknown filter operator "${e}".`,badValue:"The filter value is not valid for this column.",filtered:e=>`Filter applied: ${e} row(s) match.`,filtersCleared:"All filters cleared.",sorted:(e,t)=>`Sorted by ${e} (${t==="asc"?"ascending":"descending"}).`,sortCleared:"Sorting cleared.",internal:"Something went wrong while running this action."},te:{found:e=>`${e} \u0C35\u0C30\u0C41\u0C38(\u0C32\u0C41) \u0C26\u0C4A\u0C30\u0C3F\u0C15\u0C3E\u0C2F\u0C3F.`,count:e=>`\u0C2E\u0C4A\u0C24\u0C4D\u0C24\u0C02 ${e} \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41.`,columns:"\u0C15\u0C3E\u0C32\u0C2E\u0C4D\u200C\u0C32 \u0C35\u0C3F\u0C35\u0C30\u0C3E\u0C32\u0C41.",rowFound:"\u0C35\u0C30\u0C41\u0C38 \u0C26\u0C4A\u0C30\u0C3F\u0C15\u0C3F\u0C02\u0C26\u0C3F.",notFound:e=>`"${e}" \u0C35\u0C30\u0C41\u0C38 \u0C26\u0C4A\u0C30\u0C15\u0C32\u0C47\u0C26\u0C41.`,noneFound:"\u0C07\u0C1A\u0C4D\u0C1A\u0C3F\u0C28 \u0C35\u0C30\u0C41\u0C38\u0C32\u0C47\u0C35\u0C40 \u0C26\u0C4A\u0C30\u0C15\u0C32\u0C47\u0C26\u0C41.",highlighted:e=>`${e} \u0C35\u0C30\u0C41\u0C38(\u0C32\u0C41) \u0C39\u0C48\u0C32\u0C48\u0C1F\u0C4D \u0C1A\u0C47\u0C36\u0C3E\u0C28\u0C41.`,selected:e=>`"${e}" \u0C0E\u0C02\u0C1A\u0C41\u0C15\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41.`,opened:e=>`"${e}" \u0C24\u0C46\u0C30\u0C3F\u0C1A\u0C3E\u0C28\u0C41.`,notSupported:e=>`\u0C08 \u0C2A\u0C1F\u0C4D\u0C1F\u0C3F\u0C15\u0C32\u0C4B "${e}" \u0C38\u0C4C\u0C15\u0C30\u0C4D\u0C2F\u0C02 \u0C32\u0C47\u0C26\u0C41.`,emptyQuery:"\u0C35\u0C46\u0C24\u0C15\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C0F\u0C26\u0C48\u0C28\u0C3E \u0C30\u0C3E\u0C2F\u0C02\u0C21\u0C3F.",noIds:"\u0C35\u0C30\u0C41\u0C38 ID\u0C32\u0C41 \u0C07\u0C35\u0C4D\u0C35\u0C32\u0C47\u0C26\u0C41.",unknownColumn:e=>`"${e}" \u0C05\u0C28\u0C47 \u0C15\u0C3E\u0C32\u0C2E\u0C4D \u0C32\u0C47\u0C26\u0C41.`,badOperator:e=>`"${e}" \u0C05\u0C28\u0C47 \u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D \u0C35\u0C3F\u0C27\u0C3E\u0C28\u0C02 \u0C32\u0C47\u0C26\u0C41.`,badValue:"\u0C08 \u0C15\u0C3E\u0C32\u0C2E\u0C4D\u200C\u0C15\u0C3F \u0C08 \u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D \u0C35\u0C3F\u0C32\u0C41\u0C35 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C26\u0C41.",filtered:e=>`\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D \u0C35\u0C47\u0C36\u0C3E\u0C28\u0C41: ${e} \u0C35\u0C30\u0C41\u0C38\u0C32\u0C41 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C2F\u0C3E\u0C2F\u0C3F.`,filtersCleared:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C28\u0C4D\u0C28\u0C40 \u0C24\u0C40\u0C38\u0C47\u0C36\u0C3E\u0C28\u0C41.",sorted:(e,t)=>`${e} \u0C2A\u0C4D\u0C30\u0C15\u0C3E\u0C30\u0C02 \u0C15\u0C4D\u0C30\u0C2E\u0C02 (${t==="asc"?"\u0C06\u0C30\u0C4B\u0C39\u0C23":"\u0C05\u0C35\u0C30\u0C4B\u0C39\u0C23"}).`,sortCleared:"\u0C15\u0C4D\u0C30\u0C2E\u0C02 \u0C24\u0C40\u0C38\u0C47\u0C36\u0C3E\u0C28\u0C41.",internal:"\u0C08 \u0C2A\u0C28\u0C3F \u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C41\u0C02\u0C21\u0C17\u0C3E \u0C38\u0C2E\u0C38\u0C4D\u0C2F \u0C35\u0C1A\u0C4D\u0C1A\u0C3F\u0C02\u0C26\u0C3F."}};function xe(e){return Mr[e.locale??"en"]}function Se(e,t){return{success:!0,message:e,data:t}}function te(e,t){return{success:!1,message:t,error:{code:e}}}var Bn=["contains","equals","startsWith","endsWith","greaterThan","lessThan","between"];function et(e,t="id"){let n=e?.[t];return n==null?"":String(n)}function ze(e){return String(e??"").normalize("NFC").toLowerCase().trim()}function Hn(e){if(typeof e=="number")return Number.isFinite(e)?e:null;let t=String(e??"").trim();if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:null}function _n(e){if(e instanceof Date)return e.getTime();let t=new Date(String(e??"")).getTime();return Number.isFinite(t)?t:null}function qn(e){return(Array.isArray(e)?e:typeof e=="string"?e.split(","):[]).map(n=>String(n).trim()).filter(Boolean)}function Vt(e,t){let n=ze(t);return e.columns.find(o=>ze(o.key)===n||ze(o.label)===n)}function St(e,t){return e.data.find(n=>et(n,e.rowKey)===t)}function Fr(e,t){return e[t]}function Nr(e,t,n){let o=Fr(e,n.key),r=n.type??"text";if(r==="number"||r==="date"){let s=r==="number"?Hn:_n,c=s(o);if(c===null)return!1;if(t.operator==="between"){let[g,w]=t.value,E=s(g),O=s(w);return E!==null&&O!==null&&c>=Math.min(E,O)&&c<=Math.max(E,O)}let b=s(t.value);if(b===null)return!1;switch(t.operator){case"equals":return c===b;case"greaterThan":return c>b;case"lessThan":return c<b;default:break}}let a=ze(o),i=ze(t.value);switch(t.operator){case"equals":return a===i;case"startsWith":return a.startsWith(i);case"endsWith":return a.endsWith(i);case"contains":return a.includes(i);default:return!1}}function zr(e,t){let n=t.type??"text",o=n==="date"?_n:Hn;return e.operator==="between"?n==="text"||!Array.isArray(e.value)||e.value.length!==2?!1:o(e.value[0])!==null&&o(e.value[1])!==null:e.operator==="greaterThan"||e.operator==="lessThan"?n!=="text"&&o(e.value)!==null:!Array.isArray(e.value)&&String(e.value).trim()!==""}function tt(e,t,n){return n.length?Un({data:e,columns:t},n):e}function nt(e){return e.map(t=>({key:String(t.key),label:t.label,type:t.type==="number"?"number":t.type==="date"?"date":"text"}))}function Un(e,t){return e.data.filter(n=>t.every(o=>{let r=Vt(e,o.key);return r?Nr(n,o,r):!0}))}function jn(e,t){let n=xe(e),o=ze(t);if(!o)return te("INVALID_INPUT",n.emptyQuery);let r=e.data.filter(i=>e.columns.some(s=>ze(i[s.key]).includes(o))),a=r.map(i=>et(i,e.rowKey)).filter(Boolean);return e.onHighlightRows?.(a),Se(n.found(r.length),r)}function Vn(e){return Se(xe(e).count(e.data.length),e.data.length)}function Yn(e){return Se(xe(e).columns,e.columns)}function Kn(e,t){let n=xe(e),o=String(t??"").trim();if(!o)return te("INVALID_INPUT",n.noIds);let r=St(e,o);return r?Se(n.rowFound,r):te("NOT_FOUND",n.notFound(o))}function Zn(e,t){let n=xe(e),o=qn(t);if(o.length===0)return te("INVALID_INPUT",n.noIds);if(!e.onHighlightRows)return te("NOT_SUPPORTED",n.notSupported("highlight"));let r=o.filter(a=>St(e,a)!==void 0);return r.length===0?te("NOT_FOUND",n.noneFound):(e.onHighlightRows(r),Se(n.highlighted(r.length),r))}function Qn(e,t){let n=xe(e),o=String(t??"").trim();return o?e.onSelectRow?St(e,o)?(e.onSelectRow(o),Se(n.selected(o),o)):te("NOT_FOUND",n.notFound(o)):te("NOT_SUPPORTED",n.notSupported("select")):te("INVALID_INPUT",n.noIds)}function Xn(e,t){let n=xe(e),o=String(t??"").trim();return o?e.onOpenRow?St(e,o)?(e.onOpenRow(o),Se(n.opened(o),o)):te("NOT_FOUND",n.notFound(o)):te("NOT_SUPPORTED",n.notSupported("open")):te("INVALID_INPUT",n.noIds)}function Jn(e,t){let n=xe(e),o=Vt(e,t?.key??"");if(!o)return te("INVALID_INPUT",n.unknownColumn(String(t?.key??"")));if(!Bn.includes(t.operator))return te("INVALID_INPUT",n.badOperator(String(t.operator)));let r={...t,key:o.key};if(!zr(r,o))return te("INVALID_INPUT",n.badValue);if(!e.onFiltersChange)return te("NOT_SUPPORTED",n.notSupported("filter"));let a=[...(e.filters??[]).filter(s=>s.key!==o.key),r],i=Un(e,a).length;return e.onFiltersChange(a),Se(n.filtered(i),{filters:a,count:i})}function eo(e){let t=xe(e);return e.onFiltersChange?(e.onFiltersChange([]),Se(t.filtersCleared,[])):te("NOT_SUPPORTED",t.notSupported("clear filters"))}function to(e,t,n="asc"){let o=xe(e),r=Vt(e,t);if(!r)return te("INVALID_INPUT",o.unknownColumn(String(t)));if(n!=="asc"&&n!=="desc")return te("INVALID_INPUT",o.badValue);if(!e.onSortChange)return te("NOT_SUPPORTED",o.notSupported("sort"));let a={key:r.key,direction:n};return e.onSortChange(a),Se(o.sorted(r.label,n),a)}function no(e){let t=xe(e);return e.onSortChange?(e.onSortChange(null),Se(t.sortCleared,null)):te("NOT_SUPPORTED",t.notSupported("clear sort"))}var Wr={search:"Search all columns for text. Matching rows are highlighted.",count:"Count the rows currently in the grid.",columns:"List the grid's columns with their keys, labels and types.",get_row:"Get one row by its ID.",highlight:"Highlight one or more rows by ID without filtering the grid.",select:"Select one row by ID.",open:"Open one row by ID to show its full details.",filter:"Filter the grid by one column. Replaces any existing filter on that column.",clear_filters:"Remove all filters.",sort:"Sort the grid by one column, ascending or descending.",clear_sort:"Remove sorting."},On={en:{search:"Search",count:"Count",columns:"Columns",get_row:"Get row",highlight:"Highlight",select:"Select",open:"Open",filter:"Filter",clear_filters:"Clear filters",sort:"Sort",clear_sort:"Clear sort"},te:{search:"\u0C35\u0C46\u0C24\u0C41\u0C15\u0C41",count:"\u0C32\u0C46\u0C15\u0C4D\u0C15",columns:"\u0C15\u0C3E\u0C32\u0C2E\u0C4D\u200C\u0C32\u0C41",get_row:"\u0C35\u0C30\u0C41\u0C38 \u0C1A\u0C42\u0C2A\u0C41",highlight:"\u0C39\u0C48\u0C32\u0C48\u0C1F\u0C4D",select:"\u0C0E\u0C02\u0C1A\u0C41\u0C15\u0C4B",open:"\u0C24\u0C46\u0C30\u0C41\u0C35\u0C41",filter:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D",clear_filters:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C41 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C3F",sort:"\u0C15\u0C4D\u0C30\u0C2E\u0C02",clear_sort:"\u0C15\u0C4D\u0C30\u0C2E\u0C02 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C3F"}};async function $r(e,t){try{return t()}catch{return te("INTERNAL",xe(e).internal)}}function ot(e,t={}){let n=t.name??"yuktai_grid",o=On[e.locale??"en"],r=c=>t.descriptions?.[c]??Wr[c],a={id:{type:"string",description:"Row ID"}},i=e.columns.map(c=>c.key);return[{id:"search",available:!0,schema:{type:"object",properties:{query:{type:"string"}},required:["query"]},run:c=>jn(e,String(c.query??""))},{id:"count",available:!0,schema:{type:"object",properties:{}},run:()=>Vn(e)},{id:"columns",available:!0,schema:{type:"object",properties:{}},run:()=>Yn(e)},{id:"get_row",available:!0,schema:{type:"object",properties:a,required:["id"]},run:c=>Kn(e,String(c.id??""))},{id:"highlight",available:!!e.onHighlightRows,schema:{type:"object",properties:{ids:{type:"array",items:{type:"string"},description:"Row IDs"}},required:["ids"]},run:c=>Zn(e,qn(c.ids))},{id:"select",available:!!e.onSelectRow,schema:{type:"object",properties:a,required:["id"]},run:c=>Qn(e,String(c.id??""))},{id:"open",available:!!e.onOpenRow,schema:{type:"object",properties:a,required:["id"]},run:c=>Xn(e,String(c.id??""))},{id:"filter",available:!!e.onFiltersChange,schema:{type:"object",properties:{key:{type:"string",enum:i},operator:{type:"string",enum:Bn},value:{description:"Text or number; for 'between' an array of two numbers or dates"}},required:["key","operator","value"]},run:c=>Jn(e,{key:String(c.key??""),operator:String(c.operator??""),value:c.value})},{id:"clear_filters",available:!!e.onFiltersChange,schema:{type:"object",properties:{}},run:()=>eo(e)},{id:"sort",available:!!e.onSortChange,schema:{type:"object",properties:{key:{type:"string",enum:i},direction:{type:"string",enum:["asc","desc"]}},required:["key"]},run:c=>to(e,String(c.key??""),c.direction==="desc"?"desc":"asc")},{id:"clear_sort",available:!!e.onSortChange,schema:{type:"object",properties:{}},run:()=>no(e)}].filter(c=>c.available).map(c=>({name:`${n}_${c.id}`,title:On.en[c.id],description:r(c.id),label:o[c.id],inputSchema:c.schema,execute:b=>$r(e,()=>c.run(b??{}))}))}var Or={en:{done:"Done.",toolMissing:e=>`The action "${e}" is not available here.`,missingInput:e=>`Missing: ${e}.`,notUnderstood:"Sorry, I didn't understand. Try: a word to search, \u201Csort by <column>\u201D, or \u201Cclear filters\u201D.",noMatch:e=>`Nothing matched "${e}".`,failed:"Something went wrong while running this action."},te:{done:"\u0C2A\u0C42\u0C30\u0C4D\u0C24\u0C2F\u0C3F\u0C02\u0C26\u0C3F.",toolMissing:e=>`"${e}" \u0C38\u0C4C\u0C15\u0C30\u0C4D\u0C2F\u0C02 \u0C07\u0C15\u0C4D\u0C15\u0C21 \u0C05\u0C02\u0C26\u0C41\u0C2C\u0C3E\u0C1F\u0C41\u0C32\u0C4B \u0C32\u0C47\u0C26\u0C41.`,missingInput:e=>`\u0C07\u0C35\u0C3F \u0C15\u0C3E\u0C35\u0C3E\u0C32\u0C3F: ${e}.`,notUnderstood:"\u0C15\u0C4D\u0C37\u0C2E\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F, \u0C05\u0C30\u0C4D\u0C25\u0C02 \u0C15\u0C3E\u0C32\u0C47\u0C26\u0C41. \u0C07\u0C32\u0C3E \u0C2A\u0C4D\u0C30\u0C2F\u0C24\u0C4D\u0C28\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F: \u0C35\u0C46\u0C24\u0C15\u0C3E\u0C32\u0C4D\u0C38\u0C3F\u0C28 \u0C2A\u0C26\u0C02, \u201C<\u0C15\u0C3E\u0C32\u0C2E\u0C4D> \u0C2A\u0C4D\u0C30\u0C15\u0C3E\u0C30\u0C02 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u201D, \u0C32\u0C47\u0C26\u0C3E \u201C\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C41 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C3F\u201D.",noMatch:e=>`"${e}" \u0C15\u0C3F \u0C0F\u0C2E\u0C40 \u0C38\u0C30\u0C3F\u0C2A\u0C4B\u0C32\u0C47\u0C26\u0C41.`,failed:"\u0C08 \u0C2A\u0C28\u0C3F \u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C41\u0C02\u0C21\u0C17\u0C3E \u0C38\u0C2E\u0C38\u0C4D\u0C2F \u0C35\u0C1A\u0C4D\u0C1A\u0C3F\u0C02\u0C26\u0C3F."}},oo=e=>e.normalize("NFC").toLowerCase().trim(),Le={clearFilters:/\b(clear|remove|reset)\b.*\bfilters?\b|ఫిల్టర్.*(తీసే|తొలగ)/i,clearSort:/\b(clear|remove|reset)\b.*\bsort(ing)?\b|క్రమం.*(తీసే|తొలగ)/i,count:/^\s*(how many|count)\b|ఎన్ని|లెక్క/i,sort:/\bsort\b|\border by\b|క్రమ|అమర్చ|సార్ట్/i,desc:/\b(desc|descending|z\s*-\s*a|highest|largest|most)\b|అవరోహణ|తగ్గే|పెద్ద|అధిక|చివర|ఎక్కువ నుండి/i,openEn:/^\s*open\s+(.+?)\s*$/i,openTe:/^\s*(.+?)\s*(తెరువు|తెరవండి|తెరవు)\s*$/,searchFiller:/^\s*(search(\s+for)?|find|show(\s+me)?|filter(\s+by)?|look\s+for|వెతుకు|వెతకండి|శోధించు|శోధించండి|చూపించు|చూపించండి)\s+|\s+(వెతుకు|వెతకండి|శోధించు|శోధించండి|చూపించు|చూపించండి)\s*$/gi};function Br(e,t){let n=oo(e),o=null;for(let r of t)for(let a of[r.label,r.key]){let i=oo(a);i&&n.includes(i)&&(!o||i.length>o.len)&&(o={key:r.key,len:i.length})}return o?.key??null}function io(e,t){let n=(e??"").trim();if(!n)return null;if(Le.clearFilters.test(n))return{kind:"tool",tool:"clear_filters",input:{}};if(Le.clearSort.test(n))return{kind:"tool",tool:"clear_sort",input:{}};if(Le.count.test(n))return{kind:"tool",tool:"count",input:{}};if(Le.sort.test(n)){let a=Br(n,t.columns);return a?{kind:"tool",tool:"sort",input:{key:a,direction:Le.desc.test(n)?"desc":"asc"}}:null}let o=n.match(Le.openEn)??n.match(Le.openTe);if(o?.[1])return{kind:"open",text:o[1].trim()};let r=n.replace(Le.searchFiller,"").trim();return r?{kind:"tool",tool:"search",input:{query:r}}:null}function Hr(e){return!!e&&typeof e=="object"&&typeof e.success=="boolean"&&typeof e.message=="string"}function _r(e,t){let n=e.inputSchema?.required;return Array.isArray(n)?n.map(String).filter(o=>t[o]===void 0||t[o]===null||String(t[o]).trim()===""):[]}function qr(e,t){let n=e.find(r=>r.name===t);if(n)return n;let o=e.filter(r=>r.name.endsWith(`_${t}`)).sort((r,a)=>r.name.length-a.name.length);if(o.length!==0&&!(o.length>1&&o[0].name.length===o[1].name.length))return o[0]}function ro(e){return e.normalize("NFC").trim().toLocaleLowerCase()}function Ur(e,t){let n=ro(e);return t.find(o=>o.phrases.some(r=>{let a=ro(r);return a.length>0&&n.includes(a)}))}function At({tools:e,data:t=[],onResult:n,onError:o,locale:r="en",columns:a=[],rowKey:i="id",parseIntent:s,customRules:c=[],historyLimit:b=20}){let g=Or[r],[w,E]=Tt(0),[O,W]=Tt(null),[G,A]=Tt(null),[B,y]=Tt([]),S=Yt({tools:e,data:t,onResult:n,onError:o,columns:a,rowKey:i,parseIntent:s,customRules:c,historyLimit:b,m:g,locale:r});S.current={tools:e,data:t,onResult:n,onError:o,columns:a,rowKey:i,parseIntent:s,customRules:c,historyLimit:b,m:g,locale:r};let R=Yt(!0),m=Yt(0);Dr(()=>(R.current=!0,()=>{R.current=!1}),[]);let M=rt((Q,k,l,X,$)=>{R.current&&($===m.current&&W(l),y(H=>[...H,{id:$,tool:Q,input:k,result:l,source:X,at:Date.now()}].slice(-S.current.historyLimit)))},[]),x=rt(async(Q,k,l)=>{let{tools:X,onResult:$,onError:H,m:J}=S.current,ie=++m.current,C=qr(X,Q);if(!C){let u={success:!1,message:J.toolMissing(Q),error:{code:"NOT_SUPPORTED"}},v=new Error(u.message);return R.current&&A(v),H?.(v),M(Q,k,u,l,ie),u}let P=_r(C,k);if(P.length){let u={success:!1,message:J.missingInput(P.join(", ")),error:{code:"INVALID_INPUT"},tool:C.name};return M(C.name,k,u,l,ie),$?.(u),u}R.current&&E(u=>u+1);try{let u=await C.execute(k),v=Hr(u)?{...u,tool:C.name}:{success:!0,message:J.done,data:u,tool:C.name};return R.current&&v.success&&A(null),M(C.name,k,v,l,ie),$?.(v),v}catch(u){let v=u instanceof Error?u:new Error(String(u)),U={success:!1,message:J.failed,error:{code:"INTERNAL"},tool:C.name};return R.current&&A(v),H?.(v),M(C.name,k,U,l,ie),U}finally{R.current&&E(u=>Math.max(0,u-1))}},[M]),N=rt((Q,k={})=>x(Q,k??{},"tool"),[x]),se=rt(async Q=>{let{columns:k,locale:l,parseIntent:X,customRules:$,data:H,m:J,rowKey:ie}=S.current,C=Ur(Q,$??[]);if(C){let L={input:Q,data:H,columns:k,executeTool:N};try{let le={success:!0,message:await C.execute(L),tool:`rule:${C.name}`};return M(`rule:${C.name}`,{text:Q},le,"ask",++m.current),S.current.onResult?.(le),le}catch(ne){let le=ne instanceof Error?ne:new Error(String(ne)),ge={success:!1,message:J.failed,error:{code:"INTERNAL"},tool:`rule:${C.name}`};return R.current&&A(le),S.current.onError?.(le),M(`rule:${C.name}`,{text:Q},ge,"ask",++m.current),ge}}let u=(X??io)(Q,{columns:k,locale:l});if(!u){let L={success:!1,message:J.notUnderstood,error:{code:"NOT_UNDERSTOOD"}};return M("ask",{text:Q},L,"ask",++m.current),L}if(u.kind==="tool")return x(u.tool,u.input,"ask");let v=await x("search",{query:u.text},"ask"),U=Array.isArray(v.data)?v.data:[];if(!v.success)return v;if(U.length===0){let L={success:!1,message:J.noMatch(u.text),error:{code:"NOT_FOUND"},tool:v.tool};return M("open",{text:u.text},L,"ask",++m.current),L}return x("open",{id:et(U[0],ie)},"ask")},[N,M,x]),q=rt(()=>{y([]),W(null),A(null)},[]);return{loading:w>0,tools:e,executeTool:N,ask:se,lastResult:O,lastError:G,history:B,clearHistory:q}}var jr=At;import{useEffect as Vr,useMemo as Yr,useRef as Kt}from"react";function Kr(e){return JSON.stringify(e.map(t=>[t.name,t.title,t.description,t.inputSchema]))}function Zr({tools:e,data:t=[],columns:n=[],rowKey:o,locale:r,onSelectRow:a,onHighlightRows:i,onOpenRow:s,name:c="yuktai_grid",descriptions:b,onStatusChange:g}){let w=Yr(()=>e||ot({data:t,columns:n,rowKey:o,locale:r,onSelectRow:a,onHighlightRows:i,onOpenRow:s},{name:c,descriptions:b}),[e,t,n,o,r,a,i,s,c,b]),E=Kt(w);E.current=w;let O=Kt(g);O.current=g;let W=Kt(Promise.resolve()),G=Kr(w);return Vr(()=>{let A=m=>O.current?.(m),B=typeof document<"u"?document.modelContext:void 0;if(!B?.registerTool){A({state:"unsupported",registered:[],errors:[]});return}let y=new AbortController,S=E.current,R=W.current.then(async()=>{if(y.signal.aborted)return;A({state:"registering",registered:[],errors:[]});let m=[],M=[];for(let x of S){if(y.signal.aborted)return;try{await B.registerTool({name:x.name,title:x.title,description:x.description,inputSchema:x.inputSchema,execute:N=>{let se=E.current.find(q=>q.name===x.name);return se?se.execute(N??{}):{success:!1,message:`Tool "${x.name}" is no longer available.`,error:{code:"NOT_SUPPORTED"}}}},{signal:y.signal}),m.push(x.name)}catch(N){M.push({tool:x.name,message:N instanceof Error?N.message:String(N)})}}y.signal.aborted||A({state:M.length===0?"ready":m.length>0?"partial":"error",registered:m,errors:M})});return W.current=R.catch(()=>{}),()=>y.abort()},[G]),null}var Ct=Zr;import{jsx as I,jsxs as ae}from"react/jsx-runtime";var Qr={"en-US":{search:"Search...",searchAria:"Search grid",rows:"rows",row:"row",loading:"Loading...",noData:"No data found.",selectRow:"Select row",pageSize:"Page size",page:"Page",of:"of",previous:"Previous",next:"Next",yes:"Yes",no:"No",sortAscending:"Sort ascending",sortDescending:"Sort descending",filtersActive:e=>`${e} filter(s) applied`,clearFilters:"Clear filters"},"te-IN":{search:"\u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F...",searchAria:"\u0C17\u0C4D\u0C30\u0C3F\u0C21\u0C4D\u200C\u0C32\u0C4B \u0C36\u0C4B\u0C27\u0C3F\u0C02\u0C1A\u0C02\u0C21\u0C3F",rows:"\u0C35\u0C30\u0C41\u0C38\u0C32\u0C41",row:"\u0C35\u0C30\u0C41\u0C38",loading:"\u0C32\u0C4B\u0C21\u0C4D \u0C05\u0C35\u0C41\u0C24\u0C4B\u0C02\u0C26\u0C3F...",noData:"\u0C21\u0C47\u0C1F\u0C3E \u0C15\u0C28\u0C2C\u0C21\u0C32\u0C47\u0C26\u0C41.",selectRow:"\u0C35\u0C30\u0C41\u0C38\u0C28\u0C41 \u0C0E\u0C02\u0C1A\u0C41\u0C15\u0C4B\u0C02\u0C21\u0C3F",pageSize:"\u0C2A\u0C47\u0C1C\u0C40 \u0C2A\u0C30\u0C3F\u0C2E\u0C3E\u0C23\u0C02",page:"\u0C2A\u0C47\u0C1C\u0C40",of:"\u0C32\u0C4B",previous:"\u0C35\u0C46\u0C28\u0C41\u0C15\u0C15\u0C41",next:"\u0C2E\u0C41\u0C02\u0C26\u0C41\u0C15\u0C41",yes:"\u0C05\u0C35\u0C41\u0C28\u0C41",no:"\u0C15\u0C3E\u0C26\u0C41",sortAscending:"\u0C06\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C02\u0C21\u0C3F",sortDescending:"\u0C05\u0C35\u0C30\u0C4B\u0C39\u0C23 \u0C15\u0C4D\u0C30\u0C2E\u0C02\u0C32\u0C4B \u0C05\u0C2E\u0C30\u0C4D\u0C1A\u0C02\u0C21\u0C3F",filtersActive:e=>`${e} \u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D(\u0C32\u0C41) \u0C35\u0C47\u0C36\u0C3E\u0C30\u0C41`,clearFilters:"\u0C2B\u0C3F\u0C32\u0C4D\u0C1F\u0C30\u0C4D\u0C32\u0C41 \u0C24\u0C40\u0C38\u0C47\u0C2F\u0C02\u0C21\u0C3F"}};function Xr({size:e=20,color:t="currentColor",strokeWidth:n=2.4}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[I("circle",{cx:"11",cy:"11",r:"6.5"}),I("path",{d:"m16 16 5 5"})]})}function Jr({size:e=18,color:t="currentColor",strokeWidth:n=2.4,label:o}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":o?void 0:!0,"aria-label":o,role:o?"img":void 0,children:[o?I("title",{children:o}):null,I("path",{d:"m6 15 6-6 6 6"})]})}function ei({size:e=18,color:t="currentColor",strokeWidth:n=2.4,label:o}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":o?void 0:!0,"aria-label":o,role:o?"img":void 0,children:[o?I("title",{children:o}):null,I("path",{d:"m6 9 6 6 6-6"})]})}function ti({size:e=20,color:t="currentColor",strokeWidth:n=2.4}){return I("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:I("path",{d:"m15 18-6-6 6-6"})})}function ni({size:e=20,color:t="currentColor",strokeWidth:n=2.4}){return I("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:I("path",{d:"m9 18 6-6-6-6"})})}function ao({size:e=18,color:t="currentColor",strokeWidth:n=2.4}){return I("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:I("path",{d:"m5 12 4 4L19 6"})})}function oi({data:e,columns:t,rowKey:n="id",view:o="auto",mobileBreakpoint:r=768,theme:a="default",locale:i="en-US",ai:s=!1,search:c=!0,selectable:b=!1,selectedKeys:g=[],onSelectionChange:w,pagination:E,loading:O=!1,highlightIds:W=[],highlightColor:G="#fff3a3",autoScrollToHighlight:A=!1,onRowClick:B,onSortChange:y,empty:S,className:R="",inputLanguage:m,toolName:M="yuktai_grid",toolDescriptions:x,webmcp:N=!1,onWebMCPStatusChange:se,onAgentResult:q,customRules:Q=[]}){let k=i==="te-IN"?"te-IN":"en-US",l=Qr[k],X=s===!0||typeof s=="object"&&s!==null,$=E!==!1&&E!==void 0,H=typeof E=="object"?E.pageSize??20:20,J=typeof E=="object"&&E.sizeOptions&&E.sizeOptions.length>0?E.sizeOptions:[10,20,50,100],[ie,C]=Pe(""),[P,u]=Pe(1),[v,U]=Pe(H),[L,ne]=Pe(),[le,ge]=Pe("asc"),[Ce,Xt]=Pe(!1),[me,We]=Pe([]),[Ke,at]=Pe([]),Ie=Ve(()=>nt(t.map(d=>({key:String(d.key),label:d.label,type:d.type}))),[t]);Rt(()=>{U(H),u(1)},[H]),Rt(()=>{let d=()=>{Xt(window.innerWidth<=r)};return d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}},[r]);let fe=Ve(()=>{let d=[...e];if(ie.trim()){let T=ie.trim().toLowerCase();d=d.filter(D=>t.some(F=>String(D[F.key]??"").toLowerCase().includes(T)))}return me.length&&(d=tt(d,Ie,me)),L&&d.sort((T,D)=>{let F=T[L],be=D[L];if(F==null&&be==null)return 0;if(F==null)return 1;if(be==null)return-1;if(typeof F=="number"&&typeof be=="number")return le==="asc"?F-be:be-F;let de=String(F).localeCompare(String(be),i,{numeric:!0,sensitivity:"base"});return le==="asc"?de:-de}),d},[e,t,ie,me,Ie,L,le,i]),Re=$?Math.max(1,Math.ceil(fe.length/v)):1;Rt(()=>{P>Re&&u(Re)},[P,Re]);let Ze=Ve(()=>{let d=[...W.map(String),...Ke];return Array.from(new Set(d))},[W,Ke]);Rt(()=>{if(!A)return;let d=Ze[0];if(d==null)return;let T=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(String(d)):String(d).replace(/["\\]/g,"\\$&");document.querySelector(`[data-yuktai-row-id="${T}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},[Ze,A,P]);let Me=Ve(()=>{if(!$)return fe;let d=(P-1)*v;return fe.slice(d,d+v)},[fe,$,P,v]),$e=o==="card"||o==="auto"&&Ce,Ee=d=>String(d[n]??""),De=d=>g.some(T=>String(T)===d),st=d=>Ze.some(T=>String(T)===d),f=d=>{if(!b)return;let T=Ee(d),D=De(T)?g.filter(F=>String(F)!==T):[...g,T];w?.(D)},Z=d=>{if(d.sortable===!1)return;let T=String(d.key),D=L===T&&le==="asc"?"desc":"asc";ne(T),ge(D),u(1),y?.({key:T,direction:D})},Ae=d=>{C(d),u(1)},It=(d,T)=>{let D=t.find(F=>String(F.key)===d||F.label.toLowerCase()===d.toLowerCase());D&&(ne(String(D.key)),ge(T),u(1),y?.({key:String(D.key),direction:T}))},Et=k==="te-IN"?"te":"en",Jt=Zt(d=>{d?(ne(d.key),ge(d.direction)):(ne(void 0),ge("asc")),u(1),y?.(d)},[y]),en=Zt(d=>{We(d),u(1)},[]),tn=Zt(d=>{if(at(d),$&&d.length){let T=fe.findIndex(D=>String(D[n]??"")===d[0]);T>=0&&u(Math.floor(T/v)+1)}},[$,fe,n,v]),Gt=Ve(()=>ot({data:e,columns:Ie,rowKey:String(n),locale:Et,filters:me,onHighlightRows:tn,onFiltersChange:en,onSortChange:Jt,onOpenRow:B?d=>{let T=fe.findIndex(F=>String(F[n]??"")===d),D=T>=0?fe[T]:e.find(F=>String(F[n]??"")===d);D&&B(D,Math.max(T,0))}:void 0,onSelectRow:b&&w?d=>{g.some(T=>String(T)===d)||w([...g.map(String),d])}:void 0},{name:M,descriptions:x}),[e,Ie,n,Et,me,tn,en,Jt,B,fe,b,w,g,M,x]),lt=At({tools:Gt,data:e,locale:Et,columns:Ie,rowKey:String(n),customRules:Q,onResult:q}),nn=Ve(()=>Gt.map(d=>({...d,execute:T=>lt.executeTool(d.name,T)})),[Gt,lt.executeTool]),Io=()=>{We([]),u(1)},on=(d,T,D)=>{if(T.render)return T.render(d[T.key],d,D);let F=d[T.key];if(F==null)return"";if(T.type==="date"){let be=new Date(String(F));if(!Number.isNaN(be.getTime()))return be.toLocaleDateString(i)}return T.type==="boolean"?F?l.yes:l.no:String(F)},V=a==="dark",rn={width:"100%",overflow:"hidden",border:a==="high-contrast"?"2px solid #000000":V?"1px solid #334155":"1px solid #e2e8f0",borderRadius:12,background:V?"#0f172a":"#ffffff",color:V?"#f8fafc":"#0f172a",fontFamily:a==="dyslexia"?"Arial, sans-serif":void 0},Eo={padding:12,display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",borderBottom:V?"1px solid #334155":"1px solid #e2e8f0"},an=d=>({width:40,height:40,minWidth:40,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:8,border:V?"1px solid #475569":"1px solid #cbd5e1",background:d?V?"#1e293b":"#f8fafc":V?"#1e293b":"#ffffff",color:d?"#94a3b8":V?"#f8fafc":"#0f172a",cursor:d?"not-allowed":"pointer",opacity:d?.55:1});if(O)return ae("div",{className:R,style:rn,children:[N&&I(Ct,{tools:nn,onStatusChange:se}),I("div",{style:{padding:32,textAlign:"center"},children:l.loading})]});let Go=t.map(d=>({key:String(d.key),label:d.label,type:d.type==="number"?"number":d.type==="date"?"date":"text"}));return ae("div",{className:R,style:rn,children:[N&&I(Ct,{tools:nn,onStatusChange:se}),(c||X||me.length>0)&&ae("div",{style:Eo,children:[c&&ae("div",{style:{position:"relative",width:"100%",maxWidth:420},children:[I("div",{style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",display:"flex",alignItems:"center",color:V?"#cbd5e1":"#64748b",pointerEvents:"none"},children:I(Xr,{size:19})}),I("input",{value:ie,onChange:d=>{C(d.target.value),u(1)},placeholder:l.search,"aria-label":l.searchAria,style:{width:"100%",padding:"10px 12px 10px 40px",borderRadius:8,border:V?"1px solid #475569":"1px solid #cbd5e1",background:V?"#1e293b":"#ffffff",color:V?"#ffffff":"#0f172a",outline:"none",boxSizing:"border-box"}})]}),me.length>0&&ae("button",{type:"button",onClick:Io,title:l.clearFilters,style:{padding:"6px 10px",borderRadius:999,border:V?"1px solid #475569":"1px solid #cbd5e1",background:V?"#1e293b":"#f1f5f9",color:"inherit",fontSize:12,cursor:"pointer"},children:[l.filtersActive(me.length)," \u2715"]}),ae("div",{style:{marginLeft:"auto",fontSize:13,opacity:.7,whiteSpace:"nowrap"},children:[fe.length," ",fe.length===1?l.row:l.rows]}),X&&I(jt,{data:e,columns:Go,onSearch:Ae,onSort:It,theme:V?"dark":"light",language:k,inputLanguage:m??k,agent:{ask:lt.ask,loading:lt.loading},embedded:!0})]}),fe.length===0?I("div",{style:{padding:40,textAlign:"center",opacity:.7},children:S??l.noData}):$e?I("div",{style:{display:"grid",gap:12,padding:12},children:Me.map((d,T)=>{let D=Ee(d),F=De(D),be=st(D);return ae("div",{"data-yuktai-row-id":D,onClick:()=>B?.(d,T),style:{padding:14,borderRadius:10,border:V?"1px solid #334155":"1px solid #e2e8f0",background:be?G:F?V?"#1e3a5f":"#eff6ff":V?"#1e293b":"#ffffff",cursor:B?"pointer":"default"},children:[b&&I("button",{type:"button",onClick:de=>{de.stopPropagation(),f(d)},"aria-label":`${l.selectRow} ${D}`,"aria-pressed":F,style:{width:32,height:32,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,marginBottom:10,borderRadius:7,border:F?"1px solid #2563eb":"1px solid #cbd5e1",background:F?"#2563eb":"transparent",color:F?"#ffffff":"currentColor",cursor:"pointer"},children:F&&I(ao,{size:17})}),t.map(de=>ae("div",{style:{display:"flex",gap:8,padding:"5px 0",alignItems:"flex-start"},children:[I("strong",{style:{minWidth:100,opacity:.7},children:de.label}),I("span",{children:on(d,de,T)})]},String(de.key)))]},D)})}):I("div",{style:{width:"100%",overflowX:"auto"},children:ae("table",{style:{width:"100%",borderCollapse:"collapse"},children:[I("thead",{children:ae("tr",{children:[b&&I("th",{style:{padding:10,borderBottom:V?"1px solid #334155":"1px solid #e2e8f0",width:52}}),t.filter(d=>!(Ce&&d.hiddenOnMobile)).map(d=>{let T=L===String(d.key);return I("th",{onClick:()=>Z(d),style:{padding:10,textAlign:d.align??"left",borderBottom:V?"1px solid #334155":"1px solid #e2e8f0",whiteSpace:"nowrap",cursor:d.sortable===!1?"default":"pointer",width:d.width,userSelect:"none"},children:ae("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[d.label,T&&(le==="asc"?I(Jr,{size:17,label:l.sortAscending}):I(ei,{size:17,label:l.sortDescending}))]})},String(d.key))})]})}),I("tbody",{children:Me.map((d,T)=>{let D=Ee(d),F=De(D),be=st(D);return ae("tr",{"data-yuktai-row-id":D,onClick:()=>B?.(d,T),style:{background:be?G:F?V?"#1e3a5f":"#eff6ff":"transparent",cursor:B?"pointer":"default"},children:[b&&I("td",{style:{padding:10,borderBottom:V?"1px solid #334155":"1px solid #e2e8f0"},children:I("button",{type:"button",onClick:de=>{de.stopPropagation(),f(d)},"aria-label":`${l.selectRow} ${D}`,"aria-pressed":F,style:{width:28,height:28,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:6,border:F?"1px solid #2563eb":V?"1px solid #64748b":"1px solid #cbd5e1",background:F?"#2563eb":"transparent",color:F?"#ffffff":"currentColor",cursor:"pointer"},children:F&&I(ao,{size:16})})}),t.filter(de=>!(Ce&&de.hiddenOnMobile)).map(de=>I("td",{style:{padding:10,textAlign:de.align??"left",borderBottom:V?"1px solid #334155":"1px solid #e2e8f0"},children:on(d,de,T)},String(de.key)))]},D)})})]})}),$&&ae("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",padding:12,borderTop:V?"1px solid #334155":"1px solid #e2e8f0"},children:[ae("span",{style:{fontSize:13,opacity:.7},children:[l.page," ",P," ",l.of," ",Re]}),ae("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[typeof E=="object"&&E.showSizeChanger&&I("select",{value:v,onChange:d=>{let T=Number(d.target.value);!Number.isFinite(T)||T<=0||(U(T),u(1))},"aria-label":l.pageSize,style:{minHeight:40,padding:"7px 10px",borderRadius:8,border:V?"1px solid #475569":"1px solid #cbd5e1",background:V?"#1e293b":"#ffffff",color:V?"#ffffff":"#0f172a"},children:J.map(d=>I("option",{value:d,children:d},d))}),I("button",{type:"button",disabled:P<=1,onClick:()=>u(d=>Math.max(1,d-1)),"aria-label":l.previous,title:l.previous,style:an(P<=1),children:I(ti,{size:20})}),I("button",{type:"button",disabled:P>=Re,onClick:()=>u(d=>Math.min(Re,d+1)),"aria-label":l.next,title:l.next,style:an(P>=Re),children:I(ni,{size:20})})]})]})]})}import{useState as Ye,useMemo as it,useCallback as Te,useEffect as Qt}from"react";function so(e){return e===!1?Number.MAX_SAFE_INTEGER:e===!0||e===void 0?10:e.pageSize??10}function lo(e){return String(e??"").normalize("NFC").toLowerCase().trim()}function co(e){return e==null||typeof e=="string"&&e.trim()===""}function uo(e){if(typeof e=="number")return Number.isFinite(e)?e:null;let t=String(e??"").trim();if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:null}function po(e){let t=e instanceof Date?e.getTime():new Date(String(e)).getTime();return Number.isFinite(t)?t:null}function ri(e,t,n,o){if(n==="number"||typeof e=="number"&&typeof t=="number"){let r=uo(e),a=uo(t);if(r!==null&&a!==null)return r-a}if(n==="date"||e instanceof Date&&t instanceof Date){let r=po(e),a=po(t);if(r!==null&&a!==null)return r-a}return typeof e=="boolean"&&typeof t=="boolean"?e===t?0:e?1:-1:String(e).localeCompare(String(t),o,{sensitivity:"base",numeric:!0})}function ii(e){let{data:t,columns:n,pagination:o=!0,mobileBreakpoint:r=768,locale:a,initialFilters:i=[]}=e,[s,c]=Ye(null),[b,g]=Ye(""),[w,E]=Ye(i),[O,W]=Ye(1),[G,A]=Ye(so(o)),[B,y]=Ye(!1),S=so(o);Qt(()=>{A(S),W(1)},[S]),Qt(()=>{if(typeof window>"u")return;let u=()=>{y(window.innerWidth<=r)};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[r]);let R=it(()=>nt(n.map(u=>({key:String(u.key),label:u.label,type:u.type}))),[n]),m=Te(u=>{c(v=>!v||v.key!==u?{key:u,direction:"asc"}:v.direction==="asc"?{key:u,direction:"desc"}:null),W(1)},[]),M=Te(u=>{c(u&&u.direction?u:null),W(1)},[]),x=Te(()=>{c(null),W(1)},[]),N=Te(u=>{g(u),W(1)},[]),se=Te(u=>{E(u),W(1)},[]),q=Te(u=>{E(v=>[...v.filter(U=>U.key!==u.key),u]),W(1)},[]),Q=Te(u=>{E(v=>v.filter(U=>U.key!==u)),W(1)},[]),k=Te(()=>{E([]),W(1)},[]),l=Te(u=>{A(Math.max(1,Math.floor(u)||1)),W(1)},[]),X=it(()=>{let u=lo(b);return u?t.filter(v=>n.some(U=>{let L=v[U.key];return L==null?!1:lo(L).includes(u)})):t},[t,b,n]),$=it(()=>tt(X,R,w),[X,R,w]),H=it(()=>{if(!s||!s.direction)return $;let u=n.find(U=>String(U.key)===s.key),v=s.direction==="desc"?-1:1;return[...$].sort((U,L)=>{let ne=U[s.key],le=L[s.key],ge=co(ne),Ce=co(le);return ge&&Ce?0:ge?1:Ce?-1:v*ri(ne,le,u?.type,a)})},[$,s,n,a]),J=Math.max(1,Math.ceil(H.length/G)),ie=it(()=>{if(o===!1)return H;let u=(O-1)*G;return H.slice(u,u+G)},[H,O,G,o]);Qt(()=>{O>J&&W(J)},[O,J]);let C=Te(u=>W(Math.min(Math.max(1,Math.floor(u)||1),J)),[J]),P=Te(()=>{c(null),g(""),E([]),W(1)},[]);return{displayedData:ie,rows:H,totalCount:t.length,filteredCount:H.length,sort:s,toggleSort:m,setSort:M,clearSort:x,searchQuery:b,setSearchQuery:N,filters:w,setFilters:se,setFilter:q,removeFilter:Q,clearFilters:k,page:O,pageSize:G,totalPages:J,setPage:C,setPageSize:l,isMobile:B,reset:P}}import{jsx as ai}from"react/jsx-runtime";function ce({size:e=20,color:t="currentColor",strokeWidth:n=2.5,label:o,children:r,...a}){return ai("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!o?"true":void 0,"aria-label":o,role:o?"img":void 0,focusable:"false",...a,children:r})}import{jsx as fo,jsxs as si}from"react/jsx-runtime";function go(e){return si(ce,{...e,children:[fo("circle",{cx:"11",cy:"11",r:"7"}),fo("path",{d:"m20 20-4-4"})]})}import{jsx as mo,jsxs as li}from"react/jsx-runtime";function bo(e){return li(ce,{...e,children:[mo("path",{d:"M12 19V5"}),mo("path",{d:"m5 12 7-7 7 7"})]})}import{jsx as yo,jsxs as di}from"react/jsx-runtime";function ho(e){return di(ce,{...e,children:[yo("path",{d:"M12 5v14"}),yo("path",{d:"m5 12 7 7 7-7"})]})}import{jsx as xo}from"react/jsx-runtime";function wo(e){return xo(ce,{...e,children:xo("path",{d:"m15 18-6-6 6-6"})})}import{jsx as ko}from"react/jsx-runtime";function vo(e){return ko(ce,{...e,children:ko("path",{d:"m9 18 6-6-6-6"})})}import{jsx as So}from"react/jsx-runtime";function To(e){return So(ce,{...e,children:So("path",{d:"M5 12.5 10 17.5 19.5 7"})})}import{jsx as Ao,jsxs as ci}from"react/jsx-runtime";function Co(e){return ci(ce,{...e,children:[Ao("path",{d:"M18 6 6 18"}),Ao("path",{d:"m6 6 12 12"})]})}function ui(){if(typeof globalThis>"u")return new Ne;if(!globalThis.__yuktai_runtime__){let e=new Ne;e.register(he.name,he),e.register(wt.name,wt),e.register(kt.name,kt),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var Ro=typeof window<"u"?ui():new Ne,Es={wcagPlugin:he,list(){return Ro.getPlugins()},use(e){return Ro.use(e)},fix(e){return he.applyFixes({enabled:!0,autoFix:!0,...e})},scan(){return he.scan()}};export{To as CheckIcon,wo as ChevronLeftIcon,vo as ChevronRightIcon,Co as CloseIcon,ce as IconBase,Ne as Runtime,go as SearchIcon,ho as SortDownIcon,bo as SortUpIcon,Es as YuktAI,qt as YuktAIWrapper,oi as YuktaiGrid,jt as YuktaiGridAI,jr as YuktaiGridAgent,Ct as YuktaiGridWebMCP,wt as aiPlugin,tt as applyGridFilters,eo as clearFilters,no as clearSort,Vn as countGrid,ot as createGridTools,qt as default,Jn as filterGrid,Yn as getColumns,Kn as getRow,et as getRowId,Zn as highlightRows,Xn as openRow,io as parseGridIntent,jn as searchGrid,Qn as selectRow,to as sortGrid,nt as toGridToolColumns,ii as useGrid,At as useYuktaiGridAgent,kt as voicePlugin,he as wcag,he as wcagPlugin};
|