(()=>{(()=>{"use strict";let m=document.querySelector("html"),y=document.querySelector("body"),h=[];if(wpa.lang&&(m.getAttribute("lang")||(m.setAttribute("lang",wpa.lang),(wpa.errors||wpa.tracking)&&(h.push("html-lang"),console.log("HTML language set by WP Accessibility")))),wpa.dir&&!m.getAttribute("dir")&&wpa.dir!=="ltr"&&(m.setAttributeattr("dir",wpa.dir),(wpa.errors||wpa.tracking)&&(h.push("html-lang-direction"),console.log("HTML language direction set by WP Accessibility"))),wpa.continue){let c=document.querySelectorAll(".wp-block-post-excerpt__more-link");c.length!==0&&c.forEach(t=>{if(!t.hasAttribute("aria-describedby")){let o=t.closest(".wp-block-post"),d=o.getAttribute("class");d=d.replaceAll(" ","-");let i=o.querySelector(".wp-block-post-title");i&&(i.hasAttribute("id")?d=i.getAttribute("id"):i.setAttribute("id",d),t.setAttribute("aria-describedby",d),(wpa.errors||wpa.tracking)&&console.log("Continue Reading link description set by WP Accessibility"))}})}let A=document.querySelector('meta[name="viewport"]');if(A&&wpa.viewport){let c=A.getAttribute("content"),t=A.getAttribute("content");c.search(/user-scalable=no/g)&&(t=c.replace("user-scalable=no","user-scalable=yes"),A.setAttribute("content",t),(wpa.errors||wpa.tracking)&&t!=c&&(h.push("viewport-scalable"),console.log("Viewport made scalable by WP Accessibility"))),c.search(/maximum-scale=1/g)&&(t=c.replace("maximum-scale=1","maximum-scale=5"),t=t.replace("maximum-scale=0","maximum-scale=5"),A.setAttribute("content",t),(wpa.errors||wpa.tracking)&&t!=c&&(h.push("viewport-maxscale"),console.log("Viewport maximum scale set by WP Accessibility")))}if(wpa.skiplinks.enabled&&(y.insertAdjacentHTML("afterbegin",wpa.skiplinks.output),(wpa.errors||wpa.tracking)&&(h.push("skiplinks"),console.log("Skip links added by WP Accessibility"))),wpa.current){let c=document.querySelectorAll(".current-menu-item a, .current_page_item a");c.length!==0&&(c.forEach(t=>{t.setAttribute("aria-current","page")}),(wpa.errors||wpa.tracking)&&(h.push("aria-current"),console.log("ARIA current added by WP Accessibility")))}if(wpa.labels&&["s","author","email","url","comment"].forEach(t=>{let o,d,i,a,e,r,u,s,n,l;t=="comment"?o=document.querySelectorAll("textarea[name="+t+"]"):o=document.querySelectorAll("input[name="+t+"]:not(#adminbar-search)"),o.length!==0&&o.forEach(b=>{b.length!==0&&(d=b.getAttribute("id"),i=b.closest("label"),a=b.getAttribute("aria-label"),e=b.getAttribute("aria-labelledby"),r={},e&&(r=document.getElementById(e)),u=!(a==null||a==""||typeof a>"u"),s=!(e==null||e==""||typeof e>"u"),(!u&&!s||!u&&s&&!r)&&(d?(n=document.querySelector("label[for="+d+"]"),n&&(l=n.innerText,n&&!l&&(n.innerText=wpa.wpalabels[t],(wpa.errors||wpa.tracking)&&(h.push(["empty-label",wpa.wpalabels[t]]),console.log("Empty label on "+wpa.wpalabels[t]+" added by WP Accessibility")))),!n&&!i&&(b.insertAdjacentHTML("beforebegin","<label for='"+d+"' class='wpa-screen-reader-text'>"+wpa.wpalabels[t]+"</label>"),(wpa.errors||wpa.tracking)&&(h.push(["explicit-label",wpa.wpalabels[t]]),console.log("Explicit label on "+wpa.wpalabels[t]+" added by WP Accessibility")))):i||(b.setAttribute("id","wpa_label_"+t),b.insertAdjacentHTML("beforebegin","<label for='wpa_label_"+t+"' class='wpa-screen-reader-text'>"+wpa.wpalabels[t]+"</label>"),(wpa.errors||wpa.tracking)&&(h.push(["implicit-label",wpa.wpalabels[t]]),console.log("Implicit label on "+wpa.wpalabels[t]+" added by WP Accessibility")))))})}),wpa.titles){let c=0,t=0,o=0,d=!1,i=document.querySelectorAll("img, a, input, textarea, select, button");i.length!==0&&(i.forEach(a=>{let e=a.getAttribute("title");if(a.classList.contains("nturl")&&(d=!0),e&&e!=="")switch(a.tagName){case"IMG":let r=a.getAttribute("alt");e=a.getAttribute("title"),!r||r===""?(a.setAttribute("alt",e),a.removeAttribute("title")):e===r&&a.removeAttribute("title"),c++;break;case"A":case"BUTTON":let u=L(a);if(!u||u===""){let E=a.getAttribute("aria-label");(!E||E==="")&&(a.setAttribute("aria-label",e),d||a.removeAttribute("title"))}else a.removeAttribute("title");t++;break;case"INPUT":case"SELECT":case"TEXTAREA":let s=a.getAttribute("aria-label"),n=a.getAttribute("aria-labelledby"),l=n?document.getElementById(n):!1,b=a.getAttribute("id"),g=b?document.querySelector('label[for="'+b+'"]'):!1,w=a.closest("label"),f=!!(s&&s!==""),p=!!(g&&L(g)!==""),x=!!(w&&L(w)!==""),k=!!(l&&L(l)!=="");f||p||x||k||a.setAttribute("aria-label",e),a.removeAttribute("title"),o++;break}}),(wpa.errors||wpa.tracking)&&(c>0&&(h.push(["images-titles",c]),console.log(c+" title attributes removed from images by WP Accessibility")),t>0&&(h.push(["control-titles",t]),console.log(t+" title attributes removed from links and buttons by WP Accessibility")),o>0&&(h.push(["input-titles",o]),console.log(o+" title attributes removed from input fields by WP Accessibility"))))}if(wpa.target){let c=document.querySelectorAll("a:not(.wpa-allow-target)"),t=0;c.length!==0&&(c.forEach(o=>{let d=o.getAttribute("target"),i=o.getAttribute("href");if(d)if(i.startsWith("#"))o.removeAttribute("target");else try{new URL(i).hostname.includes("facebook")||(o.removeAttribute("target"),t++)}catch(a){console.log("href value is not a URL or a fragment:",i)}}),t>0&&(wpa.errors||wpa.tracking)&&(h.push(["link-targets",t]),console.log(t+" target attributes removed from links by WP Accessibility")))}if(wpa.tabindex){let c=document.querySelectorAll("input,a[href],select,textarea,button"),t=0;c.length!==0&&(c.forEach(e=>{e.getAttribute("tabindex")&&(e.removeAttribute("tabindex"),t++)}),t>0&&(wpa.errors||wpa.tracking)&&(h.push(["control-tabindex",t]),console.log(t+" tabindex attributes removed from links, buttons and inputs by WP Accessibility")));let o=document.querySelectorAll('[role="button"]:not([tabindex]):not(a):not(button)'),d=document.querySelectorAll('a[role="button"]:not([tabindex]):not([href])'),i=document.querySelectorAll('[role="link"]:not([tabindex]):not(a)'),a=document.querySelectorAll("a:not([href]):not([tabindex])");o.length!==0&&(o.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),o.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["button-add-tabindex",o.length]),console.log(o.length+" tabindex attributes added to divs with the button role by WP Accessibility"))),d!==0&&(d.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),d.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["link-add-tabindex",d.length]),console.log(d.length+" tabindex attributes added to anchor elements with the button role and no href value by WP Accessibility"))),i!==0&&(i.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),i.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["fakelink-add-tabindex",i.length]),console.log(i.length+" tabindex attributes added to elements with the link role not using the a element by WP Accessibility"))),a!==0&&(a.forEach(e=>{e.setAttribute("tabindex","0"),e.classList.add("wpa-focusable")}),a.length>0&&(wpa.errors||wpa.tracking)&&(h.push(["links-add-tabindex",a.length]),console.log(a.length+" tabindex attributes added to a with no href attribute by WP Accessibility")))}if(wpa.url!=="disabled"){let o=function(e,r,u="event"){e=JSON.stringify(e);let s=new FormData;s.append("action",wpa.action),s.append("security",wpa.security),s.append("stats",e),s.append("post_id",wpa.post_id),s.append("title",r),s.append("type",u),fetch(wpa.ajaxurl,{method:"POST",body:s})};class c{constructor(r){var u=Array.prototype.forEach,s=Array.prototype.map;this.each=function(n,l,b){if(n!=null){if(u&&n.forEach===u)n.forEach(l,b);else if(n.length===+n.length){for(var g=0,w=n.length;g<w;g++)if(JSON.stringify(l.call(b,n[g],g,n))==="{}")return}else for(var f in n)if(n.hasOwnProperty(f)&&JSON.stringify(l.call(b,n[f],f,n))==="{}")return}},this.map=function(n,l,b){var g=[];return n==null?g:s&&n.map===s?n.map(l,b):(this.each(n,function(w,f,p){g[g.length]=l.call(b,w,f,p)}),g)},r&&(this.hasher=r)}get(){let r=[];r.push(navigator.userAgent),r.push([screen.height,screen.width,screen.colorDepth].join("x")),r.push(new Date().getTimezoneOffset()),r.push(!!window.sessionStorage),r.push(!!window.localStorage);var u=this.map(navigator.plugins,function(s){var n=this.map(s,function(l){return[l.type,l.suffixes].join("~")}).join(",");return[s.name,s.description,n].join("::")},this).join(";");return r.push(u),this.hasher?this.hasher(r.join("###"),31):this.murmurhash3_32_gc(r.join("###"),31)}murmurhash3_32_gc(r,u){let s,n,l,b,g,w,f,p;for(s=r.length&3,n=r.length-s,l=u,g=3432918353,w=461845907,p=0;p<n;)f=r.charCodeAt(p)&255|(r.charCodeAt(++p)&255)<<8|(r.charCodeAt(++p)&255)<<16|(r.charCodeAt(++p)&255)<<24,++p,f=(f&65535)*g+(((f>>>16)*g&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*w+(((f>>>16)*w&65535)<<16)&4294967295,l^=f,l=l<<13|l>>>19,b=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(b&65535)+27492+(((b>>>16)+58964&65535)<<16);switch(f=0,s){case 3:f^=(r.charCodeAt(p+2)&255)<<16;case 2:f^=(r.charCodeAt(p+1)&255)<<8;case 1:f^=r.charCodeAt(p)&255,f=(f&65535)*g+(((f>>>16)*g&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*w+(((f>>>16)*w&65535)<<16)&4294967295,l^=f}return l^=r.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}}let t=new c().get(),d=document.querySelector(".toggle-contrast");d&&d.addEventListener("click",function(){let e;this.getAttribute("data-id")=="is_normal_contrast"?e={contrast:"disabled"}:e={contrast:"enabled"},o(e,t)});let i=document.querySelector(".toggle-fontsize");i&&i.addEventListener("click",function(){let e;this.getAttribute("data-id")=="is_normal_fontsize"?e={fontsize:"disabled"}:e={fontsize:"enabled"},o(e,t)}),v(".wpa-ld button").then(e=>{e.addEventListener("click",function(r){if(e.getAttribute("aria-expanded")==="true"){let l={longdesc:e.closest("div").getAttribute("class").replace("wpa-ld wp-image-","")};o(l,t)}})});let a=document.querySelectorAll(".wpa-alt button");a.length>0&&a.forEach(e=>{e.addEventListener("click",function(r){if(e.getAttribute("aria-expanded")==="true"){let l={alttext:e.closest("div").getAttribute("class").replace("wpa-alt wp-image-","")};o(l,t)}})}),wpa.tracking&&h.length>=1&&o(h,wpa.url,"view")}if(wpa.underline.enabled){let c=document.querySelectorAll(wpa.underline.target+":not(nav "+wpa.underline.target+"):not(#wpadminbar a), .wpa-focusable[role=link]");c.length>0&&c.forEach(t=>{let o=t.style.outlineWidth,d=t.style.outlineOffset,i=t.style.color,a=t.style.outlineColor;t.style.textDecoration="underline",t.addEventListener("mouseenter",function(){this.style.textDecoration="none"}),t.addEventListener("mouseleave",function(){this.style.textDecoration="underline"}),t.addEventListener("focusin",function(){let e="2px";o=="2px"&&(e="4px"),this.style.outlineWidth=e,this.style.outlineColor=i,this.style.outlineOffset="2px"}),t.addEventListener("focusout",function(){this.style.outlineWidth=o,this.style.outlineColor=a,this.style.outlineOffset=d})})}if(wpa.videos){let c=matchMedia("(prefers-reduced-motion)"),t="false",o=document.querySelectorAll("video[autoplay]:not([controls])");o.length>0&&o.forEach(d=>{c.matches&&(d.pause(),t="true");let i=d.parentElement,a=document.createElement("button"),e=document.createElement("span"),r=document.createElement("span");a.setAttribute("type","button"),a.classList.add("wpa-video"),a.setAttribute("aria-pressed",t),e.classList.add("dashicons-controls-pause","dashicons"),e.setAttribute("aria-hidden","true"),r.classList.add("screen-reader-text"),r.innerText=wpa.pause,a.append(e,r),i.append(a),a.addEventListener("click",function(){let u=this.getAttribute("aria-pressed");console.log(u),u==="true"?(d.play(),this.setAttribute("aria-pressed","false")):(d.pause(),this.setAttribute("aria-pressed","true"))})})}if(wpa.alt){let c=wpa.altSelector?wpa.altSelector:'.hentry img[alt]:not([alt=""]), .comment-content img[alt]:not([alt=""]), #content img[alt]:not([alt=""]),.entry-content img[alt]:not([alt=""])',t=document.querySelectorAll(c),o=(d,i)=>{d.parentElement.insertBefore(i,d),i.appendChild(d)};t.forEach(d=>{let i=d,a=i.closest("a"),e=i.closest("button"),r=!!a,u=!!e,s=i.width,n=i.height;if((s||n)&&(s=s||56,n=n||56,n*s<150*300))return;let l=i.getAttribute("alt"),b=[...i.classList];i.setAttribute("class","");let g=document.createElement("div");g.classList.add("wpa-alt"),o(r||u?r?a:e:i,g),b.forEach(p=>{g.classList.add(p)}),g.insertAdjacentHTML("afterbegin",'<button aria-expanded="false" type="button" class="wpa-toggle">alt</button>'),g.insertAdjacentHTML("beforeend",'<div class="wpa-alt-text"></div>');let w=g.querySelector(".wpa-alt-text");w.style.display="none",w.innerText=l,g.querySelector("button").addEventListener("click",function(p){w.checkVisibility()?(this.setAttribute("aria-expanded","false"),w.style.display="none"):(this.setAttribute("aria-expanded","true"),w.style.display="block")})})}if(wpa.ldType){let o=function(i){let a=i.getAttribute("class"),e=i.getAttribute("id"),r;e&&e.includes("longdesc")?r=e.replace("longdesc-return-",""):((a===null||a==="")&&(parent=i.closest(".wpa-alt"),a=parent.getAttribute("class").replace("wpa-alt ","")),r=a.replace("wp-image-",""));let u=wpa.restUrl+"/"+r;fetch(u).then(s=>s.json()).then(s=>{let n=s.description.rendered;if(n=n.replace(/(<([^>]+)>)/gi,"").trim(),n!==""){let l=new URL(wpa.ldHome);l.searchParams.set("longdesc",r),l.searchParams.set("p",r),l.toString(),d(i,r,l,n)}}).catch(s=>{console.log(s)})},d=function(i,a,e,r){let u=document.createElement("div");u.classList.add("wpa-ld");let s=i.getAttribute("alt");s===""&&(s="<code>"+i.getAttribute("src").replace(wpa.ldHome,"")+"</code>");let n=document.body.className.split(/\s+/),l="";n.forEach(p=>{p.match(/postid-/gi)&&(l=p.replace("postid-","",p)),p.match(/page-id-/gi)&&(l=p.replace("page-id-","",p))});let b=new URL(e);b.searchParams.set("referrer",l),b.toString(),[...i.classList].forEach(p=>{u.classList.add(p)}),c(i,u),i.setAttribute("alt",""),i.setAttribute("class","");let w=document.createElement("a");w.setAttribute("href",b),w.classList.add("longdesc-link");let f=document.createElement("span");if(f.classList.add("screen-reader-text"),f.textContent=" of "+s,w.textContent="Description",w.appendChild(f),wpa.ldType==="link")u.insertAdjacentElement("beforeend",w);else{u.insertAdjacentHTML("beforeend",'<button aria-expanded="false" class="wpa-toggle">'+wpa.ldText+"</button>"),u.insertAdjacentHTML("beforeend",'<div class="longdesc"></div>');let p=u.querySelector(".longdesc");p.style.display="none",fetch(e).then(x=>{if(x.ok)return x.text();p.insertAdjacentHTML("beforeend",r)}).then(x=>{let E=new DOMParser().parseFromString(x,"text/html");p.insertAdjacentElement("beforeend",E.querySelector("#desc_"+a))}),u.querySelector("button").addEventListener("click",function(x){p.checkVisibility()?(this.setAttribute("aria-expanded","false"),p.style.display="none"):(this.setAttribute("aria-expanded","true"),p.style.display="block")})}},c=(i,a)=>{i.parentElement.insertBefore(a,i),a.appendChild(i)},t=document.querySelectorAll("img[longdesc]");if(wpa.ldType==="link"){t.length>0&&t.forEach(a=>{let e=document.createElement("div");e.classList.add("wpa-ld");let r=a.getAttribute("longdesc"),u=a.getAttribute("alt"),s=[...a.classList];c(a,e),s.forEach(b=>{e.classList.add(b)}),a.setAttribute("class","");let n=document.createElement("a");n.setAttribute("href",r),n.classList.add("longdesc-link");let l=document.createElement("span");l.classList.add("screen-reader-text"),l.textContent=" of "+u,n.textContent="Description",n.appendChild(l),a.insertAdjacentElement("afterend",n)});let i=document.querySelectorAll("figure.is-style-longdesc");i.length>0&&i.forEach(a=>{let e=a.querySelector("img");o(e)})}else{t.length>0&&t.forEach(a=>{o(a)});let i=document.querySelectorAll("figure.is-style-longdesc");i.length>0&&i.forEach(a=>{let e=a.querySelector("img");o(e)})}}})();function L(m){let y="";if(m.nodeType===3||m.nodeType===4)y=m.nodeValue;else if(m.nodeType===1&&(m.tagName.toLowerCase()=="img"||m.tagName.toLowerCase()=="area"||m.tagName.toLowerCase()=="input"&&m.getAttribute("type")&&m.getAttribute("type").toLowerCase()=="image"))y=m.getAttribute("alt")||"";else if(m.nodeType===1&&!m.tagName.match(/^(script|style)$/i)){let h=m.childNodes;for(let A=0,c=h.length;A<c;A++){let t=m.getAttribute("aria-label");y+=t||L(h[A])+" "}}return y}function v(m){return new Promise(y=>{if(document.querySelector(m))return y(document.querySelector(m));let h=new MutationObserver(A=>{document.querySelector(m)&&(h.disconnect(),y(document.querySelector(m)))});h.observe(document.body,{childList:!0,subtree:!0})})}})();