@yuktishaalaa/yuktai 1.0.14 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +338 -0
- package/dist/index.cjs +5 -19
- package/dist/index.d.cts +43 -9
- package/dist/index.d.ts +43 -9
- package/dist/index.global.js +75 -0
- package/dist/index.js +5 -19
- package/package.json +59 -7
package/README.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
# @yuktishaalaa/yuktai
|
|
2
|
+
|
|
3
|
+
> Universal runtime accessibility plugin — automatically fixes WCAG violations on every page, for every user, with zero configuration.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@yuktishaalaa/yuktai)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i @yuktishaalaa/yuktai
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## What it does
|
|
19
|
+
|
|
20
|
+
yuktai scans every HTML element on the page and automatically injects missing accessibility attributes — `aria-label`, `alt`, `role`, `tabindex`, `scope`, `autocomplete`, `aria-required`, `aria-expanded`, and more. It also:
|
|
21
|
+
|
|
22
|
+
- Injects a skip-to-content link
|
|
23
|
+
- Ensures `<html lang>` and `<title>` are present
|
|
24
|
+
- Fixes `<meta viewport>` if it blocks user zoom
|
|
25
|
+
- Watches for new DOM elements via `MutationObserver` and fixes them as they appear
|
|
26
|
+
- Applies user-controlled visual preferences (high contrast, reduce motion, font scale, dyslexia font, colour-blind simulation)
|
|
27
|
+
|
|
28
|
+
The floating button appears bottom-left. Click it, enable settings, click **Apply settings**.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## React
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
// src/App.tsx
|
|
36
|
+
import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
|
|
37
|
+
|
|
38
|
+
export default function App() {
|
|
39
|
+
return (
|
|
40
|
+
<YuktAIWrapper position="left">
|
|
41
|
+
<YourAppContent />
|
|
42
|
+
</YuktAIWrapper>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Props**
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Description |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| `position` | `"left" \| "right"` | `"left"` | Side the FAB appears on |
|
|
52
|
+
| `children` | `ReactNode` | required | Your app content |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Next.js (App Router)
|
|
57
|
+
|
|
58
|
+
**Step 1 — next.config.js** (required)
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
const nextConfig = {
|
|
62
|
+
transpilePackages: ["@yuktishaalaa/yuktai"],
|
|
63
|
+
};
|
|
64
|
+
module.exports = nextConfig;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Step 2 — app/layout.tsx**
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
|
|
71
|
+
|
|
72
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
73
|
+
return (
|
|
74
|
+
<html lang="en">
|
|
75
|
+
<body>
|
|
76
|
+
<YuktAIWrapper position="left">
|
|
77
|
+
<main>{children}</main>
|
|
78
|
+
</YuktAIWrapper>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Pages Router** — use `pages/_app.tsx` instead:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { YuktAIWrapper } from "@yuktishaalaa/yuktai";
|
|
89
|
+
import type { AppProps } from "next/app";
|
|
90
|
+
|
|
91
|
+
export default function MyApp({ Component, pageProps }: AppProps) {
|
|
92
|
+
return (
|
|
93
|
+
<YuktAIWrapper position="left">
|
|
94
|
+
<Component {...pageProps} />
|
|
95
|
+
</YuktAIWrapper>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Vue 3 / Nuxt 3
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<!-- App.vue -->
|
|
106
|
+
<script setup lang="ts">
|
|
107
|
+
import YuktAIWrapper from "@yuktishaalaa/yuktai/vue";
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<YuktAIWrapper position="left">
|
|
112
|
+
<RouterView />
|
|
113
|
+
</YuktAIWrapper>
|
|
114
|
+
</template>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Nuxt 3 — app.vue**
|
|
118
|
+
|
|
119
|
+
```vue
|
|
120
|
+
<script setup lang="ts">
|
|
121
|
+
import YuktAIWrapper from "@yuktishaalaa/yuktai/vue";
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<template>
|
|
125
|
+
<YuktAIWrapper position="left">
|
|
126
|
+
<NuxtLayout>
|
|
127
|
+
<NuxtPage />
|
|
128
|
+
</NuxtLayout>
|
|
129
|
+
</YuktAIWrapper>
|
|
130
|
+
</template>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Nuxt 3 — client plugin** (`plugins/yuktai.client.ts`)
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import YuktAIWrapper from "@yuktishaalaa/yuktai/vue";
|
|
137
|
+
|
|
138
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
139
|
+
nuxtApp.vueApp.component("YuktAIWrapper", YuktAIWrapper);
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Angular
|
|
146
|
+
|
|
147
|
+
**app.module.ts**
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { YuktAIModule } from "@yuktishaalaa/yuktai/angular";
|
|
151
|
+
|
|
152
|
+
@NgModule({
|
|
153
|
+
imports: [BrowserModule, YuktAIModule],
|
|
154
|
+
bootstrap: [AppComponent],
|
|
155
|
+
})
|
|
156
|
+
export class AppModule {}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**app.component.html**
|
|
160
|
+
|
|
161
|
+
```html
|
|
162
|
+
<yuktai-a11y position="left">
|
|
163
|
+
<router-outlet></router-outlet>
|
|
164
|
+
</yuktai-a11y>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Angular 17+ standalone**
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import { YuktAIComponent } from "@yuktishaalaa/yuktai/angular";
|
|
171
|
+
|
|
172
|
+
@Component({
|
|
173
|
+
standalone: true,
|
|
174
|
+
imports: [RouterOutlet, YuktAIComponent],
|
|
175
|
+
template: `
|
|
176
|
+
<yuktai-a11y position="left">
|
|
177
|
+
<router-outlet />
|
|
178
|
+
</yuktai-a11y>
|
|
179
|
+
`,
|
|
180
|
+
})
|
|
181
|
+
export class AppComponent {}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Vanilla JavaScript
|
|
187
|
+
|
|
188
|
+
**CDN — no install needed**
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<!-- Add before </body> -->
|
|
192
|
+
<script src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai/vanilla/index.js"></script>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**npm import**
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
import "@yuktishaalaa/yuktai/vanilla";
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Configure position**
|
|
202
|
+
|
|
203
|
+
```html
|
|
204
|
+
<script>
|
|
205
|
+
window.YUKTAI_CONFIG = { position: "right" };
|
|
206
|
+
</script>
|
|
207
|
+
<script src="cdn.../vanilla/index.js"></script>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Programmatic API**
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
window.yuktai.apply(); // apply settings
|
|
214
|
+
window.yuktai.reset(); // reset everything
|
|
215
|
+
window.yuktai.wcagPlugin.scan(); // scan without fixing
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Web Component
|
|
221
|
+
|
|
222
|
+
Works in every framework and plain HTML — uses native Custom Elements with Shadow DOM.
|
|
223
|
+
|
|
224
|
+
**Plain HTML**
|
|
225
|
+
|
|
226
|
+
```html
|
|
227
|
+
<script type="module"
|
|
228
|
+
src="https://cdn.jsdelivr.net/npm/@yuktishaalaa/yuktai/web-component/index.js">
|
|
229
|
+
</script>
|
|
230
|
+
|
|
231
|
+
<yuktai-a11y position="left">
|
|
232
|
+
<!-- your content -->
|
|
233
|
+
</yuktai-a11y>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Inside React**
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import "@yuktishaalaa/yuktai/web-component";
|
|
240
|
+
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
<yuktai-a11y position="left">
|
|
243
|
+
<App />
|
|
244
|
+
</yuktai-a11y>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Inside Vue** — add to `vite.config.ts` first:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
plugins: [vue({
|
|
251
|
+
template: {
|
|
252
|
+
compilerOptions: {
|
|
253
|
+
isCustomElement: (tag) => tag === "yuktai-a11y",
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
})]
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
```vue
|
|
260
|
+
<script setup>
|
|
261
|
+
import "@yuktishaalaa/yuktai/web-component";
|
|
262
|
+
</script>
|
|
263
|
+
<template>
|
|
264
|
+
<yuktai-a11y position="left">
|
|
265
|
+
<RouterView />
|
|
266
|
+
</yuktai-a11y>
|
|
267
|
+
</template>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Direct engine API
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
import { wcagPlugin } from "@yuktishaalaa/yuktai/core";
|
|
276
|
+
|
|
277
|
+
// Apply all WCAG rules
|
|
278
|
+
const report = wcagPlugin.applyFixes({ enabled: true });
|
|
279
|
+
console.log(report.fixed); // fixes applied
|
|
280
|
+
console.log(report.scanned); // nodes scanned
|
|
281
|
+
console.log(report.renderTime); // ms
|
|
282
|
+
|
|
283
|
+
// Scan only — no DOM changes
|
|
284
|
+
const violations = wcagPlugin.scan();
|
|
285
|
+
|
|
286
|
+
// Auto-fix new elements
|
|
287
|
+
wcagPlugin.startObserver({ enabled: true, autoFix: true });
|
|
288
|
+
wcagPlugin.stopObserver();
|
|
289
|
+
|
|
290
|
+
// Cleanup
|
|
291
|
+
wcagPlugin.removeLiveRegion();
|
|
292
|
+
wcagPlugin.removeColorBlindSvg();
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## HTML elements covered
|
|
298
|
+
|
|
299
|
+
The engine covers every HTML element:
|
|
300
|
+
|
|
301
|
+
- **Headings** — `h1` through `h6`
|
|
302
|
+
- **Text** — `p`, `span`, `abbr`, `mark`, `time`, `meter`, `progress`, and all inline elements
|
|
303
|
+
- **Images & media** — `img`, `area`, `svg`, `canvas`, `video`, `audio`, `iframe`, `object`, `embed`, `figure`
|
|
304
|
+
- **Interactive** — `button`, `a`, clickable `div`/`span`
|
|
305
|
+
- **Forms** — `input` (all types), `select`, `textarea`, `fieldset`, `label`
|
|
306
|
+
- **Tables** — `table`, `th`, `td`, `caption`
|
|
307
|
+
- **Lists** — `ul`, `ol`, `dl`, `li`, `dt`, `dd`
|
|
308
|
+
- **Landmarks** — `nav`, `header`, `footer`, `main`, `aside`, `section`, `article`, `details`, `summary`, `dialog`
|
|
309
|
+
- **Document** — `html`, `head`, `meta viewport`, `body`
|
|
310
|
+
- **ARIA widgets** — `role=tab`, `alert`, `tooltip`, `menu`, `listbox`, `slider`, `checkbox`, `combobox`, `grid`, `tree`, `spinbutton`
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## The report
|
|
315
|
+
|
|
316
|
+
After clicking **Apply settings**, the panel shows:
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
✓ 12 fixes applied · 534 nodes · 1.2ms
|
|
320
|
+
✓ 0 fixes needed · 534 nodes clean · 0.8ms
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
`0 fixes needed` is a passing result — it means the page is already accessible. The render time confirms the engine ran.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Design principles
|
|
328
|
+
|
|
329
|
+
- **Zero id attributes** — no injected node ever gets an `id`. All injected nodes are tracked via module-level JavaScript references. The plugin never collides with the host app's ids.
|
|
330
|
+
- **Zero API keys** — the engine runs entirely in the browser. No external calls, no telemetry, no cost.
|
|
331
|
+
- **Zero framework lock-in** — `core/renderer.ts` has no framework imports. It works in Node.js, browsers, and test environments.
|
|
332
|
+
- **One engine, many adapters** — all adapters import from `core/renderer.ts`. The WCAG logic is written once.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## License
|
|
337
|
+
|
|
338
|
+
MIT © yuktai contributors
|
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
"use strict";"use client";var q=Object.create;var S=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var U=(e,n)=>{for(var s in n)S(e,s,{get:n[s],enumerable:!0})},_=(e,n,s,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Y(n))!K.call(e,t)&&t!==s&&S(e,t,{get:()=>n[t],enumerable:!(a=V(n,t))||a.enumerable});return e};var B=(e,n,s)=>(s=e!=null?q(G(e)):{},_(n||!e||!e.__esModule?S(s,"default",{value:e,enumerable:!0}):s,e)),Z=e=>_(S({},"__esModule",{value:!0}),e);var ne={};U(ne,{YuktAI:()=>N,YuktAIWrapper:()=>z,default:()=>te});module.exports=Z(ne);var k=class{plugins=new Map;register(n,s){if(!s||typeof s.execute!="function")throw new Error(`Invalid plugin: ${n}`);this.plugins.set(n,s)}use(n){return this.plugins.get(n)}async run(n,s){try{let a=this.use(n);if(!a)throw new Error(`Plugin not found: ${n}`);return await a.execute(s)}catch(a){throw console.error(`[YuktAI Runtime Error in ${n}]:`,a),a}}getPlugins(){return Array.from(this.plugins.keys())}};var E={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};var F={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};var W=B(require("tesseract.js"),1),p=null,P=null;function J(e){let n=new TextDecoder("utf-8",{fatal:!1}).decode(new Uint8Array(e.slice(0,2e3)));return/[\u0C00-\u0C7F]/.test(n)?"tel":/[\u0900-\u097F]/.test(n)?"hin":/[\u0B80-\u0BFF]/.test(n)?"tam":/[\u4E00-\u9FFF]/.test(n)?"chi_sim":/[\u3040-\u30FF]/.test(n)?"jpn":/[\u0600-\u06FF]/.test(n)?"ara":/[\u0400-\u04FF]/.test(n)?"rus":"eng"}async function Q(e){return p&&P===e||(p&&(await p.terminate(),p=null),p=await W.default.createWorker({langPath:"/tessdata",logger:()=>{}}),await p.loadLanguage(e),await p.initialize(e),P=e),p}var L={name:"image.ocr.smart",async execute(e){try{if(!e?.file)return"\u274C No file provided";let n=e.file instanceof Blob?e.file:new Blob([e.file],{type:e.type??"image/png"}),s=e.lang||J(await n.arrayBuffer())||"eng",a=await Q(s),{data:t}=await a.recognize(n),r=t.text?.trim();return r?{language:s,confidence:Math.round(t.confidence??0),text:r}:"\u26A0\uFE0F No text detected"}catch(n){return console.error("[ocrSmartPlugin]",n),"\u274C OCR failed"}}};var y=null,w=null,A={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},u={name:"yuktai-a11y",version:"1.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";let n=this.applyFixes(e);return e.autoFix&&this.startObserver(e),`yuktai-a11y: ${n.fixed} fixes applied across ${n.scanned} nodes.`},applyFixes(e){let n={fixed:0,scanned:0,details:[]};if(typeof document>"u")return n;let s=document.querySelectorAll("*");if(n.scanned=s.length,s.forEach(a=>{let t=a,r=t.tagName.toLowerCase();if((r==="a"||r==="button")&&!t.innerText?.trim()&&!t.getAttribute("aria-label")){let l=t.getAttribute("title")||"Interactive element";t.setAttribute("aria-label",l),n.details.push({tag:r,fix:`aria-label="${l}"`,element:t.outerHTML.slice(0,60)}),n.fixed++}if(r==="img"&&!t.hasAttribute("alt")&&(t.setAttribute("alt",""),t.setAttribute("aria-hidden","true"),n.details.push({tag:r,fix:'alt="" aria-hidden="true"',element:t.outerHTML.slice(0,60)}),n.fixed++),(t.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(t).cursor==="pointer")&&!["button","a","input","select","textarea"].includes(r)&&(t.getAttribute("role")||(t.setAttribute("role","button"),n.details.push({tag:r,fix:'role="button"',element:t.outerHTML.slice(0,60)}),n.fixed++),t.tabIndex<0&&(t.tabIndex=0,n.fixed++),t.onkeydown||(t.onkeydown=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t.click())})),["input","select","textarea"].includes(r)){if(!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let f=t.getAttribute("placeholder")||t.getAttribute("name")||r;t.setAttribute("aria-label",f),n.details.push({tag:r,fix:`aria-label="${f}"`,element:t.outerHTML.slice(0,60)}),n.fixed++}t.hasAttribute("required")&&!t.getAttribute("aria-required")&&(t.setAttribute("aria-required","true"),n.fixed++);let l=t;r==="input"&&!l.autocomplete&&(l.name?.includes("email")?l.autocomplete="email":l.name?.includes("tel")&&(l.autocomplete="tel"))}if(r==="table"&&!a.querySelector("th")&&(t.getAttribute("role")||(t.setAttribute("role","grid"),n.details.push({tag:r,fix:'role="grid"',element:t.outerHTML.slice(0,60)}),n.fixed++)),r==="a"){let l=t;if(l.target==="_blank"){l.rel?.includes("noopener")||(l.rel="noopener noreferrer",n.fixed++);let f=l.getAttribute("aria-label")||(l.innerText?.trim()?l.innerText.trim():"link");f.includes("opens in new window")||(l.setAttribute("aria-label",`${f} (opens in new window)`),n.fixed++)}}let g={nav:"navigation",header:"banner",footer:"contentinfo",main:"main"};if(g[r]&&!t.getAttribute("role")&&(t.setAttribute("role",g[r]),n.fixed++),e.highContrast&&(t.style.filter="contrast(1.15) brightness(1.05)"),e.reduceMotion&&(t.style.transition="none",t.style.animation="none"),e.fontSizeMultiplier&&e.fontSizeMultiplier!==1){let l=parseFloat(window.getComputedStyle(t).fontSize);t.style.fontSize=`${l*e.fontSizeMultiplier}px`}if(e.colorBlindMode&&e.colorBlindMode!=="none"){let l=e.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${A[e.colorBlindMode]})`;t.style.filter=(t.style.filter?t.style.filter+" ":"")+l}e.keyboardHints&&(t.tabIndex>=0||["button","a","input","select","textarea"].includes(r))&&(t.style.outline="2px solid #007acc",t.style.outlineOffset="2px")}),e.colorBlindMode&&e.colorBlindMode!=="none"&&!w){let a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("aria-hidden","true"),a.style.display="none",a.innerHTML=`
|
|
1
|
+
"use strict";var Y=Object.create;var E=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var Z=(n,a)=>{for(var d in a)E(n,d,{get:a[d],enumerable:!0})},W=(n,a,d,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of j(a))!U.call(n,r)&&r!==d&&E(n,r,{get:()=>a[r],enumerable:!(f=K(a,r))||f.enumerable});return n};var J=(n,a,d)=>(d=n!=null?Y(V(n)):{},W(a||!n||!n.__esModule?E(d,"default",{value:n,enumerable:!0}):d,n)),Q=n=>W(E({},"__esModule",{value:!0}),n);var ne={};Z(ne,{Runtime:()=>A,YuktAI:()=>re,YuktAIWrapper:()=>$,aiPlugin:()=>T,default:()=>$,voicePlugin:()=>C,wcag:()=>p,wcagPlugin:()=>p});module.exports=Q(ne);var v=null,M=null,R={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},z=new Set(["h1","h2","h3","h4","h5","h6"]),q=new Set(["input","select","textarea"]),N=new Set(["button","a","input","select","textarea","details","summary"]),X=new Set(["video","audio"]),ee=new Set(["ul","ol","dl"]);var te=new Set(["span","strong","em","b","i","u","s","small","mark","del","ins","sub","sup","abbr","cite","code","kbd","samp","var","time","q"]),_={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"},p={name:"yuktai-a11y",version:"1.0.0",observer:null,async execute(n){if(!n.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";let a=this.applyFixes(n);return n.autoFix&&this.startObserver(n),`yuktai-a11y: ${a.fixed} fixes applied across ${a.scanned} nodes in ${a.renderTime}ms.`},scan(){let n={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return n;let a=performance.now(),d=document.querySelectorAll("*");n.scanned=d.length;let f=(r,o,e,t)=>n.details.push({tag:r,fix:o,severity:e,element:t.outerHTML.slice(0,100)});return d.forEach(r=>{let o=r,e=o.tagName.toLowerCase();(e==="a"||e==="button")&&!o.innerText?.trim()&&!o.getAttribute("aria-label")&&f(e,"needs aria-label (empty)","critical",o),e==="img"&&!o.hasAttribute("alt")&&f(e,"needs alt text","serious",o),q.has(e)&&!o.getAttribute("aria-label")&&!o.getAttribute("aria-labelledby")&&f(e,"needs aria-label","serious",o),e==="iframe"&&!o.getAttribute("title")&&!o.getAttribute("aria-label")&&f(e,"iframe needs title","serious",o),X.has(e)&&!r.querySelector("track")&&!o.getAttribute("aria-label")&&f(e,"media needs captions/aria-label","serious",o),z.has(e)&&!o.innerText?.trim()&&!o.getAttribute("aria-label")&&f(e,"empty heading","moderate",o)}),n.fixed=n.details.length,n.renderTime=parseFloat((performance.now()-a).toFixed(2)),n},applyFixes(n){let a={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return a;let d=performance.now(),f=document.querySelectorAll("*");a.scanned=f.length;let r=(o,e,t,h)=>{a.details.push({tag:o,fix:e,severity:t,element:h.outerHTML.slice(0,100)}),a.fixed++};if(f.forEach(o=>{let e=o,t=e.tagName.toLowerCase();if(t==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),r(t,'lang="en" added to <html>',"critical",e)),t==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",r(t,`document.title set to "${document.title}"`,"serious",e)),t==="meta"){let i=e.getAttribute("name"),l=e.getAttribute("content")||"";i==="viewport"&&l.includes("user-scalable=no")&&(e.setAttribute("content",l.replace("user-scalable=no","user-scalable=yes")),r(t,"user-scalable=yes restored","serious",e)),i==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(l)&&(e.setAttribute("content",l.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),r(t,"maximum-scale=5 restored","serious",e))}if(t==="body"&&!document.querySelector("[data-yuktai-skip]")){let i=document.createElement("a");i.setAttribute("href","#main-content"),i.setAttribute("data-yuktai-skip","true"),i.setAttribute("aria-label","Skip to main content"),i.textContent="Skip to main content",i.style.cssText="position:fixed;top:-40px;left:0;background:#0d9488;color:#fff;padding:8px 16px;z-index:99999;font-family:system-ui;font-size:14px;border-radius:0 0 4px 0;text-decoration:none;transition:top 0.2s;",i.addEventListener("focus",()=>{i.style.top="0"}),i.addEventListener("blur",()=>{i.style.top="-40px"}),e.insertBefore(i,e.firstChild),r(t,"skip-to-content link injected","minor",e);let l=document.querySelector("main,[role='main']");l&&!l.getAttribute("tabindex")&&l.setAttribute("tabindex","-1")}if(z.has(t)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${t.toUpperCase()} section`),r(t,`aria-label="${t.toUpperCase()} section" (empty heading)`,"moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e.click())}),r(t,"tabindex=0 + keydown (clickable heading)","minor",e))),t==="p"&&e.getAttribute("dir")==="rtl"&&!e.getAttribute("lang")&&!document.documentElement.getAttribute("lang")&&(e.setAttribute("lang","ar"),r(t,'lang="ar" (rtl paragraph)',"moderate",e)),t==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),r(t,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),r(t,'alt="" (role=presentation)',"minor",e))),t==="area"&&!e.getAttribute("alt")){let i=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",i),r(t,`alt="${i}" on <area>`,"serious",e)}if(t==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!o.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let i=document.createElementNS("http://www.w3.org/2000/svg","title");i.textContent="graphic",e.prepend(i),e.setAttribute("role","img"),r(t,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),r(t,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(t==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),r(t,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),r(t,"aria-label added to canvas","serious",e))),(t==="object"||t==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${t} content`),r(t,`aria-label added to <${t}>`,"moderate",e)),t==="video"&&!o.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),r(t,"aria-label added (no captions track)","serious",e)),t==="audio"&&!o.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),r(t,"aria-label added to audio","serious",e)),t==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),r(t,'title + aria-label="embedded content"',"serious",e)),t==="figure"&&!o.querySelector("figcaption")&&!e.getAttribute("aria-label")){let l=o.querySelector("img")?.getAttribute("alt");l&&(e.setAttribute("aria-label",l),r(t,"aria-label from inner img alt","minor",e))}if(t==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let i=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",i),r(t,`aria-label="${i}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),a.fixed++)}if(t==="a"){let i=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let l=e.getAttribute("title")||"link";e.setAttribute("aria-label",l),r(t,`aria-label="${l}" (empty link)`,"critical",e)}if(i.target==="_blank"){i.rel?.includes("noopener")||(i.rel="noopener noreferrer",a.fixed++);let l=i.getAttribute("aria-label")||i.innerText?.trim()||"link";l.includes("opens in new window")||(i.setAttribute("aria-label",`${l} (opens in new window)`),r(t,"aria-label: new-window warning","moderate",e))}!i.href&&!i.getAttribute("role")&&!i.getAttribute("tabindex")&&(i.setAttribute("role","button"),i.setAttribute("tabindex","0"),r(t,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!N.has(t)&&(e.getAttribute("role")||(e.setAttribute("role","button"),r(t,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,a.fixed++),e.onkeydown||(e.onkeydown=i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e.click())})),q.has(t)){let i=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let l=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||t;e.setAttribute("aria-label",l),r(t,`aria-label="${l}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),a.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),a.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),a.fixed++),t==="input"&&!i.autocomplete){let l=i.name||"";i.type==="email"||l.includes("email")?(i.autocomplete="email",a.fixed++):i.type==="tel"||l.includes("tel")?(i.autocomplete="tel",a.fixed++):i.type==="password"?(i.autocomplete="current-password",a.fixed++):l.includes("firstname")||l.includes("fname")?(i.autocomplete="given-name",a.fixed++):l.includes("lastname")||l.includes("lname")?(i.autocomplete="family-name",a.fixed++):l==="name"||l.includes("fullname")?(i.autocomplete="name",a.fixed++):l.includes("zip")||l.includes("postal")?(i.autocomplete="postal-code",a.fixed++):l.includes("city")?(i.autocomplete="address-level2",a.fixed++):l.includes("country")&&(i.autocomplete="country",a.fixed++)}t==="input"&&i.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),r(t,"alt added to input[type=image]","serious",e)),t==="input"&&i.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",i.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",i.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",i.value||"50"),a.fixed++)}if(t==="fieldset"&&!o.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),r(t,'aria-label="form group" (no legend)',"moderate",e)),t==="label"){let i=e.getAttribute("for"),l=o.querySelector("input,select,textarea");!i&&!l&&!e.getAttribute("aria-label")&&r(t,"label not associated with any control","moderate",e)}if(t==="table"&&(!o.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),r(t,'role="grid" (no <th>)',"serious",e)),!o.querySelector("caption")&&!e.getAttribute("aria-label")&&!e.getAttribute("summary")&&(e.setAttribute("aria-label","data table"),r(t,'aria-label="data table" (no caption)',"moderate",e))),t==="th"&&!e.getAttribute("scope")){let i=e.closest("thead")!==null;e.setAttribute("scope",i?"col":"row"),r(t,`scope="${i?"col":"row"}"`,"moderate",e)}if(ee.has(t)&&(e.getAttribute("role")==="presentation"&&(o.querySelectorAll("li").forEach(i=>{i.getAttribute("role")||i.setAttribute("role","presentation")}),a.fixed++),(t==="ul"||t==="ol")&&!e.getAttribute("aria-label"))){let i=e.closest("nav");i&&(e.setAttribute("aria-label",i.getAttribute("aria-label")||"navigation list"),r(t,"aria-label from parent nav","minor",e))}if(t==="dt"&&!e.getAttribute("aria-label")){let i=e.nextElementSibling;(!i||i.tagName.toLowerCase()!=="dd")&&(e.setAttribute("aria-label",e.innerText?.trim()||"term"),r(t,"aria-label on <dt> (no following <dd>)","minor",e))}if(_[t]&&!e.getAttribute("role")&&(e.setAttribute("role",_[t]),r(t,`role="${_[t]}"`,"minor",e)),["nav","section","article","aside"].includes(t)){let i=o.parentElement?.querySelectorAll(t);if(i&&i.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let y=o.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();y&&(e.setAttribute("aria-label",y),r(t,"aria-label from inner heading","moderate",e))}}if(t==="details"&&!o.querySelector("summary")){let i=document.createElement("summary");i.textContent=e.getAttribute("aria-label")||"More details",e.prepend(i),r(t,"<summary> injected","moderate",e)}if(t==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),r(t,'aria-label="Toggle details" (empty summary)',"moderate",e)),t==="dialog"){let i=e.getAttribute("role");if(i&&i!=="dialog"&&(e.setAttribute("role","dialog"),r(t,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let y=o.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",y),r(t,"aria-label added to dialog","serious",e)}}if(t==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),r(t,"title added to <abbr>","minor",e)),t==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),r(t,`datetime="${e.innerText.trim()}" added`,"minor",e)),t==="mark"&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",`highlighted: ${e.innerText?.trim()?.slice(0,60)}`),r(t,"aria-label added to <mark>","minor",e)),t==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),r(t,"aria-label added to <meter>","moderate",e)),t==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),r(t,"aria-label added to <progress>","moderate",e));let i=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(i.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(i.max||1)),a.fixed++}let c=e.getAttribute("role")||"";if(c==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),a.fixed++),c==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),r(t,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),a.fixed++)),["alert","status","log","marquee"].includes(c)){if(!e.getAttribute("aria-live")){let i=c==="alert"?"assertive":"polite";e.setAttribute("aria-live",i),r(t,`aria-live="${i}" on role=${c}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),a.fixed++)}c==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),a.fixed++),(c==="menu"||c==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),r(t,'aria-label="menu"',"moderate",e)),c==="menuitem"&&e.tabIndex<0&&(e.tabIndex=-1,a.fixed++),c==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),r(t,'aria-label="listbox"',"moderate",e)),c==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),a.fixed++),c==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),a.fixed++),(c==="checkbox"||c==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),r(t,`aria-checked="false" on role=${c}`,"serious",e)),c==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),r(t,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),a.fixed++)),(c==="grid"||c==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),r(t,'aria-label="data grid"',"moderate",e)),c==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),r(t,'aria-label="tree"',"moderate",e)),c==="treeitem"&&o.querySelector('[role="group"]')&&!e.getAttribute("aria-expanded")&&(e.setAttribute("aria-expanded","false"),a.fixed++),c==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),a.fixed++);let b=!["html","head","meta","script","style","link","noscript"].includes(t);if(n.highContrast&&b&&!te.has(t)&&(e.style.filter="contrast(1.15) brightness(1.05)"),n.reduceMotion&&b&&(e.style.transition="none",e.style.animation="none"),n.fontSizeMultiplier&&n.fontSizeMultiplier!==1&&b){let i=parseFloat(window.getComputedStyle(e).fontSize);!isNaN(i)&&i>0&&(e.style.fontSize=`${i*n.fontSizeMultiplier}px`)}if(n.colorBlindMode&&n.colorBlindMode!=="none"&&t==="body"){let i=n.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${R[n.colorBlindMode]})`;e.style.filter=i}n.keyboardHints&&(N.has(t)||e.tabIndex>=0)&&(e.style.outline="2px solid #007acc",e.style.outlineOffset="2px")}),n.colorBlindMode&&n.colorBlindMode!=="none"&&!M){let o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("aria-hidden","true"),o.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",o.innerHTML=`
|
|
2
2
|
<defs>
|
|
3
|
-
<filter id="${
|
|
3
|
+
<filter id="${R.deuteranopia}">
|
|
4
4
|
<feColorMatrix type="matrix" values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
|
|
5
5
|
</filter>
|
|
6
|
-
<filter id="${
|
|
6
|
+
<filter id="${R.protanopia}">
|
|
7
7
|
<feColorMatrix type="matrix" values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/>
|
|
8
8
|
</filter>
|
|
9
|
-
<filter id="${
|
|
9
|
+
<filter id="${R.tritanopia}">
|
|
10
10
|
<feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
|
|
11
11
|
</filter>
|
|
12
|
-
</defs>
|
|
13
|
-
`,document.body.appendChild(a),w=a}return this.ensureLiveRegion(),n},removeColorBlindSvg(){w?.remove(),w=null},startObserver(e){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(e)),this.observer.observe(document.body,{childList:!0,subtree:!0}))},stopObserver(){this.observer?.disconnect(),this.observer=null},ensureLiveRegion(){if(typeof document>"u"||y)return;let e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(e),y=e},removeLiveRegion(){y?.remove(),y=null},announce(e){y&&(y.textContent=e)}};var d=B(require("react"),1);var o=require("react/jsx-runtime"),C=null,m=null,H={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},x=[80,90,100,110,120,130,140,150],$=[{id:"highContrast",label:"High contrast",description:"Boosts contrast and brightness on all elements",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables transitions and animations site-wide",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"Re-runs fixes automatically on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing for readability",icon:"Aa"}];function X({checked:e,onChange:n,label:s}){return(0,o.jsxs)("label",{"aria-label":s,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[(0,o.jsx)("input",{type:"checkbox",checked:e,onChange:a=>n(a.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,o.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:99,background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,o.jsx)("span",{style:{position:"absolute",top:3,left:e?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}function z({children:e}){let[n,s]=(0,d.useState)(!1),[a,t]=(0,d.useState)(!1),[r,M]=(0,d.useState)(H),[g,l]=(0,d.useState)(null),[f,I]=(0,d.useState)(!1),R=(0,d.useRef)(null),h=(0,d.useRef)(null);(0,d.useEffect)(()=>s(!0),[]),(0,d.useEffect)(()=>{if(C)return;let i=document.createElement("style");return i.innerHTML=`
|
|
14
|
-
*:focus-visible {
|
|
15
|
-
outline: 3px solid #0d9488 !important;
|
|
16
|
-
outline-offset: 2px !important;
|
|
17
|
-
box-shadow: 0 0 0 5px rgba(13,148,136,0.25) !important;
|
|
18
|
-
}
|
|
19
|
-
`,document.head.appendChild(i),C=i,()=>{C?.remove(),C=null}},[]),(0,d.useEffect)(()=>()=>{u.stopObserver(),u.removeLiveRegion(),u.removeColorBlindSvg()},[]),(0,d.useEffect)(()=>{if(!a)return;let i=c=>{R.current&&!R.current.contains(c.target)&&h.current&&!h.current.contains(c.target)&&t(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),(0,d.useEffect)(()=>{let i=c=>{c.key==="Escape"&&a&&(t(!1),h.current?.focus())};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a]);let v=(i,c)=>M(b=>({...b,[i]:c})),D=(0,d.useCallback)(async()=>{let i={enabled:!0,highContrast:r.highContrast,reduceMotion:r.reduceMotion,autoFix:r.autoFix},c=await u.execute(i);console.log("[yuktai-a11y]",c);let b=u.applyFixes(i);if(l(b),document.documentElement.style.fontSize=`${r.fontScale}%`,r.dyslexiaFont){if(!m){let T=document.createElement("style");T.textContent=`
|
|
20
|
-
body, body * {
|
|
21
|
-
font-family: 'Georgia', serif !important;
|
|
22
|
-
letter-spacing: 0.06em !important;
|
|
23
|
-
word-spacing: 0.12em !important;
|
|
24
|
-
line-height: 1.9 !important;
|
|
25
|
-
}
|
|
26
|
-
`,document.head.appendChild(T),m=T}}else m?.remove(),m=null;I(!0),t(!1),u.announce(`yuktai-a11y active. ${b.fixed} fixes applied. `+[r.highContrast&&"High contrast on.",r.reduceMotion&&"Motion reduced.",r.dyslexiaFont&&"Dyslexia font on.",r.fontScale!==100&&`Text at ${r.fontScale}%.`].filter(Boolean).join(" "))},[r]),j=(0,d.useCallback)(async()=>{await u.execute({enabled:!1}),document.documentElement.style.fontSize="",m?.remove(),m=null,document.querySelectorAll("*").forEach(i=>{i.style.filter="",i.style.transition="",i.style.animation=""}),M(H),l(null),I(!1),u.announce("yuktai-a11y disabled. All settings reset to defaults.")},[]);return n?(0,o.jsxs)(o.Fragment,{children:[e,(0,o.jsxs)("button",{ref:h,onClick:()=>t(i=>!i),"aria-label":"Open yuktai-a11y accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,right:24,width:52,height:52,borderRadius:"50%",background:f?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:i=>i.currentTarget.style.transform="scale(1.08)",onMouseLeave:i=>i.currentTarget.style.transform="scale(1)",onFocus:i=>i.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:i=>i.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[(0,o.jsx)("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),f&&(0,o.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&(0,o.jsxs)("div",{ref:R,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:88,right:24,width:312,background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},children:[(0,o.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[(0,o.jsxs)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:["yuktai-a11y v",u.version]}),f&&(0,o.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,o.jsx)("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,o.jsx)("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes for your page"})]}),(0,o.jsx)("button",{onClick:()=>t(!1),"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),(0,o.jsx)("div",{style:{padding:"6px 0"},children:$.map((i,c)=>(0,o.jsxs)(d.default.Fragment,{children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[(0,o.jsx)("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:i.icon}),(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:i.label}),(0,o.jsx)("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:i.description})]})]}),(0,o.jsx)(X,{checked:r[i.id],onChange:b=>v(i.id,b),label:`Toggle ${i.label}`})]}),c<$.length-1&&(0,o.jsx)("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},i.id))}),(0,o.jsxs)("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,o.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),(0,o.jsxs)("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[r.fontScale,"%"]})]}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{onClick:()=>{let i=x.indexOf(r.fontScale);i>0&&v("fontScale",x[i-1])},disabled:r.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:r.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:r.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,o.jsx)("div",{style:{flex:1,display:"flex",gap:3},children:x.map(i=>(0,o.jsx)("button",{onClick:()=>v("fontScale",i),"aria-label":`Set text size to ${i}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:i<=r.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},i))}),(0,o.jsx)("button",{onClick:()=>{let i=x.indexOf(r.fontScale);i<x.length-1&&v("fontScale",x[i+1])},disabled:r.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:r.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:r.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),g&&(0,o.jsxs)("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:["\u2713 yuktai-a11y: ",g.fixed," fixes across ",g.scanned," nodes"]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[(0,o.jsx)("button",{onClick:j,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,o.jsx)("button",{onClick:D,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})]}):(0,o.jsx)(o.Fragment,{children:e})}function ee(){if(!globalThis.__yuktai_runtime__){let e=new k;e.register(E.name,E),e.register(F.name,F),e.register(L.name,L),e.register(u.name,u),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var O=ee(),N={wcagPlugin:u,list(){return O.getPlugins()},use(e){return O.use(e)}},te=N;0&&(module.exports={YuktAI,YuktAIWrapper});
|
|
12
|
+
</defs>`,document.body.appendChild(o),M=o}return this.ensureLiveRegion(),a.renderTime=parseFloat((performance.now()-d).toFixed(2)),a},removeColorBlindSvg(){M?.remove(),M=null},startObserver(n){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(n)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},ensureLiveRegion(){if(typeof document>"u"||v)return;let n=document.createElement("div");n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(n),v=n},removeLiveRegion(){v?.remove(),v=null},announce(n){v&&(v.textContent=n)}};var g=require("react");var I=J(require("react"),1),s=require("react/jsx-runtime"),F={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},S=[80,90,100,110,120,130,140,150],H=[{id:"highContrast",label:"High contrast",description:"contrast(1.15) brightness on all nodes",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables all transitions & animations",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"MutationObserver on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing",icon:"Aa"}];function ie({checked:n,onChange:a,label:d}){return(0,s.jsxs)("label",{"aria-label":d,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[(0,s.jsx)("input",{type:"checkbox",checked:n,onChange:f=>a(f.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,s.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:99,background:n?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,s.jsx)("span",{style:{position:"absolute",top:3,left:n?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var P=(0,I.forwardRef)(({position:n,settings:a,report:d,isActive:f,set:r,onApply:o,onReset:e,onClose:t},h)=>(0,s.jsxs)("div",{ref:h,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...n==="left"?{left:88}:{right:88},width:312,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif"},children:[(0,s.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[(0,s.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v1.0.0"}),f&&(0,s.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,s.jsx)("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,s.jsx)("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes \xB7 Open Source"})]}),(0,s.jsx)("button",{onClick:t,"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),(0,s.jsx)("div",{style:{padding:"6px 0"},children:H.map((b,i)=>(0,s.jsxs)(I.default.Fragment,{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[(0,s.jsx)("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:b.icon}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:b.label}),(0,s.jsx)("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:b.description})]})]}),(0,s.jsx)(ie,{checked:a[b.id],onChange:l=>r(b.id,l),label:`Toggle ${b.label}`})]}),i<H.length-1&&(0,s.jsx)("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},b.id))}),(0,s.jsxs)("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,s.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),(0,s.jsxs)("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[a.fontScale,"%"]})]}),(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,s.jsx)("button",{onClick:()=>{let b=S.indexOf(a.fontScale);b>0&&r("fontScale",S[b-1])},disabled:a.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:a.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:a.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,s.jsx)("div",{style:{flex:1,display:"flex",gap:3},children:S.map(b=>(0,s.jsx)("button",{onClick:()=>r("fontScale",b),"aria-label":`Set text size to ${b}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:b<=a.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},b))}),(0,s.jsx)("button",{onClick:()=>{let b=S.indexOf(a.fontScale);b<S.length-1&&r("fontScale",S[b+1])},disabled:a.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:a.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:a.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),d&&(0,s.jsx)("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:d.fixed>0?`\u2713 ${d.fixed} fixes applied \xB7 ${d.scanned} nodes \xB7 ${d.renderTime}ms`:`\u2713 0 fixes needed \xB7 ${d.scanned} nodes clean \xB7 ${d.renderTime}ms`}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[(0,s.jsx)("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,s.jsx)("button",{onClick:o,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));P.displayName="WidgetPanel";var m=require("react/jsx-runtime"),L=null,k=null;function $({children:n,position:a="left"}){let[d,f]=(0,g.useState)(!1),[r,o]=(0,g.useState)(!1),[e,t]=(0,g.useState)(F),[h,c]=(0,g.useState)(null),[b,i]=(0,g.useState)(!1),l=(0,g.useRef)(null),y=(0,g.useRef)(null);(0,g.useEffect)(()=>f(!0),[]),(0,g.useEffect)(()=>{if(L)return;let u=document.createElement("style");return u.innerHTML="*:focus-visible{outline:3px solid #0d9488!important;outline-offset:2px!important;box-shadow:0 0 0 5px rgba(13,148,136,.25)!important;}",document.head.appendChild(u),L=u,()=>{L?.remove(),L=null}},[]),(0,g.useEffect)(()=>()=>{p.stopObserver(),p.removeLiveRegion(),p.removeColorBlindSvg()},[]),(0,g.useEffect)(()=>{if(!r)return;let u=x=>{l.current&&!l.current.contains(x.target)&&y.current&&!y.current.contains(x.target)&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),(0,g.useEffect)(()=>{let u=x=>{x.key==="Escape"&&r&&(o(!1),y.current?.focus())};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let O=(u,x)=>t(w=>({...w,[u]:x})),G=(0,g.useCallback)(async()=>{let u={enabled:!0,highContrast:e.highContrast,reduceMotion:e.reduceMotion,autoFix:e.autoFix},x=await p.execute(u);if(console.log("[yuktai-a11y]",x),c(p.applyFixes(u)),document.documentElement.style.fontSize=`${e.fontScale}%`,e.dyslexiaFont){if(!k){let w=document.createElement("style");w.textContent="body,body *{font-family:'Georgia',serif!important;letter-spacing:.06em!important;word-spacing:.12em!important;line-height:1.9!important;}",document.head.appendChild(w),k=w}}else k?.remove(),k=null;i(!0),o(!1),p.announce("yuktai-a11y active.")},[e]),D=(0,g.useCallback)(async()=>{await p.execute({enabled:!1}),document.documentElement.style.fontSize="",k?.remove(),k=null,document.querySelectorAll("*").forEach(u=>{u.style.filter="",u.style.transition="",u.style.animation=""}),t(F),c(null),i(!1),p.announce("yuktai-a11y disabled.")},[]);return d?(0,m.jsxs)(m.Fragment,{children:[n,(0,m.jsxs)("button",{ref:y,onClick:()=>o(u=>!u),"aria-label":"Open yuktai-a11y accessibility options","aria-expanded":r,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...a==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:b?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:u=>u.currentTarget.style.transform="scale(1.08)",onMouseLeave:u=>u.currentTarget.style.transform="scale(1)",onFocus:u=>u.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:u=>u.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[(0,m.jsx)("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",children:(0,m.jsx)("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),b&&(0,m.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),r&&(0,m.jsx)(P,{ref:l,position:a,settings:e,report:h,isActive:b,set:O,onApply:G,onReset:D,onClose:()=>o(!1)})]}):(0,m.jsx)(m.Fragment,{children:n})}var T={name:"ai.text",async execute(n){return`\u{1F916} YuktAI says: ${n}`}};var C={name:"voice.text",async execute(n){return!n||n.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${n}`}};var A=class{plugins=new Map;register(a,d){if(!d||typeof d.execute!="function")throw new Error(`Invalid plugin: ${a}`);this.plugins.set(a,d)}use(a){return this.plugins.get(a)}async run(a,d){try{let f=this.use(a);if(!f)throw new Error(`Plugin not found: ${a}`);return await f.execute(d)}catch(f){throw console.error(`[YuktAI Runtime Error in ${a}]:`,f),f}}getPlugins(){return Array.from(this.plugins.keys())}};function ae(){if(typeof globalThis>"u")return new A;if(!globalThis.__yuktai_runtime__){let n=new A;n.register(p.name,p),n.register(T.name,T),n.register(C.name,C),globalThis.__yuktai_runtime__=n}return globalThis.__yuktai_runtime__}var B=typeof window<"u"?ae():new A,re={wcagPlugin:p,list(){return B.getPlugins()},use(n){return B.use(n)},fix(n){return p.applyFixes({enabled:!0,autoFix:!0,...n})},scan(){return p.scan()}};0&&(module.exports={Runtime,YuktAI,YuktAIWrapper,aiPlugin,voicePlugin,wcag,wcagPlugin});
|
package/dist/index.d.cts
CHANGED
|
@@ -20,28 +20,59 @@ declare class Runtime {
|
|
|
20
20
|
getPlugins(): string[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
type ColorBlindMode = "none" | "deuteranopia" | "protanopia" | "tritanopia" | "achromatopsia";
|
|
24
|
+
type Severity = "critical" | "serious" | "moderate" | "minor";
|
|
23
25
|
interface A11yConfig {
|
|
24
26
|
enabled: boolean;
|
|
25
27
|
highContrast?: boolean;
|
|
26
28
|
reduceMotion?: boolean;
|
|
27
29
|
autoFix?: boolean;
|
|
28
30
|
fontSizeMultiplier?: number;
|
|
29
|
-
colorBlindMode?:
|
|
31
|
+
colorBlindMode?: ColorBlindMode;
|
|
30
32
|
keyboardHints?: boolean;
|
|
31
33
|
}
|
|
34
|
+
interface A11yFix {
|
|
35
|
+
tag: string;
|
|
36
|
+
fix: string;
|
|
37
|
+
severity: Severity;
|
|
38
|
+
element: string;
|
|
39
|
+
}
|
|
32
40
|
interface A11yReport {
|
|
33
41
|
fixed: number;
|
|
34
42
|
scanned: number;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
fix: string;
|
|
38
|
-
element: string;
|
|
39
|
-
}[];
|
|
43
|
+
renderTime: number;
|
|
44
|
+
details: A11yFix[];
|
|
40
45
|
}
|
|
46
|
+
declare const wcagPlugin: {
|
|
47
|
+
name: string;
|
|
48
|
+
version: string;
|
|
49
|
+
observer: MutationObserver | null;
|
|
50
|
+
execute(config: A11yConfig): Promise<string>;
|
|
51
|
+
scan(): A11yReport;
|
|
52
|
+
applyFixes(config: A11yConfig): A11yReport;
|
|
53
|
+
removeColorBlindSvg(): void;
|
|
54
|
+
startObserver(config: A11yConfig): void;
|
|
55
|
+
stopObserver(): void;
|
|
56
|
+
ensureLiveRegion(): void;
|
|
57
|
+
removeLiveRegion(): void;
|
|
58
|
+
announce(msg: string): void;
|
|
59
|
+
};
|
|
41
60
|
|
|
42
|
-
|
|
61
|
+
interface YuktAIWrapperProps {
|
|
43
62
|
children?: ReactNode;
|
|
44
|
-
|
|
63
|
+
position?: "left" | "right";
|
|
64
|
+
}
|
|
65
|
+
declare function YuktAIWrapper({ children, position }: YuktAIWrapperProps): react_jsx_runtime.JSX.Element;
|
|
66
|
+
|
|
67
|
+
declare const aiPlugin: {
|
|
68
|
+
name: string;
|
|
69
|
+
execute(input: string): Promise<string>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
declare const voicePlugin: {
|
|
73
|
+
name: string;
|
|
74
|
+
execute(input: string): Promise<string>;
|
|
75
|
+
};
|
|
45
76
|
|
|
46
77
|
declare global {
|
|
47
78
|
var __yuktai_runtime__: Runtime | undefined;
|
|
@@ -52,6 +83,7 @@ declare const YuktAI: {
|
|
|
52
83
|
version: string;
|
|
53
84
|
observer: MutationObserver | null;
|
|
54
85
|
execute(config: A11yConfig): Promise<string>;
|
|
86
|
+
scan(): A11yReport;
|
|
55
87
|
applyFixes(config: A11yConfig): A11yReport;
|
|
56
88
|
removeColorBlindSvg(): void;
|
|
57
89
|
startObserver(config: A11yConfig): void;
|
|
@@ -62,6 +94,8 @@ declare const YuktAI: {
|
|
|
62
94
|
};
|
|
63
95
|
list(): string[];
|
|
64
96
|
use(name: string): Plugin | undefined;
|
|
97
|
+
fix(config?: Partial<A11yConfig>): A11yReport;
|
|
98
|
+
scan(): A11yReport;
|
|
65
99
|
};
|
|
66
100
|
|
|
67
|
-
export { YuktAI, YuktAIWrapper,
|
|
101
|
+
export { type A11yConfig, type A11yFix, type A11yReport, type ColorBlindMode, Runtime, type Severity, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, aiPlugin, YuktAIWrapper as default, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,28 +20,59 @@ declare class Runtime {
|
|
|
20
20
|
getPlugins(): string[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
type ColorBlindMode = "none" | "deuteranopia" | "protanopia" | "tritanopia" | "achromatopsia";
|
|
24
|
+
type Severity = "critical" | "serious" | "moderate" | "minor";
|
|
23
25
|
interface A11yConfig {
|
|
24
26
|
enabled: boolean;
|
|
25
27
|
highContrast?: boolean;
|
|
26
28
|
reduceMotion?: boolean;
|
|
27
29
|
autoFix?: boolean;
|
|
28
30
|
fontSizeMultiplier?: number;
|
|
29
|
-
colorBlindMode?:
|
|
31
|
+
colorBlindMode?: ColorBlindMode;
|
|
30
32
|
keyboardHints?: boolean;
|
|
31
33
|
}
|
|
34
|
+
interface A11yFix {
|
|
35
|
+
tag: string;
|
|
36
|
+
fix: string;
|
|
37
|
+
severity: Severity;
|
|
38
|
+
element: string;
|
|
39
|
+
}
|
|
32
40
|
interface A11yReport {
|
|
33
41
|
fixed: number;
|
|
34
42
|
scanned: number;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
fix: string;
|
|
38
|
-
element: string;
|
|
39
|
-
}[];
|
|
43
|
+
renderTime: number;
|
|
44
|
+
details: A11yFix[];
|
|
40
45
|
}
|
|
46
|
+
declare const wcagPlugin: {
|
|
47
|
+
name: string;
|
|
48
|
+
version: string;
|
|
49
|
+
observer: MutationObserver | null;
|
|
50
|
+
execute(config: A11yConfig): Promise<string>;
|
|
51
|
+
scan(): A11yReport;
|
|
52
|
+
applyFixes(config: A11yConfig): A11yReport;
|
|
53
|
+
removeColorBlindSvg(): void;
|
|
54
|
+
startObserver(config: A11yConfig): void;
|
|
55
|
+
stopObserver(): void;
|
|
56
|
+
ensureLiveRegion(): void;
|
|
57
|
+
removeLiveRegion(): void;
|
|
58
|
+
announce(msg: string): void;
|
|
59
|
+
};
|
|
41
60
|
|
|
42
|
-
|
|
61
|
+
interface YuktAIWrapperProps {
|
|
43
62
|
children?: ReactNode;
|
|
44
|
-
|
|
63
|
+
position?: "left" | "right";
|
|
64
|
+
}
|
|
65
|
+
declare function YuktAIWrapper({ children, position }: YuktAIWrapperProps): react_jsx_runtime.JSX.Element;
|
|
66
|
+
|
|
67
|
+
declare const aiPlugin: {
|
|
68
|
+
name: string;
|
|
69
|
+
execute(input: string): Promise<string>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
declare const voicePlugin: {
|
|
73
|
+
name: string;
|
|
74
|
+
execute(input: string): Promise<string>;
|
|
75
|
+
};
|
|
45
76
|
|
|
46
77
|
declare global {
|
|
47
78
|
var __yuktai_runtime__: Runtime | undefined;
|
|
@@ -52,6 +83,7 @@ declare const YuktAI: {
|
|
|
52
83
|
version: string;
|
|
53
84
|
observer: MutationObserver | null;
|
|
54
85
|
execute(config: A11yConfig): Promise<string>;
|
|
86
|
+
scan(): A11yReport;
|
|
55
87
|
applyFixes(config: A11yConfig): A11yReport;
|
|
56
88
|
removeColorBlindSvg(): void;
|
|
57
89
|
startObserver(config: A11yConfig): void;
|
|
@@ -62,6 +94,8 @@ declare const YuktAI: {
|
|
|
62
94
|
};
|
|
63
95
|
list(): string[];
|
|
64
96
|
use(name: string): Plugin | undefined;
|
|
97
|
+
fix(config?: Partial<A11yConfig>): A11yReport;
|
|
98
|
+
scan(): A11yReport;
|
|
65
99
|
};
|
|
66
100
|
|
|
67
|
-
export { YuktAI, YuktAIWrapper,
|
|
101
|
+
export { type A11yConfig, type A11yFix, type A11yReport, type ColorBlindMode, Runtime, type Severity, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, aiPlugin, YuktAIWrapper as default, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";var YuktAI=(()=>{var Dt=Object.create;var Re=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var oe=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports),Ft=(r,n)=>{for(var c in n)Re(r,c,{get:n[c],enumerable:!0})},pt=(r,n,c,d)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Ht(n))!qt.call(r,a)&&a!==c&&Re(r,a,{get:()=>n[a],enumerable:!(d=Wt(n,a))||d.enumerable});return r};var ie=(r,n,c)=>(c=r!=null?Dt(zt(r)):{},pt(n||!r||!r.__esModule?Re(c,"default",{value:r,enumerable:!0}):c,r)),Ut=r=>pt(Re({},"__esModule",{value:!0}),r);var kt=oe(y=>{"use strict";var Ue=Symbol.for("react.transitional.element"),Vt=Symbol.for("react.portal"),Qt=Symbol.for("react.fragment"),Xt=Symbol.for("react.strict_mode"),Zt=Symbol.for("react.profiler"),Jt=Symbol.for("react.consumer"),er=Symbol.for("react.context"),tr=Symbol.for("react.forward_ref"),rr=Symbol.for("react.suspense"),nr=Symbol.for("react.memo"),Et=Symbol.for("react.lazy"),or=Symbol.for("react.activity"),yt=Symbol.iterator;function ir(r){return r===null||typeof r!="object"?null:(r=yt&&r[yt]||r["@@iterator"],typeof r=="function"?r:null)}var _t={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xt=Object.assign,wt={};function ue(r,n,c){this.props=r,this.context=n,this.refs=wt,this.updater=c||_t}ue.prototype.isReactComponent={};ue.prototype.setState=function(r,n){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,n,"setState")};ue.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function Tt(){}Tt.prototype=ue.prototype;function Be(r,n,c){this.props=r,this.context=n,this.refs=wt,this.updater=c||_t}var Ge=Be.prototype=new Tt;Ge.constructor=Be;xt(Ge,ue.prototype);Ge.isPureReactComponent=!0;var ht=Array.isArray;function Fe(){}var O={H:null,A:null,T:null,S:null},St=Object.prototype.hasOwnProperty;function Ke(r,n,c){var d=c.ref;return{$$typeof:Ue,type:r,key:n,ref:d!==void 0?d:null,props:c}}function ar(r,n){return Ke(r.type,n,r.props)}function Ve(r){return typeof r=="object"&&r!==null&&r.$$typeof===Ue}function sr(r){var n={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(c){return n[c]})}var vt=/\/+/g;function qe(r,n){return typeof r=="object"&&r!==null&&r.key!=null?sr(""+r.key):n.toString(36)}function ur(r){switch(r.status){case"fulfilled":return r.value;case"rejected":throw r.reason;default:switch(typeof r.status=="string"?r.then(Fe,Fe):(r.status="pending",r.then(function(n){r.status==="pending"&&(r.status="fulfilled",r.value=n)},function(n){r.status==="pending"&&(r.status="rejected",r.reason=n)})),r.status){case"fulfilled":return r.value;case"rejected":throw r.reason}}throw r}function se(r,n,c,d,a){var f=typeof r;(f==="undefined"||f==="boolean")&&(r=null);var t=!1;if(r===null)t=!0;else switch(f){case"bigint":case"string":case"number":t=!0;break;case"object":switch(r.$$typeof){case Ue:case Vt:t=!0;break;case Et:return t=r._init,se(t(r._payload),n,c,d,a)}}if(t)return a=a(r),t=d===""?"."+qe(r,0):d,ht(a)?(c="",t!=null&&(c=t.replace(vt,"$&/")+"/"),se(a,n,c,"",function(w){return w})):a!=null&&(Ve(a)&&(a=ar(a,c+(a.key==null||r&&r.key===a.key?"":(""+a.key).replace(vt,"$&/")+"/")+t)),n.push(a)),1;t=0;var i=d===""?".":d+":";if(ht(r))for(var k=0;k<r.length;k++)d=r[k],f=i+qe(d,k),t+=se(d,n,c,f,a);else if(k=ir(r),typeof k=="function")for(r=k.call(r),k=0;!(d=r.next()).done;)d=d.value,f=i+qe(d,k++),t+=se(d,n,c,f,a);else if(f==="object"){if(typeof r.then=="function")return se(ur(r),n,c,d,a);throw n=String(r),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return t}function Pe(r,n,c){if(r==null)return r;var d=[],a=0;return se(r,d,"","",function(f){return n.call(c,f,a++)}),d}function lr(r){if(r._status===-1){var n=r._result;n=n(),n.then(function(c){(r._status===0||r._status===-1)&&(r._status=1,r._result=c)},function(c){(r._status===0||r._status===-1)&&(r._status=2,r._result=c)}),r._status===-1&&(r._status=0,r._result=n)}if(r._status===1)return r._result.default;throw r._result}var At=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},cr={map:Pe,forEach:function(r,n,c){Pe(r,function(){n.apply(this,arguments)},c)},count:function(r){var n=0;return Pe(r,function(){n++}),n},toArray:function(r){return Pe(r,function(n){return n})||[]},only:function(r){if(!Ve(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};y.Activity=or;y.Children=cr;y.Component=ue;y.Fragment=Qt;y.Profiler=Zt;y.PureComponent=Be;y.StrictMode=Xt;y.Suspense=rr;y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;y.__COMPILER_RUNTIME={__proto__:null,c:function(r){return O.H.useMemoCache(r)}};y.cache=function(r){return function(){return r.apply(null,arguments)}};y.cacheSignal=function(){return null};y.cloneElement=function(r,n,c){if(r==null)throw Error("The argument must be a React element, but you passed "+r+".");var d=xt({},r.props),a=r.key;if(n!=null)for(f in n.key!==void 0&&(a=""+n.key),n)!St.call(n,f)||f==="key"||f==="__self"||f==="__source"||f==="ref"&&n.ref===void 0||(d[f]=n[f]);var f=arguments.length-2;if(f===1)d.children=c;else if(1<f){for(var t=Array(f),i=0;i<f;i++)t[i]=arguments[i+2];d.children=t}return Ke(r.type,a,d)};y.createContext=function(r){return r={$$typeof:er,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null},r.Provider=r,r.Consumer={$$typeof:Jt,_context:r},r};y.createElement=function(r,n,c){var d,a={},f=null;if(n!=null)for(d in n.key!==void 0&&(f=""+n.key),n)St.call(n,d)&&d!=="key"&&d!=="__self"&&d!=="__source"&&(a[d]=n[d]);var t=arguments.length-2;if(t===1)a.children=c;else if(1<t){for(var i=Array(t),k=0;k<t;k++)i[k]=arguments[k+2];a.children=i}if(r&&r.defaultProps)for(d in t=r.defaultProps,t)a[d]===void 0&&(a[d]=t[d]);return Ke(r,f,a)};y.createRef=function(){return{current:null}};y.forwardRef=function(r){return{$$typeof:tr,render:r}};y.isValidElement=Ve;y.lazy=function(r){return{$$typeof:Et,_payload:{_status:-1,_result:r},_init:lr}};y.memo=function(r,n){return{$$typeof:nr,type:r,compare:n===void 0?null:n}};y.startTransition=function(r){var n=O.T,c={};O.T=c;try{var d=r(),a=O.S;a!==null&&a(c,d),typeof d=="object"&&d!==null&&typeof d.then=="function"&&d.then(Fe,At)}catch(f){At(f)}finally{n!==null&&c.types!==null&&(n.types=c.types),O.T=n}};y.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};y.use=function(r){return O.H.use(r)};y.useActionState=function(r,n,c){return O.H.useActionState(r,n,c)};y.useCallback=function(r,n){return O.H.useCallback(r,n)};y.useContext=function(r){return O.H.useContext(r)};y.useDebugValue=function(){};y.useDeferredValue=function(r,n){return O.H.useDeferredValue(r,n)};y.useEffect=function(r,n){return O.H.useEffect(r,n)};y.useEffectEvent=function(r){return O.H.useEffectEvent(r)};y.useId=function(){return O.H.useId()};y.useImperativeHandle=function(r,n,c){return O.H.useImperativeHandle(r,n,c)};y.useInsertionEffect=function(r,n){return O.H.useInsertionEffect(r,n)};y.useLayoutEffect=function(r,n){return O.H.useLayoutEffect(r,n)};y.useMemo=function(r,n){return O.H.useMemo(r,n)};y.useOptimistic=function(r,n){return O.H.useOptimistic(r,n)};y.useReducer=function(r,n,c){return O.H.useReducer(r,n,c)};y.useRef=function(r){return O.H.useRef(r)};y.useState=function(r){return O.H.useState(r)};y.useSyncExternalStore=function(r,n,c){return O.H.useSyncExternalStore(r,n,c)};y.useTransition=function(){return O.H.useTransition()};y.version="19.2.5"});var Rt=oe((g,Me)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function r(e,o){Object.defineProperty(d.prototype,e,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",o[0],o[1])}})}function n(e){return e===null||typeof e!="object"?null:(e=xe&&e[xe]||e["@@iterator"],typeof e=="function"?e:null)}function c(e,o){e=(e=e.constructor)&&(e.displayName||e.name)||"ReactClass";var l=e+"."+o;et[l]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",o,e),et[l]=!0)}function d(e,o,l){this.props=e,this.context=o,this.refs=We,this.updater=l||tt}function a(){}function f(e,o,l){this.props=e,this.context=o,this.refs=We,this.updater=l||tt}function t(){}function i(e){return""+e}function k(e){try{i(e);var o=!1}catch{o=!0}if(o){o=console;var l=o.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),i(e)}}function w(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===jt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case te:return"Fragment";case u:return"Profiler";case me:return"StrictMode";case V:return"Suspense";case ge:return"SuspenseList";case re:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case be:return"Portal";case C:return e.displayName||"Context";case h:return(e._context.displayName||"Context")+".Consumer";case N:var o=e.render;return e=e.displayName,e||(e=o.displayName||o.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case M:return o=e.displayName||null,o!==null?o:w(e.type)||"Memo";case Y:o=e._payload,e=e._init;try{return w(e(o))}catch{}}return null}function S(e){if(e===te)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Y)return"<...>";try{var o=w(e);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function s(){var e=A.A;return e===null?null:e.getOwner()}function m(){return Error("react-stack-top-frame")}function L(e){if(we.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function Q(e,o){function l(){it||(it=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function fe(){var e=w(this.type);return st[e]||(st[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function H(e,o,l,p,b,_){var v=l.ref;return e={$$typeof:ee,type:e,key:o,props:l,_owner:p},(v!==void 0?v:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:fe}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:b}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function Ee(e,o){return o=H(e.type,o,e.props,e._owner,e._debugStack,e._debugTask),e._store&&(o._store.validated=e._store.validated),o}function T(e){I(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===Y&&(e._payload.status==="fulfilled"?I(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function I(e){return typeof e=="object"&&e!==null&&e.$$typeof===ee}function z(e){var o={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(l){return o[l]})}function de(e,o){return typeof e=="object"&&e!==null&&e.key!=null?(k(e.key),z(""+e.key)):o.toString(36)}function De(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(t,t):(e.status="pending",e.then(function(o){e.status==="pending"&&(e.status="fulfilled",e.value=o)},function(o){e.status==="pending"&&(e.status="rejected",e.reason=o)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function q(e,o,l,p,b){var _=typeof e;(_==="undefined"||_==="boolean")&&(e=null);var v=!1;if(e===null)v=!0;else switch(_){case"bigint":case"string":case"number":v=!0;break;case"object":switch(e.$$typeof){case ee:case be:v=!0;break;case Y:return v=e._init,q(v(e._payload),o,l,p,b)}}if(v){v=e,b=b(v);var R=p===""?"."+de(v,0):p;return nt(b)?(l="",R!=null&&(l=R.replace(lt,"$&/")+"/"),q(b,o,l,"",function(B){return B})):b!=null&&(I(b)&&(b.key!=null&&(v&&v.key===b.key||k(b.key)),l=Ee(b,l+(b.key==null||v&&v.key===b.key?"":(""+b.key).replace(lt,"$&/")+"/")+R),p!==""&&v!=null&&I(v)&&v.key==null&&v._store&&!v._store.validated&&(l._store.validated=2),b=l),o.push(b)),1}if(v=0,R=p===""?".":p+":",nt(e))for(var x=0;x<e.length;x++)p=e[x],_=R+de(p,x),v+=q(p,o,l,_,b);else if(x=n(e),typeof x=="function")for(x===e.entries&&(ut||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),ut=!0),e=x.call(e),x=0;!(p=e.next()).done;)p=p.value,_=R+de(p,x++),v+=q(p,o,l,_,b);else if(_==="object"){if(typeof e.then=="function")return q(De(e),o,l,p,b);throw o=String(e),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return v}function X(e,o,l){if(e==null)return e;var p=[],b=0;return q(e,p,"","",function(_){return o.call(l,_,b++)}),p}function pe(e){if(e._status===-1){var o=e._ioInfo;o!=null&&(o.start=o.end=performance.now()),o=e._result;var l=o();if(l.then(function(b){if(e._status===0||e._status===-1){e._status=1,e._result=b;var _=e._ioInfo;_!=null&&(_.end=performance.now()),l.status===void 0&&(l.status="fulfilled",l.value=b)}},function(b){if(e._status===0||e._status===-1){e._status=2,e._result=b;var _=e._ioInfo;_!=null&&(_.end=performance.now()),l.status===void 0&&(l.status="rejected",l.reason=b)}}),o=e._ioInfo,o!=null){o.value=l;var p=l.displayName;typeof p=="string"&&(o.name=p)}e._status===-1&&(e._status=0,e._result=l)}if(e._status===1)return o=e._result,o===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
+
|
|
3
|
+
Your code should look like:
|
|
4
|
+
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
|
+
|
|
6
|
+
Did you accidentally put curly braces around the import?`,o),"default"in o||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
+
|
|
8
|
+
Your code should look like:
|
|
9
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,o),o.default;throw e._result}function P(){var e=A.H;return e===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
|
+
2. You might be breaking the Rules of Hooks
|
|
12
|
+
3. You might have more than one copy of React in the same app
|
|
13
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function _e(){A.asyncTransitions--}function F(e){if(Te===null)try{var o=("require"+Math.random()).slice(0,7);Te=(Me&&Me[o]).call(Me,"timers").setImmediate}catch{Te=function(p){ft===!1&&(ft=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var b=new MessageChannel;b.port1.onmessage=p,b.port2.postMessage(void 0)}}return Te(e)}function U(e){return 1<e.length&&typeof AggregateError=="function"?new AggregateError(e):e[0]}function Z(e,o){o!==Se-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Se=o}function K(e,o,l){var p=A.actQueue;if(p!==null)if(p.length!==0)try{J(p),F(function(){return K(e,o,l)});return}catch(b){A.thrownErrors.push(b)}else A.actQueue=null;0<A.thrownErrors.length?(p=U(A.thrownErrors),A.thrownErrors.length=0,l(p)):o(e)}function J(e){if(!He){He=!0;var o=0;try{for(;o<e.length;o++){var l=e[o];do{A.didUsePromise=!1;var p=l(!1);if(p!==null){if(A.didUsePromise){e[o]=l,e.splice(0,o);return}l=p}else break}while(!0)}e.length=0}catch(b){e.splice(0,o+1),A.thrownErrors.push(b)}finally{He=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var ee=Symbol.for("react.transitional.element"),be=Symbol.for("react.portal"),te=Symbol.for("react.fragment"),me=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),C=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),ge=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),xe=Symbol.iterator,et={},tt={isMounted:function(){return!1},enqueueForceUpdate:function(e){c(e,"forceUpdate")},enqueueReplaceState:function(e){c(e,"replaceState")},enqueueSetState:function(e){c(e,"setState")}},rt=Object.assign,We={};Object.freeze(We),d.prototype.isReactComponent={},d.prototype.setState=function(e,o){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,o,"setState")},d.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var D={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(ye in D)D.hasOwnProperty(ye)&&r(ye,D[ye]);a.prototype=d.prototype,D=f.prototype=new a,D.constructor=f,rt(D,d.prototype),D.isPureReactComponent=!0;var nt=Array.isArray,jt=Symbol.for("react.client.reference"),A={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},we=Object.prototype.hasOwnProperty,ot=console.createTask?console.createTask:function(){return null};D={react_stack_bottom_frame:function(e){return e()}};var it,at,st={},$t=D.react_stack_bottom_frame.bind(D,m)(),Lt=ot(S(m)),ut=!1,lt=/\/+/g,ct=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ft=!1,Te=null,Se=0,ke=!1,He=!1,dt=typeof queueMicrotask=="function"?function(e){queueMicrotask(function(){return queueMicrotask(e)})}:F;D=Object.freeze({__proto__:null,c:function(e){return P().useMemoCache(e)}});var ye={map:X,forEach:function(e,o,l){X(e,function(){o.apply(this,arguments)},l)},count:function(e){var o=0;return X(e,function(){o++}),o},toArray:function(e){return X(e,function(o){return o})||[]},only:function(e){if(!I(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};g.Activity=re,g.Children=ye,g.Component=d,g.Fragment=te,g.Profiler=u,g.PureComponent=f,g.StrictMode=me,g.Suspense=V,g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,g.__COMPILER_RUNTIME=D,g.act=function(e){var o=A.actQueue,l=Se;Se++;var p=A.actQueue=o!==null?o:[],b=!1;try{var _=e()}catch(x){A.thrownErrors.push(x)}if(0<A.thrownErrors.length)throw Z(o,l),e=U(A.thrownErrors),A.thrownErrors.length=0,e;if(_!==null&&typeof _=="object"&&typeof _.then=="function"){var v=_;return dt(function(){b||ke||(ke=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(x,B){b=!0,v.then(function(ne){if(Z(o,l),l===0){try{J(p),F(function(){return K(ne,x,B)})}catch(Yt){A.thrownErrors.push(Yt)}if(0<A.thrownErrors.length){var It=U(A.thrownErrors);A.thrownErrors.length=0,B(It)}}else x(ne)},function(ne){Z(o,l),0<A.thrownErrors.length&&(ne=U(A.thrownErrors),A.thrownErrors.length=0),B(ne)})}}}var R=_;if(Z(o,l),l===0&&(J(p),p.length!==0&&dt(function(){b||ke||(ke=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),A.actQueue=null),0<A.thrownErrors.length)throw e=U(A.thrownErrors),A.thrownErrors.length=0,e;return{then:function(x,B){b=!0,l===0?(A.actQueue=p,F(function(){return K(R,x,B)})):x(R)}}},g.cache=function(e){return function(){return e.apply(null,arguments)}},g.cacheSignal=function(){return null},g.captureOwnerStack=function(){var e=A.getCurrentStack;return e===null?null:e()},g.cloneElement=function(e,o,l){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var p=rt({},e.props),b=e.key,_=e._owner;if(o!=null){var v;e:{if(we.call(o,"ref")&&(v=Object.getOwnPropertyDescriptor(o,"ref").get)&&v.isReactWarning){v=!1;break e}v=o.ref!==void 0}v&&(_=s()),L(o)&&(k(o.key),b=""+o.key);for(R in o)!we.call(o,R)||R==="key"||R==="__self"||R==="__source"||R==="ref"&&o.ref===void 0||(p[R]=o[R])}var R=arguments.length-2;if(R===1)p.children=l;else if(1<R){v=Array(R);for(var x=0;x<R;x++)v[x]=arguments[x+2];p.children=v}for(p=H(e.type,b,p,_,e._debugStack,e._debugTask),b=2;b<arguments.length;b++)T(arguments[b]);return p},g.createContext=function(e){return e={$$typeof:C,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:h,_context:e},e._currentRenderer=null,e._currentRenderer2=null,e},g.createElement=function(e,o,l){for(var p=2;p<arguments.length;p++)T(arguments[p]);p={};var b=null;if(o!=null)for(x in at||!("__self"in o)||"key"in o||(at=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),L(o)&&(k(o.key),b=""+o.key),o)we.call(o,x)&&x!=="key"&&x!=="__self"&&x!=="__source"&&(p[x]=o[x]);var _=arguments.length-2;if(_===1)p.children=l;else if(1<_){for(var v=Array(_),R=0;R<_;R++)v[R]=arguments[R+2];Object.freeze&&Object.freeze(v),p.children=v}if(e&&e.defaultProps)for(x in _=e.defaultProps,_)p[x]===void 0&&(p[x]=_[x]);b&&Q(p,typeof e=="function"?e.displayName||e.name||"Unknown":e);var x=1e4>A.recentlyCreatedOwnerStacks++;return H(e,b,p,s(),x?Error("react-stack-top-frame"):$t,x?ot(S(e)):Lt)},g.createRef=function(){var e={current:null};return Object.seal(e),e},g.forwardRef=function(e){e!=null&&e.$$typeof===M?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?console.error("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&e.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var o={$$typeof:N,render:e},l;return Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return l},set:function(p){l=p,e.name||e.displayName||(Object.defineProperty(e,"name",{value:p}),e.displayName=p)}}),o},g.isValidElement=I,g.lazy=function(e){e={_status:-1,_result:e};var o={$$typeof:Y,_payload:e,_init:pe},l={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return e._ioInfo=l,o._debugInfo=[{awaited:l}],o},g.memo=function(e,o){e==null&&console.error("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e),o={$$typeof:M,type:e,compare:o===void 0?null:o};var l;return Object.defineProperty(o,"displayName",{enumerable:!1,configurable:!0,get:function(){return l},set:function(p){l=p,e.name||e.displayName||(Object.defineProperty(e,"name",{value:p}),e.displayName=p)}}),o},g.startTransition=function(e){var o=A.T,l={};l._updatedFibers=new Set,A.T=l;try{var p=e(),b=A.S;b!==null&&b(l,p),typeof p=="object"&&p!==null&&typeof p.then=="function"&&(A.asyncTransitions++,p.then(_e,_e),p.then(t,ct))}catch(_){ct(_)}finally{o===null&&l._updatedFibers&&(e=l._updatedFibers.size,l._updatedFibers.clear(),10<e&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),o!==null&&l.types!==null&&(o.types!==null&&o.types!==l.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),o.types=l.types),A.T=o}},g.unstable_useCacheRefresh=function(){return P().useCacheRefresh()},g.use=function(e){return P().use(e)},g.useActionState=function(e,o,l){return P().useActionState(e,o,l)},g.useCallback=function(e,o){return P().useCallback(e,o)},g.useContext=function(e){var o=P();return e.$$typeof===h&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),o.useContext(e)},g.useDebugValue=function(e,o){return P().useDebugValue(e,o)},g.useDeferredValue=function(e,o){return P().useDeferredValue(e,o)},g.useEffect=function(e,o){return e==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),P().useEffect(e,o)},g.useEffectEvent=function(e){return P().useEffectEvent(e)},g.useId=function(){return P().useId()},g.useImperativeHandle=function(e,o,l){return P().useImperativeHandle(e,o,l)},g.useInsertionEffect=function(e,o){return e==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),P().useInsertionEffect(e,o)},g.useLayoutEffect=function(e,o){return e==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),P().useLayoutEffect(e,o)},g.useMemo=function(e,o){return P().useMemo(e,o)},g.useOptimistic=function(e,o){return P().useOptimistic(e,o)},g.useReducer=function(e,o,l){return P().useReducer(e,o,l)},g.useRef=function(e){return P().useRef(e)},g.useState=function(e){return P().useState(e)},g.useSyncExternalStore=function(e,o,l){return P().useSyncExternalStore(e,o,l)},g.useTransition=function(){return P().useTransition()},g.version="19.2.5",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var Ne=oe((Ar,Qe)=>{"use strict";process.env.NODE_ENV==="production"?Qe.exports=kt():Qe.exports=Rt()});var Ot=oe(je=>{"use strict";var fr=Symbol.for("react.transitional.element"),dr=Symbol.for("react.fragment");function Ct(r,n,c){var d=null;if(c!==void 0&&(d=""+c),n.key!==void 0&&(d=""+n.key),"key"in n){c={};for(var a in n)a!=="key"&&(c[a]=n[a])}else c=n;return n=c.ref,{$$typeof:fr,type:r,key:d,ref:n!==void 0?n:null,props:c}}je.Fragment=dr;je.jsx=Ct;je.jsxs=Ct});var Pt=oe($e=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function r(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===_e?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case H:return"Fragment";case T:return"Profiler";case Ee:return"StrictMode";case De:return"Suspense";case q:return"SuspenseList";case P:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case fe:return"Portal";case z:return u.displayName||"Context";case I:return(u._context.displayName||"Context")+".Consumer";case de:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case X:return h=u.displayName||null,h!==null?h:r(u.type)||"Memo";case pe:h=u._payload,u=u._init;try{return r(u(h))}catch{}}return null}function n(u){return""+u}function c(u){try{n(u);var h=!1}catch{h=!0}if(h){h=console;var C=h.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return C.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),n(u)}}function d(u){if(u===H)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===pe)return"<...>";try{var h=r(u);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function a(){var u=F.A;return u===null?null:u.getOwner()}function f(){return Error("react-stack-top-frame")}function t(u){if(U.call(u,"key")){var h=Object.getOwnPropertyDescriptor(u,"key").get;if(h&&h.isReactWarning)return!1}return u.key!==void 0}function i(u,h){function C(){J||(J=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}C.isReactWarning=!0,Object.defineProperty(u,"key",{get:C,configurable:!0})}function k(){var u=r(this.type);return ee[u]||(ee[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function w(u,h,C,N,V,ge){var M=C.ref;return u={$$typeof:Q,type:u,key:h,props:C,_owner:N},(M!==void 0?M:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:k}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ge}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function S(u,h,C,N,V,ge){var M=h.children;if(M!==void 0)if(N)if(Z(M)){for(N=0;N<M.length;N++)s(M[N]);Object.freeze&&Object.freeze(M)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else s(M);if(U.call(h,"key")){M=r(u);var Y=Object.keys(h).filter(function(xe){return xe!=="key"});N=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",me[M+N]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
14
|
+
let props = %s;
|
|
15
|
+
<%s {...props} />
|
|
16
|
+
React keys must be passed directly to JSX without using spread:
|
|
17
|
+
let props = %s;
|
|
18
|
+
<%s key={someKey} {...props} />`,N,M,Y,M),me[M+N]=!0)}if(M=null,C!==void 0&&(c(C),M=""+C),t(h)&&(c(h.key),M=""+h.key),"key"in h){C={};for(var re in h)re!=="key"&&(C[re]=h[re])}else C=h;return M&&i(C,typeof u=="function"?u.displayName||u.name||"Unknown":u),w(u,M,C,a(),V,ge)}function s(u){m(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===pe&&(u._payload.status==="fulfilled"?m(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function m(u){return typeof u=="object"&&u!==null&&u.$$typeof===Q}var L=Ne(),Q=Symbol.for("react.transitional.element"),fe=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),z=Symbol.for("react.context"),de=Symbol.for("react.forward_ref"),De=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),pe=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),_e=Symbol.for("react.client.reference"),F=L.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,Z=Array.isArray,K=console.createTask?console.createTask:function(){return null};L={react_stack_bottom_frame:function(u){return u()}};var J,ee={},be=L.react_stack_bottom_frame.bind(L,f)(),te=K(d(f)),me={};$e.Fragment=H,$e.jsx=function(u,h,C){var N=1e4>F.recentlyCreatedOwnerStacks++;return S(u,h,C,!1,N?Error("react-stack-top-frame"):be,N?K(d(u)):te)},$e.jsxs=function(u,h,C){var N=1e4>F.recentlyCreatedOwnerStacks++;return S(u,h,C,!0,N?Error("react-stack-top-frame"):be,N?K(d(u)):te)}})()});var he=oe((xr,Xe)=>{"use strict";process.env.NODE_ENV==="production"?Xe.exports=Ot():Xe.exports=Pt()});var gr={};Ft(gr,{Runtime:()=>G,YuktAI:()=>mr,YuktAIWrapper:()=>Ye,aiPlugin:()=>ve,default:()=>Ye,voicePlugin:()=>Ae,wcag:()=>j,wcagPlugin:()=>j});var ae=null,Ce=null,Oe={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},bt=new Set(["h1","h2","h3","h4","h5","h6"]),mt=new Set(["input","select","textarea"]),gt=new Set(["button","a","input","select","textarea","details","summary"]),Bt=new Set(["video","audio"]),Gt=new Set(["ul","ol","dl"]);var Kt=new Set(["span","strong","em","b","i","u","s","small","mark","del","ins","sub","sup","abbr","cite","code","kbd","samp","var","time","q"]),ze={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"},j={name:"yuktai-a11y",version:"1.0.0",observer:null,async execute(r){if(!r.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";let n=this.applyFixes(r);return r.autoFix&&this.startObserver(r),`yuktai-a11y: ${n.fixed} fixes applied across ${n.scanned} nodes in ${n.renderTime}ms.`},scan(){let r={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return r;let n=performance.now(),c=document.querySelectorAll("*");r.scanned=c.length;let d=(a,f,t,i)=>r.details.push({tag:a,fix:f,severity:t,element:i.outerHTML.slice(0,100)});return c.forEach(a=>{let f=a,t=f.tagName.toLowerCase();(t==="a"||t==="button")&&!f.innerText?.trim()&&!f.getAttribute("aria-label")&&d(t,"needs aria-label (empty)","critical",f),t==="img"&&!f.hasAttribute("alt")&&d(t,"needs alt text","serious",f),mt.has(t)&&!f.getAttribute("aria-label")&&!f.getAttribute("aria-labelledby")&&d(t,"needs aria-label","serious",f),t==="iframe"&&!f.getAttribute("title")&&!f.getAttribute("aria-label")&&d(t,"iframe needs title","serious",f),Bt.has(t)&&!a.querySelector("track")&&!f.getAttribute("aria-label")&&d(t,"media needs captions/aria-label","serious",f),bt.has(t)&&!f.innerText?.trim()&&!f.getAttribute("aria-label")&&d(t,"empty heading","moderate",f)}),r.fixed=r.details.length,r.renderTime=parseFloat((performance.now()-n).toFixed(2)),r},applyFixes(r){let n={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return n;let c=performance.now(),d=document.querySelectorAll("*");n.scanned=d.length;let a=(f,t,i,k)=>{n.details.push({tag:f,fix:t,severity:i,element:k.outerHTML.slice(0,100)}),n.fixed++};if(d.forEach(f=>{let t=f,i=t.tagName.toLowerCase();if(i==="html"&&!t.getAttribute("lang")&&(t.setAttribute("lang","en"),a(i,'lang="en" added to <html>',"critical",t)),i==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(i,`document.title set to "${document.title}"`,"serious",t)),i==="meta"){let s=t.getAttribute("name"),m=t.getAttribute("content")||"";s==="viewport"&&m.includes("user-scalable=no")&&(t.setAttribute("content",m.replace("user-scalable=no","user-scalable=yes")),a(i,"user-scalable=yes restored","serious",t)),s==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(m)&&(t.setAttribute("content",m.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(i,"maximum-scale=5 restored","serious",t))}if(i==="body"&&!document.querySelector("[data-yuktai-skip]")){let s=document.createElement("a");s.setAttribute("href","#main-content"),s.setAttribute("data-yuktai-skip","true"),s.setAttribute("aria-label","Skip to main content"),s.textContent="Skip to main content",s.style.cssText="position:fixed;top:-40px;left:0;background:#0d9488;color:#fff;padding:8px 16px;z-index:99999;font-family:system-ui;font-size:14px;border-radius:0 0 4px 0;text-decoration:none;transition:top 0.2s;",s.addEventListener("focus",()=>{s.style.top="0"}),s.addEventListener("blur",()=>{s.style.top="-40px"}),t.insertBefore(s,t.firstChild),a(i,"skip-to-content link injected","minor",t);let m=document.querySelector("main,[role='main']");m&&!m.getAttribute("tabindex")&&m.setAttribute("tabindex","-1")}if(bt.has(i)&&(!t.innerText?.trim()&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label",`${i.toUpperCase()} section`),a(i,`aria-label="${i.toUpperCase()} section" (empty heading)`,"moderate",t)),t.hasAttribute("onclick")&&!t.getAttribute("tabindex")&&(t.setAttribute("tabindex","0"),t.onkeydown||(t.onkeydown=s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t.click())}),a(i,"tabindex=0 + keydown (clickable heading)","minor",t))),i==="p"&&t.getAttribute("dir")==="rtl"&&!t.getAttribute("lang")&&!document.documentElement.getAttribute("lang")&&(t.setAttribute("lang","ar"),a(i,'lang="ar" (rtl paragraph)',"moderate",t)),i==="img"&&(t.hasAttribute("alt")||(t.setAttribute("alt",""),t.setAttribute("aria-hidden","true"),a(i,'alt="" aria-hidden="true"',"serious",t)),t.getAttribute("role")==="presentation"&&t.getAttribute("alt")!==""&&(t.setAttribute("alt",""),a(i,'alt="" (role=presentation)',"minor",t))),i==="area"&&!t.getAttribute("alt")){let s=t.getAttribute("title")||t.getAttribute("href")||"map area";t.setAttribute("alt",s),a(i,`alt="${s}" on <area>`,"serious",t)}if(i==="svg"){if(!t.getAttribute("aria-hidden")&&!t.getAttribute("aria-label")&&!f.querySelector("title"))if(!t.getAttribute("role")||t.getAttribute("role")==="img"){let s=document.createElementNS("http://www.w3.org/2000/svg","title");s.textContent="graphic",t.prepend(s),t.setAttribute("role","img"),a(i,'role="img" + <title> injected',"moderate",t)}else t.setAttribute("aria-hidden","true"),a(i,'aria-hidden="true" (decorative svg)',"minor",t);t.getAttribute("focusable")||t.setAttribute("focusable","false")}if(i==="canvas"&&(t.getAttribute("role")||(t.setAttribute("role","img"),a(i,'role="img"',"serious",t)),t.getAttribute("aria-label")||(t.setAttribute("aria-label",t.getAttribute("title")||"canvas graphic"),a(i,"aria-label added to canvas","serious",t))),(i==="object"||i==="embed")&&!t.getAttribute("aria-label")&&!t.getAttribute("title")&&(t.setAttribute("aria-label",`embedded ${i} content`),a(i,`aria-label added to <${i}>`,"moderate",t)),i==="video"&&!f.querySelector("track")&&!t.getAttribute("aria-label")&&(t.setAttribute("aria-label",t.getAttribute("title")||"video player"),a(i,"aria-label added (no captions track)","serious",t)),i==="audio"&&!f.querySelector("track")&&!t.getAttribute("aria-label")&&(t.setAttribute("aria-label",t.getAttribute("title")||"audio player"),a(i,"aria-label added to audio","serious",t)),i==="iframe"&&!t.getAttribute("title")&&!t.getAttribute("aria-label")&&(t.setAttribute("title","embedded content"),t.setAttribute("aria-label","embedded content"),a(i,'title + aria-label="embedded content"',"serious",t)),i==="figure"&&!f.querySelector("figcaption")&&!t.getAttribute("aria-label")){let m=f.querySelector("img")?.getAttribute("alt");m&&(t.setAttribute("aria-label",m),a(i,"aria-label from inner img alt","minor",t))}if(i==="button"){if(!t.innerText?.trim()&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let s=t.getAttribute("title")||t.getAttribute("data-label")||"button";t.setAttribute("aria-label",s),a(i,`aria-label="${s}" (empty button)`,"critical",t)}t.hasAttribute("disabled")&&!t.getAttribute("aria-disabled")&&(t.setAttribute("aria-disabled","true"),n.fixed++)}if(i==="a"){let s=t;if(!t.innerText?.trim()&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let m=t.getAttribute("title")||"link";t.setAttribute("aria-label",m),a(i,`aria-label="${m}" (empty link)`,"critical",t)}if(s.target==="_blank"){s.rel?.includes("noopener")||(s.rel="noopener noreferrer",n.fixed++);let m=s.getAttribute("aria-label")||s.innerText?.trim()||"link";m.includes("opens in new window")||(s.setAttribute("aria-label",`${m} (opens in new window)`),a(i,"aria-label: new-window warning","moderate",t))}!s.href&&!s.getAttribute("role")&&!s.getAttribute("tabindex")&&(s.setAttribute("role","button"),s.setAttribute("tabindex","0"),a(i,'role="button" tabindex=0 (href-less link)',"serious",t))}if((t.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(t).cursor==="pointer")&&!gt.has(i)&&(t.getAttribute("role")||(t.setAttribute("role","button"),a(i,'role="button" (clickable non-interactive)',"serious",t)),t.tabIndex<0&&(t.tabIndex=0,n.fixed++),t.onkeydown||(t.onkeydown=s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t.click())})),mt.has(i)){let s=t;if(!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let m=t.getAttribute("placeholder")||t.getAttribute("name")||t.getAttribute("title")||i;t.setAttribute("aria-label",m),a(i,`aria-label="${m}"`,"serious",t)}if(t.hasAttribute("required")&&!t.getAttribute("aria-required")&&(t.setAttribute("aria-required","true"),n.fixed++),t.hasAttribute("disabled")&&!t.getAttribute("aria-disabled")&&(t.setAttribute("aria-disabled","true"),n.fixed++),t.hasAttribute("readonly")&&!t.getAttribute("aria-readonly")&&(t.setAttribute("aria-readonly","true"),n.fixed++),i==="input"&&!s.autocomplete){let m=s.name||"";s.type==="email"||m.includes("email")?(s.autocomplete="email",n.fixed++):s.type==="tel"||m.includes("tel")?(s.autocomplete="tel",n.fixed++):s.type==="password"?(s.autocomplete="current-password",n.fixed++):m.includes("firstname")||m.includes("fname")?(s.autocomplete="given-name",n.fixed++):m.includes("lastname")||m.includes("lname")?(s.autocomplete="family-name",n.fixed++):m==="name"||m.includes("fullname")?(s.autocomplete="name",n.fixed++):m.includes("zip")||m.includes("postal")?(s.autocomplete="postal-code",n.fixed++):m.includes("city")?(s.autocomplete="address-level2",n.fixed++):m.includes("country")&&(s.autocomplete="country",n.fixed++)}i==="input"&&s.type==="image"&&!t.getAttribute("alt")&&(t.setAttribute("alt",t.getAttribute("value")||"submit"),a(i,"alt added to input[type=image]","serious",t)),i==="input"&&s.type==="range"&&(t.getAttribute("aria-valuemin")||t.setAttribute("aria-valuemin",s.min||"0"),t.getAttribute("aria-valuemax")||t.setAttribute("aria-valuemax",s.max||"100"),t.getAttribute("aria-valuenow")||t.setAttribute("aria-valuenow",s.value||"50"),n.fixed++)}if(i==="fieldset"&&!f.querySelector("legend")&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label","form group"),a(i,'aria-label="form group" (no legend)',"moderate",t)),i==="label"){let s=t.getAttribute("for"),m=f.querySelector("input,select,textarea");!s&&!m&&!t.getAttribute("aria-label")&&a(i,"label not associated with any control","moderate",t)}if(i==="table"&&(!f.querySelector("th")&&!t.getAttribute("role")&&(t.setAttribute("role","grid"),a(i,'role="grid" (no <th>)',"serious",t)),!f.querySelector("caption")&&!t.getAttribute("aria-label")&&!t.getAttribute("summary")&&(t.setAttribute("aria-label","data table"),a(i,'aria-label="data table" (no caption)',"moderate",t))),i==="th"&&!t.getAttribute("scope")){let s=t.closest("thead")!==null;t.setAttribute("scope",s?"col":"row"),a(i,`scope="${s?"col":"row"}"`,"moderate",t)}if(Gt.has(i)&&(t.getAttribute("role")==="presentation"&&(f.querySelectorAll("li").forEach(s=>{s.getAttribute("role")||s.setAttribute("role","presentation")}),n.fixed++),(i==="ul"||i==="ol")&&!t.getAttribute("aria-label"))){let s=t.closest("nav");s&&(t.setAttribute("aria-label",s.getAttribute("aria-label")||"navigation list"),a(i,"aria-label from parent nav","minor",t))}if(i==="dt"&&!t.getAttribute("aria-label")){let s=t.nextElementSibling;(!s||s.tagName.toLowerCase()!=="dd")&&(t.setAttribute("aria-label",t.innerText?.trim()||"term"),a(i,"aria-label on <dt> (no following <dd>)","minor",t))}if(ze[i]&&!t.getAttribute("role")&&(t.setAttribute("role",ze[i]),a(i,`role="${ze[i]}"`,"minor",t)),["nav","section","article","aside"].includes(i)){let s=f.parentElement?.querySelectorAll(i);if(s&&s.length>1&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let L=f.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();L&&(t.setAttribute("aria-label",L),a(i,"aria-label from inner heading","moderate",t))}}if(i==="details"&&!f.querySelector("summary")){let s=document.createElement("summary");s.textContent=t.getAttribute("aria-label")||"More details",t.prepend(s),a(i,"<summary> injected","moderate",t)}if(i==="summary"&&!t.innerText?.trim()&&!t.getAttribute("aria-label")&&(t.setAttribute("aria-label","Toggle details"),a(i,'aria-label="Toggle details" (empty summary)',"moderate",t)),i==="dialog"){let s=t.getAttribute("role");if(s&&s!=="dialog"&&(t.setAttribute("role","dialog"),a(i,'role corrected to "dialog"',"serious",t)),!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let L=f.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";t.setAttribute("aria-label",L),a(i,"aria-label added to dialog","serious",t)}}if(i==="abbr"&&!t.getAttribute("title")&&(t.setAttribute("title",t.innerText?.trim()||"abbreviation"),a(i,"title added to <abbr>","minor",t)),i==="time"&&!t.getAttribute("datetime")&&t.innerText?.trim()&&(t.setAttribute("datetime",t.innerText.trim()),a(i,`datetime="${t.innerText.trim()}" added`,"minor",t)),i==="mark"&&!t.getAttribute("aria-label")&&(t.setAttribute("aria-label",`highlighted: ${t.innerText?.trim()?.slice(0,60)}`),a(i,"aria-label added to <mark>","minor",t)),i==="meter"&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label",t.getAttribute("title")||"meter"),a(i,"aria-label added to <meter>","moderate",t)),i==="progress"){!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label",t.getAttribute("title")||"progress"),a(i,"aria-label added to <progress>","moderate",t));let s=t;t.getAttribute("aria-valuenow")||t.setAttribute("aria-valuenow",String(s.value)),t.getAttribute("aria-valuemax")||t.setAttribute("aria-valuemax",String(s.max||1)),n.fixed++}let w=t.getAttribute("role")||"";if(w==="tab"&&!t.getAttribute("aria-selected")&&(t.setAttribute("aria-selected","false"),n.fixed++),w==="tabpanel"&&(!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label","tab panel"),a(i,'aria-label="tab panel"',"moderate",t)),t.getAttribute("tabindex")||(t.setAttribute("tabindex","0"),n.fixed++)),["alert","status","log","marquee"].includes(w)){if(!t.getAttribute("aria-live")){let s=w==="alert"?"assertive":"polite";t.setAttribute("aria-live",s),a(i,`aria-live="${s}" on role=${w}`,"moderate",t)}t.getAttribute("aria-atomic")||(t.setAttribute("aria-atomic","true"),n.fixed++)}w==="tooltip"&&!t.getAttribute("aria-live")&&(t.setAttribute("aria-live","polite"),n.fixed++),(w==="menu"||w==="menubar")&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label","menu"),a(i,'aria-label="menu"',"moderate",t)),w==="menuitem"&&t.tabIndex<0&&(t.tabIndex=-1,n.fixed++),w==="listbox"&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label","listbox"),a(i,'aria-label="listbox"',"moderate",t)),w==="option"&&!t.getAttribute("aria-selected")&&(t.setAttribute("aria-selected","false"),n.fixed++),w==="slider"&&(t.getAttribute("aria-valuemin")||t.setAttribute("aria-valuemin","0"),t.getAttribute("aria-valuemax")||t.setAttribute("aria-valuemax","100"),t.getAttribute("aria-valuenow")||t.setAttribute("aria-valuenow","50"),n.fixed++),(w==="checkbox"||w==="radio")&&!t.getAttribute("aria-checked")&&(t.setAttribute("aria-checked","false"),a(i,`aria-checked="false" on role=${w}`,"serious",t)),w==="combobox"&&(t.getAttribute("aria-expanded")||(t.setAttribute("aria-expanded","false"),a(i,'aria-expanded="false" on combobox',"serious",t)),t.getAttribute("aria-haspopup")||(t.setAttribute("aria-haspopup","listbox"),n.fixed++)),(w==="grid"||w==="treegrid")&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label","data grid"),a(i,'aria-label="data grid"',"moderate",t)),w==="tree"&&!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")&&(t.setAttribute("aria-label","tree"),a(i,'aria-label="tree"',"moderate",t)),w==="treeitem"&&f.querySelector('[role="group"]')&&!t.getAttribute("aria-expanded")&&(t.setAttribute("aria-expanded","false"),n.fixed++),w==="spinbutton"&&(t.getAttribute("aria-valuenow")||t.setAttribute("aria-valuenow","0"),t.getAttribute("aria-valuemin")||t.setAttribute("aria-valuemin","0"),t.getAttribute("aria-valuemax")||t.setAttribute("aria-valuemax","100"),n.fixed++);let S=!["html","head","meta","script","style","link","noscript"].includes(i);if(r.highContrast&&S&&!Kt.has(i)&&(t.style.filter="contrast(1.15) brightness(1.05)"),r.reduceMotion&&S&&(t.style.transition="none",t.style.animation="none"),r.fontSizeMultiplier&&r.fontSizeMultiplier!==1&&S){let s=parseFloat(window.getComputedStyle(t).fontSize);!isNaN(s)&&s>0&&(t.style.fontSize=`${s*r.fontSizeMultiplier}px`)}if(r.colorBlindMode&&r.colorBlindMode!=="none"&&i==="body"){let s=r.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${Oe[r.colorBlindMode]})`;t.style.filter=s}r.keyboardHints&&(gt.has(i)||t.tabIndex>=0)&&(t.style.outline="2px solid #007acc",t.style.outlineOffset="2px")}),r.colorBlindMode&&r.colorBlindMode!=="none"&&!Ce){let f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("aria-hidden","true"),f.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",f.innerHTML=`
|
|
19
|
+
<defs>
|
|
20
|
+
<filter id="${Oe.deuteranopia}">
|
|
21
|
+
<feColorMatrix type="matrix" values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
|
|
22
|
+
</filter>
|
|
23
|
+
<filter id="${Oe.protanopia}">
|
|
24
|
+
<feColorMatrix type="matrix" values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/>
|
|
25
|
+
</filter>
|
|
26
|
+
<filter id="${Oe.tritanopia}">
|
|
27
|
+
<feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
|
|
28
|
+
</filter>
|
|
29
|
+
</defs>`,document.body.appendChild(f),Ce=f}return this.ensureLiveRegion(),n.renderTime=parseFloat((performance.now()-c).toFixed(2)),n},removeColorBlindSvg(){Ce?.remove(),Ce=null},startObserver(r){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(r)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},ensureLiveRegion(){if(typeof document>"u"||ae)return;let r=document.createElement("div");r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),r.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(r),ae=r},removeLiveRegion(){ae?.remove(),ae=null},announce(r){ae&&(ae.textContent=r)}};var $=ie(Ne(),1);var Le=ie(Ne(),1),E=ie(he(),1),Ze={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},le=[80,90,100,110,120,130,140,150],Mt=[{id:"highContrast",label:"High contrast",description:"contrast(1.15) brightness on all nodes",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables all transitions & animations",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"MutationObserver on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing",icon:"Aa"}];function pr({checked:r,onChange:n,label:c}){return(0,E.jsxs)("label",{"aria-label":c,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[(0,E.jsx)("input",{type:"checkbox",checked:r,onChange:d=>n(d.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),(0,E.jsx)("span",{style:{position:"absolute",inset:0,borderRadius:99,background:r?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),(0,E.jsx)("span",{style:{position:"absolute",top:3,left:r?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var Je=(0,Le.forwardRef)(({position:r,settings:n,report:c,isActive:d,set:a,onApply:f,onReset:t,onClose:i},k)=>(0,E.jsxs)("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...r==="left"?{left:88}:{right:88},width:312,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif"},children:[(0,E.jsxs)("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[(0,E.jsxs)("div",{children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[(0,E.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v1.0.0"}),d&&(0,E.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),(0,E.jsx)("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),(0,E.jsx)("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes \xB7 Open Source"})]}),(0,E.jsx)("button",{onClick:i,"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),(0,E.jsx)("div",{style:{padding:"6px 0"},children:Mt.map((S,s)=>(0,E.jsxs)(Le.default.Fragment,{children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[(0,E.jsx)("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:S.icon}),(0,E.jsxs)("div",{children:[(0,E.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:S.label}),(0,E.jsx)("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:S.description})]})]}),(0,E.jsx)(pr,{checked:n[S.id],onChange:m=>a(S.id,m),label:`Toggle ${S.label}`})]}),s<Mt.length-1&&(0,E.jsx)("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},S.id))}),(0,E.jsxs)("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,E.jsx)("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),(0,E.jsxs)("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[n.fontScale,"%"]})]}),(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,E.jsx)("button",{onClick:()=>{let S=le.indexOf(n.fontScale);S>0&&a("fontScale",le[S-1])},disabled:n.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:n.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:n.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),(0,E.jsx)("div",{style:{flex:1,display:"flex",gap:3},children:le.map(S=>(0,E.jsx)("button",{onClick:()=>a("fontScale",S),"aria-label":`Set text size to ${S}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:S<=n.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},S))}),(0,E.jsx)("button",{onClick:()=>{let S=le.indexOf(n.fontScale);S<le.length-1&&a("fontScale",le[S+1])},disabled:n.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:n.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:n.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),c&&(0,E.jsx)("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:c.fixed>0?`\u2713 ${c.fixed} fixes applied \xB7 ${c.scanned} nodes \xB7 ${c.renderTime}ms`:`\u2713 0 fixes needed \xB7 ${c.scanned} nodes clean \xB7 ${c.renderTime}ms`}),(0,E.jsxs)("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[(0,E.jsx)("button",{onClick:t,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),(0,E.jsx)("button",{onClick:f,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));Je.displayName="WidgetPanel";var W=ie(he(),1),Ie=null,ce=null;function Ye({children:r,position:n="left"}){let[c,d]=(0,$.useState)(!1),[a,f]=(0,$.useState)(!1),[t,i]=(0,$.useState)(Ze),[k,w]=(0,$.useState)(null),[S,s]=(0,$.useState)(!1),m=(0,$.useRef)(null),L=(0,$.useRef)(null);(0,$.useEffect)(()=>d(!0),[]),(0,$.useEffect)(()=>{if(Ie)return;let T=document.createElement("style");return T.innerHTML="*:focus-visible{outline:3px solid #0d9488!important;outline-offset:2px!important;box-shadow:0 0 0 5px rgba(13,148,136,.25)!important;}",document.head.appendChild(T),Ie=T,()=>{Ie?.remove(),Ie=null}},[]),(0,$.useEffect)(()=>()=>{j.stopObserver(),j.removeLiveRegion(),j.removeColorBlindSvg()},[]),(0,$.useEffect)(()=>{if(!a)return;let T=I=>{m.current&&!m.current.contains(I.target)&&L.current&&!L.current.contains(I.target)&&f(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[a]),(0,$.useEffect)(()=>{let T=I=>{I.key==="Escape"&&a&&(f(!1),L.current?.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[a]);let Q=(T,I)=>i(z=>({...z,[T]:I})),fe=(0,$.useCallback)(async()=>{let T={enabled:!0,highContrast:t.highContrast,reduceMotion:t.reduceMotion,autoFix:t.autoFix},I=await j.execute(T);if(console.log("[yuktai-a11y]",I),w(j.applyFixes(T)),document.documentElement.style.fontSize=`${t.fontScale}%`,t.dyslexiaFont){if(!ce){let z=document.createElement("style");z.textContent="body,body *{font-family:'Georgia',serif!important;letter-spacing:.06em!important;word-spacing:.12em!important;line-height:1.9!important;}",document.head.appendChild(z),ce=z}}else ce?.remove(),ce=null;s(!0),f(!1),j.announce("yuktai-a11y active.")},[t]),H=(0,$.useCallback)(async()=>{await j.execute({enabled:!1}),document.documentElement.style.fontSize="",ce?.remove(),ce=null,document.querySelectorAll("*").forEach(T=>{T.style.filter="",T.style.transition="",T.style.animation=""}),i(Ze),w(null),s(!1),j.announce("yuktai-a11y disabled.")},[]);return c?(0,W.jsxs)(W.Fragment,{children:[r,(0,W.jsxs)("button",{ref:L,onClick:()=>f(T=>!T),"aria-label":"Open yuktai-a11y accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...n==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:S?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:T=>T.currentTarget.style.transform="scale(1.08)",onMouseLeave:T=>T.currentTarget.style.transform="scale(1)",onFocus:T=>T.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:T=>T.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[(0,W.jsx)("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",children:(0,W.jsx)("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),S&&(0,W.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&(0,W.jsx)(Je,{ref:m,position:n,settings:t,report:k,isActive:S,set:Q,onApply:fe,onReset:H,onClose:()=>f(!1)})]}):(0,W.jsx)(W.Fragment,{children:r})}var ve={name:"ai.text",async execute(r){return`\u{1F916} YuktAI says: ${r}`}};var Ae={name:"voice.text",async execute(r){return!r||r.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${r}`}};var G=class{plugins=new Map;register(n,c){if(!c||typeof c.execute!="function")throw new Error(`Invalid plugin: ${n}`);this.plugins.set(n,c)}use(n){return this.plugins.get(n)}async run(n,c){try{let d=this.use(n);if(!d)throw new Error(`Plugin not found: ${n}`);return await d.execute(c)}catch(d){throw console.error(`[YuktAI Runtime Error in ${n}]:`,d),d}}getPlugins(){return Array.from(this.plugins.keys())}};function br(){if(typeof globalThis>"u")return new G;if(!globalThis.__yuktai_runtime__){let r=new G;r.register(j.name,j),r.register(ve.name,ve),r.register(Ae.name,Ae),globalThis.__yuktai_runtime__=r}return globalThis.__yuktai_runtime__}var Nt=typeof window<"u"?br():new G,mr={wcagPlugin:j,list(){return Nt.getPlugins()},use(r){return Nt.use(r)},fix(r){return j.applyFixes({enabled:!0,autoFix:!0,...r})},scan(){return j.scan()}};return Ut(gr);})();
|
|
30
|
+
/*! Bundled license information:
|
|
31
|
+
|
|
32
|
+
react/cjs/react.production.js:
|
|
33
|
+
(**
|
|
34
|
+
* @license React
|
|
35
|
+
* react.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*)
|
|
42
|
+
|
|
43
|
+
react/cjs/react.development.js:
|
|
44
|
+
(**
|
|
45
|
+
* @license React
|
|
46
|
+
* react.development.js
|
|
47
|
+
*
|
|
48
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
52
|
+
*)
|
|
53
|
+
|
|
54
|
+
react/cjs/react-jsx-runtime.production.js:
|
|
55
|
+
(**
|
|
56
|
+
* @license React
|
|
57
|
+
* react-jsx-runtime.production.js
|
|
58
|
+
*
|
|
59
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license found in the
|
|
62
|
+
* LICENSE file in the root directory of this source tree.
|
|
63
|
+
*)
|
|
64
|
+
|
|
65
|
+
react/cjs/react-jsx-runtime.development.js:
|
|
66
|
+
(**
|
|
67
|
+
* @license React
|
|
68
|
+
* react-jsx-runtime.development.js
|
|
69
|
+
*
|
|
70
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
71
|
+
*
|
|
72
|
+
* This source code is licensed under the MIT license found in the
|
|
73
|
+
* LICENSE file in the root directory of this source tree.
|
|
74
|
+
*)
|
|
75
|
+
*/
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
"use client";var w=class{plugins=new Map;register(n,d){if(!d||typeof d.execute!="function")throw new Error(`Invalid plugin: ${n}`);this.plugins.set(n,d)}use(n){return this.plugins.get(n)}async run(n,d){try{let a=this.use(n);if(!a)throw new Error(`Plugin not found: ${n}`);return await a.execute(d)}catch(a){throw console.error(`[YuktAI Runtime Error in ${n}]:`,a),a}}getPlugins(){return Array.from(this.plugins.keys())}};var F={name:"ai.text",async execute(e){return`\u{1F916} YuktAI says: ${e}`}};var L={name:"voice.text",async execute(e){return!e||e.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${e}`}};import q from"tesseract.js";var p=null,_=null;function V(e){let n=new TextDecoder("utf-8",{fatal:!1}).decode(new Uint8Array(e.slice(0,2e3)));return/[\u0C00-\u0C7F]/.test(n)?"tel":/[\u0900-\u097F]/.test(n)?"hin":/[\u0B80-\u0BFF]/.test(n)?"tam":/[\u4E00-\u9FFF]/.test(n)?"chi_sim":/[\u3040-\u30FF]/.test(n)?"jpn":/[\u0600-\u06FF]/.test(n)?"ara":/[\u0400-\u04FF]/.test(n)?"rus":"eng"}async function Y(e){return p&&_===e||(p&&(await p.terminate(),p=null),p=await q.createWorker({langPath:"/tessdata",logger:()=>{}}),await p.loadLanguage(e),await p.initialize(e),_=e),p}var z={name:"image.ocr.smart",async execute(e){try{if(!e?.file)return"\u274C No file provided";let n=e.file instanceof Blob?e.file:new Blob([e.file],{type:e.type??"image/png"}),d=e.lang||V(await n.arrayBuffer())||"eng",a=await Y(d),{data:t}=await a.recognize(n),o=t.text?.trim();return o?{language:d,confidence:Math.round(t.confidence??0),text:o}:"\u26A0\uFE0F No text detected"}catch(n){return console.error("[ocrSmartPlugin]",n),"\u274C OCR failed"}}};var y=null,A=null,C={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},u={name:"yuktai-a11y",version:"1.0.0",observer:null,async execute(e){if(!e.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";let n=this.applyFixes(e);return e.autoFix&&this.startObserver(e),`yuktai-a11y: ${n.fixed} fixes applied across ${n.scanned} nodes.`},applyFixes(e){let n={fixed:0,scanned:0,details:[]};if(typeof document>"u")return n;let d=document.querySelectorAll("*");if(n.scanned=d.length,d.forEach(a=>{let t=a,o=t.tagName.toLowerCase();if((o==="a"||o==="button")&&!t.innerText?.trim()&&!t.getAttribute("aria-label")){let r=t.getAttribute("title")||"Interactive element";t.setAttribute("aria-label",r),n.details.push({tag:o,fix:`aria-label="${r}"`,element:t.outerHTML.slice(0,60)}),n.fixed++}if(o==="img"&&!t.hasAttribute("alt")&&(t.setAttribute("alt",""),t.setAttribute("aria-hidden","true"),n.details.push({tag:o,fix:'alt="" aria-hidden="true"',element:t.outerHTML.slice(0,60)}),n.fixed++),(t.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(t).cursor==="pointer")&&!["button","a","input","select","textarea"].includes(o)&&(t.getAttribute("role")||(t.setAttribute("role","button"),n.details.push({tag:o,fix:'role="button"',element:t.outerHTML.slice(0,60)}),n.fixed++),t.tabIndex<0&&(t.tabIndex=0,n.fixed++),t.onkeydown||(t.onkeydown=r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t.click())})),["input","select","textarea"].includes(o)){if(!t.getAttribute("aria-label")&&!t.getAttribute("aria-labelledby")){let f=t.getAttribute("placeholder")||t.getAttribute("name")||o;t.setAttribute("aria-label",f),n.details.push({tag:o,fix:`aria-label="${f}"`,element:t.outerHTML.slice(0,60)}),n.fixed++}t.hasAttribute("required")&&!t.getAttribute("aria-required")&&(t.setAttribute("aria-required","true"),n.fixed++);let r=t;o==="input"&&!r.autocomplete&&(r.name?.includes("email")?r.autocomplete="email":r.name?.includes("tel")&&(r.autocomplete="tel"))}if(o==="table"&&!a.querySelector("th")&&(t.getAttribute("role")||(t.setAttribute("role","grid"),n.details.push({tag:o,fix:'role="grid"',element:t.outerHTML.slice(0,60)}),n.fixed++)),o==="a"){let r=t;if(r.target==="_blank"){r.rel?.includes("noopener")||(r.rel="noopener noreferrer",n.fixed++);let f=r.getAttribute("aria-label")||(r.innerText?.trim()?r.innerText.trim():"link");f.includes("opens in new window")||(r.setAttribute("aria-label",`${f} (opens in new window)`),n.fixed++)}}let g={nav:"navigation",header:"banner",footer:"contentinfo",main:"main"};if(g[o]&&!t.getAttribute("role")&&(t.setAttribute("role",g[o]),n.fixed++),e.highContrast&&(t.style.filter="contrast(1.15) brightness(1.05)"),e.reduceMotion&&(t.style.transition="none",t.style.animation="none"),e.fontSizeMultiplier&&e.fontSizeMultiplier!==1){let r=parseFloat(window.getComputedStyle(t).fontSize);t.style.fontSize=`${r*e.fontSizeMultiplier}px`}if(e.colorBlindMode&&e.colorBlindMode!=="none"){let r=e.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${C[e.colorBlindMode]})`;t.style.filter=(t.style.filter?t.style.filter+" ":"")+r}e.keyboardHints&&(t.tabIndex>=0||["button","a","input","select","textarea"].includes(o))&&(t.style.outline="2px solid #007acc",t.style.outlineOffset="2px")}),e.colorBlindMode&&e.colorBlindMode!=="none"&&!A){let a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("aria-hidden","true"),a.style.display="none",a.innerHTML=`
|
|
1
|
+
var h=null,E=null,M={deuteranopia:"yuktai-cb-d",protanopia:"yuktai-cb-p",tritanopia:"yuktai-cb-t"},W=new Set(["h1","h2","h3","h4","h5","h6"]),z=new Set(["input","select","textarea"]),q=new Set(["button","a","input","select","textarea","details","summary"]),V=new Set(["video","audio"]),U=new Set(["ul","ol","dl"]);var Z=new Set(["span","strong","em","b","i","u","s","small","mark","del","ins","sub","sup","abbr","cite","code","kbd","samp","var","time","q"]),$={nav:"navigation",header:"banner",footer:"contentinfo",main:"main",aside:"complementary"},p={name:"yuktai-a11y",version:"1.0.0",observer:null,async execute(n){if(!n.enabled)return this.stopObserver(),"yuktai-a11y: disabled.";let r=this.applyFixes(n);return n.autoFix&&this.startObserver(n),`yuktai-a11y: ${r.fixed} fixes applied across ${r.scanned} nodes in ${r.renderTime}ms.`},scan(){let n={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return n;let r=performance.now(),b=document.querySelectorAll("*");n.scanned=b.length;let f=(a,o,e,t)=>n.details.push({tag:a,fix:o,severity:e,element:t.outerHTML.slice(0,100)});return b.forEach(a=>{let o=a,e=o.tagName.toLowerCase();(e==="a"||e==="button")&&!o.innerText?.trim()&&!o.getAttribute("aria-label")&&f(e,"needs aria-label (empty)","critical",o),e==="img"&&!o.hasAttribute("alt")&&f(e,"needs alt text","serious",o),z.has(e)&&!o.getAttribute("aria-label")&&!o.getAttribute("aria-labelledby")&&f(e,"needs aria-label","serious",o),e==="iframe"&&!o.getAttribute("title")&&!o.getAttribute("aria-label")&&f(e,"iframe needs title","serious",o),V.has(e)&&!a.querySelector("track")&&!o.getAttribute("aria-label")&&f(e,"media needs captions/aria-label","serious",o),W.has(e)&&!o.innerText?.trim()&&!o.getAttribute("aria-label")&&f(e,"empty heading","moderate",o)}),n.fixed=n.details.length,n.renderTime=parseFloat((performance.now()-r).toFixed(2)),n},applyFixes(n){let r={fixed:0,scanned:0,renderTime:0,details:[]};if(typeof document>"u")return r;let b=performance.now(),f=document.querySelectorAll("*");r.scanned=f.length;let a=(o,e,t,A)=>{r.details.push({tag:o,fix:e,severity:t,element:A.outerHTML.slice(0,100)}),r.fixed++};if(f.forEach(o=>{let e=o,t=e.tagName.toLowerCase();if(t==="html"&&!e.getAttribute("lang")&&(e.setAttribute("lang","en"),a(t,'lang="en" added to <html>',"critical",e)),t==="head"&&!document.title&&(document.title=document.querySelector("h1")?.innerText?.trim()||"Page",a(t,`document.title set to "${document.title}"`,"serious",e)),t==="meta"){let i=e.getAttribute("name"),l=e.getAttribute("content")||"";i==="viewport"&&l.includes("user-scalable=no")&&(e.setAttribute("content",l.replace("user-scalable=no","user-scalable=yes")),a(t,"user-scalable=yes restored","serious",e)),i==="viewport"&&/maximum-scale=1(?:[^0-9]|$)/.test(l)&&(e.setAttribute("content",l.replace(/maximum-scale=1(?=[^0-9]|$)/,"maximum-scale=5")),a(t,"maximum-scale=5 restored","serious",e))}if(t==="body"&&!document.querySelector("[data-yuktai-skip]")){let i=document.createElement("a");i.setAttribute("href","#main-content"),i.setAttribute("data-yuktai-skip","true"),i.setAttribute("aria-label","Skip to main content"),i.textContent="Skip to main content",i.style.cssText="position:fixed;top:-40px;left:0;background:#0d9488;color:#fff;padding:8px 16px;z-index:99999;font-family:system-ui;font-size:14px;border-radius:0 0 4px 0;text-decoration:none;transition:top 0.2s;",i.addEventListener("focus",()=>{i.style.top="0"}),i.addEventListener("blur",()=>{i.style.top="-40px"}),e.insertBefore(i,e.firstChild),a(t,"skip-to-content link injected","minor",e);let l=document.querySelector("main,[role='main']");l&&!l.getAttribute("tabindex")&&l.setAttribute("tabindex","-1")}if(W.has(t)&&(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",`${t.toUpperCase()} section`),a(t,`aria-label="${t.toUpperCase()} section" (empty heading)`,"moderate",e)),e.hasAttribute("onclick")&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","0"),e.onkeydown||(e.onkeydown=i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e.click())}),a(t,"tabindex=0 + keydown (clickable heading)","minor",e))),t==="p"&&e.getAttribute("dir")==="rtl"&&!e.getAttribute("lang")&&!document.documentElement.getAttribute("lang")&&(e.setAttribute("lang","ar"),a(t,'lang="ar" (rtl paragraph)',"moderate",e)),t==="img"&&(e.hasAttribute("alt")||(e.setAttribute("alt",""),e.setAttribute("aria-hidden","true"),a(t,'alt="" aria-hidden="true"',"serious",e)),e.getAttribute("role")==="presentation"&&e.getAttribute("alt")!==""&&(e.setAttribute("alt",""),a(t,'alt="" (role=presentation)',"minor",e))),t==="area"&&!e.getAttribute("alt")){let i=e.getAttribute("title")||e.getAttribute("href")||"map area";e.setAttribute("alt",i),a(t,`alt="${i}" on <area>`,"serious",e)}if(t==="svg"){if(!e.getAttribute("aria-hidden")&&!e.getAttribute("aria-label")&&!o.querySelector("title"))if(!e.getAttribute("role")||e.getAttribute("role")==="img"){let i=document.createElementNS("http://www.w3.org/2000/svg","title");i.textContent="graphic",e.prepend(i),e.setAttribute("role","img"),a(t,'role="img" + <title> injected',"moderate",e)}else e.setAttribute("aria-hidden","true"),a(t,'aria-hidden="true" (decorative svg)',"minor",e);e.getAttribute("focusable")||e.setAttribute("focusable","false")}if(t==="canvas"&&(e.getAttribute("role")||(e.setAttribute("role","img"),a(t,'role="img"',"serious",e)),e.getAttribute("aria-label")||(e.setAttribute("aria-label",e.getAttribute("title")||"canvas graphic"),a(t,"aria-label added to canvas","serious",e))),(t==="object"||t==="embed")&&!e.getAttribute("aria-label")&&!e.getAttribute("title")&&(e.setAttribute("aria-label",`embedded ${t} content`),a(t,`aria-label added to <${t}>`,"moderate",e)),t==="video"&&!o.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"video player"),a(t,"aria-label added (no captions track)","serious",e)),t==="audio"&&!o.querySelector("track")&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",e.getAttribute("title")||"audio player"),a(t,"aria-label added to audio","serious",e)),t==="iframe"&&!e.getAttribute("title")&&!e.getAttribute("aria-label")&&(e.setAttribute("title","embedded content"),e.setAttribute("aria-label","embedded content"),a(t,'title + aria-label="embedded content"',"serious",e)),t==="figure"&&!o.querySelector("figcaption")&&!e.getAttribute("aria-label")){let l=o.querySelector("img")?.getAttribute("alt");l&&(e.setAttribute("aria-label",l),a(t,"aria-label from inner img alt","minor",e))}if(t==="button"){if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let i=e.getAttribute("title")||e.getAttribute("data-label")||"button";e.setAttribute("aria-label",i),a(t,`aria-label="${i}" (empty button)`,"critical",e)}e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),r.fixed++)}if(t==="a"){let i=e;if(!e.innerText?.trim()&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let l=e.getAttribute("title")||"link";e.setAttribute("aria-label",l),a(t,`aria-label="${l}" (empty link)`,"critical",e)}if(i.target==="_blank"){i.rel?.includes("noopener")||(i.rel="noopener noreferrer",r.fixed++);let l=i.getAttribute("aria-label")||i.innerText?.trim()||"link";l.includes("opens in new window")||(i.setAttribute("aria-label",`${l} (opens in new window)`),a(t,"aria-label: new-window warning","moderate",e))}!i.href&&!i.getAttribute("role")&&!i.getAttribute("tabindex")&&(i.setAttribute("role","button"),i.setAttribute("tabindex","0"),a(t,'role="button" tabindex=0 (href-less link)',"serious",e))}if((e.hasAttribute("onclick")||typeof window<"u"&&window.getComputedStyle(e).cursor==="pointer")&&!q.has(t)&&(e.getAttribute("role")||(e.setAttribute("role","button"),a(t,'role="button" (clickable non-interactive)',"serious",e)),e.tabIndex<0&&(e.tabIndex=0,r.fixed++),e.onkeydown||(e.onkeydown=i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),e.click())})),z.has(t)){let i=e;if(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let l=e.getAttribute("placeholder")||e.getAttribute("name")||e.getAttribute("title")||t;e.setAttribute("aria-label",l),a(t,`aria-label="${l}"`,"serious",e)}if(e.hasAttribute("required")&&!e.getAttribute("aria-required")&&(e.setAttribute("aria-required","true"),r.fixed++),e.hasAttribute("disabled")&&!e.getAttribute("aria-disabled")&&(e.setAttribute("aria-disabled","true"),r.fixed++),e.hasAttribute("readonly")&&!e.getAttribute("aria-readonly")&&(e.setAttribute("aria-readonly","true"),r.fixed++),t==="input"&&!i.autocomplete){let l=i.name||"";i.type==="email"||l.includes("email")?(i.autocomplete="email",r.fixed++):i.type==="tel"||l.includes("tel")?(i.autocomplete="tel",r.fixed++):i.type==="password"?(i.autocomplete="current-password",r.fixed++):l.includes("firstname")||l.includes("fname")?(i.autocomplete="given-name",r.fixed++):l.includes("lastname")||l.includes("lname")?(i.autocomplete="family-name",r.fixed++):l==="name"||l.includes("fullname")?(i.autocomplete="name",r.fixed++):l.includes("zip")||l.includes("postal")?(i.autocomplete="postal-code",r.fixed++):l.includes("city")?(i.autocomplete="address-level2",r.fixed++):l.includes("country")&&(i.autocomplete="country",r.fixed++)}t==="input"&&i.type==="image"&&!e.getAttribute("alt")&&(e.setAttribute("alt",e.getAttribute("value")||"submit"),a(t,"alt added to input[type=image]","serious",e)),t==="input"&&i.type==="range"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin",i.min||"0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",i.max||"100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",i.value||"50"),r.fixed++)}if(t==="fieldset"&&!o.querySelector("legend")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","form group"),a(t,'aria-label="form group" (no legend)',"moderate",e)),t==="label"){let i=e.getAttribute("for"),l=o.querySelector("input,select,textarea");!i&&!l&&!e.getAttribute("aria-label")&&a(t,"label not associated with any control","moderate",e)}if(t==="table"&&(!o.querySelector("th")&&!e.getAttribute("role")&&(e.setAttribute("role","grid"),a(t,'role="grid" (no <th>)',"serious",e)),!o.querySelector("caption")&&!e.getAttribute("aria-label")&&!e.getAttribute("summary")&&(e.setAttribute("aria-label","data table"),a(t,'aria-label="data table" (no caption)',"moderate",e))),t==="th"&&!e.getAttribute("scope")){let i=e.closest("thead")!==null;e.setAttribute("scope",i?"col":"row"),a(t,`scope="${i?"col":"row"}"`,"moderate",e)}if(U.has(t)&&(e.getAttribute("role")==="presentation"&&(o.querySelectorAll("li").forEach(i=>{i.getAttribute("role")||i.setAttribute("role","presentation")}),r.fixed++),(t==="ul"||t==="ol")&&!e.getAttribute("aria-label"))){let i=e.closest("nav");i&&(e.setAttribute("aria-label",i.getAttribute("aria-label")||"navigation list"),a(t,"aria-label from parent nav","minor",e))}if(t==="dt"&&!e.getAttribute("aria-label")){let i=e.nextElementSibling;(!i||i.tagName.toLowerCase()!=="dd")&&(e.setAttribute("aria-label",e.innerText?.trim()||"term"),a(t,"aria-label on <dt> (no following <dd>)","minor",e))}if($[t]&&!e.getAttribute("role")&&(e.setAttribute("role",$[t]),a(t,`role="${$[t]}"`,"minor",e)),["nav","section","article","aside"].includes(t)){let i=o.parentElement?.querySelectorAll(t);if(i&&i.length>1&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let m=o.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim();m&&(e.setAttribute("aria-label",m),a(t,"aria-label from inner heading","moderate",e))}}if(t==="details"&&!o.querySelector("summary")){let i=document.createElement("summary");i.textContent=e.getAttribute("aria-label")||"More details",e.prepend(i),a(t,"<summary> injected","moderate",e)}if(t==="summary"&&!e.innerText?.trim()&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label","Toggle details"),a(t,'aria-label="Toggle details" (empty summary)',"moderate",e)),t==="dialog"){let i=e.getAttribute("role");if(i&&i!=="dialog"&&(e.setAttribute("role","dialog"),a(t,'role corrected to "dialog"',"serious",e)),!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")){let m=o.querySelector("h1,h2,h3,h4,h5,h6")?.textContent?.trim()||"dialog";e.setAttribute("aria-label",m),a(t,"aria-label added to dialog","serious",e)}}if(t==="abbr"&&!e.getAttribute("title")&&(e.setAttribute("title",e.innerText?.trim()||"abbreviation"),a(t,"title added to <abbr>","minor",e)),t==="time"&&!e.getAttribute("datetime")&&e.innerText?.trim()&&(e.setAttribute("datetime",e.innerText.trim()),a(t,`datetime="${e.innerText.trim()}" added`,"minor",e)),t==="mark"&&!e.getAttribute("aria-label")&&(e.setAttribute("aria-label",`highlighted: ${e.innerText?.trim()?.slice(0,60)}`),a(t,"aria-label added to <mark>","minor",e)),t==="meter"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"meter"),a(t,"aria-label added to <meter>","moderate",e)),t==="progress"){!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label",e.getAttribute("title")||"progress"),a(t,"aria-label added to <progress>","moderate",e));let i=e;e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow",String(i.value)),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax",String(i.max||1)),r.fixed++}let u=e.getAttribute("role")||"";if(u==="tab"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),r.fixed++),u==="tabpanel"&&(!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tab panel"),a(t,'aria-label="tab panel"',"moderate",e)),e.getAttribute("tabindex")||(e.setAttribute("tabindex","0"),r.fixed++)),["alert","status","log","marquee"].includes(u)){if(!e.getAttribute("aria-live")){let i=u==="alert"?"assertive":"polite";e.setAttribute("aria-live",i),a(t,`aria-live="${i}" on role=${u}`,"moderate",e)}e.getAttribute("aria-atomic")||(e.setAttribute("aria-atomic","true"),r.fixed++)}u==="tooltip"&&!e.getAttribute("aria-live")&&(e.setAttribute("aria-live","polite"),r.fixed++),(u==="menu"||u==="menubar")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","menu"),a(t,'aria-label="menu"',"moderate",e)),u==="menuitem"&&e.tabIndex<0&&(e.tabIndex=-1,r.fixed++),u==="listbox"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","listbox"),a(t,'aria-label="listbox"',"moderate",e)),u==="option"&&!e.getAttribute("aria-selected")&&(e.setAttribute("aria-selected","false"),r.fixed++),u==="slider"&&(e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","50"),r.fixed++),(u==="checkbox"||u==="radio")&&!e.getAttribute("aria-checked")&&(e.setAttribute("aria-checked","false"),a(t,`aria-checked="false" on role=${u}`,"serious",e)),u==="combobox"&&(e.getAttribute("aria-expanded")||(e.setAttribute("aria-expanded","false"),a(t,'aria-expanded="false" on combobox',"serious",e)),e.getAttribute("aria-haspopup")||(e.setAttribute("aria-haspopup","listbox"),r.fixed++)),(u==="grid"||u==="treegrid")&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","data grid"),a(t,'aria-label="data grid"',"moderate",e)),u==="tree"&&!e.getAttribute("aria-label")&&!e.getAttribute("aria-labelledby")&&(e.setAttribute("aria-label","tree"),a(t,'aria-label="tree"',"moderate",e)),u==="treeitem"&&o.querySelector('[role="group"]')&&!e.getAttribute("aria-expanded")&&(e.setAttribute("aria-expanded","false"),r.fixed++),u==="spinbutton"&&(e.getAttribute("aria-valuenow")||e.setAttribute("aria-valuenow","0"),e.getAttribute("aria-valuemin")||e.setAttribute("aria-valuemin","0"),e.getAttribute("aria-valuemax")||e.setAttribute("aria-valuemax","100"),r.fixed++);let d=!["html","head","meta","script","style","link","noscript"].includes(t);if(n.highContrast&&d&&!Z.has(t)&&(e.style.filter="contrast(1.15) brightness(1.05)"),n.reduceMotion&&d&&(e.style.transition="none",e.style.animation="none"),n.fontSizeMultiplier&&n.fontSizeMultiplier!==1&&d){let i=parseFloat(window.getComputedStyle(e).fontSize);!isNaN(i)&&i>0&&(e.style.fontSize=`${i*n.fontSizeMultiplier}px`)}if(n.colorBlindMode&&n.colorBlindMode!=="none"&&t==="body"){let i=n.colorBlindMode==="achromatopsia"?"grayscale(100%)":`url(#${M[n.colorBlindMode]})`;e.style.filter=i}n.keyboardHints&&(q.has(t)||e.tabIndex>=0)&&(e.style.outline="2px solid #007acc",e.style.outlineOffset="2px")}),n.colorBlindMode&&n.colorBlindMode!=="none"&&!E){let o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("aria-hidden","true"),o.style.cssText="position:absolute;width:0;height:0;overflow:hidden;",o.innerHTML=`
|
|
2
2
|
<defs>
|
|
3
|
-
<filter id="${
|
|
3
|
+
<filter id="${M.deuteranopia}">
|
|
4
4
|
<feColorMatrix type="matrix" values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/>
|
|
5
5
|
</filter>
|
|
6
|
-
<filter id="${
|
|
6
|
+
<filter id="${M.protanopia}">
|
|
7
7
|
<feColorMatrix type="matrix" values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/>
|
|
8
8
|
</filter>
|
|
9
|
-
<filter id="${
|
|
9
|
+
<filter id="${M.tritanopia}">
|
|
10
10
|
<feColorMatrix type="matrix" values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/>
|
|
11
11
|
</filter>
|
|
12
|
-
</defs>
|
|
13
|
-
`,document.body.appendChild(a),A=a}return this.ensureLiveRegion(),n},removeColorBlindSvg(){A?.remove(),A=null},startObserver(e){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(e)),this.observer.observe(document.body,{childList:!0,subtree:!0}))},stopObserver(){this.observer?.disconnect(),this.observer=null},ensureLiveRegion(){if(typeof document>"u"||y)return;let e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(e),y=e},removeLiveRegion(){y?.remove(),y=null},announce(e){y&&(y.textContent=e)}};import G,{useState as h,useEffect as v,useRef as B,useCallback as P}from"react";import{Fragment as $,jsx as l,jsxs as s}from"react/jsx-runtime";var M=null,m=null,W={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},x=[80,90,100,110,120,130,140,150],H=[{id:"highContrast",label:"High contrast",description:"Boosts contrast and brightness on all elements",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables transitions and animations site-wide",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"Re-runs fixes automatically on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing for readability",icon:"Aa"}];function K({checked:e,onChange:n,label:d}){return s("label",{"aria-label":d,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[l("input",{type:"checkbox",checked:e,onChange:a=>n(a.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),l("span",{style:{position:"absolute",inset:0,borderRadius:99,background:e?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),l("span",{style:{position:"absolute",top:3,left:e?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}function O({children:e}){let[n,d]=h(!1),[a,t]=h(!1),[o,R]=h(W),[g,r]=h(null),[f,I]=h(!1),T=B(null),S=B(null);v(()=>d(!0),[]),v(()=>{if(M)return;let i=document.createElement("style");return i.innerHTML=`
|
|
14
|
-
*:focus-visible {
|
|
15
|
-
outline: 3px solid #0d9488 !important;
|
|
16
|
-
outline-offset: 2px !important;
|
|
17
|
-
box-shadow: 0 0 0 5px rgba(13,148,136,0.25) !important;
|
|
18
|
-
}
|
|
19
|
-
`,document.head.appendChild(i),M=i,()=>{M?.remove(),M=null}},[]),v(()=>()=>{u.stopObserver(),u.removeLiveRegion(),u.removeColorBlindSvg()},[]),v(()=>{if(!a)return;let i=c=>{T.current&&!T.current.contains(c.target)&&S.current&&!S.current.contains(c.target)&&t(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),v(()=>{let i=c=>{c.key==="Escape"&&a&&(t(!1),S.current?.focus())};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a]);let k=(i,c)=>R(b=>({...b,[i]:c})),D=P(async()=>{let i={enabled:!0,highContrast:o.highContrast,reduceMotion:o.reduceMotion,autoFix:o.autoFix},c=await u.execute(i);console.log("[yuktai-a11y]",c);let b=u.applyFixes(i);if(r(b),document.documentElement.style.fontSize=`${o.fontScale}%`,o.dyslexiaFont){if(!m){let E=document.createElement("style");E.textContent=`
|
|
20
|
-
body, body * {
|
|
21
|
-
font-family: 'Georgia', serif !important;
|
|
22
|
-
letter-spacing: 0.06em !important;
|
|
23
|
-
word-spacing: 0.12em !important;
|
|
24
|
-
line-height: 1.9 !important;
|
|
25
|
-
}
|
|
26
|
-
`,document.head.appendChild(E),m=E}}else m?.remove(),m=null;I(!0),t(!1),u.announce(`yuktai-a11y active. ${b.fixed} fixes applied. `+[o.highContrast&&"High contrast on.",o.reduceMotion&&"Motion reduced.",o.dyslexiaFont&&"Dyslexia font on.",o.fontScale!==100&&`Text at ${o.fontScale}%.`].filter(Boolean).join(" "))},[o]),j=P(async()=>{await u.execute({enabled:!1}),document.documentElement.style.fontSize="",m?.remove(),m=null,document.querySelectorAll("*").forEach(i=>{i.style.filter="",i.style.transition="",i.style.animation=""}),R(W),r(null),I(!1),u.announce("yuktai-a11y disabled. All settings reset to defaults.")},[]);return n?s($,{children:[e,s("button",{ref:S,onClick:()=>t(i=>!i),"aria-label":"Open yuktai-a11y accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,right:24,width:52,height:52,borderRadius:"50%",background:f?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:i=>i.currentTarget.style.transform="scale(1.08)",onMouseLeave:i=>i.currentTarget.style.transform="scale(1)",onFocus:i=>i.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:i=>i.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[l("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",children:l("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),f&&l("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&s("div",{ref:T,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:88,right:24,width:312,background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},children:[s("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[s("div",{children:[s("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[s("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:["yuktai-a11y v",u.version]}),f&&l("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),l("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),l("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes for your page"})]}),l("button",{onClick:()=>t(!1),"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),l("div",{style:{padding:"6px 0"},children:H.map((i,c)=>s(G.Fragment,{children:[s("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[s("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[l("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:i.icon}),s("div",{children:[l("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:i.label}),l("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:i.description})]})]}),l(K,{checked:o[i.id],onChange:b=>k(i.id,b),label:`Toggle ${i.label}`})]}),c<H.length-1&&l("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},i.id))}),s("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[s("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[l("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),s("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[o.fontScale,"%"]})]}),s("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l("button",{onClick:()=>{let i=x.indexOf(o.fontScale);i>0&&k("fontScale",x[i-1])},disabled:o.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:o.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:o.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),l("div",{style:{flex:1,display:"flex",gap:3},children:x.map(i=>l("button",{onClick:()=>k("fontScale",i),"aria-label":`Set text size to ${i}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:i<=o.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},i))}),l("button",{onClick:()=>{let i=x.indexOf(o.fontScale);i<x.length-1&&k("fontScale",x[i+1])},disabled:o.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:o.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:o.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),g&&s("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:["\u2713 yuktai-a11y: ",g.fixed," fixes across ",g.scanned," nodes"]}),s("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[l("button",{onClick:j,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),l("button",{onClick:D,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]})]}):l($,{children:e})}function U(){if(!globalThis.__yuktai_runtime__){let e=new w;e.register(F.name,F),e.register(L.name,L),e.register(z.name,z),e.register(u.name,u),globalThis.__yuktai_runtime__=e}return globalThis.__yuktai_runtime__}var N=U(),Z={wcagPlugin:u,list(){return N.getPlugins()},use(e){return N.use(e)}},ge=Z;export{Z as YuktAI,O as YuktAIWrapper,ge as default};
|
|
12
|
+
</defs>`,document.body.appendChild(o),E=o}return this.ensureLiveRegion(),r.renderTime=parseFloat((performance.now()-b).toFixed(2)),r},removeColorBlindSvg(){E?.remove(),E=null},startObserver(n){this.observer||typeof document>"u"||(this.observer=new MutationObserver(()=>this.applyFixes(n)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1}))},stopObserver(){this.observer?.disconnect(),this.observer=null},ensureLiveRegion(){if(typeof document>"u"||h)return;let n=document.createElement("div");n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;",document.body.appendChild(n),h=n},removeLiveRegion(){h?.remove(),h=null},announce(n){h&&(h.textContent=n)}};import{useState as w,useEffect as T,useRef as H,useCallback as B}from"react";import J,{forwardRef as Q}from"react";import{jsx as c,jsxs as g}from"react/jsx-runtime";var _={highContrast:!1,reduceMotion:!1,autoFix:!0,dyslexiaFont:!1,fontScale:100},v=[80,90,100,110,120,130,140,150],N=[{id:"highContrast",label:"High contrast",description:"contrast(1.15) brightness on all nodes",icon:"\u25D1"},{id:"reduceMotion",label:"Reduce motion",description:"Disables all transitions & animations",icon:"\u23F8"},{id:"autoFix",label:"Auto-fix ARIA",description:"MutationObserver on new DOM nodes",icon:"\u267F"},{id:"dyslexiaFont",label:"Dyslexia-friendly font",description:"Wider letter & word spacing",icon:"Aa"}];function X({checked:n,onChange:r,label:b}){return g("label",{"aria-label":b,style:{position:"relative",display:"inline-flex",width:40,height:24,cursor:"pointer",flexShrink:0},children:[c("input",{type:"checkbox",checked:n,onChange:f=>r(f.target.checked),style:{opacity:0,width:0,height:0,position:"absolute"}}),c("span",{style:{position:"absolute",inset:0,borderRadius:99,background:n?"#0d9488":"#cbd5e1",transition:"background 0.2s"}}),c("span",{style:{position:"absolute",top:3,left:n?19:3,width:18,height:18,background:"#fff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)",pointerEvents:"none"}})]})}var F=Q(({position:n,settings:r,report:b,isActive:f,set:a,onApply:o,onReset:e,onClose:t},A)=>g("div",{ref:A,role:"dialog","aria-modal":"true","aria-label":"yuktai-a11y accessibility options",style:{position:"fixed",bottom:24,...n==="left"?{left:88}:{right:88},width:312,background:"#fff",border:"1px solid #e2e8f0",borderRadius:16,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",zIndex:9998,overflow:"hidden",fontFamily:"system-ui,-apple-system,sans-serif"},children:[g("div",{style:{padding:"14px 18px 12px",borderBottom:"1px solid #f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[g("div",{children:[g("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:5},children:[c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0d9488",letterSpacing:"0.05em",fontFamily:"monospace"},children:"@yuktishaalaa/yuktai v1.0.0"}),f&&c("span",{style:{fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:99,background:"#f0fdfa",color:"#0f766e",border:"1px solid #99f6e4"},children:"\u25CF ACTIVE"})]}),c("p",{style:{margin:"0 0 2px",fontSize:15,fontWeight:600,color:"#0f172a"},children:"Accessibility"}),c("p",{style:{margin:0,fontSize:12,color:"#64748b"},children:"Zero-config WCAG fixes \xB7 Open Source"})]}),c("button",{onClick:t,"aria-label":"Close panel",style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8",fontSize:18,lineHeight:1,borderRadius:6},children:"\xD7"})]}),c("div",{style:{padding:"6px 0"},children:N.map((d,i)=>g(J.Fragment,{children:[g("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 18px",gap:12},children:[g("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1},children:[c("span",{"aria-hidden":"true",style:{width:30,height:30,borderRadius:8,background:"#f0fdfa",color:"#0d9488",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,flexShrink:0,fontWeight:700},children:d.icon}),g("div",{children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:d.label}),c("p",{style:{margin:0,fontSize:11,color:"#94a3b8"},children:d.description})]})]}),c(X,{checked:r[d.id],onChange:l=>a(d.id,l),label:`Toggle ${d.label}`})]}),i<N.length-1&&c("div",{style:{height:1,background:"#f8fafc",margin:"0 18px"}})]},d.id))}),g("div",{style:{padding:"10px 18px 14px",borderTop:"1px solid #f1f5f9"},children:[g("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[c("p",{style:{margin:0,fontSize:13,fontWeight:500,color:"#0f172a"},children:"Text size"}),g("span",{style:{fontSize:12,fontWeight:600,color:"#0d9488",background:"#f0fdfa",padding:"2px 8px",borderRadius:99},children:[r.fontScale,"%"]})]}),g("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c("button",{onClick:()=>{let d=v.indexOf(r.fontScale);d>0&&a("fontScale",v[d-1])},disabled:r.fontScale<=80,"aria-label":"Decrease text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:r.fontScale<=80?"not-allowed":"pointer",fontSize:16,color:r.fontScale<=80?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"\u2212"}),c("div",{style:{flex:1,display:"flex",gap:3},children:v.map(d=>c("button",{onClick:()=>a("fontScale",d),"aria-label":`Set text size to ${d}%`,style:{flex:1,height:6,borderRadius:99,border:"none",cursor:"pointer",padding:0,background:d<=r.fontScale?"#0d9488":"#e2e8f0",transition:"background 0.15s"}},d))}),c("button",{onClick:()=>{let d=v.indexOf(r.fontScale);d<v.length-1&&a("fontScale",v[d+1])},disabled:r.fontScale>=150,"aria-label":"Increase text size",style:{width:30,height:30,borderRadius:8,border:"1px solid #e2e8f0",background:"#fff",cursor:r.fontScale>=150?"not-allowed":"pointer",fontSize:16,color:r.fontScale>=150?"#cbd5e1":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"+"})]})]}),b&&c("div",{role:"status",style:{margin:"0 14px",padding:"8px 12px",background:"#f0fdfa",border:"1px solid #99f6e4",borderRadius:8,fontSize:12,color:"#0f766e",fontWeight:500,fontFamily:"monospace"},children:b.fixed>0?`\u2713 ${b.fixed} fixes applied \xB7 ${b.scanned} nodes \xB7 ${b.renderTime}ms`:`\u2713 0 fixes needed \xB7 ${b.scanned} nodes clean \xB7 ${b.renderTime}ms`}),g("div",{style:{display:"flex",gap:8,padding:"12px 14px 14px"},children:[c("button",{onClick:e,style:{flex:1,padding:"8px 0",fontSize:13,fontWeight:500,borderRadius:9,border:"1px solid #e2e8f0",background:"#fff",color:"#64748b",cursor:"pointer"},children:"Reset"}),c("button",{onClick:o,style:{flex:2,padding:"8px 0",fontSize:13,fontWeight:600,borderRadius:9,border:"none",background:"#0d9488",color:"#fff",cursor:"pointer"},children:"Apply settings"})]})]}));F.displayName="WidgetPanel";import{Fragment as O,jsx as C,jsxs as G}from"react/jsx-runtime";var R=null,S=null;function P({children:n,position:r="left"}){let[b,f]=w(!1),[a,o]=w(!1),[e,t]=w(_),[A,u]=w(null),[d,i]=w(!1),l=H(null),m=H(null);T(()=>f(!0),[]),T(()=>{if(R)return;let s=document.createElement("style");return s.innerHTML="*:focus-visible{outline:3px solid #0d9488!important;outline-offset:2px!important;box-shadow:0 0 0 5px rgba(13,148,136,.25)!important;}",document.head.appendChild(s),R=s,()=>{R?.remove(),R=null}},[]),T(()=>()=>{p.stopObserver(),p.removeLiveRegion(),p.removeColorBlindSvg()},[]),T(()=>{if(!a)return;let s=y=>{l.current&&!l.current.contains(y.target)&&m.current&&!m.current.contains(y.target)&&o(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[a]),T(()=>{let s=y=>{y.key==="Escape"&&a&&(o(!1),m.current?.focus())};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[a]);let Y=(s,y)=>t(k=>({...k,[s]:y})),K=B(async()=>{let s={enabled:!0,highContrast:e.highContrast,reduceMotion:e.reduceMotion,autoFix:e.autoFix},y=await p.execute(s);if(console.log("[yuktai-a11y]",y),u(p.applyFixes(s)),document.documentElement.style.fontSize=`${e.fontScale}%`,e.dyslexiaFont){if(!S){let k=document.createElement("style");k.textContent="body,body *{font-family:'Georgia',serif!important;letter-spacing:.06em!important;word-spacing:.12em!important;line-height:1.9!important;}",document.head.appendChild(k),S=k}}else S?.remove(),S=null;i(!0),o(!1),p.announce("yuktai-a11y active.")},[e]),j=B(async()=>{await p.execute({enabled:!1}),document.documentElement.style.fontSize="",S?.remove(),S=null,document.querySelectorAll("*").forEach(s=>{s.style.filter="",s.style.transition="",s.style.animation=""}),t(_),u(null),i(!1),p.announce("yuktai-a11y disabled.")},[]);return b?G(O,{children:[n,G("button",{ref:m,onClick:()=>o(s=>!s),"aria-label":"Open yuktai-a11y accessibility options","aria-expanded":a,"aria-haspopup":"dialog",style:{position:"fixed",bottom:24,...r==="left"?{left:24}:{right:24},width:52,height:52,borderRadius:"50%",background:d?"#0f766e":"#0d9488",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(0,0,0,0.18)",zIndex:9999,transition:"background 0.2s, transform 0.15s",outline:"none"},onMouseEnter:s=>s.currentTarget.style.transform="scale(1.08)",onMouseLeave:s=>s.currentTarget.style.transform="scale(1)",onFocus:s=>s.currentTarget.style.boxShadow="0 0 0 4px rgba(13,148,136,0.45)",onBlur:s=>s.currentTarget.style.boxShadow="0 4px 14px rgba(0,0,0,0.18)",children:[C("svg",{viewBox:"0 0 24 24",style:{width:26,height:26,fill:"#fff"},"aria-hidden":"true",children:C("path",{d:"M12 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4zm9 4.5l-5-.5-2-.2V5l-4 .5-4-.5v.8L4 6.5 3 7l1 3 4-.5v2.3L6 17h2l2-4.5L12 14l2 2.5L16 17h2l-2-4.2V9.5l4 .5 1-3z"})}),d&&C("span",{"aria-hidden":"true",style:{position:"absolute",top:4,right:4,width:10,height:10,borderRadius:"50%",background:"#5eead4",border:"2px solid #fff"}})]}),a&&C(F,{ref:l,position:r,settings:e,report:A,isActive:d,set:Y,onApply:K,onReset:j,onClose:()=>o(!1)})]}):C(O,{children:n})}var I={name:"ai.text",async execute(n){return`\u{1F916} YuktAI says: ${n}`}};var L={name:"voice.text",async execute(n){return!n||n.trim()===""?"\u{1F3A4} No speech detected":`\u{1F3A4} You said: ${n}`}};var x=class{plugins=new Map;register(r,b){if(!b||typeof b.execute!="function")throw new Error(`Invalid plugin: ${r}`);this.plugins.set(r,b)}use(r){return this.plugins.get(r)}async run(r,b){try{let f=this.use(r);if(!f)throw new Error(`Plugin not found: ${r}`);return await f.execute(b)}catch(f){throw console.error(`[YuktAI Runtime Error in ${r}]:`,f),f}}getPlugins(){return Array.from(this.plugins.keys())}};function ee(){if(typeof globalThis>"u")return new x;if(!globalThis.__yuktai_runtime__){let n=new x;n.register(p.name,p),n.register(I.name,I),n.register(L.name,L),globalThis.__yuktai_runtime__=n}return globalThis.__yuktai_runtime__}var D=typeof window<"u"?ee():new x,we={wcagPlugin:p,list(){return D.getPlugins()},use(n){return D.use(n)},fix(n){return p.applyFixes({enabled:!0,autoFix:!0,...n})},scan(){return p.scan()}};export{x as Runtime,we as YuktAI,P as YuktAIWrapper,I as aiPlugin,P as default,L as voicePlugin,p as wcag,p as wcagPlugin};
|
package/package.json
CHANGED
|
@@ -1,16 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuktishaalaa/yuktai",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Privacy-first, offline-first Indic language AI
|
|
3
|
+
"version": "2.0.4",
|
|
4
|
+
"description": "Privacy-first, offline-first universal accessibility engine with WCAG auto-fix, OCR, voice, and Indic language AI support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
|
+
"browser": "./dist/index.global.js",
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"types": "./dist/index.d.ts",
|
|
12
13
|
"import": "./dist/index.js",
|
|
13
14
|
"require": "./dist/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./core": {
|
|
17
|
+
"types": "./dist/core/renderer.d.ts",
|
|
18
|
+
"import": "./dist/core/renderer.js",
|
|
19
|
+
"require": "./dist/core/renderer.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./react": {
|
|
22
|
+
"types": "./dist/core/YuktAIWrapper.d.ts",
|
|
23
|
+
"import": "./dist/core/YuktAIWrapper.js",
|
|
24
|
+
"require": "./dist/core/YuktAIWrapper.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./next": {
|
|
27
|
+
"types": "./dist/core/YuktAIWrapper.d.ts",
|
|
28
|
+
"import": "./dist/core/YuktAIWrapper.js",
|
|
29
|
+
"require": "./dist/core/YuktAIWrapper.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./plugins/ai": {
|
|
32
|
+
"types": "./dist/plugins/ai.d.ts",
|
|
33
|
+
"import": "./dist/plugins/ai.js",
|
|
34
|
+
"require": "./dist/plugins/ai.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./plugins/ocr": {
|
|
37
|
+
"types": "./dist/plugins/ocr.d.ts",
|
|
38
|
+
"import": "./dist/plugins/ocr.js",
|
|
39
|
+
"require": "./dist/plugins/ocr.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./plugins/voice": {
|
|
42
|
+
"types": "./dist/plugins/voice.d.ts",
|
|
43
|
+
"import": "./dist/plugins/voice.js",
|
|
44
|
+
"require": "./dist/plugins/voice.cjs"
|
|
45
|
+
},
|
|
46
|
+
"./plugins/wcag": {
|
|
47
|
+
"types": "./dist/plugins/wcag.d.ts",
|
|
48
|
+
"import": "./dist/plugins/wcag.js",
|
|
49
|
+
"require": "./dist/plugins/wcag.cjs"
|
|
14
50
|
}
|
|
15
51
|
},
|
|
16
52
|
"publishConfig": {
|
|
@@ -21,8 +57,8 @@
|
|
|
21
57
|
"dist"
|
|
22
58
|
],
|
|
23
59
|
"scripts": {
|
|
24
|
-
"dev": "tsup src/index.ts --format cjs,esm --watch --dts --external react --external react-dom",
|
|
25
|
-
"build": "tsup src/index.ts --format cjs,esm --clean --dts --minify --external react --external react-dom",
|
|
60
|
+
"dev": "tsup src/index.ts --format cjs,esm,iife --watch --dts --external react --external react-dom --global-name YuktAI",
|
|
61
|
+
"build": "tsup src/index.ts --format cjs,esm,iife --clean --dts --minify --external react --external react-dom --global-name YuktAI",
|
|
26
62
|
"lint": "tsc --noEmit",
|
|
27
63
|
"prepublishOnly": "npm run build"
|
|
28
64
|
},
|
|
@@ -31,12 +67,20 @@
|
|
|
31
67
|
"url": "git+https://github.com/sandeepmiriyala03/yuktai.git"
|
|
32
68
|
},
|
|
33
69
|
"keywords": [
|
|
70
|
+
"accessibility",
|
|
71
|
+
"a11y",
|
|
72
|
+
"wcag",
|
|
73
|
+
"aria",
|
|
34
74
|
"indic",
|
|
35
75
|
"ocr",
|
|
36
|
-
"
|
|
37
|
-
"vibe-coding",
|
|
76
|
+
"voice",
|
|
38
77
|
"offline-ai",
|
|
39
|
-
"
|
|
78
|
+
"react",
|
|
79
|
+
"nextjs",
|
|
80
|
+
"vue",
|
|
81
|
+
"angular",
|
|
82
|
+
"yuktai",
|
|
83
|
+
"vibe-coding"
|
|
40
84
|
],
|
|
41
85
|
"author": "Sandeep Miriyala",
|
|
42
86
|
"license": "ISC",
|
|
@@ -44,6 +88,14 @@
|
|
|
44
88
|
"react": ">=18",
|
|
45
89
|
"react-dom": ">=18"
|
|
46
90
|
},
|
|
91
|
+
"peerDependenciesMeta": {
|
|
92
|
+
"react": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"react-dom": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
47
99
|
"dependencies": {
|
|
48
100
|
"idb-keyval": "^6.2.2",
|
|
49
101
|
"tesseract.js": "^7.0.0",
|