Module 230906

2,015 characters · in 514.d733764d42c2ab66.js
Dependencies
Lazily required by (0)none
Requires (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{iP:()=>i,pA:()=>a,vS:()=>o});let r=null;function i(e,t="assertive",n=7e3){r?r.announce(e,t,n):(r=new s,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"u">typeof jest)?r.announce(e,t,n):setTimeout(()=>{(null==r?void 0:r.isAttached())&&(null==r||r.announce(e,t,n))},100))}function a(e){r&&r.clear(e)}function o(e=null){r?r.move(e):function(e=null){r||(r=new s(e))}(e)}class s{isAttached(){var e;return null==(e=this.node)?void 0:e.isConnected}createLog(e){let t=document.createElement("div");return t.setAttribute("role","log"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions"),t}destroy(){this.node&&this.parentNode&&(this.parentNode.removeChild(this.node),this.node=null)}move(e=null){this.node&&(this.parentNode=null!=e?e:document.body,this.parentNode.prepend(this.node))}announce(e,t="assertive",n=7e3){var r,i;if(!this.node)return;let a=document.createElement("div");"object"==typeof e?(a.setAttribute("role","img"),a.setAttribute("aria-labelledby",e["aria-labelledby"])):a.textContent=e,"assertive"===t?null==(r=this.assertiveLog)||r.appendChild(a):null==(i=this.politeLog)||i.appendChild(a),""!==e&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||"assertive"===e)&&this.assertiveLog&&(this.assertiveLog.innerHTML=""),(!e||"polite"===e)&&this.politeLog&&(this.politeLog.innerHTML=""))}constructor(e=null){this.node=null,this.parentNode=null,this.assertiveLog=null,this.politeLog=null,"u">typeof document&&(this.node=document.createElement("div"),this.parentNode=null!=e?e:document.body,this.node.dataset.liveAnnouncer="true",Object.assign(this.node.style,{border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}),this.assertiveLog=this.createLog("assertive"),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog("polite"),this.node.appendChild(this.politeLog),this.parentNode.prepend(this.node))}}}