ape-accessibility 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto.cjs +1 -1
- package/dist/auto.global.js +1 -1
- package/dist/auto.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.global.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/auto.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
`,Ci(i,t)}function cn(e,t,i){let n=yi(),o=t.slice(0,3),a=`<div style="font-weight:700;font-size:14px;margin-bottom:8px;color:#1d4ed8">${e}</div>`;for(let r of o){a+=`<div style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#9ca3af;margin-bottom:3px">${r.partOfSpeech}</div>`;for(let c of r.definitions.slice(0,2)){let l=bi(c.definition);a+=`<div style="margin-bottom:5px;color:#374151">\u2022 ${l}</div>`}}n.innerHTML=a,Ci(n,i)}function ln(e){let t=document.getElementById(me);t&&(t.innerHTML=`
|
|
12
12
|
<div style="font-weight:700;font-size:14px;margin-bottom:4px;color:#1d4ed8">${e}</div>
|
|
13
13
|
<div style="color:#9ca3af;font-size:12px">Sin definici\xF3n disponible</div>
|
|
14
|
-
`)}function Ci(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,a=t.top-o-8,r=t.left+t.width/2-320/2;a<8&&(a=t.bottom+8),r<8&&(r=8),r+320>window.innerWidth-8&&(r=window.innerWidth-320-8),e.style.top=`${a}px`,e.style.left=`${r}px`,e.style.opacity="1"}function fe(){let e=document.getElementById(me);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function dn(){document.getElementById(me)?.remove()}var xi="es",lt="",Ze=null;async function un(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){fe();return}let i=window.getSelection();if(!i||i.rangeCount===0){fe();return}let n=i.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){fe();return}let o=n;lt=o;let r=i.getRangeAt(0).getBoundingClientRect();rn(o,r);try{let c=await nn(o,xi);if(lt!==o)return;if(!c.length){ln(o);return}cn(o,c,r)}catch{fe()}}function pn(e){e.composedPath()[0]?.id!==me&&fe()}function Ee(e,t="es"){if(xi=t,e){if(Ze)return;let i=o=>{un(o)},n=o=>{pn(o)};document.addEventListener("mouseup",i),document.addEventListener("mousedown",n),Ze=()=>{document.removeEventListener("mouseup",i),document.removeEventListener("mousedown",n)}}else Ze?.(),Ze=null,lt="",fe(),dn()}function Ei(){let[e,t]=(0,K.useState)(()=>p().dictionaryActive??!1);(0,K.useEffect)(()=>{let n=p();Ee(e,n.language??"es")},[]),(0,K.useEffect)(()=>{let n=o=>{let{settings:a}=o.detail,r=a.dictionaryActive??!1;r!==e&&(t(r),Ee(r,a.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[e]),(0,K.useEffect)(()=>()=>{Ee(!1)},[]);let i=(0,K.useCallback)(()=>{let n=!e,o=p().language??"es";t(n),Ee(n,o),g("dictionaryActive",n)},[e]);return{isActive:e,toggle:i}}function Ue(){let e=_t(),t=zt(),i=Wt(),n=Ft(),o=Vt(),a=Gt(),r=Ut(),c=Xt(),l=Kt(),f=Yt(),d=ni(),m=oi(),v=si(),h=ri(),I=ci(),C=ui(),y=mi(),S=vi(),P=Ei(),x=p(),O=Dt(x);return{contrast:e,textSize:t,language:i,colorblind:n,saturation:o,dyslexia:a,letterSpacing:r,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:I,tts:C,profiles:y,pageStructure:S,dictionary:P,hasActiveFeatures:O,resetAllFeatures:()=>{ue(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:x}}var M=require("react");var dt="apea-fab-position",_=60,L=16,fn=6;function ge(e,t,i){return Math.max(t,Math.min(i,e))}function mn(){try{let e=localStorage.getItem(dt);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(dt),null;let i=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,o=ge(t.hOffset,L,Math.max(L,i/2-_/2)),a=ge(t.vOffset,L,Math.max(L,n/2-_/2));return o>L&&a>L&&(o<a?o=L:a=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:a}}catch{return null}}function gn(e){try{localStorage.setItem(dt,JSON.stringify(e))}catch{}}function hn(e){return mn()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function ut(e,t,i){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-_,y:e.vEdge==="top"?e.vOffset:i-e.vOffset-_}}function vn(e,t,i,n){let o=e,a=i-e-_,r=t,c=n-t-_,l=Math.min(o,a,r,c),f="left",d="top",m=L,v=L;return l===o||l===a?(f=l===o?"left":"right",m=L,d=r<=c?"top":"bottom",v=ge(d==="top"?t:c,L,n/2-_/2)):(d=l===r?"top":"bottom",v=L,f=o<=a?"left":"right",m=ge(f==="left"?e:a,L,i/2-_/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function Sn(e,t){let i=Te(),n=window.innerWidth/i,o=window.innerHeight/i,a=ut(e,n,o);return{position:"fixed",top:`${a.y}px`,left:`${a.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function Li({defaultPosition:e="bottom-left",onTap:t,disabled:i=!1}={}){let[n,o]=(0,M.useState)(()=>hn(e)),[a,r]=(0,M.useState)(!1),[,c]=(0,M.useState)(0),l=(0,M.useRef)(null),f=(0,M.useRef)(t);f.current=t;let d=(0,M.useRef)(n);d.current=n;let m=(0,M.useRef)(i);m.current=i,(0,M.useEffect)(()=>{let h=()=>{c(I=>I+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=(0,M.useCallback)((h,I)=>{if(m.current)return;let C=Te(),y=b=>b/C,S=y(window.innerWidth),P=y(window.innerHeight),x=ut(d.current,S,P),O=x.x,he=x.y,Le=l.current;Le&&(Le.style.transition="none");let Ye=y(h)-O,Je=y(I)-he,ve=O,Se=he,we=0;function u(b,Y){let le=ge(y(b)-Ye,0,S-_),be=ge(y(Y)-Je,0,P-_);we+=Math.abs(le-ve)+Math.abs(be-Se),ve=le,Se=be;let ye=l.current;ye&&(ye.style.top=`${be}px`,ye.style.left=`${le}px`)}function Ae(b,Y){let le=Te(),be=window.innerWidth/le,ye=window.innerHeight/le,{x:Pi,y:Ri}=ut(Y,be,ye);b.style.top=`${Ri}px`,b.style.left=`${Pi}px`,b.style.transition="all 0.25s ease"}function Et(){Ni();let b=l.current;if(we<fn)b&&Ae(b,d.current),r(!1),f.current?.();else{let Y=vn(ve,Se,S,P);gn(Y),b&&Ae(b,Y),r(!1),o(Y)}}function Lt(b){u(b.clientX,b.clientY)}function wt(b){b.preventDefault(),u(b.touches[0].clientX,b.touches[0].clientY)}function At(){Et()}function Mt(){Et()}function Ni(){window.removeEventListener("mousemove",Lt),window.removeEventListener("mouseup",At),window.removeEventListener("touchmove",wt),window.removeEventListener("touchend",Mt)}window.addEventListener("mousemove",Lt),window.addEventListener("mouseup",At),window.addEventListener("touchmove",wt,{passive:!1}),window.addEventListener("touchend",Mt),r(!0)},[]);return{fabStyle:Sn(n,a),isDragging:a,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}var wi=require("react");var Xe=require("react/jsx-runtime");function pt({title:e,children:t}){return(0,Xe.jsxs)("section",{className:"px-4 py-3",children:[(0,Xe.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}var ce=require("react/jsx-runtime");function z({icon:e,label:t,isActive:i,onClick:n,disabled:o=!1,className:a,hint:r}){return(0,ce.jsxs)("button",{type:"button",role:"switch","aria-checked":i,"aria-label":t,onClick:o?void 0:n,disabled:o,className:R("apea-focus apea-feature-row",a),"data-active":i,"data-disabled":o||void 0,children:[(0,ce.jsx)("span",{className:R("h-5 w-5 shrink-0",i?"text-blue-700":"text-gray-500"),children:e}),(0,ce.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),r&&(0,ce.jsx)("span",{title:r,"aria-label":r,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,ce.jsx)("span",{className:"apea-toggle","data-checked":i,"aria-hidden":"true"})]})}var T=require("react/jsx-runtime");function bn(){return(0,T.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,T.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function V({icon:e,name:t,levels:i,currentIndex:n,onCycle:o,className:a}){let r=n>=0,c=r?i[n]:null,l=i.length>1;function f(){let v=n>=i.length-1?-1:n+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=r?`${t}: ${c.label}`:t;return(0,T.jsxs)("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":r,...l&&r?{"aria-valuenow":n+1,"aria-valuemax":i.length}:{},"data-active":r,onClick:f,onKeyDown:d,className:R("apea-focus apea-cyclic-tile",a),children:[(0,T.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:r&&(0,T.jsx)(bn,{})}),(0,T.jsx)("span",{className:"apea-cyclic-tile__icon",children:e}),(0,T.jsx)("span",{className:"apea-cyclic-tile__label",children:r?c.label:t}),l&&(0,T.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:i.map((v,h)=>(0,T.jsx)("span",{className:"apea-cyclic-dot","data-filled":r&&h<=n},h))})]})}var s=require("react/jsx-runtime"),ft=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],mt=[{label:"Alto Contraste",value:"high"}],gt=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],ht=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],vt=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],St=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Ai({onClose:e}){let[t,i]=(0,wi.useState)(!1),{contrast:n,textSize:o,saturation:a,dyslexia:r,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:I,hideImages:C,textAlign:y,tts:S,profiles:P,pageStructure:x,dictionary:O,resetAllFeatures:he}=Ue(),Le=ft.findIndex(u=>u.value===o.textSizePercentage),Ye=mt.findIndex(u=>u.value===n.contrastMode),Je=gt.findIndex(u=>u.value===a.saturationMode),ve=ht.findIndex(u=>u.value===l.level),Se=vt.findIndex(u=>u.value===c.level),we=St.findIndex(u=>u.value===y.mode);return(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,s.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&(0,s.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(rt).map(u=>(0,s.jsx)(z,{icon:(0,s.jsx)(Hn,{profile:u}),label:rt[u],isActive:P.activeProfile===u,onClick:()=>P.applyProfile(u)},u))})]}),(0,s.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,s.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,s.jsx)(V,{icon:(0,s.jsx)(Rn,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:S.isReading?0:-1,onCycle:()=>S.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(yn,{}),name:"Tama\xF1o de fuente",levels:ft,currentIndex:Le,onCycle:u=>o.setSpecificTextSize(u===-1?100:ft[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Mn,{}),name:"Contraste",levels:mt,currentIndex:Ye,onCycle:u=>n.setContrastMode(u===-1?"normal":mt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(In,{}),name:"Saturaci\xF3n",levels:gt,currentIndex:Je,onCycle:u=>a.setSaturationMode(u===-1?"normal":gt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(wn,{}),name:"Interlineado",levels:ht,currentIndex:ve,onCycle:u=>l.setTo(u===-1?14:ht[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Ln,{}),name:"Interletrado",levels:vt,currentIndex:Se,onCycle:u=>c.setTo(u===-1?0:vt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(En,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:r.isActive?0:-1,onCycle:()=>r.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(Pn,{mode:y.mode}),name:"Alinear texto",levels:St,currentIndex:we,onCycle:u=>y.setMode(u===-1?"default":St[u].value)})]})}),(0,s.jsx)(pt,{title:"Ajustes de contenido",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(Cn,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,s.jsx)(z,{icon:(0,s.jsx)(xn,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,s.jsx)(z,{icon:(0,s.jsx)(An,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Nn,{}),label:"Ocultar im\xE1genes",isActive:C.isActive,onClick:C.toggle})]})}),(0,s.jsxs)(pt,{title:"Herramientas",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(On,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(kn,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Tn,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Dn,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:O.isActive,onClick:O.toggle})]}),x.isOpen&&x.structure.length>0&&(0,s.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,s.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,s.jsx)("ul",{className:"space-y-1",children:x.structure.map((u,Ae)=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>x.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[(0,s.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),(0,s.jsx)("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${Ae}`))})]}),x.isOpen&&x.structure.length===0&&(0,s.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,s.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,s.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,s.jsx)("button",{type:"button",onClick:he,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function yn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function xn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function En(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ln(){return(0,s.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function wn(){return(0,s.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,s.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function An(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,s.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Mn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("path",{d:"M12 3v18"}),(0,s.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function In(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,s.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function On(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function kn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,s.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function Tn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function Nn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,s.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function Pn({mode:e}){return e==="center"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function Rn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function Hn({profile:e}){switch(e){case"visionImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,s.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,s.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function Dn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var N=require("react/jsx-runtime");function bt({position:e="bottom-left",className:t}={}){let[i,n]=(0,Ke.useState)(!0),{hasActiveFeatures:o}=Ue(),{fabStyle:a,isDragging:r,fabRef:c,dragHandlers:l}=Li({defaultPosition:e,onTap:()=>n(d=>!d),disabled:i});(0,Ke.useEffect)(()=>{if(!i)return;let d=m=>{m.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[i]);let f=i||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{ref:c,className:t,style:{...a,zIndex:i?30:50,opacity:r?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{i||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,N.jsx)(Qe,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,N.jsx)(Nt,{className:"w-full z-50",color:f,stroke:f})})}),(0,N.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":i?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,N.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":i?"true":"false",children:(0,N.jsx)(Ai,{onClose:()=>n(!1)})})]})}var Ct=require("react/jsx-runtime"),_n={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function yt(e){return{..._n,...e}}function zn(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Mi(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function Oi(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:yt(e.theme)},i=yt(t.theme),n=t.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
14
|
+
`)}function Ci(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,a=t.top-o-8,r=t.left+t.width/2-320/2;a<8&&(a=t.bottom+8),r<8&&(r=8),r+320>window.innerWidth-8&&(r=window.innerWidth-320-8),e.style.top=`${a}px`,e.style.left=`${r}px`,e.style.opacity="1"}function fe(){let e=document.getElementById(me);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function dn(){document.getElementById(me)?.remove()}var xi="es",lt="",Ze=null;async function un(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){fe();return}let i=window.getSelection();if(!i||i.rangeCount===0){fe();return}let n=i.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){fe();return}let o=n;lt=o;let r=i.getRangeAt(0).getBoundingClientRect();rn(o,r);try{let c=await nn(o,xi);if(lt!==o)return;if(!c.length){ln(o);return}cn(o,c,r)}catch{fe()}}function pn(e){e.composedPath()[0]?.id!==me&&fe()}function Ee(e,t="es"){if(xi=t,e){if(Ze)return;let i=o=>{un(o)},n=o=>{pn(o)};document.addEventListener("mouseup",i),document.addEventListener("mousedown",n),Ze=()=>{document.removeEventListener("mouseup",i),document.removeEventListener("mousedown",n)}}else Ze?.(),Ze=null,lt="",fe(),dn()}function Ei(){let[e,t]=(0,K.useState)(()=>p().dictionaryActive??!1);(0,K.useEffect)(()=>{let n=p();Ee(e,n.language??"es")},[]),(0,K.useEffect)(()=>{let n=o=>{let{settings:a}=o.detail,r=a.dictionaryActive??!1;r!==e&&(t(r),Ee(r,a.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[e]),(0,K.useEffect)(()=>()=>{Ee(!1)},[]);let i=(0,K.useCallback)(()=>{let n=!e,o=p().language??"es";t(n),Ee(n,o),g("dictionaryActive",n)},[e]);return{isActive:e,toggle:i}}function Ue(){let e=_t(),t=zt(),i=Wt(),n=Ft(),o=Vt(),a=Gt(),r=Ut(),c=Xt(),l=Kt(),f=Yt(),d=ni(),m=oi(),v=si(),h=ri(),I=ci(),C=ui(),y=mi(),S=vi(),P=Ei(),x=p(),O=Dt(x);return{contrast:e,textSize:t,language:i,colorblind:n,saturation:o,dyslexia:a,letterSpacing:r,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:I,tts:C,profiles:y,pageStructure:S,dictionary:P,hasActiveFeatures:O,resetAllFeatures:()=>{ue(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:x}}var M=require("react");var dt="apea-fab-position",_=60,L=16,fn=6;function ge(e,t,i){return Math.max(t,Math.min(i,e))}function mn(){try{let e=localStorage.getItem(dt);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(dt),null;let i=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,o=ge(t.hOffset,L,Math.max(L,i/2-_/2)),a=ge(t.vOffset,L,Math.max(L,n/2-_/2));return o>L&&a>L&&(o<a?o=L:a=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:a}}catch{return null}}function gn(e){try{localStorage.setItem(dt,JSON.stringify(e))}catch{}}function hn(e){return mn()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function ut(e,t,i){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-_,y:e.vEdge==="top"?e.vOffset:i-e.vOffset-_}}function vn(e,t,i,n){let o=e,a=i-e-_,r=t,c=n-t-_,l=Math.min(o,a,r,c),f="left",d="top",m=L,v=L;return l===o||l===a?(f=l===o?"left":"right",m=L,d=r<=c?"top":"bottom",v=ge(d==="top"?t:c,L,n/2-_/2)):(d=l===r?"top":"bottom",v=L,f=o<=a?"left":"right",m=ge(f==="left"?e:a,L,i/2-_/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function Sn(e,t){let i=Te(),n=window.innerWidth/i,o=window.innerHeight/i,a=ut(e,n,o);return{position:"fixed",top:`${a.y}px`,left:`${a.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function Li({defaultPosition:e="bottom-left",onTap:t,disabled:i=!1}={}){let[n,o]=(0,M.useState)(()=>hn(e)),[a,r]=(0,M.useState)(!1),[,c]=(0,M.useState)(0),l=(0,M.useRef)(null),f=(0,M.useRef)(t);f.current=t;let d=(0,M.useRef)(n);d.current=n;let m=(0,M.useRef)(i);m.current=i,(0,M.useEffect)(()=>{let h=()=>{c(I=>I+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=(0,M.useCallback)((h,I)=>{if(m.current)return;let C=Te(),y=b=>b/C,S=y(window.innerWidth),P=y(window.innerHeight),x=ut(d.current,S,P),O=x.x,he=x.y,Le=l.current;Le&&(Le.style.transition="none");let Ye=y(h)-O,Je=y(I)-he,ve=O,Se=he,we=0;function u(b,Y){let le=ge(y(b)-Ye,0,S-_),be=ge(y(Y)-Je,0,P-_);we+=Math.abs(le-ve)+Math.abs(be-Se),ve=le,Se=be;let ye=l.current;ye&&(ye.style.top=`${be}px`,ye.style.left=`${le}px`)}function Ae(b,Y){let le=Te(),be=window.innerWidth/le,ye=window.innerHeight/le,{x:Pi,y:Ri}=ut(Y,be,ye);b.style.top=`${Ri}px`,b.style.left=`${Pi}px`,b.style.transition="all 0.25s ease"}function Et(){Ni();let b=l.current;if(we<fn)b&&Ae(b,d.current),r(!1),f.current?.();else{let Y=vn(ve,Se,S,P);gn(Y),b&&Ae(b,Y),r(!1),o(Y)}}function Lt(b){u(b.clientX,b.clientY)}function wt(b){b.preventDefault(),u(b.touches[0].clientX,b.touches[0].clientY)}function At(){Et()}function Mt(){Et()}function Ni(){window.removeEventListener("mousemove",Lt),window.removeEventListener("mouseup",At),window.removeEventListener("touchmove",wt),window.removeEventListener("touchend",Mt)}window.addEventListener("mousemove",Lt),window.addEventListener("mouseup",At),window.addEventListener("touchmove",wt,{passive:!1}),window.addEventListener("touchend",Mt),r(!0)},[]);return{fabStyle:Sn(n,a),isDragging:a,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}var wi=require("react");var Xe=require("react/jsx-runtime");function pt({title:e,children:t}){return(0,Xe.jsxs)("section",{className:"px-4 py-3",children:[(0,Xe.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}var ce=require("react/jsx-runtime");function z({icon:e,label:t,isActive:i,onClick:n,disabled:o=!1,className:a,hint:r}){return(0,ce.jsxs)("button",{type:"button",role:"switch","aria-checked":i,"aria-label":t,onClick:o?void 0:n,disabled:o,className:R("apea-focus apea-feature-row",a),"data-active":i,"data-disabled":o||void 0,children:[(0,ce.jsx)("span",{className:R("h-5 w-5 shrink-0",i?"text-blue-700":"text-gray-500"),children:e}),(0,ce.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),r&&(0,ce.jsx)("span",{title:r,"aria-label":r,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,ce.jsx)("span",{className:"apea-toggle","data-checked":i,"aria-hidden":"true"})]})}var T=require("react/jsx-runtime");function bn(){return(0,T.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,T.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function V({icon:e,name:t,levels:i,currentIndex:n,onCycle:o,className:a}){let r=n>=0,c=r?i[n]:null,l=i.length>1;function f(){let v=n>=i.length-1?-1:n+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=r?`${t}: ${c.label}`:t;return(0,T.jsxs)("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":r,...l&&r?{"aria-valuenow":n+1,"aria-valuemax":i.length}:{},"data-active":r,onClick:f,onKeyDown:d,className:R("apea-focus apea-cyclic-tile",a),children:[(0,T.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:r&&(0,T.jsx)(bn,{})}),(0,T.jsx)("span",{className:"apea-cyclic-tile__icon",children:e}),(0,T.jsx)("span",{className:"apea-cyclic-tile__label",children:r?c.label:t}),l&&(0,T.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:i.map((v,h)=>(0,T.jsx)("span",{className:"apea-cyclic-dot","data-filled":r&&h<=n},h))})]})}var s=require("react/jsx-runtime"),ft=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],mt=[{label:"Alto Contraste",value:"high"}],gt=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],ht=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],vt=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],St=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Ai({onClose:e}){let[t,i]=(0,wi.useState)(!1),{contrast:n,textSize:o,saturation:a,dyslexia:r,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:I,hideImages:C,textAlign:y,tts:S,profiles:P,pageStructure:x,dictionary:O,resetAllFeatures:he}=Ue(),Le=ft.findIndex(u=>u.value===o.textSizePercentage),Ye=mt.findIndex(u=>u.value===n.contrastMode),Je=gt.findIndex(u=>u.value===a.saturationMode),ve=ht.findIndex(u=>u.value===l.level),Se=vt.findIndex(u=>u.value===c.level),we=St.findIndex(u=>u.value===y.mode);return(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,s.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&(0,s.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(rt).map(u=>(0,s.jsx)(z,{icon:(0,s.jsx)(Hn,{profile:u}),label:rt[u],isActive:P.activeProfile===u,onClick:()=>P.applyProfile(u)},u))})]}),(0,s.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,s.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,s.jsx)(V,{icon:(0,s.jsx)(Rn,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:S.isReading?0:-1,onCycle:()=>S.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(yn,{}),name:"Tama\xF1o de fuente",levels:ft,currentIndex:Le,onCycle:u=>o.setSpecificTextSize(u===-1?100:ft[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Mn,{}),name:"Contraste",levels:mt,currentIndex:Ye,onCycle:u=>n.setContrastMode(u===-1?"normal":mt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(In,{}),name:"Saturaci\xF3n",levels:gt,currentIndex:Je,onCycle:u=>a.setSaturationMode(u===-1?"normal":gt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(wn,{}),name:"Interlineado",levels:ht,currentIndex:ve,onCycle:u=>l.setTo(u===-1?14:ht[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Ln,{}),name:"Interletrado",levels:vt,currentIndex:Se,onCycle:u=>c.setTo(u===-1?0:vt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(En,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:r.isActive?0:-1,onCycle:()=>r.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(Pn,{mode:y.mode}),name:"Alinear texto",levels:St,currentIndex:we,onCycle:u=>y.setMode(u===-1?"default":St[u].value)})]})}),(0,s.jsx)(pt,{title:"Ajustes de contenido",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(Cn,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,s.jsx)(z,{icon:(0,s.jsx)(xn,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,s.jsx)(z,{icon:(0,s.jsx)(An,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Nn,{}),label:"Ocultar im\xE1genes",isActive:C.isActive,onClick:C.toggle})]})}),(0,s.jsxs)(pt,{title:"Herramientas",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(On,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(kn,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Tn,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Dn,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:O.isActive,onClick:O.toggle})]}),x.isOpen&&x.structure.length>0&&(0,s.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,s.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,s.jsx)("ul",{className:"space-y-1",children:x.structure.map((u,Ae)=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>x.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[(0,s.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),(0,s.jsx)("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${Ae}`))})]}),x.isOpen&&x.structure.length===0&&(0,s.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,s.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,s.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,s.jsx)("button",{type:"button",onClick:he,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function yn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function xn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function En(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ln(){return(0,s.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function wn(){return(0,s.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,s.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function An(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,s.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Mn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("path",{d:"M12 3v18"}),(0,s.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function In(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,s.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function On(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function kn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,s.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function Tn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function Nn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,s.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function Pn({mode:e}){return e==="center"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function Rn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function Hn({profile:e}){switch(e){case"visionImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,s.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,s.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function Dn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var N=require("react/jsx-runtime");function bt({position:e="bottom-left",className:t}={}){let[i,n]=(0,Ke.useState)(!1),{hasActiveFeatures:o}=Ue(),{fabStyle:a,isDragging:r,fabRef:c,dragHandlers:l}=Li({defaultPosition:e,onTap:()=>n(d=>!d),disabled:i});(0,Ke.useEffect)(()=>{if(!i)return;let d=m=>{m.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[i]);let f=i||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{ref:c,className:t,style:{...a,zIndex:i?30:50,opacity:r?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{i||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,N.jsx)(Qe,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,N.jsx)(Nt,{className:"w-full z-50",color:f,stroke:f})})}),(0,N.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":i?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,N.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":i?"true":"false",children:(0,N.jsx)(Ai,{onClose:()=>n(!1)})})]})}var Ct=require("react/jsx-runtime"),_n={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function yt(e){return{..._n,...e}}function zn(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Mi(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function Oi(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:yt(e.theme)},i=yt(t.theme),n=t.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
15
15
|
/* Accessibility Feature Styles */
|
|
16
16
|
/* ============================================= */
|
|
17
17
|
|
package/dist/auto.global.js
CHANGED
|
@@ -19,7 +19,7 @@ Error generating stack: `+n.message+`
|
|
|
19
19
|
`,hg(l,e)}function Iy(t,e,l){let n=yg(),a=e.slice(0,3),i=`<div style="font-weight:700;font-size:14px;margin-bottom:8px;color:#1d4ed8">${t}</div>`;for(let u of a){i+=`<div style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#9ca3af;margin-bottom:3px">${u.partOfSpeech}</div>`;for(let c of u.definitions.slice(0,2)){let o=vg(c.definition);i+=`<div style="margin-bottom:5px;color:#374151">\u2022 ${o}</div>`}}n.innerHTML=i,hg(n,l)}function Py(t){let e=document.getElementById(ua);e&&(e.innerHTML=`
|
|
20
20
|
<div style="font-weight:700;font-size:14px;margin-bottom:4px;color:#1d4ed8">${t}</div>
|
|
21
21
|
<div style="color:#9ca3af;font-size:12px">Sin definici\xF3n disponible</div>
|
|
22
|
-
`)}function hg(t,e){t.style.top="-9999px",t.style.left="-9999px",t.style.display="block",t.style.opacity="0";let a=t.offsetHeight||100,i=e.top-a-8,u=e.left+e.width/2-320/2;i<8&&(i=e.bottom+8),u<8&&(u=8),u+320>window.innerWidth-8&&(u=window.innerWidth-320-8),t.style.top=`${i}px`,t.style.left=`${u}px`,t.style.opacity="1"}function ia(){let t=document.getElementById(ua);t&&(t.style.opacity="0",setTimeout(()=>{t.style.opacity==="0"&&(t.style.display="none")},150))}function t2(){document.getElementById(ua)?.remove()}var Sg="es",mf="",dc=null;async function e2(t){if(t.composedPath()[0]?.closest?.("[data-a11y-icon]")){ia();return}let l=window.getSelection();if(!l||l.rangeCount===0){ia();return}let n=l.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){ia();return}let a=n;mf=a;let u=l.getRangeAt(0).getBoundingClientRect();$y(a,u);try{let c=await Jy(a,Sg);if(mf!==a)return;if(!c.length){Py(a);return}Iy(a,c,u)}catch{ia()}}function l2(t){t.composedPath()[0]?.id!==ua&&ia()}function mi(t,e="es"){if(Sg=e,t){if(dc)return;let l=a=>{e2(a)},n=a=>{l2(a)};document.addEventListener("mouseup",l),document.addEventListener("mousedown",n),dc=()=>{document.removeEventListener("mouseup",l),document.removeEventListener("mousedown",n)}}else dc?.(),dc=null,mf="",ia(),t2()}function bg(){let[t,e]=(0,_l.useState)(()=>D().dictionaryActive??!1);(0,_l.useEffect)(()=>{let n=D();mi(t,n.language??"es")},[]),(0,_l.useEffect)(()=>{let n=a=>{let{settings:i}=a.detail,u=i.dictionaryActive??!1;u!==t&&(e(u),mi(u,i.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[t]),(0,_l.useEffect)(()=>()=>{mi(!1)},[]);let l=(0,_l.useCallback)(()=>{let n=!t,a=D().language??"es";e(n),mi(n,a),Y("dictionaryActive",n)},[t]);return{isActive:t,toggle:l}}function mc(){let t=Rm(),e=Um(),l=Bm(),n=qm(),a=Ym(),i=jm(),u=Qm(),c=Km(),o=Jm(),f=km(),d=tg(),v=eg(),m=lg(),p=ag(),b=ig(),E=og(),O=rg(),r=gg(),s=bg(),g=D(),h=Hm(g);return{contrast:t,textSize:e,language:l,colorblind:n,saturation:a,dyslexia:i,letterSpacing:u,lineHeight:c,fontWeight:o,highlight:f,animations:d,cursor:v,readingGuide:m,hideImages:p,textAlign:b,tts:E,profiles:O,pageStructure:r,dictionary:s,hasActiveFeatures:h,resetAllFeatures:()=>{na(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:g}}var Jt=N(J(),1);var gf="apea-fab-position",Ae=60,Ht=16,n2=6;function ca(t,e,l){return Math.max(e,Math.min(l,t))}function a2(){try{let t=localStorage.getItem(gf);if(!t)return null;let e=JSON.parse(t);if(e.vEdge!=="top"&&e.vEdge!=="bottom"||e.hEdge!=="left"&&e.hEdge!=="right"||typeof e.vOffset!="number"||typeof e.hOffset!="number"||isNaN(e.vOffset)||isNaN(e.hOffset))return localStorage.removeItem(gf),null;let l=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,a=ca(e.hOffset,Ht,Math.max(Ht,l/2-Ae/2)),i=ca(e.vOffset,Ht,Math.max(Ht,n/2-Ae/2));return a>Ht&&i>Ht&&(a<i?a=Ht:i=Ht),{vEdge:e.vEdge,hEdge:e.hEdge,hOffset:a,vOffset:i}}catch{return null}}function i2(t){try{localStorage.setItem(gf,JSON.stringify(t))}catch{}}function u2(t){return a2()??{vEdge:"bottom",hEdge:t==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function pf(t,e,l){return{x:t.hEdge==="left"?t.hOffset:e-t.hOffset-Ae,y:t.vEdge==="top"?t.vOffset:l-t.vOffset-Ae}}function c2(t,e,l,n){let a=t,i=l-t-Ae,u=e,c=n-e-Ae,o=Math.min(a,i,u,c),f="left",d="top",v=Ht,m=Ht;return o===a||o===i?(f=o===a?"left":"right",v=Ht,d=u<=c?"top":"bottom",m=ca(d==="top"?e:c,Ht,n/2-Ae/2)):(d=o===u?"top":"bottom",m=Ht,f=a<=i?"left":"right",v=ca(f==="left"?t:i,Ht,l/2-Ae/2)),{hEdge:f,vEdge:d,hOffset:v,vOffset:m}}function o2(t,e){let l=Fu(),n=window.innerWidth/l,a=window.innerHeight/l,i=pf(t,n,a);return{position:"fixed",top:`${i.y}px`,left:`${i.x}px`,cursor:e?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:e?"none":"all 0.25s ease"}}function Eg({defaultPosition:t="bottom-left",onTap:e,disabled:l=!1}={}){let[n,a]=(0,Jt.useState)(()=>u2(t)),[i,u]=(0,Jt.useState)(!1),[,c]=(0,Jt.useState)(0),o=(0,Jt.useRef)(null),f=(0,Jt.useRef)(e);f.current=e;let d=(0,Jt.useRef)(n);d.current=n;let v=(0,Jt.useRef)(l);v.current=l,(0,Jt.useEffect)(()=>{let p=()=>{c(b=>b+1)};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);let m=(0,Jt.useCallback)((p,b)=>{if(v.current)return;let E=Fu(),O=st=>st/E,r=O(window.innerWidth),s=O(window.innerHeight),g=pf(d.current,r,s),h=g.x,C=g.y,R=o.current;R&&(R.style.transition="none");let A=O(p)-h,z=O(b)-C,_=h,H=C,Rt=0;function M(st,Ll){let sn=ca(O(st)-A,0,r-Ae),oa=ca(O(Ll)-z,0,s-Ae);Rt+=Math.abs(sn-_)+Math.abs(oa-H),_=sn,H=oa;let sa=o.current;sa&&(sa.style.top=`${oa}px`,sa.style.left=`${sn}px`)}function gi(st,Ll){let sn=Fu(),oa=window.innerWidth/sn,sa=window.innerHeight/sn,{x:Lg,y:Dg}=pf(Ll,oa,sa);st.style.top=`${Dg}px`,st.style.left=`${Lg}px`,st.style.transition="all 0.25s ease"}function zf(){_g();let st=o.current;if(Rt<n2)st&&gi(st,d.current),u(!1),f.current?.();else{let Ll=c2(_,H,r,s);i2(Ll),st&&gi(st,Ll),u(!1),a(Ll)}}function xf(st){M(st.clientX,st.clientY)}function _f(st){st.preventDefault(),M(st.touches[0].clientX,st.touches[0].clientY)}function Lf(){zf()}function Df(){zf()}function _g(){window.removeEventListener("mousemove",xf),window.removeEventListener("mouseup",Lf),window.removeEventListener("touchmove",_f),window.removeEventListener("touchend",Df)}window.addEventListener("mousemove",xf),window.addEventListener("mouseup",Lf),window.addEventListener("touchmove",_f,{passive:!1}),window.addEventListener("touchend",Df),u(!0)},[]);return{fabStyle:o2(n,i),isDragging:i,fabRef:o,dragHandlers:{onMouseDown:p=>{p.button!==0||v.current||(p.preventDefault(),m(p.clientX,p.clientY))},onTouchStart:p=>{v.current||m(p.touches[0].clientX,p.touches[0].clientY)}}}}var Ag=N(J(),1);var gc=N(bt(),1);function vf({title:t,children:e}){return(0,gc.jsxs)("section",{className:"px-4 py-3",children:[(0,gc.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:t}),e]})}var on=N(bt(),1);function Ce({icon:t,label:e,isActive:l,onClick:n,disabled:a=!1,className:i,hint:u}){return(0,on.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":e,onClick:a?void 0:n,disabled:a,className:Se("apea-focus apea-feature-row",i),"data-active":l,"data-disabled":a||void 0,children:[(0,on.jsx)("span",{className:Se("h-5 w-5 shrink-0",l?"text-blue-700":"text-gray-500"),children:t}),(0,on.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:e}),u&&(0,on.jsx)("span",{title:u,"aria-label":u,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,on.jsx)("span",{className:"apea-toggle","data-checked":l,"aria-hidden":"true"})]})}var se=N(bt(),1);function s2(){return(0,se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,se.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function Je({icon:t,name:e,levels:l,currentIndex:n,onCycle:a,className:i}){let u=n>=0,c=u?l[n]:null,o=l.length>1;function f(){let m=n>=l.length-1?-1:n+1;a(m)}function d(m){(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())}let v=u?`${e}: ${c.label}`:e;return(0,se.jsxs)("div",{role:"button",tabIndex:0,"aria-label":v,"aria-roledescription":"cyclic toggle","aria-pressed":u,...o&&u?{"aria-valuenow":n+1,"aria-valuemax":l.length}:{},"data-active":u,onClick:f,onKeyDown:d,className:Se("apea-focus apea-cyclic-tile",i),children:[(0,se.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:u&&(0,se.jsx)(s2,{})}),(0,se.jsx)("span",{className:"apea-cyclic-tile__icon",children:t}),(0,se.jsx)("span",{className:"apea-cyclic-tile__label",children:u?c.label:e}),o&&(0,se.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:l.map((m,p)=>(0,se.jsx)("span",{className:"apea-cyclic-dot","data-filled":u&&p<=n},p))})]})}var y=N(bt(),1),yf=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],hf=[{label:"Alto Contraste",value:"high"}],Sf=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],bf=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],Ef=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],Af=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Cg({onClose:t}){let[e,l]=(0,Ag.useState)(!1),{contrast:n,textSize:a,saturation:i,dyslexia:u,letterSpacing:c,lineHeight:o,fontWeight:f,highlight:d,animations:v,cursor:m,readingGuide:p,colorblind:b,hideImages:E,textAlign:O,tts:r,profiles:s,pageStructure:g,dictionary:h,resetAllFeatures:C}=mc(),R=yf.findIndex(M=>M.value===a.textSizePercentage),A=hf.findIndex(M=>M.value===n.contrastMode),z=Sf.findIndex(M=>M.value===i.saturationMode),_=bf.findIndex(M=>M.value===o.level),H=Ef.findIndex(M=>M.value===c.level),Rt=Af.findIndex(M=>M.value===O.mode);return(0,y.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,y.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,y.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,y.jsx)("div",{className:"flex items-center gap-2",children:(0,y.jsx)("button",{type:"button",onClick:t,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,y.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,y.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,y.jsxs)("button",{type:"button",onClick:()=>l(M=>!M),"aria-expanded":e,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${e?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e&&(0,y.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(rf).map(M=>(0,y.jsx)(Ce,{icon:(0,y.jsx)(T2,{profile:M}),label:rf[M],isActive:s.activeProfile===M,onClick:()=>s.applyProfile(M)},M))})]}),(0,y.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,y.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,y.jsx)(Je,{icon:(0,y.jsx)(M2,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:r.isReading?0:-1,onCycle:()=>r.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(f2,{}),name:"Tama\xF1o de fuente",levels:yf,currentIndex:R,onCycle:M=>a.setSpecificTextSize(M===-1?100:yf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(y2,{}),name:"Contraste",levels:hf,currentIndex:A,onCycle:M=>n.setContrastMode(M===-1?"normal":hf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(h2,{}),name:"Saturaci\xF3n",levels:Sf,currentIndex:z,onCycle:M=>i.setSaturationMode(M===-1?"normal":Sf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(p2,{}),name:"Interlineado",levels:bf,currentIndex:_,onCycle:M=>o.setTo(M===-1?14:bf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(g2,{}),name:"Interletrado",levels:Ef,currentIndex:H,onCycle:M=>c.setTo(M===-1?0:Ef[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(m2,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:u.isActive?0:-1,onCycle:()=>u.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(C2,{mode:O.mode}),name:"Alinear texto",levels:Af,currentIndex:Rt,onCycle:M=>O.setMode(M===-1?"default":Af[M].value)})]})}),(0,y.jsx)(vf,{title:"Ajustes de contenido",children:(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(r2,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(d2,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(v2,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(A2,{}),label:"Ocultar im\xE1genes",isActive:E.isActive,onClick:E.toggle})]})}),(0,y.jsxs)(vf,{title:"Herramientas",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(S2,{}),label:"Gu\xEDa de lectura",isActive:p.isActive,onClick:p.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(b2,{}),label:"Pausar animaciones",isActive:v.isActive,onClick:v.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(E2,{}),label:"Cursor grande",isActive:m.isActive,onClick:m.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(O2,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:h.isActive,onClick:h.toggle})]}),g.isOpen&&g.structure.length>0&&(0,y.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,y.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,y.jsx)("ul",{className:"space-y-1",children:g.structure.map((M,gi)=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",onClick:()=>g.navigateTo(M),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(M.level||1)*12}px`},children:[(0,y.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:M.tag}),(0,y.jsx)("span",{className:"text-gray-700",children:M.text})]})},`${M.tag}-${gi}`))})]}),g.isOpen&&g.structure.length===0&&(0,y.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,y.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,y.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,y.jsx)("button",{type:"button",onClick:C,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function f2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function r2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function m2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function g2(){return(0,y.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function p2(){return(0,y.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,y.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function v2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,y.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function y2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M12 3v18"}),(0,y.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function h2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,y.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function S2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function b2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,y.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function E2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function A2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,y.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function C2({mode:t}){return t==="center"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):t==="right"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function M2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function T2({profile:t}){switch(t){case"visionImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,y.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,y.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function O2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var fe=N(bt(),1);function Cf({position:t="bottom-left",className:e}={}){let[l,n]=(0,pc.useState)(!0),{hasActiveFeatures:a}=mc(),{fabStyle:i,isDragging:u,fabRef:c,dragHandlers:o}=Eg({defaultPosition:t,onTap:()=>n(d=>!d),disabled:l});(0,pc.useEffect)(()=>{if(!l)return;let d=v=>{v.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let f=l||a?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("div",{ref:c,className:e,style:{...i,zIndex:l?30:50,opacity:u?.85:1,filter:a?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${a?"Funciones activas":"Sin funciones activas"}`,...o,onKeyDown:d=>{l||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,fe.jsx)(lf,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,fe.jsx)(_m,{className:"w-full z-50",color:f,stroke:f})})}),(0,fe.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":l?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,fe.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":l?"true":"false",children:(0,fe.jsx)(Cg,{onClose:()=>n(!1)})})]})}var Tf=N(bt(),1),z2={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function Mf(t){return{...z2,...t}}function x2(t,e){return{...t,...e,theme:{...t.theme??{},...e.theme??{}}}}function Mg(t,e){t.style.setProperty("--apea-color-primary-500",e.primary500),t.style.setProperty("--apea-color-primary-600",e.primary600),t.style.setProperty("--apea-color-primary-700",e.primary700),t.style.setProperty("--apea-color-panel-bg",e.panelBackground),t.style.setProperty("--apea-color-fab-active",e.fabActive),t.style.setProperty("--apea-color-fab-inactive",e.fabInactive),t.style.setProperty("--apea-color-backdrop",e.backdrop)}function Og(t={}){let e={position:t.position||"bottom-left",zIndex:t.zIndex||9999,containerId:t.containerId||"ape-accessibility-root",theme:Mf(t.theme)},l=Mf(e.theme),n=e.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:t};let a=document.createElement("style");a.id="ape-accessibility-tools-css",a.textContent=`/* ============================================= */
|
|
22
|
+
`)}function hg(t,e){t.style.top="-9999px",t.style.left="-9999px",t.style.display="block",t.style.opacity="0";let a=t.offsetHeight||100,i=e.top-a-8,u=e.left+e.width/2-320/2;i<8&&(i=e.bottom+8),u<8&&(u=8),u+320>window.innerWidth-8&&(u=window.innerWidth-320-8),t.style.top=`${i}px`,t.style.left=`${u}px`,t.style.opacity="1"}function ia(){let t=document.getElementById(ua);t&&(t.style.opacity="0",setTimeout(()=>{t.style.opacity==="0"&&(t.style.display="none")},150))}function t2(){document.getElementById(ua)?.remove()}var Sg="es",mf="",dc=null;async function e2(t){if(t.composedPath()[0]?.closest?.("[data-a11y-icon]")){ia();return}let l=window.getSelection();if(!l||l.rangeCount===0){ia();return}let n=l.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){ia();return}let a=n;mf=a;let u=l.getRangeAt(0).getBoundingClientRect();$y(a,u);try{let c=await Jy(a,Sg);if(mf!==a)return;if(!c.length){Py(a);return}Iy(a,c,u)}catch{ia()}}function l2(t){t.composedPath()[0]?.id!==ua&&ia()}function mi(t,e="es"){if(Sg=e,t){if(dc)return;let l=a=>{e2(a)},n=a=>{l2(a)};document.addEventListener("mouseup",l),document.addEventListener("mousedown",n),dc=()=>{document.removeEventListener("mouseup",l),document.removeEventListener("mousedown",n)}}else dc?.(),dc=null,mf="",ia(),t2()}function bg(){let[t,e]=(0,_l.useState)(()=>D().dictionaryActive??!1);(0,_l.useEffect)(()=>{let n=D();mi(t,n.language??"es")},[]),(0,_l.useEffect)(()=>{let n=a=>{let{settings:i}=a.detail,u=i.dictionaryActive??!1;u!==t&&(e(u),mi(u,i.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[t]),(0,_l.useEffect)(()=>()=>{mi(!1)},[]);let l=(0,_l.useCallback)(()=>{let n=!t,a=D().language??"es";e(n),mi(n,a),Y("dictionaryActive",n)},[t]);return{isActive:t,toggle:l}}function mc(){let t=Rm(),e=Um(),l=Bm(),n=qm(),a=Ym(),i=jm(),u=Qm(),c=Km(),o=Jm(),f=km(),d=tg(),v=eg(),m=lg(),p=ag(),b=ig(),E=og(),O=rg(),r=gg(),s=bg(),g=D(),h=Hm(g);return{contrast:t,textSize:e,language:l,colorblind:n,saturation:a,dyslexia:i,letterSpacing:u,lineHeight:c,fontWeight:o,highlight:f,animations:d,cursor:v,readingGuide:m,hideImages:p,textAlign:b,tts:E,profiles:O,pageStructure:r,dictionary:s,hasActiveFeatures:h,resetAllFeatures:()=>{na(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:g}}var Jt=N(J(),1);var gf="apea-fab-position",Ae=60,Ht=16,n2=6;function ca(t,e,l){return Math.max(e,Math.min(l,t))}function a2(){try{let t=localStorage.getItem(gf);if(!t)return null;let e=JSON.parse(t);if(e.vEdge!=="top"&&e.vEdge!=="bottom"||e.hEdge!=="left"&&e.hEdge!=="right"||typeof e.vOffset!="number"||typeof e.hOffset!="number"||isNaN(e.vOffset)||isNaN(e.hOffset))return localStorage.removeItem(gf),null;let l=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,a=ca(e.hOffset,Ht,Math.max(Ht,l/2-Ae/2)),i=ca(e.vOffset,Ht,Math.max(Ht,n/2-Ae/2));return a>Ht&&i>Ht&&(a<i?a=Ht:i=Ht),{vEdge:e.vEdge,hEdge:e.hEdge,hOffset:a,vOffset:i}}catch{return null}}function i2(t){try{localStorage.setItem(gf,JSON.stringify(t))}catch{}}function u2(t){return a2()??{vEdge:"bottom",hEdge:t==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function pf(t,e,l){return{x:t.hEdge==="left"?t.hOffset:e-t.hOffset-Ae,y:t.vEdge==="top"?t.vOffset:l-t.vOffset-Ae}}function c2(t,e,l,n){let a=t,i=l-t-Ae,u=e,c=n-e-Ae,o=Math.min(a,i,u,c),f="left",d="top",v=Ht,m=Ht;return o===a||o===i?(f=o===a?"left":"right",v=Ht,d=u<=c?"top":"bottom",m=ca(d==="top"?e:c,Ht,n/2-Ae/2)):(d=o===u?"top":"bottom",m=Ht,f=a<=i?"left":"right",v=ca(f==="left"?t:i,Ht,l/2-Ae/2)),{hEdge:f,vEdge:d,hOffset:v,vOffset:m}}function o2(t,e){let l=Fu(),n=window.innerWidth/l,a=window.innerHeight/l,i=pf(t,n,a);return{position:"fixed",top:`${i.y}px`,left:`${i.x}px`,cursor:e?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:e?"none":"all 0.25s ease"}}function Eg({defaultPosition:t="bottom-left",onTap:e,disabled:l=!1}={}){let[n,a]=(0,Jt.useState)(()=>u2(t)),[i,u]=(0,Jt.useState)(!1),[,c]=(0,Jt.useState)(0),o=(0,Jt.useRef)(null),f=(0,Jt.useRef)(e);f.current=e;let d=(0,Jt.useRef)(n);d.current=n;let v=(0,Jt.useRef)(l);v.current=l,(0,Jt.useEffect)(()=>{let p=()=>{c(b=>b+1)};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);let m=(0,Jt.useCallback)((p,b)=>{if(v.current)return;let E=Fu(),O=st=>st/E,r=O(window.innerWidth),s=O(window.innerHeight),g=pf(d.current,r,s),h=g.x,C=g.y,R=o.current;R&&(R.style.transition="none");let A=O(p)-h,z=O(b)-C,_=h,H=C,Rt=0;function M(st,Ll){let sn=ca(O(st)-A,0,r-Ae),oa=ca(O(Ll)-z,0,s-Ae);Rt+=Math.abs(sn-_)+Math.abs(oa-H),_=sn,H=oa;let sa=o.current;sa&&(sa.style.top=`${oa}px`,sa.style.left=`${sn}px`)}function gi(st,Ll){let sn=Fu(),oa=window.innerWidth/sn,sa=window.innerHeight/sn,{x:Lg,y:Dg}=pf(Ll,oa,sa);st.style.top=`${Dg}px`,st.style.left=`${Lg}px`,st.style.transition="all 0.25s ease"}function zf(){_g();let st=o.current;if(Rt<n2)st&&gi(st,d.current),u(!1),f.current?.();else{let Ll=c2(_,H,r,s);i2(Ll),st&&gi(st,Ll),u(!1),a(Ll)}}function xf(st){M(st.clientX,st.clientY)}function _f(st){st.preventDefault(),M(st.touches[0].clientX,st.touches[0].clientY)}function Lf(){zf()}function Df(){zf()}function _g(){window.removeEventListener("mousemove",xf),window.removeEventListener("mouseup",Lf),window.removeEventListener("touchmove",_f),window.removeEventListener("touchend",Df)}window.addEventListener("mousemove",xf),window.addEventListener("mouseup",Lf),window.addEventListener("touchmove",_f,{passive:!1}),window.addEventListener("touchend",Df),u(!0)},[]);return{fabStyle:o2(n,i),isDragging:i,fabRef:o,dragHandlers:{onMouseDown:p=>{p.button!==0||v.current||(p.preventDefault(),m(p.clientX,p.clientY))},onTouchStart:p=>{v.current||m(p.touches[0].clientX,p.touches[0].clientY)}}}}var Ag=N(J(),1);var gc=N(bt(),1);function vf({title:t,children:e}){return(0,gc.jsxs)("section",{className:"px-4 py-3",children:[(0,gc.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:t}),e]})}var on=N(bt(),1);function Ce({icon:t,label:e,isActive:l,onClick:n,disabled:a=!1,className:i,hint:u}){return(0,on.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":e,onClick:a?void 0:n,disabled:a,className:Se("apea-focus apea-feature-row",i),"data-active":l,"data-disabled":a||void 0,children:[(0,on.jsx)("span",{className:Se("h-5 w-5 shrink-0",l?"text-blue-700":"text-gray-500"),children:t}),(0,on.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:e}),u&&(0,on.jsx)("span",{title:u,"aria-label":u,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,on.jsx)("span",{className:"apea-toggle","data-checked":l,"aria-hidden":"true"})]})}var se=N(bt(),1);function s2(){return(0,se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,se.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function Je({icon:t,name:e,levels:l,currentIndex:n,onCycle:a,className:i}){let u=n>=0,c=u?l[n]:null,o=l.length>1;function f(){let m=n>=l.length-1?-1:n+1;a(m)}function d(m){(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())}let v=u?`${e}: ${c.label}`:e;return(0,se.jsxs)("div",{role:"button",tabIndex:0,"aria-label":v,"aria-roledescription":"cyclic toggle","aria-pressed":u,...o&&u?{"aria-valuenow":n+1,"aria-valuemax":l.length}:{},"data-active":u,onClick:f,onKeyDown:d,className:Se("apea-focus apea-cyclic-tile",i),children:[(0,se.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:u&&(0,se.jsx)(s2,{})}),(0,se.jsx)("span",{className:"apea-cyclic-tile__icon",children:t}),(0,se.jsx)("span",{className:"apea-cyclic-tile__label",children:u?c.label:e}),o&&(0,se.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:l.map((m,p)=>(0,se.jsx)("span",{className:"apea-cyclic-dot","data-filled":u&&p<=n},p))})]})}var y=N(bt(),1),yf=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],hf=[{label:"Alto Contraste",value:"high"}],Sf=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],bf=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],Ef=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],Af=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Cg({onClose:t}){let[e,l]=(0,Ag.useState)(!1),{contrast:n,textSize:a,saturation:i,dyslexia:u,letterSpacing:c,lineHeight:o,fontWeight:f,highlight:d,animations:v,cursor:m,readingGuide:p,colorblind:b,hideImages:E,textAlign:O,tts:r,profiles:s,pageStructure:g,dictionary:h,resetAllFeatures:C}=mc(),R=yf.findIndex(M=>M.value===a.textSizePercentage),A=hf.findIndex(M=>M.value===n.contrastMode),z=Sf.findIndex(M=>M.value===i.saturationMode),_=bf.findIndex(M=>M.value===o.level),H=Ef.findIndex(M=>M.value===c.level),Rt=Af.findIndex(M=>M.value===O.mode);return(0,y.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,y.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,y.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,y.jsx)("div",{className:"flex items-center gap-2",children:(0,y.jsx)("button",{type:"button",onClick:t,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,y.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,y.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,y.jsxs)("button",{type:"button",onClick:()=>l(M=>!M),"aria-expanded":e,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${e?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e&&(0,y.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(rf).map(M=>(0,y.jsx)(Ce,{icon:(0,y.jsx)(T2,{profile:M}),label:rf[M],isActive:s.activeProfile===M,onClick:()=>s.applyProfile(M)},M))})]}),(0,y.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,y.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,y.jsx)(Je,{icon:(0,y.jsx)(M2,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:r.isReading?0:-1,onCycle:()=>r.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(f2,{}),name:"Tama\xF1o de fuente",levels:yf,currentIndex:R,onCycle:M=>a.setSpecificTextSize(M===-1?100:yf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(y2,{}),name:"Contraste",levels:hf,currentIndex:A,onCycle:M=>n.setContrastMode(M===-1?"normal":hf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(h2,{}),name:"Saturaci\xF3n",levels:Sf,currentIndex:z,onCycle:M=>i.setSaturationMode(M===-1?"normal":Sf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(p2,{}),name:"Interlineado",levels:bf,currentIndex:_,onCycle:M=>o.setTo(M===-1?14:bf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(g2,{}),name:"Interletrado",levels:Ef,currentIndex:H,onCycle:M=>c.setTo(M===-1?0:Ef[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(m2,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:u.isActive?0:-1,onCycle:()=>u.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(C2,{mode:O.mode}),name:"Alinear texto",levels:Af,currentIndex:Rt,onCycle:M=>O.setMode(M===-1?"default":Af[M].value)})]})}),(0,y.jsx)(vf,{title:"Ajustes de contenido",children:(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(r2,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(d2,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(v2,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(A2,{}),label:"Ocultar im\xE1genes",isActive:E.isActive,onClick:E.toggle})]})}),(0,y.jsxs)(vf,{title:"Herramientas",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(S2,{}),label:"Gu\xEDa de lectura",isActive:p.isActive,onClick:p.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(b2,{}),label:"Pausar animaciones",isActive:v.isActive,onClick:v.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(E2,{}),label:"Cursor grande",isActive:m.isActive,onClick:m.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(O2,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:h.isActive,onClick:h.toggle})]}),g.isOpen&&g.structure.length>0&&(0,y.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,y.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,y.jsx)("ul",{className:"space-y-1",children:g.structure.map((M,gi)=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",onClick:()=>g.navigateTo(M),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(M.level||1)*12}px`},children:[(0,y.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:M.tag}),(0,y.jsx)("span",{className:"text-gray-700",children:M.text})]})},`${M.tag}-${gi}`))})]}),g.isOpen&&g.structure.length===0&&(0,y.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,y.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,y.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,y.jsx)("button",{type:"button",onClick:C,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function f2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function r2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function m2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function g2(){return(0,y.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function p2(){return(0,y.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,y.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function v2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,y.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function y2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M12 3v18"}),(0,y.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function h2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,y.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function S2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function b2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,y.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function E2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function A2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,y.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function C2({mode:t}){return t==="center"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):t==="right"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function M2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function T2({profile:t}){switch(t){case"visionImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,y.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,y.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function O2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var fe=N(bt(),1);function Cf({position:t="bottom-left",className:e}={}){let[l,n]=(0,pc.useState)(!1),{hasActiveFeatures:a}=mc(),{fabStyle:i,isDragging:u,fabRef:c,dragHandlers:o}=Eg({defaultPosition:t,onTap:()=>n(d=>!d),disabled:l});(0,pc.useEffect)(()=>{if(!l)return;let d=v=>{v.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let f=l||a?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("div",{ref:c,className:e,style:{...i,zIndex:l?30:50,opacity:u?.85:1,filter:a?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${a?"Funciones activas":"Sin funciones activas"}`,...o,onKeyDown:d=>{l||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,fe.jsx)(lf,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,fe.jsx)(_m,{className:"w-full z-50",color:f,stroke:f})})}),(0,fe.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":l?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,fe.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":l?"true":"false",children:(0,fe.jsx)(Cg,{onClose:()=>n(!1)})})]})}var Tf=N(bt(),1),z2={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function Mf(t){return{...z2,...t}}function x2(t,e){return{...t,...e,theme:{...t.theme??{},...e.theme??{}}}}function Mg(t,e){t.style.setProperty("--apea-color-primary-500",e.primary500),t.style.setProperty("--apea-color-primary-600",e.primary600),t.style.setProperty("--apea-color-primary-700",e.primary700),t.style.setProperty("--apea-color-panel-bg",e.panelBackground),t.style.setProperty("--apea-color-fab-active",e.fabActive),t.style.setProperty("--apea-color-fab-inactive",e.fabInactive),t.style.setProperty("--apea-color-backdrop",e.backdrop)}function Og(t={}){let e={position:t.position||"bottom-left",zIndex:t.zIndex||9999,containerId:t.containerId||"ape-accessibility-root",theme:Mf(t.theme)},l=Mf(e.theme),n=e.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:t};let a=document.createElement("style");a.id="ape-accessibility-tools-css",a.textContent=`/* ============================================= */
|
|
23
23
|
/* Accessibility Feature Styles */
|
|
24
24
|
/* ============================================= */
|
|
25
25
|
|
package/dist/auto.js
CHANGED
|
@@ -11,7 +11,7 @@ import{createRoot as Lo}from"react-dom/client";import{useState as yo,useEffect a
|
|
|
11
11
|
`,Ai(n,t)}function Hn(e,t,n){let i=wi(),o=t.slice(0,3),s=`<div style="font-weight:700;font-size:14px;margin-bottom:8px;color:#1d4ed8">${e}</div>`;for(let a of o){s+=`<div style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#9ca3af;margin-bottom:3px">${a.partOfSpeech}</div>`;for(let c of a.definitions.slice(0,2)){let l=Li(c.definition);s+=`<div style="margin-bottom:5px;color:#374151">\u2022 ${l}</div>`}}i.innerHTML=s,Ai(i,n)}function Dn(e){let t=document.getElementById(Z);t&&(t.innerHTML=`
|
|
12
12
|
<div style="font-weight:700;font-size:14px;margin-bottom:4px;color:#1d4ed8">${e}</div>
|
|
13
13
|
<div style="color:#9ca3af;font-size:12px">Sin definici\xF3n disponible</div>
|
|
14
|
-
`)}function Ai(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,s=t.top-o-8,a=t.left+t.width/2-320/2;s<8&&(s=t.bottom+8),a<8&&(a=8),a+320>window.innerWidth-8&&(a=window.innerWidth-320-8),e.style.top=`${s}px`,e.style.left=`${a}px`,e.style.opacity="1"}function q(){let e=document.getElementById(Z);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function _n(){document.getElementById(Z)?.remove()}var Mi="es",Ke="",Ne=null;async function zn(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){q();return}let n=window.getSelection();if(!n||n.rangeCount===0){q();return}let i=n.toString().trim();if(!i||/\s/.test(i)||i.length<2||i.length>50){q();return}let o=i;Ke=o;let a=n.getRangeAt(0).getBoundingClientRect();Rn(o,a);try{let c=await kn(o,Mi);if(Ke!==o)return;if(!c.length){Dn(o);return}Hn(o,c,a)}catch{q()}}function Wn(e){e.composedPath()[0]?.id!==Z&&q()}function ne(e,t="es"){if(Mi=t,e){if(Ne)return;let n=o=>{zn(o)},i=o=>{Wn(o)};document.addEventListener("mouseup",n),document.addEventListener("mousedown",i),Ne=()=>{document.removeEventListener("mouseup",n),document.removeEventListener("mousedown",i)}}else Ne?.(),Ne=null,Ke="",q(),_n()}function Ii(){let[e,t]=Fn(()=>p().dictionaryActive??!1);Ye(()=>{let i=p();ne(e,i.language??"es")},[]),Ye(()=>{let i=o=>{let{settings:s}=o.detail,a=s.dictionaryActive??!1;a!==e&&(t(a),ne(a,s.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",i),()=>window.removeEventListener("accessibilitySettingsChanged",i)},[e]),Ye(()=>()=>{ne(!1)},[]);let n=Bn(()=>{let i=!e,o=p().language??"es";t(i),ne(i,o),g("dictionaryActive",i)},[e]);return{isActive:e,toggle:n}}function Pe(){let e=Et(),t=At(),n=Mt(),i=Ot(),o=Nt(),s=Ht(),a=Ft(),c=Vt(),l=Gt(),f=qt(),d=Qt(),m=ti(),v=ni(),h=ai(),A=li(),x=mi(),C=Si(),S=xi(),O=Ii(),E=p(),M=Ct(E);return{contrast:e,textSize:t,language:n,colorblind:i,saturation:o,dyslexia:s,letterSpacing:a,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:A,tts:x,profiles:C,pageStructure:S,dictionary:O,hasActiveFeatures:M,resetAllFeatures:()=>{G(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:E}}import{useCallback as Vn,useEffect as jn,useRef as Re,useState as Je}from"react";var Qe="apea-fab-position",T=60,L=16,Gn=6;function U(e,t,n){return Math.max(t,Math.min(n,e))}function $n(){try{let e=localStorage.getItem(Qe);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(Qe),null;let n=typeof window<"u"?window.innerWidth:1e3,i=typeof window<"u"?window.innerHeight:1e3,o=U(t.hOffset,L,Math.max(L,n/2-T/2)),s=U(t.vOffset,L,Math.max(L,i/2-T/2));return o>L&&s>L&&(o<s?o=L:s=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:s}}catch{return null}}function qn(e){try{localStorage.setItem(Qe,JSON.stringify(e))}catch{}}function Zn(e){return $n()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function et(e,t,n){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-T,y:e.vEdge==="top"?e.vOffset:n-e.vOffset-T}}function Un(e,t,n,i){let o=e,s=n-e-T,a=t,c=i-t-T,l=Math.min(o,s,a,c),f="left",d="top",m=L,v=L;return l===o||l===s?(f=l===o?"left":"right",m=L,d=a<=c?"top":"bottom",v=U(d==="top"?t:c,L,i/2-T/2)):(d=l===a?"top":"bottom",v=L,f=o<=s?"left":"right",m=U(f==="left"?e:s,L,n/2-T/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function Xn(e,t){let n=pe(),i=window.innerWidth/n,o=window.innerHeight/n,s=et(e,i,o);return{position:"fixed",top:`${s.y}px`,left:`${s.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function Oi({defaultPosition:e="bottom-left",onTap:t,disabled:n=!1}={}){let[i,o]=Je(()=>Zn(e)),[s,a]=Je(!1),[,c]=Je(0),l=Re(null),f=Re(t);f.current=t;let d=Re(i);d.current=i;let m=Re(n);m.current=n,jn(()=>{let h=()=>{c(A=>A+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=Vn((h,A)=>{if(m.current)return;let x=pe(),C=y=>y/x,S=C(window.innerWidth),O=C(window.innerHeight),E=et(d.current,S,O),M=E.x,K=E.y,oe=l.current;oe&&(oe.style.transition="none");let De=C(h)-M,_e=C(A)-K,Y=M,J=K,se=0;function u(y,W){let j=U(C(y)-De,0,S-T),Q=U(C(W)-_e,0,O-T);se+=Math.abs(j-Y)+Math.abs(Q-J),Y=j,J=Q;let ee=l.current;ee&&(ee.style.top=`${Q}px`,ee.style.left=`${j}px`)}function ae(y,W){let j=pe(),Q=window.innerWidth/j,ee=window.innerHeight/j,{x:_i,y:zi}=et(W,Q,ee);y.style.top=`${zi}px`,y.style.left=`${_i}px`,y.style.transition="all 0.25s ease"}function ut(){Di();let y=l.current;if(se<Gn)y&&ae(y,d.current),a(!1),f.current?.();else{let W=Un(Y,J,S,O);qn(W),y&&ae(y,W),a(!1),o(W)}}function pt(y){u(y.clientX,y.clientY)}function ft(y){y.preventDefault(),u(y.touches[0].clientX,y.touches[0].clientY)}function mt(){ut()}function gt(){ut()}function Di(){window.removeEventListener("mousemove",pt),window.removeEventListener("mouseup",mt),window.removeEventListener("touchmove",ft),window.removeEventListener("touchend",gt)}window.addEventListener("mousemove",pt),window.addEventListener("mouseup",mt),window.addEventListener("touchmove",ft,{passive:!1}),window.addEventListener("touchend",gt),a(!0)},[]);return{fabStyle:Xn(i,s),isDragging:s,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}import{useState as to}from"react";import{jsx as Kn,jsxs as Yn}from"react/jsx-runtime";function tt({title:e,children:t}){return Yn("section",{className:"px-4 py-3",children:[Kn("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}import{jsx as He,jsxs as Jn}from"react/jsx-runtime";function N({icon:e,label:t,isActive:n,onClick:i,disabled:o=!1,className:s,hint:a}){return Jn("button",{type:"button",role:"switch","aria-checked":n,"aria-label":t,onClick:o?void 0:i,disabled:o,className:k("apea-focus apea-feature-row",s),"data-active":n,"data-disabled":o||void 0,children:[He("span",{className:k("h-5 w-5 shrink-0",n?"text-blue-700":"text-gray-500"),children:e}),He("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),a&&He("span",{title:a,"aria-label":a,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),He("span",{className:"apea-toggle","data-checked":n,"aria-hidden":"true"})]})}import{jsx as z,jsxs as eo}from"react/jsx-runtime";function Qn(){return z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:z("polyline",{points:"2,6 5,9 10,3"})})}function R({icon:e,name:t,levels:n,currentIndex:i,onCycle:o,className:s}){let a=i>=0,c=a?n[i]:null,l=n.length>1;function f(){let v=i>=n.length-1?-1:i+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=a?`${t}: ${c.label}`:t;return eo("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":a,...l&&a?{"aria-valuenow":i+1,"aria-valuemax":n.length}:{},"data-active":a,onClick:f,onKeyDown:d,className:k("apea-focus apea-cyclic-tile",s),children:[z("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:a&&z(Qn,{})}),z("span",{className:"apea-cyclic-tile__icon",children:e}),z("span",{className:"apea-cyclic-tile__label",children:a?c.label:t}),l&&z("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:n.map((v,h)=>z("span",{className:"apea-cyclic-dot","data-filled":a&&h<=i},h))})]})}import{jsx as r,jsxs as b}from"react/jsx-runtime";var it=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],nt=[{label:"Alto Contraste",value:"high"}],ot=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],st=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],at=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],rt=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function ki({onClose:e}){let[t,n]=to(!1),{contrast:i,textSize:o,saturation:s,dyslexia:a,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:A,hideImages:x,textAlign:C,tts:S,profiles:O,pageStructure:E,dictionary:M,resetAllFeatures:K}=Pe(),oe=it.findIndex(u=>u.value===o.textSizePercentage),De=nt.findIndex(u=>u.value===i.contrastMode),_e=ot.findIndex(u=>u.value===s.saturationMode),Y=st.findIndex(u=>u.value===l.level),J=at.findIndex(u=>u.value===c.level),se=rt.findIndex(u=>u.value===C.mode);return b("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[b("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[r("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),r("div",{className:"flex items-center gap-2",children:r("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:r("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),b("div",{className:"flex-1 overflow-y-auto",children:[b("section",{className:"px-4 pb-0 py-3",children:[b("button",{type:"button",onClick:()=>n(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:r("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&r("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(Ue).map(u=>r(N,{icon:r(So,{profile:u}),label:Ue[u],isActive:O.activeProfile===u,onClick:()=>O.applyProfile(u)},u))})]}),r("section",{className:"px-4 pt-0 py-3",children:b("div",{className:"apea-cyclic-grid",children:[r(R,{icon:r(vo,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:S.isReading?0:-1,onCycle:()=>S.toggle()}),r(R,{icon:r(io,{}),name:"Tama\xF1o de fuente",levels:it,currentIndex:oe,onCycle:u=>o.setSpecificTextSize(u===-1?100:it[u].value)}),r(R,{icon:r(lo,{}),name:"Contraste",levels:nt,currentIndex:De,onCycle:u=>i.setContrastMode(u===-1?"normal":nt[u].value)}),r(R,{icon:r(uo,{}),name:"Saturaci\xF3n",levels:ot,currentIndex:_e,onCycle:u=>s.setSaturationMode(u===-1?"normal":ot[u].value)}),r(R,{icon:r(ro,{}),name:"Interlineado",levels:st,currentIndex:Y,onCycle:u=>l.setTo(u===-1?14:st[u].value)}),r(R,{icon:r(ao,{}),name:"Interletrado",levels:at,currentIndex:J,onCycle:u=>c.setTo(u===-1?0:at[u].value)}),r(R,{icon:r(so,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:a.isActive?0:-1,onCycle:()=>a.toggle()}),r(R,{icon:r(ho,{mode:C.mode}),name:"Alinear texto",levels:rt,currentIndex:se,onCycle:u=>C.setMode(u===-1?"default":rt[u].value)})]})}),r(tt,{title:"Ajustes de contenido",children:b("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(no,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),r(N,{icon:r(oo,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),r(N,{icon:r(co,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),r(N,{icon:r(go,{}),label:"Ocultar im\xE1genes",isActive:x.isActive,onClick:x.toggle})]})}),b(tt,{title:"Herramientas",children:[b("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(po,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),r(N,{icon:r(fo,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),r(N,{icon:r(mo,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),r(N,{icon:r(bo,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:M.isActive,onClick:M.toggle})]}),E.isOpen&&E.structure.length>0&&b("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[r("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),r("ul",{className:"space-y-1",children:E.structure.map((u,ae)=>r("li",{children:b("button",{type:"button",onClick:()=>E.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[r("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),r("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${ae}`))})]}),E.isOpen&&E.structure.length===0&&r("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:r("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),r("section",{className:"px-4 pb-6 pt-2",children:r("button",{type:"button",onClick:K,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function io(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function no(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),r("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function so(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ao(){return r("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:r("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function ro(){return b("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[r("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),r("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function co(){return b("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),r("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function lo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function uo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"8"}),r("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),r("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function po(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),r("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function fo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),r("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function mo(){return r("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function go(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),r("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),r("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function ho({mode:e}){return e==="center"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function vo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),r("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),r("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function So({profile:e}){switch(e){case"visionImpaired":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),r("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),r("circle",{cx:"8",cy:"20",r:"2"}),r("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function bo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),r("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}import{Fragment as xo,jsx as X,jsxs as Eo}from"react/jsx-runtime";function ct({position:e="bottom-left",className:t}={}){let[n,i]=yo(!0),{hasActiveFeatures:o}=Pe(),{fabStyle:s,isDragging:a,fabRef:c,dragHandlers:l}=Oi({defaultPosition:e,onTap:()=>i(d=>!d),disabled:n});Co(()=>{if(!n)return;let d=m=>{m.key==="Escape"&&i(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]);let f=n||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return Eo(xo,{children:[X("div",{ref:c,className:t,style:{...s,zIndex:n?30:50,opacity:a?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":n,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{n||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i(!0))},children:X(ze,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:X(vt,{className:"w-full z-50",color:f,stroke:f})})}),X("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":n?"true":"false",onClick:()=>i(!1),"aria-hidden":"true"}),X("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":n?"true":"false",children:X(ki,{onClose:()=>i(!1)})})]})}import{jsx as Ni}from"react/jsx-runtime";var wo={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function lt(e){return{...wo,...e}}function Ao(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Ti(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function Pi(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:lt(e.theme)},n=lt(t.theme),i=t.containerId||"ape-accessibility-root";if(document.getElementById(i))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
14
|
+
`)}function Ai(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,s=t.top-o-8,a=t.left+t.width/2-320/2;s<8&&(s=t.bottom+8),a<8&&(a=8),a+320>window.innerWidth-8&&(a=window.innerWidth-320-8),e.style.top=`${s}px`,e.style.left=`${a}px`,e.style.opacity="1"}function q(){let e=document.getElementById(Z);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function _n(){document.getElementById(Z)?.remove()}var Mi="es",Ke="",Ne=null;async function zn(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){q();return}let n=window.getSelection();if(!n||n.rangeCount===0){q();return}let i=n.toString().trim();if(!i||/\s/.test(i)||i.length<2||i.length>50){q();return}let o=i;Ke=o;let a=n.getRangeAt(0).getBoundingClientRect();Rn(o,a);try{let c=await kn(o,Mi);if(Ke!==o)return;if(!c.length){Dn(o);return}Hn(o,c,a)}catch{q()}}function Wn(e){e.composedPath()[0]?.id!==Z&&q()}function ne(e,t="es"){if(Mi=t,e){if(Ne)return;let n=o=>{zn(o)},i=o=>{Wn(o)};document.addEventListener("mouseup",n),document.addEventListener("mousedown",i),Ne=()=>{document.removeEventListener("mouseup",n),document.removeEventListener("mousedown",i)}}else Ne?.(),Ne=null,Ke="",q(),_n()}function Ii(){let[e,t]=Fn(()=>p().dictionaryActive??!1);Ye(()=>{let i=p();ne(e,i.language??"es")},[]),Ye(()=>{let i=o=>{let{settings:s}=o.detail,a=s.dictionaryActive??!1;a!==e&&(t(a),ne(a,s.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",i),()=>window.removeEventListener("accessibilitySettingsChanged",i)},[e]),Ye(()=>()=>{ne(!1)},[]);let n=Bn(()=>{let i=!e,o=p().language??"es";t(i),ne(i,o),g("dictionaryActive",i)},[e]);return{isActive:e,toggle:n}}function Pe(){let e=Et(),t=At(),n=Mt(),i=Ot(),o=Nt(),s=Ht(),a=Ft(),c=Vt(),l=Gt(),f=qt(),d=Qt(),m=ti(),v=ni(),h=ai(),A=li(),x=mi(),C=Si(),S=xi(),O=Ii(),E=p(),M=Ct(E);return{contrast:e,textSize:t,language:n,colorblind:i,saturation:o,dyslexia:s,letterSpacing:a,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:A,tts:x,profiles:C,pageStructure:S,dictionary:O,hasActiveFeatures:M,resetAllFeatures:()=>{G(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:E}}import{useCallback as Vn,useEffect as jn,useRef as Re,useState as Je}from"react";var Qe="apea-fab-position",T=60,L=16,Gn=6;function U(e,t,n){return Math.max(t,Math.min(n,e))}function $n(){try{let e=localStorage.getItem(Qe);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(Qe),null;let n=typeof window<"u"?window.innerWidth:1e3,i=typeof window<"u"?window.innerHeight:1e3,o=U(t.hOffset,L,Math.max(L,n/2-T/2)),s=U(t.vOffset,L,Math.max(L,i/2-T/2));return o>L&&s>L&&(o<s?o=L:s=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:s}}catch{return null}}function qn(e){try{localStorage.setItem(Qe,JSON.stringify(e))}catch{}}function Zn(e){return $n()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function et(e,t,n){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-T,y:e.vEdge==="top"?e.vOffset:n-e.vOffset-T}}function Un(e,t,n,i){let o=e,s=n-e-T,a=t,c=i-t-T,l=Math.min(o,s,a,c),f="left",d="top",m=L,v=L;return l===o||l===s?(f=l===o?"left":"right",m=L,d=a<=c?"top":"bottom",v=U(d==="top"?t:c,L,i/2-T/2)):(d=l===a?"top":"bottom",v=L,f=o<=s?"left":"right",m=U(f==="left"?e:s,L,n/2-T/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function Xn(e,t){let n=pe(),i=window.innerWidth/n,o=window.innerHeight/n,s=et(e,i,o);return{position:"fixed",top:`${s.y}px`,left:`${s.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function Oi({defaultPosition:e="bottom-left",onTap:t,disabled:n=!1}={}){let[i,o]=Je(()=>Zn(e)),[s,a]=Je(!1),[,c]=Je(0),l=Re(null),f=Re(t);f.current=t;let d=Re(i);d.current=i;let m=Re(n);m.current=n,jn(()=>{let h=()=>{c(A=>A+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=Vn((h,A)=>{if(m.current)return;let x=pe(),C=y=>y/x,S=C(window.innerWidth),O=C(window.innerHeight),E=et(d.current,S,O),M=E.x,K=E.y,oe=l.current;oe&&(oe.style.transition="none");let De=C(h)-M,_e=C(A)-K,Y=M,J=K,se=0;function u(y,W){let j=U(C(y)-De,0,S-T),Q=U(C(W)-_e,0,O-T);se+=Math.abs(j-Y)+Math.abs(Q-J),Y=j,J=Q;let ee=l.current;ee&&(ee.style.top=`${Q}px`,ee.style.left=`${j}px`)}function ae(y,W){let j=pe(),Q=window.innerWidth/j,ee=window.innerHeight/j,{x:_i,y:zi}=et(W,Q,ee);y.style.top=`${zi}px`,y.style.left=`${_i}px`,y.style.transition="all 0.25s ease"}function ut(){Di();let y=l.current;if(se<Gn)y&&ae(y,d.current),a(!1),f.current?.();else{let W=Un(Y,J,S,O);qn(W),y&&ae(y,W),a(!1),o(W)}}function pt(y){u(y.clientX,y.clientY)}function ft(y){y.preventDefault(),u(y.touches[0].clientX,y.touches[0].clientY)}function mt(){ut()}function gt(){ut()}function Di(){window.removeEventListener("mousemove",pt),window.removeEventListener("mouseup",mt),window.removeEventListener("touchmove",ft),window.removeEventListener("touchend",gt)}window.addEventListener("mousemove",pt),window.addEventListener("mouseup",mt),window.addEventListener("touchmove",ft,{passive:!1}),window.addEventListener("touchend",gt),a(!0)},[]);return{fabStyle:Xn(i,s),isDragging:s,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}import{useState as to}from"react";import{jsx as Kn,jsxs as Yn}from"react/jsx-runtime";function tt({title:e,children:t}){return Yn("section",{className:"px-4 py-3",children:[Kn("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}import{jsx as He,jsxs as Jn}from"react/jsx-runtime";function N({icon:e,label:t,isActive:n,onClick:i,disabled:o=!1,className:s,hint:a}){return Jn("button",{type:"button",role:"switch","aria-checked":n,"aria-label":t,onClick:o?void 0:i,disabled:o,className:k("apea-focus apea-feature-row",s),"data-active":n,"data-disabled":o||void 0,children:[He("span",{className:k("h-5 w-5 shrink-0",n?"text-blue-700":"text-gray-500"),children:e}),He("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),a&&He("span",{title:a,"aria-label":a,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),He("span",{className:"apea-toggle","data-checked":n,"aria-hidden":"true"})]})}import{jsx as z,jsxs as eo}from"react/jsx-runtime";function Qn(){return z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:z("polyline",{points:"2,6 5,9 10,3"})})}function R({icon:e,name:t,levels:n,currentIndex:i,onCycle:o,className:s}){let a=i>=0,c=a?n[i]:null,l=n.length>1;function f(){let v=i>=n.length-1?-1:i+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=a?`${t}: ${c.label}`:t;return eo("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":a,...l&&a?{"aria-valuenow":i+1,"aria-valuemax":n.length}:{},"data-active":a,onClick:f,onKeyDown:d,className:k("apea-focus apea-cyclic-tile",s),children:[z("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:a&&z(Qn,{})}),z("span",{className:"apea-cyclic-tile__icon",children:e}),z("span",{className:"apea-cyclic-tile__label",children:a?c.label:t}),l&&z("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:n.map((v,h)=>z("span",{className:"apea-cyclic-dot","data-filled":a&&h<=i},h))})]})}import{jsx as r,jsxs as b}from"react/jsx-runtime";var it=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],nt=[{label:"Alto Contraste",value:"high"}],ot=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],st=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],at=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],rt=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function ki({onClose:e}){let[t,n]=to(!1),{contrast:i,textSize:o,saturation:s,dyslexia:a,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:A,hideImages:x,textAlign:C,tts:S,profiles:O,pageStructure:E,dictionary:M,resetAllFeatures:K}=Pe(),oe=it.findIndex(u=>u.value===o.textSizePercentage),De=nt.findIndex(u=>u.value===i.contrastMode),_e=ot.findIndex(u=>u.value===s.saturationMode),Y=st.findIndex(u=>u.value===l.level),J=at.findIndex(u=>u.value===c.level),se=rt.findIndex(u=>u.value===C.mode);return b("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[b("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[r("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),r("div",{className:"flex items-center gap-2",children:r("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:r("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),b("div",{className:"flex-1 overflow-y-auto",children:[b("section",{className:"px-4 pb-0 py-3",children:[b("button",{type:"button",onClick:()=>n(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:r("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&r("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(Ue).map(u=>r(N,{icon:r(So,{profile:u}),label:Ue[u],isActive:O.activeProfile===u,onClick:()=>O.applyProfile(u)},u))})]}),r("section",{className:"px-4 pt-0 py-3",children:b("div",{className:"apea-cyclic-grid",children:[r(R,{icon:r(vo,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:S.isReading?0:-1,onCycle:()=>S.toggle()}),r(R,{icon:r(io,{}),name:"Tama\xF1o de fuente",levels:it,currentIndex:oe,onCycle:u=>o.setSpecificTextSize(u===-1?100:it[u].value)}),r(R,{icon:r(lo,{}),name:"Contraste",levels:nt,currentIndex:De,onCycle:u=>i.setContrastMode(u===-1?"normal":nt[u].value)}),r(R,{icon:r(uo,{}),name:"Saturaci\xF3n",levels:ot,currentIndex:_e,onCycle:u=>s.setSaturationMode(u===-1?"normal":ot[u].value)}),r(R,{icon:r(ro,{}),name:"Interlineado",levels:st,currentIndex:Y,onCycle:u=>l.setTo(u===-1?14:st[u].value)}),r(R,{icon:r(ao,{}),name:"Interletrado",levels:at,currentIndex:J,onCycle:u=>c.setTo(u===-1?0:at[u].value)}),r(R,{icon:r(so,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:a.isActive?0:-1,onCycle:()=>a.toggle()}),r(R,{icon:r(ho,{mode:C.mode}),name:"Alinear texto",levels:rt,currentIndex:se,onCycle:u=>C.setMode(u===-1?"default":rt[u].value)})]})}),r(tt,{title:"Ajustes de contenido",children:b("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(no,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),r(N,{icon:r(oo,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),r(N,{icon:r(co,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),r(N,{icon:r(go,{}),label:"Ocultar im\xE1genes",isActive:x.isActive,onClick:x.toggle})]})}),b(tt,{title:"Herramientas",children:[b("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(po,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),r(N,{icon:r(fo,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),r(N,{icon:r(mo,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),r(N,{icon:r(bo,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:M.isActive,onClick:M.toggle})]}),E.isOpen&&E.structure.length>0&&b("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[r("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),r("ul",{className:"space-y-1",children:E.structure.map((u,ae)=>r("li",{children:b("button",{type:"button",onClick:()=>E.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[r("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),r("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${ae}`))})]}),E.isOpen&&E.structure.length===0&&r("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:r("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),r("section",{className:"px-4 pb-6 pt-2",children:r("button",{type:"button",onClick:K,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function io(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function no(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),r("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function so(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ao(){return r("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:r("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function ro(){return b("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[r("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),r("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function co(){return b("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),r("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function lo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function uo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"8"}),r("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),r("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function po(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),r("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function fo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),r("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function mo(){return r("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function go(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),r("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),r("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function ho({mode:e}){return e==="center"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function vo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),r("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),r("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function So({profile:e}){switch(e){case"visionImpaired":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),r("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),r("circle",{cx:"8",cy:"20",r:"2"}),r("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function bo(){return b("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),r("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}import{Fragment as xo,jsx as X,jsxs as Eo}from"react/jsx-runtime";function ct({position:e="bottom-left",className:t}={}){let[n,i]=yo(!1),{hasActiveFeatures:o}=Pe(),{fabStyle:s,isDragging:a,fabRef:c,dragHandlers:l}=Oi({defaultPosition:e,onTap:()=>i(d=>!d),disabled:n});Co(()=>{if(!n)return;let d=m=>{m.key==="Escape"&&i(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]);let f=n||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return Eo(xo,{children:[X("div",{ref:c,className:t,style:{...s,zIndex:n?30:50,opacity:a?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":n,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{n||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i(!0))},children:X(ze,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:X(vt,{className:"w-full z-50",color:f,stroke:f})})}),X("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":n?"true":"false",onClick:()=>i(!1),"aria-hidden":"true"}),X("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":n?"true":"false",children:X(ki,{onClose:()=>i(!1)})})]})}import{jsx as Ni}from"react/jsx-runtime";var wo={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function lt(e){return{...wo,...e}}function Ao(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Ti(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function Pi(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:lt(e.theme)},n=lt(t.theme),i=t.containerId||"ape-accessibility-root";if(document.getElementById(i))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
15
15
|
/* Accessibility Feature Styles */
|
|
16
16
|
/* ============================================= */
|
|
17
17
|
|
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
`,Oi(i,t)}function vn(e,t,i){let n=Ii(),o=t.slice(0,3),a=`<div style="font-weight:700;font-size:14px;margin-bottom:8px;color:#1d4ed8">${e}</div>`;for(let r of o){a+=`<div style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#9ca3af;margin-bottom:3px">${r.partOfSpeech}</div>`;for(let c of r.definitions.slice(0,2)){let l=Mi(c.definition);a+=`<div style="margin-bottom:5px;color:#374151">\u2022 ${l}</div>`}}n.innerHTML=a,Oi(n,i)}function bn(e){let t=document.getElementById(me);t&&(t.innerHTML=`
|
|
12
12
|
<div style="font-weight:700;font-size:14px;margin-bottom:4px;color:#1d4ed8">${e}</div>
|
|
13
13
|
<div style="color:#9ca3af;font-size:12px">Sin definici\xF3n disponible</div>
|
|
14
|
-
`)}function Oi(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,a=t.top-o-8,r=t.left+t.width/2-320/2;a<8&&(a=t.bottom+8),r<8&&(r=8),r+320>window.innerWidth-8&&(r=window.innerWidth-320-8),e.style.top=`${a}px`,e.style.left=`${r}px`,e.style.opacity="1"}function fe(){let e=document.getElementById(me);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function yn(){document.getElementById(me)?.remove()}var ki="es",ft="",Ke=null;async function Sn(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){fe();return}let i=window.getSelection();if(!i||i.rangeCount===0){fe();return}let n=i.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){fe();return}let o=n;ft=o;let r=i.getRangeAt(0).getBoundingClientRect();hn(o,r);try{let c=await pn(o,ki);if(ft!==o)return;if(!c.length){bn(o);return}vn(o,c,r)}catch{fe()}}function Cn(e){e.composedPath()[0]?.id!==me&&fe()}function Le(e,t="es"){if(ki=t,e){if(Ke)return;let i=o=>{Sn(o)},n=o=>{Cn(o)};document.addEventListener("mouseup",i),document.addEventListener("mousedown",n),Ke=()=>{document.removeEventListener("mouseup",i),document.removeEventListener("mousedown",n)}}else Ke?.(),Ke=null,ft="",fe(),yn()}function Ti(){let[e,t]=(0,K.useState)(()=>p().dictionaryActive??!1);(0,K.useEffect)(()=>{let n=p();Le(e,n.language??"es")},[]),(0,K.useEffect)(()=>{let n=o=>{let{settings:a}=o.detail,r=a.dictionaryActive??!1;r!==e&&(t(r),Le(r,a.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[e]),(0,K.useEffect)(()=>()=>{Le(!1)},[]);let i=(0,K.useCallback)(()=>{let n=!e,o=p().language??"es";t(n),Le(n,o),g("dictionaryActive",n)},[e]);return{isActive:e,toggle:i}}function Ye(){let e=$t(),t=qt(),i=Zt(),n=Ut(),o=Kt(),a=Jt(),r=ii(),c=ni(),l=oi(),f=si(),d=ui(),m=pi(),v=fi(),h=gi(),I=hi(),C=yi(),S=xi(),b=wi(),P=Ti(),x=p(),O=Gt(x);return{contrast:e,textSize:t,language:i,colorblind:n,saturation:o,dyslexia:a,letterSpacing:r,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:I,tts:C,profiles:S,pageStructure:b,dictionary:P,hasActiveFeatures:O,resetAllFeatures:()=>{ue(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:x}}var M=require("react");var mt="apea-fab-position",_=60,L=16,xn=6;function ge(e,t,i){return Math.max(t,Math.min(i,e))}function En(){try{let e=localStorage.getItem(mt);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(mt),null;let i=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,o=ge(t.hOffset,L,Math.max(L,i/2-_/2)),a=ge(t.vOffset,L,Math.max(L,n/2-_/2));return o>L&&a>L&&(o<a?o=L:a=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:a}}catch{return null}}function Ln(e){try{localStorage.setItem(mt,JSON.stringify(e))}catch{}}function wn(e){return En()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function gt(e,t,i){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-_,y:e.vEdge==="top"?e.vOffset:i-e.vOffset-_}}function An(e,t,i,n){let o=e,a=i-e-_,r=t,c=n-t-_,l=Math.min(o,a,r,c),f="left",d="top",m=L,v=L;return l===o||l===a?(f=l===o?"left":"right",m=L,d=r<=c?"top":"bottom",v=ge(d==="top"?t:c,L,n/2-_/2)):(d=l===r?"top":"bottom",v=L,f=o<=a?"left":"right",m=ge(f==="left"?e:a,L,i/2-_/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function Mn(e,t){let i=Re(),n=window.innerWidth/i,o=window.innerHeight/i,a=gt(e,n,o);return{position:"fixed",top:`${a.y}px`,left:`${a.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function Ni({defaultPosition:e="bottom-left",onTap:t,disabled:i=!1}={}){let[n,o]=(0,M.useState)(()=>wn(e)),[a,r]=(0,M.useState)(!1),[,c]=(0,M.useState)(0),l=(0,M.useRef)(null),f=(0,M.useRef)(t);f.current=t;let d=(0,M.useRef)(n);d.current=n;let m=(0,M.useRef)(i);m.current=i,(0,M.useEffect)(()=>{let h=()=>{c(I=>I+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=(0,M.useCallback)((h,I)=>{if(m.current)return;let C=Re(),S=y=>y/C,b=S(window.innerWidth),P=S(window.innerHeight),x=gt(d.current,b,P),O=x.x,ve=x.y,Ae=l.current;Ae&&(Ae.style.transition="none");let tt=S(h)-O,it=S(I)-ve,be=O,ye=ve,Me=0;function u(y,Y){let le=ge(S(y)-tt,0,b-_),Se=ge(S(Y)-it,0,P-_);Me+=Math.abs(le-be)+Math.abs(Se-ye),be=le,ye=Se;let Ce=l.current;Ce&&(Ce.style.top=`${Se}px`,Ce.style.left=`${le}px`)}function Ie(y,Y){let le=Re(),Se=window.innerWidth/le,Ce=window.innerHeight/le,{x:Bi,y:Vi}=gt(Y,Se,Ce);y.style.top=`${Vi}px`,y.style.left=`${Bi}px`,y.style.transition="all 0.25s ease"}function Tt(){Fi();let y=l.current;if(Me<xn)y&&Ie(y,d.current),r(!1),f.current?.();else{let Y=An(be,ye,b,P);Ln(Y),y&&Ie(y,Y),r(!1),o(Y)}}function Nt(y){u(y.clientX,y.clientY)}function Pt(y){y.preventDefault(),u(y.touches[0].clientX,y.touches[0].clientY)}function Rt(){Tt()}function Ht(){Tt()}function Fi(){window.removeEventListener("mousemove",Nt),window.removeEventListener("mouseup",Rt),window.removeEventListener("touchmove",Pt),window.removeEventListener("touchend",Ht)}window.addEventListener("mousemove",Nt),window.addEventListener("mouseup",Rt),window.addEventListener("touchmove",Pt,{passive:!1}),window.addEventListener("touchend",Ht),r(!0)},[]);return{fabStyle:Mn(n,a),isDragging:a,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}var Pi=require("react");var Je=require("react/jsx-runtime");function ht({title:e,children:t}){return(0,Je.jsxs)("section",{className:"px-4 py-3",children:[(0,Je.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}var ce=require("react/jsx-runtime");function z({icon:e,label:t,isActive:i,onClick:n,disabled:o=!1,className:a,hint:r}){return(0,ce.jsxs)("button",{type:"button",role:"switch","aria-checked":i,"aria-label":t,onClick:o?void 0:n,disabled:o,className:R("apea-focus apea-feature-row",a),"data-active":i,"data-disabled":o||void 0,children:[(0,ce.jsx)("span",{className:R("h-5 w-5 shrink-0",i?"text-blue-700":"text-gray-500"),children:e}),(0,ce.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),r&&(0,ce.jsx)("span",{title:r,"aria-label":r,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,ce.jsx)("span",{className:"apea-toggle","data-checked":i,"aria-hidden":"true"})]})}var T=require("react/jsx-runtime");function In(){return(0,T.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,T.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function V({icon:e,name:t,levels:i,currentIndex:n,onCycle:o,className:a}){let r=n>=0,c=r?i[n]:null,l=i.length>1;function f(){let v=n>=i.length-1?-1:n+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=r?`${t}: ${c.label}`:t;return(0,T.jsxs)("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":r,...l&&r?{"aria-valuenow":n+1,"aria-valuemax":i.length}:{},"data-active":r,onClick:f,onKeyDown:d,className:R("apea-focus apea-cyclic-tile",a),children:[(0,T.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:r&&(0,T.jsx)(In,{})}),(0,T.jsx)("span",{className:"apea-cyclic-tile__icon",children:e}),(0,T.jsx)("span",{className:"apea-cyclic-tile__label",children:r?c.label:t}),l&&(0,T.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:i.map((v,h)=>(0,T.jsx)("span",{className:"apea-cyclic-dot","data-filled":r&&h<=n},h))})]})}var s=require("react/jsx-runtime"),vt=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],bt=[{label:"Alto Contraste",value:"high"}],yt=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],St=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],Ct=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],xt=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Ri({onClose:e}){let[t,i]=(0,Pi.useState)(!1),{contrast:n,textSize:o,saturation:a,dyslexia:r,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:I,hideImages:C,textAlign:S,tts:b,profiles:P,pageStructure:x,dictionary:O,resetAllFeatures:ve}=Ye(),Ae=vt.findIndex(u=>u.value===o.textSizePercentage),tt=bt.findIndex(u=>u.value===n.contrastMode),it=yt.findIndex(u=>u.value===a.saturationMode),be=St.findIndex(u=>u.value===l.level),ye=Ct.findIndex(u=>u.value===c.level),Me=xt.findIndex(u=>u.value===S.mode);return(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,s.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&(0,s.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(ut).map(u=>(0,s.jsx)(z,{icon:(0,s.jsx)(Gn,{profile:u}),label:ut[u],isActive:P.activeProfile===u,onClick:()=>P.applyProfile(u)},u))})]}),(0,s.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,s.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,s.jsx)(V,{icon:(0,s.jsx)(jn,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:b.isReading?0:-1,onCycle:()=>b.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(On,{}),name:"Tama\xF1o de fuente",levels:vt,currentIndex:Ae,onCycle:u=>o.setSpecificTextSize(u===-1?100:vt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Dn,{}),name:"Contraste",levels:bt,currentIndex:tt,onCycle:u=>n.setContrastMode(u===-1?"normal":bt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(_n,{}),name:"Saturaci\xF3n",levels:yt,currentIndex:it,onCycle:u=>a.setSaturationMode(u===-1?"normal":yt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Rn,{}),name:"Interlineado",levels:St,currentIndex:be,onCycle:u=>l.setTo(u===-1?14:St[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Pn,{}),name:"Interletrado",levels:Ct,currentIndex:ye,onCycle:u=>c.setTo(u===-1?0:Ct[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Nn,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:r.isActive?0:-1,onCycle:()=>r.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(Vn,{mode:S.mode}),name:"Alinear texto",levels:xt,currentIndex:Me,onCycle:u=>S.setMode(u===-1?"default":xt[u].value)})]})}),(0,s.jsx)(ht,{title:"Ajustes de contenido",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(kn,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,s.jsx)(z,{icon:(0,s.jsx)(Tn,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,s.jsx)(z,{icon:(0,s.jsx)(Hn,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Bn,{}),label:"Ocultar im\xE1genes",isActive:C.isActive,onClick:C.toggle})]})}),(0,s.jsxs)(ht,{title:"Herramientas",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(zn,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Wn,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Fn,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)($n,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:O.isActive,onClick:O.toggle})]}),x.isOpen&&x.structure.length>0&&(0,s.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,s.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,s.jsx)("ul",{className:"space-y-1",children:x.structure.map((u,Ie)=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>x.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[(0,s.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),(0,s.jsx)("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${Ie}`))})]}),x.isOpen&&x.structure.length===0&&(0,s.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,s.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,s.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,s.jsx)("button",{type:"button",onClick:ve,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function On(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function kn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pn(){return(0,s.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Rn(){return(0,s.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,s.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function Hn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,s.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Dn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("path",{d:"M12 3v18"}),(0,s.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function _n(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,s.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function zn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function Wn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,s.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function Fn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function Bn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,s.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function Vn({mode:e}){return e==="center"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function jn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function Gn({profile:e}){switch(e){case"visionImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,s.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,s.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function $n(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var N=require("react/jsx-runtime");function Et({position:e="bottom-left",className:t}={}){let[i,n]=(0,Qe.useState)(!0),{hasActiveFeatures:o}=Ye(),{fabStyle:a,isDragging:r,fabRef:c,dragHandlers:l}=Ni({defaultPosition:e,onTap:()=>n(d=>!d),disabled:i});(0,Qe.useEffect)(()=>{if(!i)return;let d=m=>{m.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[i]);let f=i||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{ref:c,className:t,style:{...a,zIndex:i?30:50,opacity:r?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{i||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,N.jsx)(nt,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,N.jsx)(Ft,{className:"w-full z-50",color:f,stroke:f})})}),(0,N.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":i?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,N.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":i?"true":"false",children:(0,N.jsx)(Ri,{onClose:()=>n(!1)})})]})}var wt=require("react/jsx-runtime"),qn={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function Lt(e){return{...qn,...e}}function Zn(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Hi(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function _i(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:Lt(e.theme)},i=Lt(t.theme),n=t.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
14
|
+
`)}function Oi(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,a=t.top-o-8,r=t.left+t.width/2-320/2;a<8&&(a=t.bottom+8),r<8&&(r=8),r+320>window.innerWidth-8&&(r=window.innerWidth-320-8),e.style.top=`${a}px`,e.style.left=`${r}px`,e.style.opacity="1"}function fe(){let e=document.getElementById(me);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function yn(){document.getElementById(me)?.remove()}var ki="es",ft="",Ke=null;async function Sn(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){fe();return}let i=window.getSelection();if(!i||i.rangeCount===0){fe();return}let n=i.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){fe();return}let o=n;ft=o;let r=i.getRangeAt(0).getBoundingClientRect();hn(o,r);try{let c=await pn(o,ki);if(ft!==o)return;if(!c.length){bn(o);return}vn(o,c,r)}catch{fe()}}function Cn(e){e.composedPath()[0]?.id!==me&&fe()}function Le(e,t="es"){if(ki=t,e){if(Ke)return;let i=o=>{Sn(o)},n=o=>{Cn(o)};document.addEventListener("mouseup",i),document.addEventListener("mousedown",n),Ke=()=>{document.removeEventListener("mouseup",i),document.removeEventListener("mousedown",n)}}else Ke?.(),Ke=null,ft="",fe(),yn()}function Ti(){let[e,t]=(0,K.useState)(()=>p().dictionaryActive??!1);(0,K.useEffect)(()=>{let n=p();Le(e,n.language??"es")},[]),(0,K.useEffect)(()=>{let n=o=>{let{settings:a}=o.detail,r=a.dictionaryActive??!1;r!==e&&(t(r),Le(r,a.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[e]),(0,K.useEffect)(()=>()=>{Le(!1)},[]);let i=(0,K.useCallback)(()=>{let n=!e,o=p().language??"es";t(n),Le(n,o),g("dictionaryActive",n)},[e]);return{isActive:e,toggle:i}}function Ye(){let e=$t(),t=qt(),i=Zt(),n=Ut(),o=Kt(),a=Jt(),r=ii(),c=ni(),l=oi(),f=si(),d=ui(),m=pi(),v=fi(),h=gi(),I=hi(),C=yi(),S=xi(),b=wi(),P=Ti(),x=p(),O=Gt(x);return{contrast:e,textSize:t,language:i,colorblind:n,saturation:o,dyslexia:a,letterSpacing:r,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:I,tts:C,profiles:S,pageStructure:b,dictionary:P,hasActiveFeatures:O,resetAllFeatures:()=>{ue(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:x}}var M=require("react");var mt="apea-fab-position",_=60,L=16,xn=6;function ge(e,t,i){return Math.max(t,Math.min(i,e))}function En(){try{let e=localStorage.getItem(mt);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(mt),null;let i=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,o=ge(t.hOffset,L,Math.max(L,i/2-_/2)),a=ge(t.vOffset,L,Math.max(L,n/2-_/2));return o>L&&a>L&&(o<a?o=L:a=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:a}}catch{return null}}function Ln(e){try{localStorage.setItem(mt,JSON.stringify(e))}catch{}}function wn(e){return En()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function gt(e,t,i){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-_,y:e.vEdge==="top"?e.vOffset:i-e.vOffset-_}}function An(e,t,i,n){let o=e,a=i-e-_,r=t,c=n-t-_,l=Math.min(o,a,r,c),f="left",d="top",m=L,v=L;return l===o||l===a?(f=l===o?"left":"right",m=L,d=r<=c?"top":"bottom",v=ge(d==="top"?t:c,L,n/2-_/2)):(d=l===r?"top":"bottom",v=L,f=o<=a?"left":"right",m=ge(f==="left"?e:a,L,i/2-_/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function Mn(e,t){let i=Re(),n=window.innerWidth/i,o=window.innerHeight/i,a=gt(e,n,o);return{position:"fixed",top:`${a.y}px`,left:`${a.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function Ni({defaultPosition:e="bottom-left",onTap:t,disabled:i=!1}={}){let[n,o]=(0,M.useState)(()=>wn(e)),[a,r]=(0,M.useState)(!1),[,c]=(0,M.useState)(0),l=(0,M.useRef)(null),f=(0,M.useRef)(t);f.current=t;let d=(0,M.useRef)(n);d.current=n;let m=(0,M.useRef)(i);m.current=i,(0,M.useEffect)(()=>{let h=()=>{c(I=>I+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=(0,M.useCallback)((h,I)=>{if(m.current)return;let C=Re(),S=y=>y/C,b=S(window.innerWidth),P=S(window.innerHeight),x=gt(d.current,b,P),O=x.x,ve=x.y,Ae=l.current;Ae&&(Ae.style.transition="none");let tt=S(h)-O,it=S(I)-ve,be=O,ye=ve,Me=0;function u(y,Y){let le=ge(S(y)-tt,0,b-_),Se=ge(S(Y)-it,0,P-_);Me+=Math.abs(le-be)+Math.abs(Se-ye),be=le,ye=Se;let Ce=l.current;Ce&&(Ce.style.top=`${Se}px`,Ce.style.left=`${le}px`)}function Ie(y,Y){let le=Re(),Se=window.innerWidth/le,Ce=window.innerHeight/le,{x:Bi,y:Vi}=gt(Y,Se,Ce);y.style.top=`${Vi}px`,y.style.left=`${Bi}px`,y.style.transition="all 0.25s ease"}function Tt(){Fi();let y=l.current;if(Me<xn)y&&Ie(y,d.current),r(!1),f.current?.();else{let Y=An(be,ye,b,P);Ln(Y),y&&Ie(y,Y),r(!1),o(Y)}}function Nt(y){u(y.clientX,y.clientY)}function Pt(y){y.preventDefault(),u(y.touches[0].clientX,y.touches[0].clientY)}function Rt(){Tt()}function Ht(){Tt()}function Fi(){window.removeEventListener("mousemove",Nt),window.removeEventListener("mouseup",Rt),window.removeEventListener("touchmove",Pt),window.removeEventListener("touchend",Ht)}window.addEventListener("mousemove",Nt),window.addEventListener("mouseup",Rt),window.addEventListener("touchmove",Pt,{passive:!1}),window.addEventListener("touchend",Ht),r(!0)},[]);return{fabStyle:Mn(n,a),isDragging:a,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}var Pi=require("react");var Je=require("react/jsx-runtime");function ht({title:e,children:t}){return(0,Je.jsxs)("section",{className:"px-4 py-3",children:[(0,Je.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}var ce=require("react/jsx-runtime");function z({icon:e,label:t,isActive:i,onClick:n,disabled:o=!1,className:a,hint:r}){return(0,ce.jsxs)("button",{type:"button",role:"switch","aria-checked":i,"aria-label":t,onClick:o?void 0:n,disabled:o,className:R("apea-focus apea-feature-row",a),"data-active":i,"data-disabled":o||void 0,children:[(0,ce.jsx)("span",{className:R("h-5 w-5 shrink-0",i?"text-blue-700":"text-gray-500"),children:e}),(0,ce.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),r&&(0,ce.jsx)("span",{title:r,"aria-label":r,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,ce.jsx)("span",{className:"apea-toggle","data-checked":i,"aria-hidden":"true"})]})}var T=require("react/jsx-runtime");function In(){return(0,T.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,T.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function V({icon:e,name:t,levels:i,currentIndex:n,onCycle:o,className:a}){let r=n>=0,c=r?i[n]:null,l=i.length>1;function f(){let v=n>=i.length-1?-1:n+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=r?`${t}: ${c.label}`:t;return(0,T.jsxs)("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":r,...l&&r?{"aria-valuenow":n+1,"aria-valuemax":i.length}:{},"data-active":r,onClick:f,onKeyDown:d,className:R("apea-focus apea-cyclic-tile",a),children:[(0,T.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:r&&(0,T.jsx)(In,{})}),(0,T.jsx)("span",{className:"apea-cyclic-tile__icon",children:e}),(0,T.jsx)("span",{className:"apea-cyclic-tile__label",children:r?c.label:t}),l&&(0,T.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:i.map((v,h)=>(0,T.jsx)("span",{className:"apea-cyclic-dot","data-filled":r&&h<=n},h))})]})}var s=require("react/jsx-runtime"),vt=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],bt=[{label:"Alto Contraste",value:"high"}],yt=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],St=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],Ct=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],xt=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Ri({onClose:e}){let[t,i]=(0,Pi.useState)(!1),{contrast:n,textSize:o,saturation:a,dyslexia:r,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:I,hideImages:C,textAlign:S,tts:b,profiles:P,pageStructure:x,dictionary:O,resetAllFeatures:ve}=Ye(),Ae=vt.findIndex(u=>u.value===o.textSizePercentage),tt=bt.findIndex(u=>u.value===n.contrastMode),it=yt.findIndex(u=>u.value===a.saturationMode),be=St.findIndex(u=>u.value===l.level),ye=Ct.findIndex(u=>u.value===c.level),Me=xt.findIndex(u=>u.value===S.mode);return(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,s.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&(0,s.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(ut).map(u=>(0,s.jsx)(z,{icon:(0,s.jsx)(Gn,{profile:u}),label:ut[u],isActive:P.activeProfile===u,onClick:()=>P.applyProfile(u)},u))})]}),(0,s.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,s.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,s.jsx)(V,{icon:(0,s.jsx)(jn,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:b.isReading?0:-1,onCycle:()=>b.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(On,{}),name:"Tama\xF1o de fuente",levels:vt,currentIndex:Ae,onCycle:u=>o.setSpecificTextSize(u===-1?100:vt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Dn,{}),name:"Contraste",levels:bt,currentIndex:tt,onCycle:u=>n.setContrastMode(u===-1?"normal":bt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(_n,{}),name:"Saturaci\xF3n",levels:yt,currentIndex:it,onCycle:u=>a.setSaturationMode(u===-1?"normal":yt[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Rn,{}),name:"Interlineado",levels:St,currentIndex:be,onCycle:u=>l.setTo(u===-1?14:St[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Pn,{}),name:"Interletrado",levels:Ct,currentIndex:ye,onCycle:u=>c.setTo(u===-1?0:Ct[u].value)}),(0,s.jsx)(V,{icon:(0,s.jsx)(Nn,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:r.isActive?0:-1,onCycle:()=>r.toggle()}),(0,s.jsx)(V,{icon:(0,s.jsx)(Vn,{mode:S.mode}),name:"Alinear texto",levels:xt,currentIndex:Me,onCycle:u=>S.setMode(u===-1?"default":xt[u].value)})]})}),(0,s.jsx)(ht,{title:"Ajustes de contenido",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(kn,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,s.jsx)(z,{icon:(0,s.jsx)(Tn,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,s.jsx)(z,{icon:(0,s.jsx)(Hn,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Bn,{}),label:"Ocultar im\xE1genes",isActive:C.isActive,onClick:C.toggle})]})}),(0,s.jsxs)(ht,{title:"Herramientas",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(z,{icon:(0,s.jsx)(zn,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Wn,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)(Fn,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),(0,s.jsx)(z,{icon:(0,s.jsx)($n,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:O.isActive,onClick:O.toggle})]}),x.isOpen&&x.structure.length>0&&(0,s.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,s.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,s.jsx)("ul",{className:"space-y-1",children:x.structure.map((u,Ie)=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>x.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[(0,s.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),(0,s.jsx)("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${Ie}`))})]}),x.isOpen&&x.structure.length===0&&(0,s.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,s.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,s.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,s.jsx)("button",{type:"button",onClick:ve,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function On(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function kn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pn(){return(0,s.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Rn(){return(0,s.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,s.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function Hn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,s.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Dn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("path",{d:"M12 3v18"}),(0,s.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function _n(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,s.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function zn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function Wn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,s.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function Fn(){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function Bn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,s.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function Vn({mode:e}){return e==="center"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,s.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function jn(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,s.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function Gn({profile:e}){switch(e){case"visionImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,s.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,s.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,s.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function $n(){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,s.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var N=require("react/jsx-runtime");function Et({position:e="bottom-left",className:t}={}){let[i,n]=(0,Qe.useState)(!1),{hasActiveFeatures:o}=Ye(),{fabStyle:a,isDragging:r,fabRef:c,dragHandlers:l}=Ni({defaultPosition:e,onTap:()=>n(d=>!d),disabled:i});(0,Qe.useEffect)(()=>{if(!i)return;let d=m=>{m.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[i]);let f=i||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{ref:c,className:t,style:{...a,zIndex:i?30:50,opacity:r?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{i||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,N.jsx)(nt,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,N.jsx)(Ft,{className:"w-full z-50",color:f,stroke:f})})}),(0,N.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":i?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,N.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":i?"true":"false",children:(0,N.jsx)(Ri,{onClose:()=>n(!1)})})]})}var wt=require("react/jsx-runtime"),qn={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function Lt(e){return{...qn,...e}}function Zn(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Hi(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function _i(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:Lt(e.theme)},i=Lt(t.theme),n=t.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
15
15
|
/* Accessibility Feature Styles */
|
|
16
16
|
/* ============================================= */
|
|
17
17
|
|
package/dist/index.global.js
CHANGED
|
@@ -19,7 +19,7 @@ Error generating stack: `+n.message+`
|
|
|
19
19
|
`,Og(l,e)}function c2(t,e,l){let n=Tg(),a=e.slice(0,3),i=`<div style="font-weight:700;font-size:14px;margin-bottom:8px;color:#1d4ed8">${t}</div>`;for(let u of a){i+=`<div style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#9ca3af;margin-bottom:3px">${u.partOfSpeech}</div>`;for(let c of u.definitions.slice(0,2)){let o=Mg(c.definition);i+=`<div style="margin-bottom:5px;color:#374151">\u2022 ${o}</div>`}}n.innerHTML=i,Og(n,l)}function o2(t){let e=document.getElementById(ua);e&&(e.innerHTML=`
|
|
20
20
|
<div style="font-weight:700;font-size:14px;margin-bottom:4px;color:#1d4ed8">${t}</div>
|
|
21
21
|
<div style="color:#9ca3af;font-size:12px">Sin definici\xF3n disponible</div>
|
|
22
|
-
`)}function Og(t,e){t.style.top="-9999px",t.style.left="-9999px",t.style.display="block",t.style.opacity="0";let a=t.offsetHeight||100,i=e.top-a-8,u=e.left+e.width/2-320/2;i<8&&(i=e.bottom+8),u<8&&(u=8),u+320>window.innerWidth-8&&(u=window.innerWidth-320-8),t.style.top=`${i}px`,t.style.left=`${u}px`,t.style.opacity="1"}function ia(){let t=document.getElementById(ua);t&&(t.style.opacity="0",setTimeout(()=>{t.style.opacity==="0"&&(t.style.display="none")},150))}function s2(){document.getElementById(ua)?.remove()}var zg="es",yf="",pc=null;async function f2(t){if(t.composedPath()[0]?.closest?.("[data-a11y-icon]")){ia();return}let l=window.getSelection();if(!l||l.rangeCount===0){ia();return}let n=l.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){ia();return}let a=n;yf=a;let u=l.getRangeAt(0).getBoundingClientRect();u2(a,u);try{let c=await l2(a,zg);if(yf!==a)return;if(!c.length){o2(a);return}c2(a,c,u)}catch{ia()}}function r2(t){t.composedPath()[0]?.id!==ua&&ia()}function gi(t,e="es"){if(zg=e,t){if(pc)return;let l=a=>{f2(a)},n=a=>{r2(a)};document.addEventListener("mouseup",l),document.addEventListener("mousedown",n),pc=()=>{document.removeEventListener("mouseup",l),document.removeEventListener("mousedown",n)}}else pc?.(),pc=null,yf="",ia(),s2()}function xg(){let[t,e]=(0,_l.useState)(()=>D().dictionaryActive??!1);(0,_l.useEffect)(()=>{let n=D();gi(t,n.language??"es")},[]),(0,_l.useEffect)(()=>{let n=a=>{let{settings:i}=a.detail,u=i.dictionaryActive??!1;u!==t&&(e(u),gi(u,i.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[t]),(0,_l.useEffect)(()=>()=>{gi(!1)},[]);let l=(0,_l.useCallback)(()=>{let n=!t,a=D().language??"es";e(n),gi(n,a),Y("dictionaryActive",n)},[t]);return{isActive:t,toggle:l}}function vc(){let t=Xm(),e=Zm(),l=Vm(),n=Qm(),a=Jm(),i=Wm(),u=Pm(),c=tg(),o=eg(),f=lg(),d=og(),v=sg(),m=fg(),p=dg(),b=mg(),E=vg(),O=Sg(),r=Ag(),s=xg(),g=D(),h=jm(g);return{contrast:t,textSize:e,language:l,colorblind:n,saturation:a,dyslexia:i,letterSpacing:u,lineHeight:c,fontWeight:o,highlight:f,animations:d,cursor:v,readingGuide:m,hideImages:p,textAlign:b,tts:E,profiles:O,pageStructure:r,dictionary:s,hasActiveFeatures:h,resetAllFeatures:()=>{na(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:g}}var Jt=N(K(),1);var hf="apea-fab-position",Ae=60,Ht=16,d2=6;function ca(t,e,l){return Math.max(e,Math.min(l,t))}function m2(){try{let t=localStorage.getItem(hf);if(!t)return null;let e=JSON.parse(t);if(e.vEdge!=="top"&&e.vEdge!=="bottom"||e.hEdge!=="left"&&e.hEdge!=="right"||typeof e.vOffset!="number"||typeof e.hOffset!="number"||isNaN(e.vOffset)||isNaN(e.hOffset))return localStorage.removeItem(hf),null;let l=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,a=ca(e.hOffset,Ht,Math.max(Ht,l/2-Ae/2)),i=ca(e.vOffset,Ht,Math.max(Ht,n/2-Ae/2));return a>Ht&&i>Ht&&(a<i?a=Ht:i=Ht),{vEdge:e.vEdge,hEdge:e.hEdge,hOffset:a,vOffset:i}}catch{return null}}function g2(t){try{localStorage.setItem(hf,JSON.stringify(t))}catch{}}function p2(t){return m2()??{vEdge:"bottom",hEdge:t==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function Sf(t,e,l){return{x:t.hEdge==="left"?t.hOffset:e-t.hOffset-Ae,y:t.vEdge==="top"?t.vOffset:l-t.vOffset-Ae}}function v2(t,e,l,n){let a=t,i=l-t-Ae,u=e,c=n-e-Ae,o=Math.min(a,i,u,c),f="left",d="top",v=Ht,m=Ht;return o===a||o===i?(f=o===a?"left":"right",v=Ht,d=u<=c?"top":"bottom",m=ca(d==="top"?e:c,Ht,n/2-Ae/2)):(d=o===u?"top":"bottom",m=Ht,f=a<=i?"left":"right",v=ca(f==="left"?t:i,Ht,l/2-Ae/2)),{hEdge:f,vEdge:d,hOffset:v,vOffset:m}}function y2(t,e){let l=Pu(),n=window.innerWidth/l,a=window.innerHeight/l,i=Sf(t,n,a);return{position:"fixed",top:`${i.y}px`,left:`${i.x}px`,cursor:e?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:e?"none":"all 0.25s ease"}}function _g({defaultPosition:t="bottom-left",onTap:e,disabled:l=!1}={}){let[n,a]=(0,Jt.useState)(()=>p2(t)),[i,u]=(0,Jt.useState)(!1),[,c]=(0,Jt.useState)(0),o=(0,Jt.useRef)(null),f=(0,Jt.useRef)(e);f.current=e;let d=(0,Jt.useRef)(n);d.current=n;let v=(0,Jt.useRef)(l);v.current=l,(0,Jt.useEffect)(()=>{let p=()=>{c(b=>b+1)};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);let m=(0,Jt.useCallback)((p,b)=>{if(v.current)return;let E=Pu(),O=st=>st/E,r=O(window.innerWidth),s=O(window.innerHeight),g=Sf(d.current,r,s),h=g.x,C=g.y,R=o.current;R&&(R.style.transition="none");let A=O(p)-h,z=O(b)-C,_=h,H=C,Rt=0;function M(st,Ll){let sn=ca(O(st)-A,0,r-Ae),sa=ca(O(Ll)-z,0,s-Ae);Rt+=Math.abs(sn-_)+Math.abs(sa-H),_=sn,H=sa;let fa=o.current;fa&&(fa.style.top=`${sa}px`,fa.style.left=`${sn}px`)}function vi(st,Ll){let sn=Pu(),sa=window.innerWidth/sn,fa=window.innerHeight/sn,{x:wg,y:Yg}=Sf(Ll,sa,fa);st.style.top=`${Yg}px`,st.style.left=`${wg}px`,st.style.transition="all 0.25s ease"}function Uf(){qg();let st=o.current;if(Rt<d2)st&&vi(st,d.current),u(!1),f.current?.();else{let Ll=v2(_,H,r,s);g2(Ll),st&&vi(st,Ll),u(!1),a(Ll)}}function Bf(st){M(st.clientX,st.clientY)}function qf(st){st.preventDefault(),M(st.touches[0].clientX,st.touches[0].clientY)}function wf(){Uf()}function Yf(){Uf()}function qg(){window.removeEventListener("mousemove",Bf),window.removeEventListener("mouseup",wf),window.removeEventListener("touchmove",qf),window.removeEventListener("touchend",Yf)}window.addEventListener("mousemove",Bf),window.addEventListener("mouseup",wf),window.addEventListener("touchmove",qf,{passive:!1}),window.addEventListener("touchend",Yf),u(!0)},[]);return{fabStyle:y2(n,i),isDragging:i,fabRef:o,dragHandlers:{onMouseDown:p=>{p.button!==0||v.current||(p.preventDefault(),m(p.clientX,p.clientY))},onTouchStart:p=>{v.current||m(p.touches[0].clientX,p.touches[0].clientY)}}}}var Lg=N(K(),1);var yc=N(bt(),1);function bf({title:t,children:e}){return(0,yc.jsxs)("section",{className:"px-4 py-3",children:[(0,yc.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:t}),e]})}var on=N(bt(),1);function Ce({icon:t,label:e,isActive:l,onClick:n,disabled:a=!1,className:i,hint:u}){return(0,on.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":e,onClick:a?void 0:n,disabled:a,className:Se("apea-focus apea-feature-row",i),"data-active":l,"data-disabled":a||void 0,children:[(0,on.jsx)("span",{className:Se("h-5 w-5 shrink-0",l?"text-blue-700":"text-gray-500"),children:t}),(0,on.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:e}),u&&(0,on.jsx)("span",{title:u,"aria-label":u,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,on.jsx)("span",{className:"apea-toggle","data-checked":l,"aria-hidden":"true"})]})}var se=N(bt(),1);function h2(){return(0,se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,se.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function Je({icon:t,name:e,levels:l,currentIndex:n,onCycle:a,className:i}){let u=n>=0,c=u?l[n]:null,o=l.length>1;function f(){let m=n>=l.length-1?-1:n+1;a(m)}function d(m){(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())}let v=u?`${e}: ${c.label}`:e;return(0,se.jsxs)("div",{role:"button",tabIndex:0,"aria-label":v,"aria-roledescription":"cyclic toggle","aria-pressed":u,...o&&u?{"aria-valuenow":n+1,"aria-valuemax":l.length}:{},"data-active":u,onClick:f,onKeyDown:d,className:Se("apea-focus apea-cyclic-tile",i),children:[(0,se.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:u&&(0,se.jsx)(h2,{})}),(0,se.jsx)("span",{className:"apea-cyclic-tile__icon",children:t}),(0,se.jsx)("span",{className:"apea-cyclic-tile__label",children:u?c.label:e}),o&&(0,se.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:l.map((m,p)=>(0,se.jsx)("span",{className:"apea-cyclic-dot","data-filled":u&&p<=n},p))})]})}var y=N(bt(),1),Ef=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],Af=[{label:"Alto Contraste",value:"high"}],Cf=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],Mf=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],Tf=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],Of=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Dg({onClose:t}){let[e,l]=(0,Lg.useState)(!1),{contrast:n,textSize:a,saturation:i,dyslexia:u,letterSpacing:c,lineHeight:o,fontWeight:f,highlight:d,animations:v,cursor:m,readingGuide:p,colorblind:b,hideImages:E,textAlign:O,tts:r,profiles:s,pageStructure:g,dictionary:h,resetAllFeatures:C}=vc(),R=Ef.findIndex(M=>M.value===a.textSizePercentage),A=Af.findIndex(M=>M.value===n.contrastMode),z=Cf.findIndex(M=>M.value===i.saturationMode),_=Mf.findIndex(M=>M.value===o.level),H=Tf.findIndex(M=>M.value===c.level),Rt=Of.findIndex(M=>M.value===O.mode);return(0,y.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,y.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,y.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,y.jsx)("div",{className:"flex items-center gap-2",children:(0,y.jsx)("button",{type:"button",onClick:t,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,y.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,y.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,y.jsxs)("button",{type:"button",onClick:()=>l(M=>!M),"aria-expanded":e,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${e?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e&&(0,y.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(pf).map(M=>(0,y.jsx)(Ce,{icon:(0,y.jsx)(R2,{profile:M}),label:pf[M],isActive:s.activeProfile===M,onClick:()=>s.applyProfile(M)},M))})]}),(0,y.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,y.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,y.jsx)(Je,{icon:(0,y.jsx)(H2,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:r.isReading?0:-1,onCycle:()=>r.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(S2,{}),name:"Tama\xF1o de fuente",levels:Ef,currentIndex:R,onCycle:M=>a.setSpecificTextSize(M===-1?100:Ef[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(O2,{}),name:"Contraste",levels:Af,currentIndex:A,onCycle:M=>n.setContrastMode(M===-1?"normal":Af[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(z2,{}),name:"Saturaci\xF3n",levels:Cf,currentIndex:z,onCycle:M=>i.setSaturationMode(M===-1?"normal":Cf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(M2,{}),name:"Interlineado",levels:Mf,currentIndex:_,onCycle:M=>o.setTo(M===-1?14:Mf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(C2,{}),name:"Interletrado",levels:Tf,currentIndex:H,onCycle:M=>c.setTo(M===-1?0:Tf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(A2,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:u.isActive?0:-1,onCycle:()=>u.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(N2,{mode:O.mode}),name:"Alinear texto",levels:Of,currentIndex:Rt,onCycle:M=>O.setMode(M===-1?"default":Of[M].value)})]})}),(0,y.jsx)(bf,{title:"Ajustes de contenido",children:(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(b2,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(E2,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(T2,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(D2,{}),label:"Ocultar im\xE1genes",isActive:E.isActive,onClick:E.toggle})]})}),(0,y.jsxs)(bf,{title:"Herramientas",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(x2,{}),label:"Gu\xEDa de lectura",isActive:p.isActive,onClick:p.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(_2,{}),label:"Pausar animaciones",isActive:v.isActive,onClick:v.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(L2,{}),label:"Cursor grande",isActive:m.isActive,onClick:m.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(U2,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:h.isActive,onClick:h.toggle})]}),g.isOpen&&g.structure.length>0&&(0,y.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,y.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,y.jsx)("ul",{className:"space-y-1",children:g.structure.map((M,vi)=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",onClick:()=>g.navigateTo(M),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(M.level||1)*12}px`},children:[(0,y.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:M.tag}),(0,y.jsx)("span",{className:"text-gray-700",children:M.text})]})},`${M.tag}-${vi}`))})]}),g.isOpen&&g.structure.length===0&&(0,y.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,y.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,y.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,y.jsx)("button",{type:"button",onClick:C,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function S2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function b2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function E2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function A2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function C2(){return(0,y.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function M2(){return(0,y.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,y.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function T2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,y.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function O2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M12 3v18"}),(0,y.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function z2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,y.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function x2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function _2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,y.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function L2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function D2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,y.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function N2({mode:t}){return t==="center"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):t==="right"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function H2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function R2({profile:t}){switch(t){case"visionImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,y.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,y.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function U2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var fe=N(bt(),1);function zf({position:t="bottom-left",className:e}={}){let[l,n]=(0,hc.useState)(!0),{hasActiveFeatures:a}=vc(),{fabStyle:i,isDragging:u,fabRef:c,dragHandlers:o}=_g({defaultPosition:t,onTap:()=>n(d=>!d),disabled:l});(0,hc.useEffect)(()=>{if(!l)return;let d=v=>{v.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let f=l||a?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("div",{ref:c,className:e,style:{...i,zIndex:l?30:50,opacity:u?.85:1,filter:a?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${a?"Funciones activas":"Sin funciones activas"}`,...o,onKeyDown:d=>{l||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,fe.jsx)(cf,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,fe.jsx)(qm,{className:"w-full z-50",color:f,stroke:f})})}),(0,fe.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":l?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,fe.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":l?"true":"false",children:(0,fe.jsx)(Dg,{onClose:()=>n(!1)})})]})}var _f=N(bt(),1),B2={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function xf(t){return{...B2,...t}}function q2(t,e){return{...t,...e,theme:{...t.theme??{},...e.theme??{}}}}function Ng(t,e){t.style.setProperty("--apea-color-primary-500",e.primary500),t.style.setProperty("--apea-color-primary-600",e.primary600),t.style.setProperty("--apea-color-primary-700",e.primary700),t.style.setProperty("--apea-color-panel-bg",e.panelBackground),t.style.setProperty("--apea-color-fab-active",e.fabActive),t.style.setProperty("--apea-color-fab-inactive",e.fabInactive),t.style.setProperty("--apea-color-backdrop",e.backdrop)}function Rg(t={}){let e={position:t.position||"bottom-left",zIndex:t.zIndex||9999,containerId:t.containerId||"ape-accessibility-root",theme:xf(t.theme)},l=xf(e.theme),n=e.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:t};let a=document.createElement("style");a.id="ape-accessibility-tools-css",a.textContent=`/* ============================================= */
|
|
22
|
+
`)}function Og(t,e){t.style.top="-9999px",t.style.left="-9999px",t.style.display="block",t.style.opacity="0";let a=t.offsetHeight||100,i=e.top-a-8,u=e.left+e.width/2-320/2;i<8&&(i=e.bottom+8),u<8&&(u=8),u+320>window.innerWidth-8&&(u=window.innerWidth-320-8),t.style.top=`${i}px`,t.style.left=`${u}px`,t.style.opacity="1"}function ia(){let t=document.getElementById(ua);t&&(t.style.opacity="0",setTimeout(()=>{t.style.opacity==="0"&&(t.style.display="none")},150))}function s2(){document.getElementById(ua)?.remove()}var zg="es",yf="",pc=null;async function f2(t){if(t.composedPath()[0]?.closest?.("[data-a11y-icon]")){ia();return}let l=window.getSelection();if(!l||l.rangeCount===0){ia();return}let n=l.toString().trim();if(!n||/\s/.test(n)||n.length<2||n.length>50){ia();return}let a=n;yf=a;let u=l.getRangeAt(0).getBoundingClientRect();u2(a,u);try{let c=await l2(a,zg);if(yf!==a)return;if(!c.length){o2(a);return}c2(a,c,u)}catch{ia()}}function r2(t){t.composedPath()[0]?.id!==ua&&ia()}function gi(t,e="es"){if(zg=e,t){if(pc)return;let l=a=>{f2(a)},n=a=>{r2(a)};document.addEventListener("mouseup",l),document.addEventListener("mousedown",n),pc=()=>{document.removeEventListener("mouseup",l),document.removeEventListener("mousedown",n)}}else pc?.(),pc=null,yf="",ia(),s2()}function xg(){let[t,e]=(0,_l.useState)(()=>D().dictionaryActive??!1);(0,_l.useEffect)(()=>{let n=D();gi(t,n.language??"es")},[]),(0,_l.useEffect)(()=>{let n=a=>{let{settings:i}=a.detail,u=i.dictionaryActive??!1;u!==t&&(e(u),gi(u,i.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",n),()=>window.removeEventListener("accessibilitySettingsChanged",n)},[t]),(0,_l.useEffect)(()=>()=>{gi(!1)},[]);let l=(0,_l.useCallback)(()=>{let n=!t,a=D().language??"es";e(n),gi(n,a),Y("dictionaryActive",n)},[t]);return{isActive:t,toggle:l}}function vc(){let t=Xm(),e=Zm(),l=Vm(),n=Qm(),a=Jm(),i=Wm(),u=Pm(),c=tg(),o=eg(),f=lg(),d=og(),v=sg(),m=fg(),p=dg(),b=mg(),E=vg(),O=Sg(),r=Ag(),s=xg(),g=D(),h=jm(g);return{contrast:t,textSize:e,language:l,colorblind:n,saturation:a,dyslexia:i,letterSpacing:u,lineHeight:c,fontWeight:o,highlight:f,animations:d,cursor:v,readingGuide:m,hideImages:p,textAlign:b,tts:E,profiles:O,pageStructure:r,dictionary:s,hasActiveFeatures:h,resetAllFeatures:()=>{na(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:g}}var Jt=N(K(),1);var hf="apea-fab-position",Ae=60,Ht=16,d2=6;function ca(t,e,l){return Math.max(e,Math.min(l,t))}function m2(){try{let t=localStorage.getItem(hf);if(!t)return null;let e=JSON.parse(t);if(e.vEdge!=="top"&&e.vEdge!=="bottom"||e.hEdge!=="left"&&e.hEdge!=="right"||typeof e.vOffset!="number"||typeof e.hOffset!="number"||isNaN(e.vOffset)||isNaN(e.hOffset))return localStorage.removeItem(hf),null;let l=typeof window<"u"?window.innerWidth:1e3,n=typeof window<"u"?window.innerHeight:1e3,a=ca(e.hOffset,Ht,Math.max(Ht,l/2-Ae/2)),i=ca(e.vOffset,Ht,Math.max(Ht,n/2-Ae/2));return a>Ht&&i>Ht&&(a<i?a=Ht:i=Ht),{vEdge:e.vEdge,hEdge:e.hEdge,hOffset:a,vOffset:i}}catch{return null}}function g2(t){try{localStorage.setItem(hf,JSON.stringify(t))}catch{}}function p2(t){return m2()??{vEdge:"bottom",hEdge:t==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function Sf(t,e,l){return{x:t.hEdge==="left"?t.hOffset:e-t.hOffset-Ae,y:t.vEdge==="top"?t.vOffset:l-t.vOffset-Ae}}function v2(t,e,l,n){let a=t,i=l-t-Ae,u=e,c=n-e-Ae,o=Math.min(a,i,u,c),f="left",d="top",v=Ht,m=Ht;return o===a||o===i?(f=o===a?"left":"right",v=Ht,d=u<=c?"top":"bottom",m=ca(d==="top"?e:c,Ht,n/2-Ae/2)):(d=o===u?"top":"bottom",m=Ht,f=a<=i?"left":"right",v=ca(f==="left"?t:i,Ht,l/2-Ae/2)),{hEdge:f,vEdge:d,hOffset:v,vOffset:m}}function y2(t,e){let l=Pu(),n=window.innerWidth/l,a=window.innerHeight/l,i=Sf(t,n,a);return{position:"fixed",top:`${i.y}px`,left:`${i.x}px`,cursor:e?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:e?"none":"all 0.25s ease"}}function _g({defaultPosition:t="bottom-left",onTap:e,disabled:l=!1}={}){let[n,a]=(0,Jt.useState)(()=>p2(t)),[i,u]=(0,Jt.useState)(!1),[,c]=(0,Jt.useState)(0),o=(0,Jt.useRef)(null),f=(0,Jt.useRef)(e);f.current=e;let d=(0,Jt.useRef)(n);d.current=n;let v=(0,Jt.useRef)(l);v.current=l,(0,Jt.useEffect)(()=>{let p=()=>{c(b=>b+1)};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);let m=(0,Jt.useCallback)((p,b)=>{if(v.current)return;let E=Pu(),O=st=>st/E,r=O(window.innerWidth),s=O(window.innerHeight),g=Sf(d.current,r,s),h=g.x,C=g.y,R=o.current;R&&(R.style.transition="none");let A=O(p)-h,z=O(b)-C,_=h,H=C,Rt=0;function M(st,Ll){let sn=ca(O(st)-A,0,r-Ae),sa=ca(O(Ll)-z,0,s-Ae);Rt+=Math.abs(sn-_)+Math.abs(sa-H),_=sn,H=sa;let fa=o.current;fa&&(fa.style.top=`${sa}px`,fa.style.left=`${sn}px`)}function vi(st,Ll){let sn=Pu(),sa=window.innerWidth/sn,fa=window.innerHeight/sn,{x:wg,y:Yg}=Sf(Ll,sa,fa);st.style.top=`${Yg}px`,st.style.left=`${wg}px`,st.style.transition="all 0.25s ease"}function Uf(){qg();let st=o.current;if(Rt<d2)st&&vi(st,d.current),u(!1),f.current?.();else{let Ll=v2(_,H,r,s);g2(Ll),st&&vi(st,Ll),u(!1),a(Ll)}}function Bf(st){M(st.clientX,st.clientY)}function qf(st){st.preventDefault(),M(st.touches[0].clientX,st.touches[0].clientY)}function wf(){Uf()}function Yf(){Uf()}function qg(){window.removeEventListener("mousemove",Bf),window.removeEventListener("mouseup",wf),window.removeEventListener("touchmove",qf),window.removeEventListener("touchend",Yf)}window.addEventListener("mousemove",Bf),window.addEventListener("mouseup",wf),window.addEventListener("touchmove",qf,{passive:!1}),window.addEventListener("touchend",Yf),u(!0)},[]);return{fabStyle:y2(n,i),isDragging:i,fabRef:o,dragHandlers:{onMouseDown:p=>{p.button!==0||v.current||(p.preventDefault(),m(p.clientX,p.clientY))},onTouchStart:p=>{v.current||m(p.touches[0].clientX,p.touches[0].clientY)}}}}var Lg=N(K(),1);var yc=N(bt(),1);function bf({title:t,children:e}){return(0,yc.jsxs)("section",{className:"px-4 py-3",children:[(0,yc.jsx)("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:t}),e]})}var on=N(bt(),1);function Ce({icon:t,label:e,isActive:l,onClick:n,disabled:a=!1,className:i,hint:u}){return(0,on.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":e,onClick:a?void 0:n,disabled:a,className:Se("apea-focus apea-feature-row",i),"data-active":l,"data-disabled":a||void 0,children:[(0,on.jsx)("span",{className:Se("h-5 w-5 shrink-0",l?"text-blue-700":"text-gray-500"),children:t}),(0,on.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:e}),u&&(0,on.jsx)("span",{title:u,"aria-label":u,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),(0,on.jsx)("span",{className:"apea-toggle","data-checked":l,"aria-hidden":"true"})]})}var se=N(bt(),1);function h2(){return(0,se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,se.jsx)("polyline",{points:"2,6 5,9 10,3"})})}function Je({icon:t,name:e,levels:l,currentIndex:n,onCycle:a,className:i}){let u=n>=0,c=u?l[n]:null,o=l.length>1;function f(){let m=n>=l.length-1?-1:n+1;a(m)}function d(m){(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),f())}let v=u?`${e}: ${c.label}`:e;return(0,se.jsxs)("div",{role:"button",tabIndex:0,"aria-label":v,"aria-roledescription":"cyclic toggle","aria-pressed":u,...o&&u?{"aria-valuenow":n+1,"aria-valuemax":l.length}:{},"data-active":u,onClick:f,onKeyDown:d,className:Se("apea-focus apea-cyclic-tile",i),children:[(0,se.jsx)("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:u&&(0,se.jsx)(h2,{})}),(0,se.jsx)("span",{className:"apea-cyclic-tile__icon",children:t}),(0,se.jsx)("span",{className:"apea-cyclic-tile__label",children:u?c.label:e}),o&&(0,se.jsx)("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:l.map((m,p)=>(0,se.jsx)("span",{className:"apea-cyclic-dot","data-filled":u&&p<=n},p))})]})}var y=N(bt(),1),Ef=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],Af=[{label:"Alto Contraste",value:"high"}],Cf=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],Mf=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],Tf=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],Of=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Dg({onClose:t}){let[e,l]=(0,Lg.useState)(!1),{contrast:n,textSize:a,saturation:i,dyslexia:u,letterSpacing:c,lineHeight:o,fontWeight:f,highlight:d,animations:v,cursor:m,readingGuide:p,colorblind:b,hideImages:E,textAlign:O,tts:r,profiles:s,pageStructure:g,dictionary:h,resetAllFeatures:C}=vc(),R=Ef.findIndex(M=>M.value===a.textSizePercentage),A=Af.findIndex(M=>M.value===n.contrastMode),z=Cf.findIndex(M=>M.value===i.saturationMode),_=Mf.findIndex(M=>M.value===o.level),H=Tf.findIndex(M=>M.value===c.level),Rt=Of.findIndex(M=>M.value===O.mode);return(0,y.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[(0,y.jsxs)("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[(0,y.jsx)("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),(0,y.jsx)("div",{className:"flex items-center gap-2",children:(0,y.jsx)("button",{type:"button",onClick:t,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),(0,y.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,y.jsxs)("section",{className:"px-4 pb-0 py-3",children:[(0,y.jsxs)("button",{type:"button",onClick:()=>l(M=>!M),"aria-expanded":e,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${e?"rotate-180":""}`,"data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e&&(0,y.jsx)("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(pf).map(M=>(0,y.jsx)(Ce,{icon:(0,y.jsx)(R2,{profile:M}),label:pf[M],isActive:s.activeProfile===M,onClick:()=>s.applyProfile(M)},M))})]}),(0,y.jsx)("section",{className:"px-4 pt-0 py-3",children:(0,y.jsxs)("div",{className:"apea-cyclic-grid",children:[(0,y.jsx)(Je,{icon:(0,y.jsx)(H2,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:r.isReading?0:-1,onCycle:()=>r.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(S2,{}),name:"Tama\xF1o de fuente",levels:Ef,currentIndex:R,onCycle:M=>a.setSpecificTextSize(M===-1?100:Ef[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(O2,{}),name:"Contraste",levels:Af,currentIndex:A,onCycle:M=>n.setContrastMode(M===-1?"normal":Af[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(z2,{}),name:"Saturaci\xF3n",levels:Cf,currentIndex:z,onCycle:M=>i.setSaturationMode(M===-1?"normal":Cf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(M2,{}),name:"Interlineado",levels:Mf,currentIndex:_,onCycle:M=>o.setTo(M===-1?14:Mf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(C2,{}),name:"Interletrado",levels:Tf,currentIndex:H,onCycle:M=>c.setTo(M===-1?0:Tf[M].value)}),(0,y.jsx)(Je,{icon:(0,y.jsx)(A2,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:u.isActive?0:-1,onCycle:()=>u.toggle()}),(0,y.jsx)(Je,{icon:(0,y.jsx)(N2,{mode:O.mode}),name:"Alinear texto",levels:Of,currentIndex:Rt,onCycle:M=>O.setMode(M===-1?"default":Of[M].value)})]})}),(0,y.jsx)(bf,{title:"Ajustes de contenido",children:(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(b2,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(E2,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(T2,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(D2,{}),label:"Ocultar im\xE1genes",isActive:E.isActive,onClick:E.toggle})]})}),(0,y.jsxs)(bf,{title:"Herramientas",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,y.jsx)(Ce,{icon:(0,y.jsx)(x2,{}),label:"Gu\xEDa de lectura",isActive:p.isActive,onClick:p.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(_2,{}),label:"Pausar animaciones",isActive:v.isActive,onClick:v.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(L2,{}),label:"Cursor grande",isActive:m.isActive,onClick:m.toggle}),(0,y.jsx)(Ce,{icon:(0,y.jsx)(U2,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:h.isActive,onClick:h.toggle})]}),g.isOpen&&g.structure.length>0&&(0,y.jsxs)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[(0,y.jsx)("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),(0,y.jsx)("ul",{className:"space-y-1",children:g.structure.map((M,vi)=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",onClick:()=>g.navigateTo(M),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(M.level||1)*12}px`},children:[(0,y.jsx)("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:M.tag}),(0,y.jsx)("span",{className:"text-gray-700",children:M.text})]})},`${M.tag}-${vi}`))})]}),g.isOpen&&g.structure.length===0&&(0,y.jsx)("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:(0,y.jsx)("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),(0,y.jsx)("section",{className:"px-4 pb-6 pt-2",children:(0,y.jsx)("button",{type:"button",onClick:C,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function S2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function b2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function E2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function A2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function C2(){return(0,y.jsx)("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function M2(){return(0,y.jsxs)("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),(0,y.jsx)("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function T2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),(0,y.jsx)("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function O2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M12 3v18"}),(0,y.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function z2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,y.jsx)("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function x2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function _2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),(0,y.jsx)("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function L2(){return(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function D2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,y.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function N2({mode:t}){return t==="center"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):t==="right"?(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):(0,y.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:(0,y.jsx)("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function H2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),(0,y.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),(0,y.jsx)("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function R2({profile:t}){switch(t){case"visionImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),(0,y.jsx)("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("circle",{cx:"8",cy:"20",r:"2"}),(0,y.jsx)("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),(0,y.jsx)("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function U2(){return(0,y.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[(0,y.jsx)("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),(0,y.jsx)("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}var fe=N(bt(),1);function zf({position:t="bottom-left",className:e}={}){let[l,n]=(0,hc.useState)(!1),{hasActiveFeatures:a}=vc(),{fabStyle:i,isDragging:u,fabRef:c,dragHandlers:o}=_g({defaultPosition:t,onTap:()=>n(d=>!d),disabled:l});(0,hc.useEffect)(()=>{if(!l)return;let d=v=>{v.key==="Escape"&&n(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let f=l||a?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("div",{ref:c,className:e,style:{...i,zIndex:l?30:50,opacity:u?.85:1,filter:a?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${a?"Funciones activas":"Sin funciones activas"}`,...o,onKeyDown:d=>{l||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},children:(0,fe.jsx)(cf,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:(0,fe.jsx)(qm,{className:"w-full z-50",color:f,stroke:f})})}),(0,fe.jsx)("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":l?"true":"false",onClick:()=>n(!1),"aria-hidden":"true"}),(0,fe.jsx)("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":l?"true":"false",children:(0,fe.jsx)(Dg,{onClose:()=>n(!1)})})]})}var _f=N(bt(),1),B2={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function xf(t){return{...B2,...t}}function q2(t,e){return{...t,...e,theme:{...t.theme??{},...e.theme??{}}}}function Ng(t,e){t.style.setProperty("--apea-color-primary-500",e.primary500),t.style.setProperty("--apea-color-primary-600",e.primary600),t.style.setProperty("--apea-color-primary-700",e.primary700),t.style.setProperty("--apea-color-panel-bg",e.panelBackground),t.style.setProperty("--apea-color-fab-active",e.fabActive),t.style.setProperty("--apea-color-fab-inactive",e.fabInactive),t.style.setProperty("--apea-color-backdrop",e.backdrop)}function Rg(t={}){let e={position:t.position||"bottom-left",zIndex:t.zIndex||9999,containerId:t.containerId||"ape-accessibility-root",theme:xf(t.theme)},l=xf(e.theme),n=e.containerId||"ape-accessibility-root";if(document.getElementById(n))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:t};let a=document.createElement("style");a.id="ape-accessibility-tools-css",a.textContent=`/* ============================================= */
|
|
23
23
|
/* Accessibility Feature Styles */
|
|
24
24
|
/* ============================================= */
|
|
25
25
|
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import{createRoot as ko}from"react-dom/client";import{useState as Ao,useEffect a
|
|
|
11
11
|
`,Mi(n,t)}function Bn(e,t,n){let i=Ai(),o=t.slice(0,3),s=`<div style="font-weight:700;font-size:14px;margin-bottom:8px;color:#1d4ed8">${e}</div>`;for(let a of o){s+=`<div style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#9ca3af;margin-bottom:3px">${a.partOfSpeech}</div>`;for(let c of a.definitions.slice(0,2)){let l=wi(c.definition);s+=`<div style="margin-bottom:5px;color:#374151">\u2022 ${l}</div>`}}i.innerHTML=s,Mi(i,n)}function Vn(e){let t=document.getElementById(Z);t&&(t.innerHTML=`
|
|
12
12
|
<div style="font-weight:700;font-size:14px;margin-bottom:4px;color:#1d4ed8">${e}</div>
|
|
13
13
|
<div style="color:#9ca3af;font-size:12px">Sin definici\xF3n disponible</div>
|
|
14
|
-
`)}function Mi(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,s=t.top-o-8,a=t.left+t.width/2-320/2;s<8&&(s=t.bottom+8),a<8&&(a=8),a+320>window.innerWidth-8&&(a=window.innerWidth-320-8),e.style.top=`${s}px`,e.style.left=`${a}px`,e.style.opacity="1"}function q(){let e=document.getElementById(Z);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function jn(){document.getElementById(Z)?.remove()}var Ii="es",Ye="",Pe=null;async function Gn(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){q();return}let n=window.getSelection();if(!n||n.rangeCount===0){q();return}let i=n.toString().trim();if(!i||/\s/.test(i)||i.length<2||i.length>50){q();return}let o=i;Ye=o;let a=n.getRangeAt(0).getBoundingClientRect();Fn(o,a);try{let c=await Dn(o,Ii);if(Ye!==o)return;if(!c.length){Vn(o);return}Bn(o,c,a)}catch{q()}}function $n(e){e.composedPath()[0]?.id!==Z&&q()}function ne(e,t="es"){if(Ii=t,e){if(Pe)return;let n=o=>{Gn(o)},i=o=>{$n(o)};document.addEventListener("mouseup",n),document.addEventListener("mousedown",i),Pe=()=>{document.removeEventListener("mouseup",n),document.removeEventListener("mousedown",i)}}else Pe?.(),Pe=null,Ye="",q(),jn()}function Oi(){let[e,t]=qn(()=>p().dictionaryActive??!1);Je(()=>{let i=p();ne(e,i.language??"es")},[]),Je(()=>{let i=o=>{let{settings:s}=o.detail,a=s.dictionaryActive??!1;a!==e&&(t(a),ne(a,s.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",i),()=>window.removeEventListener("accessibilitySettingsChanged",i)},[e]),Je(()=>()=>{ne(!1)},[]);let n=Zn(()=>{let i=!e,o=p().language??"es";t(i),ne(i,o),g("dictionaryActive",i)},[e]);return{isActive:e,toggle:n}}function Re(){let e=Lt(),t=Mt(),n=It(),i=kt(),o=Pt(),s=Dt(),a=Bt(),c=jt(),l=$t(),f=Zt(),d=ei(),m=ii(),v=oi(),h=ri(),A=di(),x=gi(),C=yi(),b=Ei(),O=Oi(),E=p(),M=xt(E);return{contrast:e,textSize:t,language:n,colorblind:i,saturation:o,dyslexia:s,letterSpacing:a,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:A,tts:x,profiles:C,pageStructure:b,dictionary:O,hasActiveFeatures:M,resetAllFeatures:()=>{G(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:E}}import{useCallback as Un,useEffect as Xn,useRef as He,useState as Qe}from"react";var et="apea-fab-position",T=60,L=16,Kn=6;function U(e,t,n){return Math.max(t,Math.min(n,e))}function Yn(){try{let e=localStorage.getItem(et);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(et),null;let n=typeof window<"u"?window.innerWidth:1e3,i=typeof window<"u"?window.innerHeight:1e3,o=U(t.hOffset,L,Math.max(L,n/2-T/2)),s=U(t.vOffset,L,Math.max(L,i/2-T/2));return o>L&&s>L&&(o<s?o=L:s=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:s}}catch{return null}}function Jn(e){try{localStorage.setItem(et,JSON.stringify(e))}catch{}}function Qn(e){return Yn()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function tt(e,t,n){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-T,y:e.vEdge==="top"?e.vOffset:n-e.vOffset-T}}function eo(e,t,n,i){let o=e,s=n-e-T,a=t,c=i-t-T,l=Math.min(o,s,a,c),f="left",d="top",m=L,v=L;return l===o||l===s?(f=l===o?"left":"right",m=L,d=a<=c?"top":"bottom",v=U(d==="top"?t:c,L,i/2-T/2)):(d=l===a?"top":"bottom",v=L,f=o<=s?"left":"right",m=U(f==="left"?e:s,L,n/2-T/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function to(e,t){let n=fe(),i=window.innerWidth/n,o=window.innerHeight/n,s=tt(e,i,o);return{position:"fixed",top:`${s.y}px`,left:`${s.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function ki({defaultPosition:e="bottom-left",onTap:t,disabled:n=!1}={}){let[i,o]=Qe(()=>Qn(e)),[s,a]=Qe(!1),[,c]=Qe(0),l=He(null),f=He(t);f.current=t;let d=He(i);d.current=i;let m=He(n);m.current=n,Xn(()=>{let h=()=>{c(A=>A+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=Un((h,A)=>{if(m.current)return;let x=fe(),C=S=>S/x,b=C(window.innerWidth),O=C(window.innerHeight),E=tt(d.current,b,O),M=E.x,K=E.y,se=l.current;se&&(se.style.transition="none");let _e=C(h)-M,ze=C(A)-K,Y=M,J=K,ae=0;function u(S,W){let j=U(C(S)-_e,0,b-T),Q=U(C(W)-ze,0,O-T);ae+=Math.abs(j-Y)+Math.abs(Q-J),Y=j,J=Q;let ee=l.current;ee&&(ee.style.top=`${Q}px`,ee.style.left=`${j}px`)}function re(S,W){let j=fe(),Q=window.innerWidth/j,ee=window.innerHeight/j,{x:ji,y:Gi}=tt(W,Q,ee);S.style.top=`${Gi}px`,S.style.left=`${ji}px`,S.style.transition="all 0.25s ease"}function pt(){Vi();let S=l.current;if(ae<Kn)S&&re(S,d.current),a(!1),f.current?.();else{let W=eo(Y,J,b,O);Jn(W),S&&re(S,W),a(!1),o(W)}}function ft(S){u(S.clientX,S.clientY)}function mt(S){S.preventDefault(),u(S.touches[0].clientX,S.touches[0].clientY)}function gt(){pt()}function ht(){pt()}function Vi(){window.removeEventListener("mousemove",ft),window.removeEventListener("mouseup",gt),window.removeEventListener("touchmove",mt),window.removeEventListener("touchend",ht)}window.addEventListener("mousemove",ft),window.addEventListener("mouseup",gt),window.addEventListener("touchmove",mt,{passive:!1}),window.addEventListener("touchend",ht),a(!0)},[]);return{fabStyle:to(i,s),isDragging:s,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}import{useState as ro}from"react";import{jsx as io,jsxs as no}from"react/jsx-runtime";function it({title:e,children:t}){return no("section",{className:"px-4 py-3",children:[io("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}import{jsx as De,jsxs as oo}from"react/jsx-runtime";function N({icon:e,label:t,isActive:n,onClick:i,disabled:o=!1,className:s,hint:a}){return oo("button",{type:"button",role:"switch","aria-checked":n,"aria-label":t,onClick:o?void 0:i,disabled:o,className:k("apea-focus apea-feature-row",s),"data-active":n,"data-disabled":o||void 0,children:[De("span",{className:k("h-5 w-5 shrink-0",n?"text-blue-700":"text-gray-500"),children:e}),De("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),a&&De("span",{title:a,"aria-label":a,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),De("span",{className:"apea-toggle","data-checked":n,"aria-hidden":"true"})]})}import{jsx as z,jsxs as ao}from"react/jsx-runtime";function so(){return z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:z("polyline",{points:"2,6 5,9 10,3"})})}function R({icon:e,name:t,levels:n,currentIndex:i,onCycle:o,className:s}){let a=i>=0,c=a?n[i]:null,l=n.length>1;function f(){let v=i>=n.length-1?-1:i+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=a?`${t}: ${c.label}`:t;return ao("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":a,...l&&a?{"aria-valuenow":i+1,"aria-valuemax":n.length}:{},"data-active":a,onClick:f,onKeyDown:d,className:k("apea-focus apea-cyclic-tile",s),children:[z("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:a&&z(so,{})}),z("span",{className:"apea-cyclic-tile__icon",children:e}),z("span",{className:"apea-cyclic-tile__label",children:a?c.label:t}),l&&z("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:n.map((v,h)=>z("span",{className:"apea-cyclic-dot","data-filled":a&&h<=i},h))})]})}import{jsx as r,jsxs as y}from"react/jsx-runtime";var nt=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],ot=[{label:"Alto Contraste",value:"high"}],st=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],at=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],rt=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],ct=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Ti({onClose:e}){let[t,n]=ro(!1),{contrast:i,textSize:o,saturation:s,dyslexia:a,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:A,hideImages:x,textAlign:C,tts:b,profiles:O,pageStructure:E,dictionary:M,resetAllFeatures:K}=Re(),se=nt.findIndex(u=>u.value===o.textSizePercentage),_e=ot.findIndex(u=>u.value===i.contrastMode),ze=st.findIndex(u=>u.value===s.saturationMode),Y=at.findIndex(u=>u.value===l.level),J=rt.findIndex(u=>u.value===c.level),ae=ct.findIndex(u=>u.value===C.mode);return y("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[y("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[r("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),r("div",{className:"flex items-center gap-2",children:r("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:r("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),y("div",{className:"flex-1 overflow-y-auto",children:[y("section",{className:"px-4 pb-0 py-3",children:[y("button",{type:"button",onClick:()=>n(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:r("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&r("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(Xe).map(u=>r(N,{icon:r(Lo,{profile:u}),label:Xe[u],isActive:O.activeProfile===u,onClick:()=>O.applyProfile(u)},u))})]}),r("section",{className:"px-4 pt-0 py-3",children:y("div",{className:"apea-cyclic-grid",children:[r(R,{icon:r(Eo,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:b.isReading?0:-1,onCycle:()=>b.toggle()}),r(R,{icon:r(co,{}),name:"Tama\xF1o de fuente",levels:nt,currentIndex:se,onCycle:u=>o.setSpecificTextSize(u===-1?100:nt[u].value)}),r(R,{icon:r(ho,{}),name:"Contraste",levels:ot,currentIndex:_e,onCycle:u=>i.setContrastMode(u===-1?"normal":ot[u].value)}),r(R,{icon:r(vo,{}),name:"Saturaci\xF3n",levels:st,currentIndex:ze,onCycle:u=>s.setSaturationMode(u===-1?"normal":st[u].value)}),r(R,{icon:r(mo,{}),name:"Interlineado",levels:at,currentIndex:Y,onCycle:u=>l.setTo(u===-1?14:at[u].value)}),r(R,{icon:r(fo,{}),name:"Interletrado",levels:rt,currentIndex:J,onCycle:u=>c.setTo(u===-1?0:rt[u].value)}),r(R,{icon:r(po,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:a.isActive?0:-1,onCycle:()=>a.toggle()}),r(R,{icon:r(xo,{mode:C.mode}),name:"Alinear texto",levels:ct,currentIndex:ae,onCycle:u=>C.setMode(u===-1?"default":ct[u].value)})]})}),r(it,{title:"Ajustes de contenido",children:y("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(lo,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),r(N,{icon:r(uo,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),r(N,{icon:r(go,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),r(N,{icon:r(Co,{}),label:"Ocultar im\xE1genes",isActive:x.isActive,onClick:x.toggle})]})}),y(it,{title:"Herramientas",children:[y("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(bo,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),r(N,{icon:r(yo,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),r(N,{icon:r(So,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),r(N,{icon:r(wo,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:M.isActive,onClick:M.toggle})]}),E.isOpen&&E.structure.length>0&&y("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[r("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),r("ul",{className:"space-y-1",children:E.structure.map((u,re)=>r("li",{children:y("button",{type:"button",onClick:()=>E.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[r("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),r("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${re}`))})]}),E.isOpen&&E.structure.length===0&&r("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:r("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),r("section",{className:"px-4 pb-6 pt-2",children:r("button",{type:"button",onClick:K,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function co(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function lo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),r("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function uo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function po(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function fo(){return r("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:r("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function mo(){return y("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[r("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),r("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function go(){return y("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),r("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function ho(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function vo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"8"}),r("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),r("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function bo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),r("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function yo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),r("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function So(){return r("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function Co(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),r("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),r("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function xo({mode:e}){return e==="center"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function Eo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),r("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),r("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function Lo({profile:e}){switch(e){case"visionImpaired":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),r("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),r("circle",{cx:"8",cy:"20",r:"2"}),r("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function wo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),r("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}import{Fragment as Io,jsx as X,jsxs as Oo}from"react/jsx-runtime";function lt({position:e="bottom-left",className:t}={}){let[n,i]=Ao(!0),{hasActiveFeatures:o}=Re(),{fabStyle:s,isDragging:a,fabRef:c,dragHandlers:l}=ki({defaultPosition:e,onTap:()=>i(d=>!d),disabled:n});Mo(()=>{if(!n)return;let d=m=>{m.key==="Escape"&&i(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]);let f=n||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return Oo(Io,{children:[X("div",{ref:c,className:t,style:{...s,zIndex:n?30:50,opacity:a?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":n,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{n||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i(!0))},children:X(We,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:X(bt,{className:"w-full z-50",color:f,stroke:f})})}),X("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":n?"true":"false",onClick:()=>i(!1),"aria-hidden":"true"}),X("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":n?"true":"false",children:X(Ti,{onClose:()=>i(!1)})})]})}import{jsx as Pi}from"react/jsx-runtime";var To={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function dt(e){return{...To,...e}}function No(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Ni(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function Ri(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:dt(e.theme)},n=dt(t.theme),i=t.containerId||"ape-accessibility-root";if(document.getElementById(i))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
14
|
+
`)}function Mi(e,t){e.style.top="-9999px",e.style.left="-9999px",e.style.display="block",e.style.opacity="0";let o=e.offsetHeight||100,s=t.top-o-8,a=t.left+t.width/2-320/2;s<8&&(s=t.bottom+8),a<8&&(a=8),a+320>window.innerWidth-8&&(a=window.innerWidth-320-8),e.style.top=`${s}px`,e.style.left=`${a}px`,e.style.opacity="1"}function q(){let e=document.getElementById(Z);e&&(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},150))}function jn(){document.getElementById(Z)?.remove()}var Ii="es",Ye="",Pe=null;async function Gn(e){if(e.composedPath()[0]?.closest?.("[data-a11y-icon]")){q();return}let n=window.getSelection();if(!n||n.rangeCount===0){q();return}let i=n.toString().trim();if(!i||/\s/.test(i)||i.length<2||i.length>50){q();return}let o=i;Ye=o;let a=n.getRangeAt(0).getBoundingClientRect();Fn(o,a);try{let c=await Dn(o,Ii);if(Ye!==o)return;if(!c.length){Vn(o);return}Bn(o,c,a)}catch{q()}}function $n(e){e.composedPath()[0]?.id!==Z&&q()}function ne(e,t="es"){if(Ii=t,e){if(Pe)return;let n=o=>{Gn(o)},i=o=>{$n(o)};document.addEventListener("mouseup",n),document.addEventListener("mousedown",i),Pe=()=>{document.removeEventListener("mouseup",n),document.removeEventListener("mousedown",i)}}else Pe?.(),Pe=null,Ye="",q(),jn()}function Oi(){let[e,t]=qn(()=>p().dictionaryActive??!1);Je(()=>{let i=p();ne(e,i.language??"es")},[]),Je(()=>{let i=o=>{let{settings:s}=o.detail,a=s.dictionaryActive??!1;a!==e&&(t(a),ne(a,s.language??"es"))};return window.addEventListener("accessibilitySettingsChanged",i),()=>window.removeEventListener("accessibilitySettingsChanged",i)},[e]),Je(()=>()=>{ne(!1)},[]);let n=Zn(()=>{let i=!e,o=p().language??"es";t(i),ne(i,o),g("dictionaryActive",i)},[e]);return{isActive:e,toggle:n}}function Re(){let e=Lt(),t=Mt(),n=It(),i=kt(),o=Pt(),s=Dt(),a=Bt(),c=jt(),l=$t(),f=Zt(),d=ei(),m=ii(),v=oi(),h=ri(),A=di(),x=gi(),C=yi(),b=Ei(),O=Oi(),E=p(),M=xt(E);return{contrast:e,textSize:t,language:n,colorblind:i,saturation:o,dyslexia:s,letterSpacing:a,lineHeight:c,fontWeight:l,highlight:f,animations:d,cursor:m,readingGuide:v,hideImages:h,textAlign:A,tts:x,profiles:C,pageStructure:b,dictionary:O,hasActiveFeatures:M,resetAllFeatures:()=>{G(),window.dispatchEvent(new CustomEvent("accessibilityReset",{detail:{timestamp:Date.now()}}))},currentSettings:E}}import{useCallback as Un,useEffect as Xn,useRef as He,useState as Qe}from"react";var et="apea-fab-position",T=60,L=16,Kn=6;function U(e,t,n){return Math.max(t,Math.min(n,e))}function Yn(){try{let e=localStorage.getItem(et);if(!e)return null;let t=JSON.parse(e);if(t.vEdge!=="top"&&t.vEdge!=="bottom"||t.hEdge!=="left"&&t.hEdge!=="right"||typeof t.vOffset!="number"||typeof t.hOffset!="number"||isNaN(t.vOffset)||isNaN(t.hOffset))return localStorage.removeItem(et),null;let n=typeof window<"u"?window.innerWidth:1e3,i=typeof window<"u"?window.innerHeight:1e3,o=U(t.hOffset,L,Math.max(L,n/2-T/2)),s=U(t.vOffset,L,Math.max(L,i/2-T/2));return o>L&&s>L&&(o<s?o=L:s=L),{vEdge:t.vEdge,hEdge:t.hEdge,hOffset:o,vOffset:s}}catch{return null}}function Jn(e){try{localStorage.setItem(et,JSON.stringify(e))}catch{}}function Qn(e){return Yn()??{vEdge:"bottom",hEdge:e==="bottom-right"?"right":"left",vOffset:32,hOffset:20}}function tt(e,t,n){return{x:e.hEdge==="left"?e.hOffset:t-e.hOffset-T,y:e.vEdge==="top"?e.vOffset:n-e.vOffset-T}}function eo(e,t,n,i){let o=e,s=n-e-T,a=t,c=i-t-T,l=Math.min(o,s,a,c),f="left",d="top",m=L,v=L;return l===o||l===s?(f=l===o?"left":"right",m=L,d=a<=c?"top":"bottom",v=U(d==="top"?t:c,L,i/2-T/2)):(d=l===a?"top":"bottom",v=L,f=o<=s?"left":"right",m=U(f==="left"?e:s,L,n/2-T/2)),{hEdge:f,vEdge:d,hOffset:m,vOffset:v}}function to(e,t){let n=fe(),i=window.innerWidth/n,o=window.innerHeight/n,s=tt(e,i,o);return{position:"fixed",top:`${s.y}px`,left:`${s.x}px`,cursor:t?"grabbing":"grab",userSelect:"none",touchAction:"none",transition:t?"none":"all 0.25s ease"}}function ki({defaultPosition:e="bottom-left",onTap:t,disabled:n=!1}={}){let[i,o]=Qe(()=>Qn(e)),[s,a]=Qe(!1),[,c]=Qe(0),l=He(null),f=He(t);f.current=t;let d=He(i);d.current=i;let m=He(n);m.current=n,Xn(()=>{let h=()=>{c(A=>A+1)};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let v=Un((h,A)=>{if(m.current)return;let x=fe(),C=S=>S/x,b=C(window.innerWidth),O=C(window.innerHeight),E=tt(d.current,b,O),M=E.x,K=E.y,se=l.current;se&&(se.style.transition="none");let _e=C(h)-M,ze=C(A)-K,Y=M,J=K,ae=0;function u(S,W){let j=U(C(S)-_e,0,b-T),Q=U(C(W)-ze,0,O-T);ae+=Math.abs(j-Y)+Math.abs(Q-J),Y=j,J=Q;let ee=l.current;ee&&(ee.style.top=`${Q}px`,ee.style.left=`${j}px`)}function re(S,W){let j=fe(),Q=window.innerWidth/j,ee=window.innerHeight/j,{x:ji,y:Gi}=tt(W,Q,ee);S.style.top=`${Gi}px`,S.style.left=`${ji}px`,S.style.transition="all 0.25s ease"}function pt(){Vi();let S=l.current;if(ae<Kn)S&&re(S,d.current),a(!1),f.current?.();else{let W=eo(Y,J,b,O);Jn(W),S&&re(S,W),a(!1),o(W)}}function ft(S){u(S.clientX,S.clientY)}function mt(S){S.preventDefault(),u(S.touches[0].clientX,S.touches[0].clientY)}function gt(){pt()}function ht(){pt()}function Vi(){window.removeEventListener("mousemove",ft),window.removeEventListener("mouseup",gt),window.removeEventListener("touchmove",mt),window.removeEventListener("touchend",ht)}window.addEventListener("mousemove",ft),window.addEventListener("mouseup",gt),window.addEventListener("touchmove",mt,{passive:!1}),window.addEventListener("touchend",ht),a(!0)},[]);return{fabStyle:to(i,s),isDragging:s,fabRef:l,dragHandlers:{onMouseDown:h=>{h.button!==0||m.current||(h.preventDefault(),v(h.clientX,h.clientY))},onTouchStart:h=>{m.current||v(h.touches[0].clientX,h.touches[0].clientY)}}}}import{useState as ro}from"react";import{jsx as io,jsxs as no}from"react/jsx-runtime";function it({title:e,children:t}){return no("section",{className:"px-4 py-3",children:[io("h3",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wider mb-3",children:e}),t]})}import{jsx as De,jsxs as oo}from"react/jsx-runtime";function N({icon:e,label:t,isActive:n,onClick:i,disabled:o=!1,className:s,hint:a}){return oo("button",{type:"button",role:"switch","aria-checked":n,"aria-label":t,onClick:o?void 0:i,disabled:o,className:k("apea-focus apea-feature-row",s),"data-active":n,"data-disabled":o||void 0,children:[De("span",{className:k("h-5 w-5 shrink-0",n?"text-blue-700":"text-gray-500"),children:e}),De("span",{className:"flex-1 text-sm font-medium text-gray-700 leading-tight text-left",children:t}),a&&De("span",{title:a,"aria-label":a,role:"note",onClick:c=>c.stopPropagation(),className:"shrink-0 inline-flex h-6 w-6 items-center justify-center rounded-full ring ring-gray-500 text-gray-600 text-sm font-bold cursor-help select-none hover:scale-105 hover:ring-2 hover:ring-blue-600 hover:text-blue-600 transition-all",children:"?"}),De("span",{className:"apea-toggle","data-checked":n,"aria-hidden":"true"})]})}import{jsx as z,jsxs as ao}from"react/jsx-runtime";function so(){return z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:z("polyline",{points:"2,6 5,9 10,3"})})}function R({icon:e,name:t,levels:n,currentIndex:i,onCycle:o,className:s}){let a=i>=0,c=a?n[i]:null,l=n.length>1;function f(){let v=i>=n.length-1?-1:i+1;o(v)}function d(v){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f())}let m=a?`${t}: ${c.label}`:t;return ao("div",{role:"button",tabIndex:0,"aria-label":m,"aria-roledescription":"cyclic toggle","aria-pressed":a,...l&&a?{"aria-valuenow":i+1,"aria-valuemax":n.length}:{},"data-active":a,onClick:f,onKeyDown:d,className:k("apea-focus apea-cyclic-tile",s),children:[z("span",{className:"apea-cyclic-tile__check","aria-hidden":"true",children:a&&z(so,{})}),z("span",{className:"apea-cyclic-tile__icon",children:e}),z("span",{className:"apea-cyclic-tile__label",children:a?c.label:t}),l&&z("span",{className:"apea-cyclic-tile__dots","aria-hidden":"true",children:n.map((v,h)=>z("span",{className:"apea-cyclic-dot","data-filled":a&&h<=i},h))})]})}import{jsx as r,jsxs as y}from"react/jsx-runtime";var nt=[{label:"Leve",value:120},{label:"Grande",value:130},{label:"M\xE1s grande",value:150},{label:"M\xE1ximo",value:160}],ot=[{label:"Alto Contraste",value:"high"}],st=[{label:"Alta Saturaci\xF3n",value:"high"},{label:"Baja Saturaci\xF3n",value:"low"},{label:"Desaturado",value:"mono"}],at=[{label:"Leve",value:16},{label:"Medio",value:19},{label:"M\xE1ximo",value:23}],rt=[{label:"Leve",value:2},{label:"Medio",value:3},{label:"M\xE1ximo",value:5}],ct=[{label:"Izquierda",value:"left"},{label:"Centro",value:"center"},{label:"Derecha",value:"right"}];function Ti({onClose:e}){let[t,n]=ro(!1),{contrast:i,textSize:o,saturation:s,dyslexia:a,letterSpacing:c,lineHeight:l,fontWeight:f,highlight:d,animations:m,cursor:v,readingGuide:h,colorblind:A,hideImages:x,textAlign:C,tts:b,profiles:O,pageStructure:E,dictionary:M,resetAllFeatures:K}=Re(),se=nt.findIndex(u=>u.value===o.textSizePercentage),_e=ot.findIndex(u=>u.value===i.contrastMode),ze=st.findIndex(u=>u.value===s.saturationMode),Y=at.findIndex(u=>u.value===l.level),J=rt.findIndex(u=>u.value===c.level),ae=ct.findIndex(u=>u.value===C.mode);return y("div",{role:"dialog","aria-modal":"true","aria-label":"Men\xFA de Accesibilidad",className:"flex flex-col h-full overflow-hidden",children:[y("div",{className:"flex items-center justify-between apea-header-glass px-4 py-3 shrink-0",children:[r("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Men\xFA de Accesibilidad"}),r("div",{className:"flex items-center gap-2",children:r("button",{type:"button",onClick:e,"aria-label":"Cerrar men\xFA de accesibilidad",className:"apea-focus flex h-8 w-8 items-center justify-center rounded-full border border-white/30 text-white cursor-pointer transition hover:bg-red-500/80",style:{"--apea-color-focus-ring":"#fff","--apea-color-focus-offset":"transparent"},children:r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,className:"h-4 w-4","data-a11y-icon":!0,children:r("path",{d:"M18 6 6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),y("div",{className:"flex-1 overflow-y-auto",children:[y("section",{className:"px-4 pb-0 py-3",children:[y("button",{type:"button",onClick:()=>n(u=>!u),"aria-expanded":t,"aria-controls":"apea-profiles-list",className:"flex w-full items-center justify-between text-xs font-semibold text-blue-700 uppercase tracking-wider cursor-pointer",children:["Perfiles de accesibilidad",r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:`h-4 w-4 transition-transform duration-300 ease-in-out ${t?"rotate-180":""}`,"data-a11y-icon":!0,children:r("path",{d:"M6 9l6 6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})})]}),t&&r("div",{id:"apea-profiles-list",className:"flex flex-col gap-2 pt-3 pb-5 px-2 -mx-2",children:Object.keys(Xe).map(u=>r(N,{icon:r(Lo,{profile:u}),label:Xe[u],isActive:O.activeProfile===u,onClick:()=>O.applyProfile(u)},u))})]}),r("section",{className:"px-4 pt-0 py-3",children:y("div",{className:"apea-cyclic-grid",children:[r(R,{icon:r(Eo,{}),name:"Lector de pantalla",levels:[{label:"Activo",value:!0}],currentIndex:b.isReading?0:-1,onCycle:()=>b.toggle()}),r(R,{icon:r(co,{}),name:"Tama\xF1o de fuente",levels:nt,currentIndex:se,onCycle:u=>o.setSpecificTextSize(u===-1?100:nt[u].value)}),r(R,{icon:r(ho,{}),name:"Contraste",levels:ot,currentIndex:_e,onCycle:u=>i.setContrastMode(u===-1?"normal":ot[u].value)}),r(R,{icon:r(vo,{}),name:"Saturaci\xF3n",levels:st,currentIndex:ze,onCycle:u=>s.setSaturationMode(u===-1?"normal":st[u].value)}),r(R,{icon:r(mo,{}),name:"Interlineado",levels:at,currentIndex:Y,onCycle:u=>l.setTo(u===-1?14:at[u].value)}),r(R,{icon:r(fo,{}),name:"Interletrado",levels:rt,currentIndex:J,onCycle:u=>c.setTo(u===-1?0:rt[u].value)}),r(R,{icon:r(po,{}),name:"Fuente dislexia",levels:[{label:"Activa",value:!0}],currentIndex:a.isActive?0:-1,onCycle:()=>a.toggle()}),r(R,{icon:r(xo,{mode:C.mode}),name:"Alinear texto",levels:ct,currentIndex:ae,onCycle:u=>C.setMode(u===-1?"default":ct[u].value)})]})}),r(it,{title:"Ajustes de contenido",children:y("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(lo,{}),label:"Resaltar t\xEDtulos",isActive:d.isTitlesActive,onClick:d.toggleTitles}),r(N,{icon:r(uo,{}),label:"Resaltar enlaces",isActive:d.isLinksActive,onClick:d.toggleLinks}),r(N,{icon:r(go,{}),label:"Fuente negrita",isActive:f.isBold,onClick:f.toggle}),r(N,{icon:r(Co,{}),label:"Ocultar im\xE1genes",isActive:x.isActive,onClick:x.toggle})]})}),y(it,{title:"Herramientas",children:[y("div",{className:"flex flex-col gap-2",children:[r(N,{icon:r(bo,{}),label:"Gu\xEDa de lectura",isActive:h.isActive,onClick:h.toggle}),r(N,{icon:r(yo,{}),label:"Pausar animaciones",isActive:m.isActive,onClick:m.toggle}),r(N,{icon:r(So,{}),label:"Cursor grande",isActive:v.isActive,onClick:v.toggle}),r(N,{icon:r(wo,{}),label:"Diccionario",hint:"Selecciona una palabra en la p\xE1gina para ver su definici\xF3n al instante.",isActive:M.isActive,onClick:M.toggle})]}),E.isOpen&&E.structure.length>0&&y("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 max-h-60 overflow-y-auto shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:[r("p",{className:"mb-2 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Estructura de la p\xE1gina"}),r("ul",{className:"space-y-1",children:E.structure.map((u,re)=>r("li",{children:y("button",{type:"button",onClick:()=>E.navigateTo(u),className:"apea-focus w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-blue-50 transition-colors",style:{paddingLeft:`${(u.level||1)*12}px`},children:[r("span",{className:"inline-block mr-2 text-xs font-mono text-blue-600 bg-blue-100 px-1.5 py-0.5 rounded",children:u.tag}),r("span",{className:"text-gray-700",children:u.text})]})},`${u.tag}-${re}`))})]}),E.isOpen&&E.structure.length===0&&r("div",{className:"mt-3 rounded-xl border border-white/70 bg-white/80 p-3 shadow-[0_2px_8px_rgba(0,0,0,0.06)]",children:r("p",{className:"text-sm text-gray-500 text-center",children:"No se encontraron encabezados"})})]})]}),r("section",{className:"px-4 pb-6 pt-2",children:r("button",{type:"button",onClick:K,className:"apea-focus w-full rounded-xl apea-header-glass py-3 text-sm font-semibold text-white cursor-pointer transition hover:brightness-110",children:"Restablecer configuraci\xF3n"})})]})}function co(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7V4h16v3M9 20h6M12 4v16",strokeLinecap:"round",strokeLinejoin:"round"})})}function lo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 12h8M4 18h12",strokeLinecap:"round"}),r("path",{d:"M15 14l5 5M20 14l-5 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function uo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",strokeLinecap:"round",strokeLinejoin:"round"})]})}function po(){return r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 7l4 10 4-10M20 7v10M17 7h6",strokeLinecap:"round",strokeLinejoin:"round"})})}function fo(){return r("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:r("path",{d:"m20.003 16.975-2.027 2.028m.113-3.943 1.914 1.915m-16.006 0 2.027-2.029m-.113 3.944-1.914-1.915m0 0h16.006m-2-5.975L15.16 4.997 12.317 11m.568-1.2h4.547M4.997 4.997 7.84 11l2.843-6.003",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function mo(){return y("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-a11y-icon":!0,children:[r("path",{d:"M12.754 4a.75.75 0 0 1 .75-.75H20.5a.75.75 0 0 1 0 1.5h-6.996a.75.75 0 0 1-.75-.75m7.746 9.917h-6.996a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5m-6.996 5.333a.75.75 0 0 0 0 1.5H20.5a.75.75 0 0 0 0-1.5zm6.996-9.167h-6.996a.75.75 0 0 1 0-1.5H20.5a.75.75 0 0 1 0 1.5",opacity:.4,fill:"#323544"}),r("path",{d:"m9.974 16.47-1.722 1.72V5.81l1.722 1.72a.75.75 0 0 0 1.06-1.06l-3.002-3a.75.75 0 0 0-1.06 0l-3.002 3a.75.75 0 0 0 1.06 1.06l1.722-1.72v12.38L5.03 16.47a.75.75 0 0 0-1.06 1.06l3.002 3a.75.75 0 0 0 1.06 0l3.002-3a.75.75 0 0 0-1.06-1.06",fill:"#323544"})]})}function go(){return y("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),r("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function ho(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18V3z",fill:"currentColor",stroke:"none"})]})}function vo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"8"}),r("path",{d:"M12 4v16M8 8l8 8M4 12h16",strokeLinecap:"round",strokeOpacity:.4}),r("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"})]})}function bo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 6h16M4 10h16M4 14h10",strokeLinecap:"round"}),r("path",{d:"M3 18h18",strokeWidth:3,strokeLinecap:"round"})]})}function yo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("rect",{x:"9",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"}),r("rect",{x:"13",y:"9",width:"2",height:"6",fill:"currentColor",stroke:"none"})]})}function So(){return r("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M5 3l14 9-7.5 1.5L9 20l-4-17z"})})}function Co(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),r("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor",stroke:"none"}),r("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M2 2l20 20",strokeLinecap:"round",strokeWidth:2.5})]})}function xo({mode:e}){return e==="center"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M6 6h12M8 10h8M6 14h12M8 18h8",strokeLinecap:"round"})}):e==="right"?r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M8 10h12M4 14h16M8 18h12",strokeLinecap:"round"})}):r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:r("path",{d:"M4 6h16M4 10h12M4 14h16M4 18h12",strokeLinecap:"round"})})}function Eo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M11 5L6 9H2v6h4l5 4V5z",fill:"currentColor",stroke:"none"}),r("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",strokeLinecap:"round"}),r("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",strokeLinecap:"round"})]})}function Lo({profile:e}){switch(e){case"visionImpaired":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})]});case"cognitive":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M12 2a7 7 0 0 1 7 7c0 3-2 5-3 7h-8c-1-2-3-4-3-7a7 7 0 0 1 7-7z"}),r("path",{d:"M9 16v2a3 3 0 0 0 6 0v-2"})]});case"motorImpaired":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v6l4 4M12 12l-4 4",strokeLinecap:"round",strokeLinejoin:"round"}),r("circle",{cx:"8",cy:"20",r:"2"}),r("circle",{cx:"16",cy:"20",r:"2"})]});case"seniorFriendly":return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("circle",{cx:"12",cy:"4",r:"2",fill:"currentColor"}),r("path",{d:"M12 6v8M12 14l-3 6M12 14l3 6M12 10h-2l-3 4M12 10h2",strokeLinecap:"round",strokeLinejoin:"round"})]});default:return null}}function wo(){return y("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"h-full w-full","data-a11y-icon":!0,children:[r("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",strokeLinejoin:"round"}),r("path",{d:"M9 7h6M9 11h4",strokeLinecap:"round"})]})}import{Fragment as Io,jsx as X,jsxs as Oo}from"react/jsx-runtime";function lt({position:e="bottom-left",className:t}={}){let[n,i]=Ao(!1),{hasActiveFeatures:o}=Re(),{fabStyle:s,isDragging:a,fabRef:c,dragHandlers:l}=ki({defaultPosition:e,onTap:()=>i(d=>!d),disabled:n});Mo(()=>{if(!n)return;let d=m=>{m.key==="Escape"&&i(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]);let f=n||o?"var(--apea-color-fab-active, #FFD54F)":"var(--apea-color-fab-inactive, #F6F6F6)";return Oo(Io,{children:[X("div",{ref:c,className:t,style:{...s,zIndex:n?30:50,opacity:a?.85:1,filter:o?"drop-shadow(0 4px 12px rgba(255, 213, 79, 0.3))":"none"},role:"button",tabIndex:0,"aria-expanded":n,"aria-haspopup":"dialog","aria-label":`Accesibilidad - ${o?"Funciones activas":"Sin funciones activas"}`,...l,onKeyDown:d=>{n||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i(!0))},children:X(We,{size:"lg","aria-hidden":"true",tabIndex:-1,leftIcon:X(bt,{className:"w-full z-50",color:f,stroke:f})})}),X("div",{className:"fixed inset-0 z-40 apea-backdrop",style:{backgroundColor:"var(--apea-color-backdrop, rgba(0, 0, 0, 0.15))"},"data-visible":n?"true":"false",onClick:()=>i(!1),"aria-hidden":"true"}),X("div",{role:"none",className:"fixed inset-y-0 right-0 z-50 w-full max-w-sm shadow-2xl apea-panel rounded-l-4xl overflow-hidden","data-open":n?"true":"false",children:X(Ti,{onClose:()=>i(!1)})})]})}import{jsx as Pi}from"react/jsx-runtime";var To={primary500:"#005dca",primary600:"#004faf",primary700:"#003b8a",panelBackground:"#f9fafb",fabActive:"#ffd54f",fabInactive:"#f6f6f6",backdrop:"rgba(0, 0, 0, 0.2)"};function dt(e){return{...To,...e}}function No(e,t){return{...e,...t,theme:{...e.theme??{},...t.theme??{}}}}function Ni(e,t){e.style.setProperty("--apea-color-primary-500",t.primary500),e.style.setProperty("--apea-color-primary-600",t.primary600),e.style.setProperty("--apea-color-primary-700",t.primary700),e.style.setProperty("--apea-color-panel-bg",t.panelBackground),e.style.setProperty("--apea-color-fab-active",t.fabActive),e.style.setProperty("--apea-color-fab-inactive",t.fabInactive),e.style.setProperty("--apea-color-backdrop",t.backdrop)}function Ri(e={}){let t={position:e.position||"bottom-left",zIndex:e.zIndex||9999,containerId:e.containerId||"ape-accessibility-root",theme:dt(e.theme)},n=dt(t.theme),i=t.containerId||"ape-accessibility-root";if(document.getElementById(i))return console.warn("[ape-accessibility] Widget already mounted. Call destroy() first."),{destroy:()=>{},updateConfig:()=>{},config:e};let o=document.createElement("style");o.id="ape-accessibility-tools-css",o.textContent=`/* ============================================= */
|
|
15
15
|
/* Accessibility Feature Styles */
|
|
16
16
|
/* ============================================= */
|
|
17
17
|
|