1 line
46 KiB
JavaScript
1 line
46 KiB
JavaScript
(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{getHighlighter:()=>T});var i={};t.r(i),t.d(i,{AbstractRegion:()=>H,DummyRegion:()=>D,HoverRegion:()=>U,LiveRegion:()=>F,SpeechRegion:()=>K,StringRegion:()=>_,ToolTip:()=>J});var s={};t.r(s),t.d(s,{AbstractExplorer:()=>V});var o={};t.r(o),t.d(o,{SpeechExplorer:()=>W,hasModifiers:()=>$,isContainer:()=>X});var r={};t.r(r),t.d(r,{AbstractMouseExplorer:()=>Q,ContentHoverer:()=>et,FlameHoverer:()=>it,Hoverer:()=>Z,ValueHoverer:()=>tt});var n={};t.r(n),t.d(n,{AbstractTreeExplorer:()=>st,ContrastPicker:()=>nt,FlameColorer:()=>ot,TreeColorer:()=>rt});var h={};t.r(h),t.d(h,{ExplorerPool:()=>lt,RegionPool:()=>ht});var a={};t.r(a),t.d(a,{ExplorerHandler:()=>pt,ExplorerMathDocumentMixin:()=>ut,ExplorerMathItemMixin:()=>dt,setA11yOption:()=>mt,setA11yOptions:()=>gt});const l=("undefined"!=typeof window?window:global).MathJax._.components.global,c=(l.GLOBAL,l.isObject,l.combineConfig,l.combineDefaults,l.combineWithMathJax),d=(l.MathJax,MathJax._.core.MathItem),u=(d.protoItem,d.AbstractMathItem,d.STATE),p=d.newState,g=MathJax._.a11y.speech_ts,m=(g.SpeechMathItemMixin,g.SpeechMathDocumentMixin,g.SpeechHandler),b=MathJax._.util.Options,f=(b.isObject,b.APPEND,b.REMOVE,b.OPTIONS,b.Expandable,b.expandable),v=(b.makeArray,b.keys,b.copy,b.insert,b.defaultOptions,b.userOptions,b.selectOptions,b.selectOptionsFromKeys,b.separateOptions,b.lookup,MathJax._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor),x=MathJax._.util.context,y=x.hasWindow,k=x.context,A=MathJax._.util.StyleJson.StyleJsonSheet,S={red:{red:255,green:0,blue:0},green:{red:0,green:255,blue:0},blue:{red:0,green:0,blue:255},yellow:{red:255,green:255,blue:0},cyan:{red:0,green:255,blue:255},magenta:{red:255,green:0,blue:255},white:{red:255,green:255,blue:255},black:{red:0,green:0,blue:0}};function w(t,e){var i;const s=S[t.color]||S[e.color];return s.alpha=null!==(i=t.alpha)&&void 0!==i?i:e.alpha,function(t){var e;return`rgba(${t.red},${t.green},${t.blue},${null!==(e=t.alpha)&&void 0!==e?e:1})`}(s)}const N={color:"blue",alpha:1},M={color:"black",alpha:1};let C=0;class E{constructor(){this.counter=C++,this.ATTR="sre-highlight-"+this.counter.toString(),this.mactionName="",this.currentHighlights=[]}highlight(t){this.currentHighlights.push(t.map((t=>{const e=this.highlightNode(t);return this.setHighlighted(t),e})))}highlightAll(t){const e=this.getMactionNodes(t);for(let t,i=0;t=e[i];i++)this.highlight([t])}unhighlight(){const t=this.currentHighlights.pop();t&&t.forEach((t=>{this.isHighlighted(t.node)&&(this.unhighlightNode(t),this.unsetHighlighted(t.node))}))}unhighlightAll(){for(;this.currentHighlights.length>0;)this.unhighlight()}setColor(t,e){this._foreground=w(e,M),this._background=w(t,N)}get foreground(){return this._foreground}get background(){return this._background}getMactionNodes(t){return Array.from(t.getElementsByClassName(this.mactionName))}isMactionNode(t){const e=t.className||t.getAttribute("class");return!!e&&!!e.match(new RegExp(this.mactionName))}isHighlighted(t){return t.hasAttribute(this.ATTR)}setHighlighted(t){t.setAttribute(this.ATTR,"true")}unsetHighlighted(t){t.removeAttribute(this.ATTR)}}class R extends E{constructor(){super(),this.mactionName="mjx-maction"}highlightNode(t){const e={node:t,background:t.style.backgroundColor,foreground:t.style.color};return this.isHighlighted(t)||(t.style.backgroundColor=this.background,t.style.color=this.foreground),e}unhighlightNode(t){t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}isMactionNode(t){var e;return(null===(e=t.tagName)||void 0===e?void 0:e.toUpperCase())===this.mactionName.toUpperCase()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}}function T(t,e,i){const s=new O[i];return s.setColor(t,e),s}const O={SVG:class extends E{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e;if(this.isHighlighted(t))return e={node:t,background:this.background,foreground:this.foreground},e;if("svg"===t.tagName||"MJX-CONTAINER"===t.tagName)return e={node:t,background:t.style.backgroundColor,foreground:t.style.color},t.style.backgroundColor=this.background,t.style.color=this.foreground,e;const i=document.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("sre-highlighter-added","true");const s=t.getBBox();i.setAttribute("x",(s.x-40).toString()),i.setAttribute("y",(s.y-40).toString()),i.setAttribute("width",(s.width+80).toString()),i.setAttribute("height",(s.height+80).toString());const o=t.getAttribute("transform");return o&&i.setAttribute("transform",o),i.setAttribute("fill",this.background),t.setAttribute(this.ATTR,"true"),t.parentNode.insertBefore(i,t),e={node:t,foreground:t.getAttribute("fill")},"rect"!==t.nodeName&&t.setAttribute("fill",this.foreground),e}setHighlighted(t){"svg"===t.tagName&&super.setHighlighted(t)}unhighlightNode(t){const e=t.node.previousSibling;if(e&&e.hasAttribute("sre-highlighter-added"))return t.foreground?t.node.setAttribute("fill",t.foreground):t.node.removeAttribute("fill"),void t.node.parentNode.removeChild(e);t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}isMactionNode(t){return t.getAttribute("data-mml-node")===this.mactionName}getMactionNodes(t){return Array.from(t.querySelectorAll(`[data-mml-node="${this.mactionName}"]`))}},CHTML:R,generic:R},I=MathJax._.a11y.speech.SpeechUtil,L=(I.ssmlParsing,I.buildLabel,I.buildSpeech),j=I.honk,P=(I.InPlace,I.SemAttr);class H{constructor(t){this.document=t,this.CLASS=this.constructor,this.AddStyles()}AddStyles(){if(this.CLASS.styleAdded)return;const t=this.document.adaptor.node("style");t.innerHTML=this.CLASS.style.cssText,this.document.adaptor.head(this.document.adaptor.document).appendChild(t),this.CLASS.styleAdded=!0}AddElement(){if(this.div)return;const t=this.document.adaptor.node("div");t.classList.add(this.CLASS.className),this.div=t,this.inner=this.document.adaptor.node("div"),this.div.appendChild(this.inner),this.document.adaptor.body(this.document.adaptor.document).appendChild(this.div)}Show(t,e){this.AddElement(),this.position(t),this.highlight(e),this.div.classList.add(this.CLASS.className+"_Show")}Hide(){this.div&&(this.div.parentNode.removeChild(this.div),this.div=null,this.inner=null)}stackRegions(t){const e=t.getBoundingClientRect();let i=0,s=Number.POSITIVE_INFINITY;const o=this.document.adaptor.document.getElementsByClassName(this.CLASS.className+"_Show");for(let t,e=0;t=o[e];e++)t!==this.div&&(i=Math.max(t.getBoundingClientRect().bottom,i),s=Math.min(t.getBoundingClientRect().left,s));const r=(i||e.bottom+10)+window.scrollY,n=(s<Number.POSITIVE_INFINITY?s:e.left)+window.scrollX;this.div.style.top=r+"px",this.div.style.left=n+"px"}}H.styleAdded=!1;class D extends H{Clear(){}Update(){}Hide(){}Show(){}AddElement(){}AddStyles(){}position(){}highlight(t){}}class _ extends H{Clear(){this.div&&(this.Update(""),this.inner.style.top="",this.inner.style.backgroundColor="")}Update(t){t&&this.AddElement(),this.inner&&(this.inner.textContent="",this.inner.textContent=t||"\xa0")}position(t){this.stackRegions(t)}highlight(t){this.div&&(this.inner.style.backgroundColor=t.background,this.inner.style.color=t.foreground)}}class J extends _{}J.className="MJX_ToolTip",J.style=new A({["."+J.className]:{width:"auto",height:"auto",opacity:1,"text-align":"center","border-radius":"4px",padding:0,"border-bottom":"1px dotted black",position:"absolute",display:"inline-block","background-color":"white","z-index":202},["."+J.className+" > div"]:{"border-radius":"inherit",padding:"0 2px"}});class F extends _{}F.className="MJX_LiveRegion",F.style=new A({["."+F.className]:{position:"absolute",top:0,display:"none",width:"auto",height:"auto",padding:0,opacity:1,"z-index":"202",left:0,right:0,margin:"0 auto","background-color":"white","box-shadow":"0px 5px 20px #888",border:"2px solid #CCCCCC"},["."+F.className+"_Show"]:{display:"block"}});class K extends F{constructor(){super(...arguments),this.active=!1,this.node=null,this.clear=!1,this.highlighter=T({color:"red"},{color:"black"},this.document.outputJax.name),this.voiceRequest=!1,this.voiceCancelled=!1}Show(t,e){super.Update("\xa0"),this.node=t,super.Show(t,e)}Update(t){if(this.voiceRequest)return void this.makeVoice(t);speechSynthesis.onvoiceschanged=(()=>this.voiceRequest=!0).bind(this);new Promise((t=>{setTimeout((()=>{this.voiceRequest?t(!0):setTimeout((()=>{this.voiceRequest=!0,t(!0)}),100)}),100)})).then((()=>this.makeVoice(t)))}makeVoice(t){this.active=this.document.options.a11y.voicing&&!!speechSynthesis.getVoices().length,speechSynthesis.cancel(),this.clear=!0;const[e,i]=L(t,this.document.options.sre.locale,this.document.options.sre.rate);super.Update(e),this.active&&e&&this.makeUtterances(i,this.document.options.sre.locale)}makeUtterances(t,e){this.voiceCancelled=!1;let i=null;for(const s of t)if(s.mark){if(!i){this.highlightNode(s.mark,!0);continue}i.addEventListener("end",(t=>{this.voiceCancelled||this.highlightNode(s.mark)}))}else if(s.pause){const t=parseInt(s.pause.match(/^[0-9]+/)[0]);if(isNaN(t)||!i)continue;i.addEventListener("end",(e=>{speechSynthesis.pause(),setTimeout((()=>{speechSynthesis.resume()}),t)}))}else i=new SpeechSynthesisUtterance(s.text),s.rate&&(i.rate=s.rate),s.pitch&&(i.pitch=s.pitch),i.lang=e,speechSynthesis.speak(i);i&&i.addEventListener("end",(t=>{this.highlighter.unhighlight()}))}Hide(){this.cancelVoice(),super.Hide()}cancelVoice(){this.voiceCancelled=!0,speechSynthesis.cancel(),this.highlighter.unhighlight()}highlightNode(t,e=!1){this.highlighter.unhighlight();const i=Array.from(this.node.querySelectorAll(`[data-semantic-id="${t}"]`));this.clear&&!e||this.highlighter.highlight(i),this.clear=!1}}class U extends H{position(t){const e=t.getBoundingClientRect(),i=this.div.getBoundingClientRect();let s,o=e.left+e.width/2-i.width/2;switch(o=o<0?0:o,o+=window.scrollX,this.document.options.a11y.align){case"top":s=e.top-i.height-10;break;case"bottom":s=e.bottom+10;break;default:s=e.top+e.height/2-i.height/2}s+=window.scrollY,s=s<0?0:s,this.div.style.top=s+"px",this.div.style.left=o+"px"}highlight(t){this.div&&(this.inner.firstChild&&!this.inner.firstChild.hasAttribute("sre-highlight")||(this.inner.style.backgroundColor=t.background,this.inner.style.color=t.foreground))}Show(t,e){this.AddElement(),this.div.style.fontSize=this.document.options.a11y.magnify,this.Update(t),super.Show(t,e)}Clear(){this.div&&(this.inner.textContent="",this.inner.style.top="",this.inner.style.backgroundColor="")}Update(t){if(!this.div)return;this.Clear();const e=this.cloneNode(t),i=e.querySelector("[data-mjx-clone]");this.inner.style.backgroundColor=t.style.backgroundColor,i.style.backgroundColor="",i.classList.remove("mjx-selected"),this.inner.appendChild(e),this.position(t)}cloneNode(t){let e=t.cloneNode(!0);if(e.setAttribute("data-mjx-clone","true"),"MJX-CONTAINER"!==e.nodeName){"g"!==e.nodeName&&(e.style.marginLeft=e.style.marginRight="0");let i=t;for(;i&&"MJX-CONTAINER"!==i.nodeName;)i=i.parentNode;if("MJX-MATH"!==e.nodeName&&"svg"!==e.nodeName){if(e=i.firstChild.cloneNode(!1).appendChild(e).parentNode,"svg"===e.nodeName){e.firstChild.setAttribute("transform","matrix(1 0 0 -1 0 0)");const s=parseFloat(e.getAttribute("viewBox").split(/ /)[2]),o=parseFloat(e.getAttribute("width")),{x:r,y:n,width:h,height:a}=t.getBBox();e.setAttribute("viewBox",[r,-(n+a),h,a].join(" ")),e.removeAttribute("style"),e.setAttribute("width",o/s*h+"ex"),e.setAttribute("height",o/s*a+"ex"),i.setAttribute("sre-highlight","false")}}e=i.cloneNode(!1).appendChild(e).parentNode,e.style.margin="0"}return e}}U.className="MJX_HoverRegion",U.style=new A({["."+U.className]:{display:"block",position:"absolute",width:"max-content",height:"auto",padding:0,opacity:1,"z-index":"202",margin:"0 auto","background-color":"white","line-height":0,"box-shadow":"0px 10px 20px #888",border:"2px solid #CCCCCC"},["."+U.className+" > div"]:{overflow:"hidden"}});class V{get highlighter(){return this.pool.highlighter}static stopEvent(t){t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopImmediatePropagation?t.stopImmediatePropagation():t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}static create(t,e,i,s,...o){return new this(t,e,i,s,...o)}constructor(t,e,i,s,...o){this.document=t,this.pool=e,this.region=i,this.node=s,this.stoppable=!0,this.events=[],this._active=!1}Events(){return this.events}get active(){return this._active}set active(t){this._active=t}Attach(){this.AddEvents()}Detach(){this.RemoveEvents()}Start(){this.active=!0}Stop(){this.active&&(this.region.Clear(),this.region.Hide(),this.active=!1)}AddEvents(){for(const[t,e]of this.events)this.node.addEventListener(t,e)}RemoveEvents(){for(const[t,e]of this.events)this.node.removeEventListener(t,e)}Update(t=!1){}stopEvent(t){this.stoppable&&V.stopEvent(t)}}var B=function(t,e,i,s){return new(i||(i=Promise))((function(o,r){function n(t){try{a(s.next(t))}catch(t){r(t)}}function h(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,h)}a((s=s.apply(t,e||[])).next())}))};const z="[data-speech-node]";function X(t){return t.matches("mjx-container")}function $(t,e=!0){return t.shiftKey&&e||t.metaKey||t.altKey||t.ctrlKey}const q=new Map([["MacOS",["on MacOS and iOS using VoiceOver",", or the VoiceOver arrow keys to select an expression"]],["Windows",["in Windows using NVDA or JAWS",". The screen reader should enter focus or forms mode automatically\nwhen the expression gets the browser focus, but if not, you can toggle\nfocus mode using NVDA+space in NVDA; for JAWS, Enter should start\nforms mode while Numpad Plus leaves it. Also note that you can use\nthe NVDA or JAWS key plus the arrow keys to explore the expression\neven in browse mode, and you can use NVDA+shift+arrow keys to\nnavigate out of an expression that has the focus in NVDA"]],["Unix",["in Unix using Orca",", and Orca should enter focus mode automatically. If not, use the\nOrca+a key to toggle focus mode on or off. Also note that you can use\nOrca+arrow keys to explore expressions even in browse mode"]],["unknown",["with a Screen Reader.",""]]]);class W extends V{get generators(){var t;return null===(t=this.item)||void 0===t?void 0:t.generatorPool}get role(){return this.item.ariaRole}get description(){return this.item.roleDescription}get none(){return this.item.none}FocusIn(t){this.item.outputData.nofocus?this.item.outputData.nofocus=!1:(this.clicked||this.Start(),this.clicked=null)}FocusOut(t){this.current&&!this.focusSpeech&&(this.setCurrent(null),this.Stop(),document.hasFocus()||this.focusTop())}KeyDown(t){if(this.pendingIndex.shift(),this.region.cancelVoice(),$(t,!1))return;const e=this.constructor,i=1===t.key.length?t.key.toLowerCase():t.key,[s,o]=e.keyMap.get(i)||[],r=s?void 0===o||this.active?s(this,t):o:this.undefinedKey(t);r||(this.stopEvent(t),!1===r&&this.sound&&this.NoMove())}MouseDown(t){var e;if(this.pendingIndex=[],this.region.cancelVoice(),$(t)||2===t.buttons)return void(this.item.outputData.nofocus=!0);const i=this.findClicked(t.target,t.x,t.y);i!==this.document.infoIcon?(null===(e=document.getSelection())||void 0===e||e.removeAllRanges(),t.target.getAttribute("sre-highlighter-added")?this.refocus=i:this.clicked=i):this.stopEvent(t)}Click(t){if($(t)||2===t.buttons||"Range"===document.getSelection().type)return void this.FocusOut(null);const e=this.findClicked(t.target,t.x,t.y);if(e===this.document.infoIcon)return this.stopEvent(t),void this.help();e&&!this.node.contains(e)||(this.stopEvent(t),this.refocus=e,this.triggerLinkMouse()||this.Start())}DblClick(t){var e;const i=null!==(e=document.getSelection().direction)&&void 0!==e?e:"none";$(t)||2===t.buttons||"none"!==i?this.FocusOut(null):(this.stopEvent(t),this.refocus=this.rootNode(),this.Start())}spaceKey(){return this.refocus=this.current,!0}hKey(){this.refocus=this.current,this.help()}escapeKey(){return this.Stop(),this.focusTop(),!0}enterKey(t){if(this.active)if(this.triggerLinkKeyboard(t))this.Stop();else{const t=this.actionable(this.current);if(!t)return!1;this.refocus=t,t.dispatchEvent(new Event("click"))}else this.Start()}homeKey(){this.setCurrent(this.rootNode())}moveDown(t){return t?this.moveToNeighborCell(1,0):this.moveTo(this.firstNode(this.current))}moveUp(t){return t?this.moveToNeighborCell(-1,0):this.moveTo(this.getParent(this.current))}moveRight(t){return t?this.moveToNeighborCell(0,1):this.moveTo(this.nextSibling(this.current))}moveLeft(t){return t?this.moveToNeighborCell(0,-1):this.moveTo(this.prevSibling(this.current))}moveTo(t){if(!t)return!1;this.setCurrent(t)}moveToNeighborCell(t,e){const i=this.tableCell(this.current);if(!i)return!1;const[s,o]=this.cellPosition(i);if(null==s)return!1;const r=this.cellAt(this.cellTable(i),s+t,o+e);if(!r)return!1;this.setCurrent(r)}undefinedKey(t){return!this.active||$(t)}addMark(){this.current===this.marks[this.marks.length-1]?this.setCurrent(this.current):(this.currentMark=this.marks.length-1,this.marks.push(this.current),this.speak("Position marked"))}prevMark(){if(this.currentMark<0){if(0===this.marks.length)return void this.setCurrent(this.lastMark||this.rootNode());this.currentMark=this.marks.length-1}const t=this.currentMark;this.setCurrent(this.marks[t]),this.currentMark=t-1}clearMarks(){this.marks=[],this.currentMark=-1,this.prevMark()}autoVoice(){const t=!this.document.options.a11y.voicing;this.document.menu?this.document.menu.menu.pool.lookup("voicing").setValue(t):this.document.options.a11y.voicing=t,this.Update()}numberKey(t){if(!this.tableCell(this.current))return!1;if(0===t&&(t=10),this.pendingIndex.length){const e=this.cellTable(this.tableCell(this.current)),i=this.cellAt(e,this.pendingIndex[0]-1,t-1);if(this.pendingIndex=[],this.speak(String(t)),!i)return!1;setTimeout((()=>this.setCurrent(i)),500)}else this.pendingIndex=[null,t],this.speak(`Jump to row ${t} and column`)}depth(){var t,e,i;if("d"===this.speechType)return void this.setCurrent(this.current);this.speechType="d";const s=[[null!==(t=this.node.getAttribute("data-semantic-level"))&&void 0!==t?t:"Level",null!==(e=this.current.getAttribute("aria-level"))&&void 0!==e?e:"0"].join(" ").trim()],o=this.actionable(this.current);o&&s.unshift(null!==(i=this.node.getAttribute("1"===o.getAttribute("toggle")?"data-semantic-expandable":"data-semantic-collapsible"))&&void 0!==i?i:""),this.speak(s.join(" "),this.current.getAttribute(P.BRAILLE))}summary(){if("x"===this.speechType)return void this.setCurrent(this.current);this.speechType="x";const t=this.current.getAttribute(P.SUMMARY);this.speak(t,this.current.getAttribute(P.BRAILLE),this.SsmlAttributes(this.current,P.SUMMARY_SSML))}nextRules(){this.node.removeAttribute("data-speech-attached"),this.restartAfter(this.generators.nextRules(this.item))}nextStyle(){this.node.removeAttribute("data-speech-attached"),this.restartAfter(this.generators.nextStyle(this.current,this.item))}details(){const t=this.actionable(this.current);if(!t||!t.getAttribute("data-collapsible")||"1"!==t.getAttribute("toggle")||"z"===this.speechType)return void this.setCurrent(this.current);this.speechType="z";const e=this.nodeId(this.current);let i;this.item.root.walkTree((t=>{t.attributes.get("data-semantic-id")===e&&(i=t)}));let s=this.item.toMathML(i,this.item);i.isKind("math")||(s=`<math>${s}</math>`),s=s.replace(/ (?:data-semantic-|aria-|data-speech-|data-latex).*?=".*?"/g,""),this.item.speechFor(s).then((([t,e])=>this.speak(t,e)))}help(){const t=this.document.adaptor,e=t.node("mjx-help-background"),i=t=>{e.remove(),this.node.focus(),this.stopEvent(t)};e.addEventListener("click",i);const s=t.node("mjx-help-sizer",{},[t.node("mjx-help-dialog",{tabindex:0,role:"dialog","aria-labeledby":"mjx-help-label"},[t.node("h1",{id:"mjx-help-label"},[t.text("MathJax Expression Explorer Help")]),t.node("div"),t.node("input",{type:"button",value:"Close"})])]);e.append(s);const o=s.firstChild;o.addEventListener("click",(t=>this.stopEvent(t))),o.lastChild.addEventListener("click",i),o.addEventListener("keydown",(t=>{"Escape"===t.code&&i(t)}));const[r,n]=q.get(k.os);o.childNodes[1].innerHTML=function(t,e){return`\n<H2>Exploring expressions ${t}</h2>\n\n<p>The mathematics on this page is being rendered by <a\nhref="https://www.mathjax.org/" target="_blank">MathJax</a>, which\ngenerates both the text spoken by screen readers, as well as the\nvisual layout for sighted users.</p>\n\n<p>Expressions typeset by MathJax can be explored interactively, and\nare focusable. You can use the <kbd>Tab</kbd> key to move to a typeset\nexpression${e}. Initially, the expression will be read in full,\nbut you can use the following keys to explore the expression\nfurther:<p>\n\n<ul>\n\n<li><kbd>Down Arrow</kbd> moves one level deeper into the expression to\nallow you to explore the current subexpression term by term.</li>\n\n<li><kbd>Up Arrow</kbd> moves back up a level within the expression.</li>\n\n<li><kbd>Right Arrow</kbd> moves to the next term in the current\nsubexpression.</li>\n\n<li><kbd>Left Arrow</kbd> moves to the next term in the current\nsubexpression.</li>\n\n<li><kbd>Shift</kbd>+<kbd>Arrow</kbd> moves to a neighboring cell within a table.\n\n<li><kbd>0-9</kbd>+<kbd>0-9</kbd> jumps to a cell by its index in the table, where 0 = 10.\n\n<li><kbd>Home</kbd> takes you to the top of the expression.</li>\n\n<li><kbd>Enter</kbd> or <kbd>Return</kbd> clicks a link or activates an active\nsubexpression.</li>\n\n<li><kbd>Space</kbd> opens the MathJax contextual menu where you can view\nor copy the source format of the expression, or modify MathJax's\nsettings.</li>\n\n<li><kbd>Escape</kbd> exits the expression explorer.</li>\n\n<li><kbd>x</kbd> gives a summary of the current subexpression.</li>\n\n<li><kbd>z</kbd> gives the full text of a collapsed expression.</li>\n\n<li><kbd>d</kbd> gives the current depth within the expression.</li>\n\n<li><kbd>s</kbd> starts or stops auto-voicing with synchronized highlighting.</li>\n\n<li><kbd>v</kbd> marks the current position in the expression.</li>\n\n<li><kbd>p</kbd> cycles through the marked positions in the expression.</li>\n\n<li><kbd>u</kbd> clears all marked positions and returns to the starting position.</li>\n\n<li><kbd>></kbd> cycles through the available speech rule sets\n(MathSpeak, ClearSpeak).</li>\n\n<li><kbd><</kbd> cycles through the verbosity levels for the current\nrule set.</li>\n\n<li><kbd>h</kbd> produces this help listing.</li>\n</ul>\n\n<p>The MathJax contextual menu allows you to enable or disable speech\nor Braille generation for mathematical expressions, the language to\nuse for the spoken mathematics, and other features of MathJax. In\nparticular, the Explorer submenu allows you to specify how the\nmathematics should be identified in the page (e.g., by saying "math"\nwhen the expression is spoken), and whether or not to include a\nmessage about the letter "h" bringing up this dialog box.</p>\n\n<p>The contextual menu also provides options for viewing or copying a\nMathML version of the expression or its original source format,\ncreating an SVG version of the expression, and viewing various other\ninformation.</p>\n\n<p>For more help, see the <a\nhref="https://docs.mathjax.org/en/latest/basic/accessibility.html"\ntarge="_blank">MathJax accessibility documentation.</a></p>\n`}(r,n),document.body.append(e),o.focus()}setCurrent(t,e=!1){if(this.speechType="",document.hasFocus()||(this.refocus=this.current),this.node.setAttribute("aria-busy","true"),this.current){for(const t of this.getSplitNodes(this.current))t.classList.remove("mjx-selected");this.pool.unhighlight(),"last"===this.document.options.a11y.tabSelects&&(this.refocus=this.current),t||(this.lastMark=this.current,this.removeSpeech()),this.current=null}if(this.current=t,this.currentMark=-1,this.current){const i=this.getSplitNodes(this.current);for(const t of i)t.classList.add("mjx-selected");this.pool.highlight(i),this.addSpeech(t,e)}this.node.removeAttribute("aria-busy")}getSplitNodes(t){const e=this.nodeId(t);return e?Array.from(this.node.querySelectorAll(`[data-semantic-id="${e}"]`)):[t]}addSpeech(t,e){var i;null===(i=this.img)||void 0===i||i.remove();let s=[t.getAttribute(P.PREFIX),t.getAttribute(P.SPEECH),t.getAttribute(P.POSTFIX)].join(" ").trim();if(e){let t=this.description===this.none?"":", "+this.description;this.document.options.a11y.help&&(t+=", press h for help"),s+=t}this.speak(s,t.getAttribute(P.BRAILLE),this.SsmlAttributes(t,P.SPEECH_SSML)),this.node.setAttribute("tabindex","-1")}removeSpeech(){this.speech&&(this.speech.remove(),this.speech=null,this.img&&this.node.append(this.img),this.node.setAttribute("tabindex","0"))}speak(t,e="",i=null,s=this.none){const o=this.speech;this.speech=document.createElement("mjx-speech"),this.speech.setAttribute("role",this.role),this.speech.setAttribute("aria-label",t),this.speech.setAttribute(P.SPEECH,t),i&&(this.speech.setAttribute(P.PREFIX_SSML,i[0]||""),this.speech.setAttribute(P.SPEECH_SSML,i[1]||""),this.speech.setAttribute(P.POSTFIX_SSML,i[2]||"")),e&&this.speech.setAttribute("aria-braillelabel",e),this.speech.setAttribute("aria-roledescription",s),this.speech.setAttribute("tabindex","0"),this.node.append(this.speech),this.focusSpeech=!0,this.speech.focus(),this.focusSpeech=!1,this.Update(),o&&setTimeout((()=>o.remove()),100)}attachSpeech(){var t;const e=this.item,i=this.node;if(!i.hasAttribute("has-speech")){for(const t of Array.from(i.childNodes))t.setAttribute("aria-hidden","true");i.setAttribute("has-speech","true")}const s=e.roleDescription,o=(i.getAttribute(P.SPEECH)||"")+(s?", "+s:"");null===(t=this.img)||void 0===t||t.remove(),this.img=this.document.adaptor.node("mjx-speech",{"aria-label":o,role:"img","aria-roledescription":e.none}),i.appendChild(this.img)}detachSpeech(){var t;const e=this.node;null===(t=this.img)||void 0===t||t.remove(),e.removeAttribute("has-speech");for(const t of Array.from(e.childNodes))t.removeAttribute("aria-hidden")}focus(){this.node.focus()}nodeId(t){return t.getAttribute("data-semantic-id")}parentId(t){return t.getAttribute("data-semantic-parent")}getNode(t){return t?this.node.querySelector(`[data-semantic-id="${t}"]`):null}getParent(t){return this.getNode(this.parentId(t))}childArray(t){return t?t.getAttribute("data-semantic-children").split(/,/):[]}isCell(t){return!!t&&this.cellTypes.includes(t.getAttribute("data-semantic-type"))}isRow(t){return!!t&&"row"===t.getAttribute("data-semantic-type")}tableCell(t){for(;t&&t!==this.node;){if(this.isCell(t))return t;t=t.parentNode}return null}cellTable(t){const e=this.getParent(t);return this.isRow(e)?this.getParent(e):e}cellPosition(t){const e=this.getParent(t),i=this.childArray(e).indexOf(this.nodeId(t));if(!this.isRow(e))return[i,1];const s=this.getParent(e);return[this.childArray(s).indexOf(this.nodeId(e)),i]}cellAt(t,e,i){const s=this.getNode(this.childArray(t)[e]);if(!this.isRow(s))return 1===i?s:null;return this.getNode(this.childArray(s)[i])}firstNode(t){const e=t.getAttribute("data-semantic-owns");if(!e)return t.querySelector(z);const i=e.split(/ /);for(const t of i){const e=this.getNode(t);if(null==e?void 0:e.hasAttribute("data-speech-node"))return e}return t.querySelector(z)}rootNode(){const t=this.node.querySelector("[data-semantic-structure]");if(!t)return this.node.querySelector(z);const e=t.getAttribute("data-semantic-structure").split(/ /)[0].replace("(","");return this.getNode(e)}nextSibling(t){var e;const i=this.parentId(t);if(!i)return null;const s=null===(e=this.getNode(i).getAttribute("data-semantic-owns"))||void 0===e?void 0:e.split(/ /);if(!s)return null;let o,r=s.indexOf(this.nodeId(t));do{o=this.getNode(s[++r])}while(o&&!o.hasAttribute("data-speech-node"));return o}prevSibling(t){var e;const i=this.parentId(t);if(!i)return null;const s=null===(e=this.getNode(i).getAttribute("data-semantic-owns"))||void 0===e?void 0:e.split(/ /);if(!s)return null;let o,r=s.indexOf(this.nodeId(t));do{o=this.getNode(s[--r])}while(o&&!o.hasAttribute("data-speech-node"));return o}findClicked(t,e,i){const s=this.document.infoIcon;if(s===t||s.contains(t))return s;if("SVG"!==this.node.getAttribute("jax"))return t.closest(z);let o=null,r=this.node;for(;r;){r.matches(z)&&(o=r);const t=Array.from(r.childNodes);r=null;for(const s of t)if(s!==this.speech&&s!==this.img&&"rect"!==s.tagName.toLowerCase()){const{left:t,right:o,top:n,bottom:h}=s.getBoundingClientRect();if(t<=e&&e<=o&&n<=i&&i<=h){r=s;break}}}return o}focusTop(){this.focusSpeech=!0,this.node.focus(),this.focusSpeech=!1}SsmlAttributes(t,e){return[t.getAttribute(P.PREFIX_SSML),t.getAttribute(e),t.getAttribute(P.POSTFIX_SSML)]}restartAfter(t){return B(this,void 0,void 0,(function*(){yield t,this.attachSpeech();const e=this.current;this.current=null,this.pool.unhighlight(),this.setCurrent(e)}))}constructor(t,e,i,s,o,r,n,h){super(t,e,null,s),this.document=t,this.pool=e,this.region=i,this.node=s,this.brailleRegion=o,this.magnifyRegion=r,this.item=h,this.sound=!1,this.current=null,this.clicked=null,this.refocus=null,this.focusSpeech=!1,this.restarted=null,this.speech=null,this.speechType="",this.img=null,this.attached=!1,this.eventsAttached=!1,this.marks=[],this.currentMark=-1,this.lastMark=null,this.pendingIndex=[],this.cellTypes=["cell","line"],this.events=super.Events().concat([["focusin",this.FocusIn.bind(this)],["focusout",this.FocusOut.bind(this)],["keydown",this.KeyDown.bind(this)],["mousedown",this.MouseDown.bind(this)],["click",this.Click.bind(this)],["dblclick",this.DblClick.bind(this)]])}findStartNode(){let t=this.refocus||this.current;return!t&&this.restarted&&(t=this.node.querySelector(this.restarted)),this.refocus=this.restarted=null,t}Start(){const t=Object.create(null,{Start:{get:()=>super.Start}});return B(this,void 0,void 0,(function*(){if(!this.attached||this.active)return;if(this.document.activeItem=this.item,this.item.state()<u.ATTACHSPEECH&&(this.item.attachSpeech(this.document),yield this.generators.promise),this.focusSpeech)return;this.node.classList.add("mjx-explorer-active"),this.node.append(this.document.infoIcon);const e=this.findStartNode();this.setCurrent(e||this.rootNode(),!e),t.Start.call(this);const i=this.document.options,s=i.a11y;s.subtitles&&s.speech&&i.enableSpeech&&this.region.Show(this.node,this.highlighter),s.viewBraille&&s.braille&&i.enableBraille&&this.brailleRegion.Show(this.node,this.highlighter),s.keyMagnifier&&this.magnifyRegion.Show(this.current,this.highlighter),this.Update()}))}Stop(){if(this.active){const t=this.description;this.node.getAttribute("aria-roledescription")!==t&&this.node.setAttribute("aria-roledescription",t),this.node.classList.remove("mjx-explorer-active"),this.document.infoIcon.remove(),this.pool.unhighlight(),this.magnifyRegion.Hide(),this.region.Hide(),this.brailleRegion.Hide()}super.Stop()}Update(){this.active&&(this.region.node=this.node,this.generators.updateRegions(this.speech||this.node,this.region,this.brailleRegion),this.magnifyRegion.Update(this.current))}Attach(){this.attached||(super.Attach(),this.node.setAttribute("tabindex","0"),this.attached=!0)}Detach(){var t;super.RemoveEvents(),this.node.removeAttribute("role"),this.node.removeAttribute("aria-roledescription"),this.node.removeAttribute("aria-label"),null===(t=this.img)||void 0===t||t.remove(),this.active&&this.node.setAttribute("tabindex","0"),this.attached=!1}NoMove(){j()}AddEvents(){this.eventsAttached||(super.AddEvents(),this.eventsAttached=!0)}actionable(t){const e=null==t?void 0:t.parentNode;return e&&this.highlighter.isMactionNode(e)?e:null}triggerLinkKeyboard(t){return this.current?this.triggerLink(this.current):t.target instanceof HTMLAnchorElement&&(t.target.dispatchEvent(new MouseEvent("click")),!0)}triggerLink(t){var e;if(null===(e=null==t?void 0:t.getAttribute("data-semantic-postfix"))||void 0===e?void 0:e.match(/(^| )link($| )/))for(;t&&t!==this.node;){if(t instanceof HTMLAnchorElement)return t.dispatchEvent(new MouseEvent("click")),setTimeout((()=>this.FocusOut(null)),50),!0;t=t.parentNode}return!1}triggerLinkMouse(){let t=this.refocus;for(;t&&t!==this.node;){if(this.triggerLink(t))return!0;t=t.parentNode}return!1}semanticFocus(){const t=[];let e="data-semantic-id",i=this.current||this.refocus||this.node;const s=this.actionable(i);s&&(e=s.hasAttribute("data-maction-id")?"data-maction-id":"id",i=s,t.push(z));const o=i.getAttribute(e);return o&&t.unshift(`[${e}="${o}"]`),t.join(" ")}}W.keyMap=new Map([["Tab",[()=>!0]],["Escape",[t=>t.escapeKey()]],["Enter",[(t,e)=>t.enterKey(e)]],["Home",[t=>t.homeKey()]],["ArrowDown",[(t,e)=>t.moveDown(e.shiftKey),!0]],["ArrowUp",[(t,e)=>t.moveUp(e.shiftKey),!0]],["ArrowLeft",[(t,e)=>t.moveLeft(e.shiftKey),!0]],["ArrowRight",[(t,e)=>t.moveRight(e.shiftKey),!0]],[" ",[t=>t.spaceKey()]],["h",[t=>t.hKey()]],[">",[t=>t.nextRules(),!1]],["<",[t=>t.nextStyle(),!1]],["x",[t=>t.summary(),!1]],["z",[t=>t.details(),!1]],["d",[t=>t.depth(),!1]],["v",[t=>t.addMark(),!1]],["p",[t=>t.prevMark(),!1]],["u",[t=>t.clearMarks(),!1]],["s",[t=>t.autoVoice(),!1]],...[..."0123456789"].map((t=>[t,[e=>e.numberKey(parseInt(t)),!1]]))]);const Y=MathJax._.a11y.sre_ts,G=(Y.locales,Y.setupEngine,Y.engineSetup);Y.toEnriched,Y.parseDOM,Y.addPreference,Y.fromPreference,Y.toPreference;class Q extends V{constructor(){super(...arguments),this.events=super.Events().concat([["mouseover",this.MouseOver.bind(this)],["mouseout",this.MouseOut.bind(this)]])}MouseOver(t){this.Start()}MouseOut(t){this.Stop()}}class Z extends Q{constructor(t,e,i,s,o,r){super(t,e,i,s),this.document=t,this.pool=e,this.region=i,this.node=s,this.nodeQuery=o,this.nodeAccess=r}MouseOut(t){this.highlighter.unhighlight(),this.region.Hide(),super.MouseOut(t)}MouseOver(t){super.MouseOver(t);const e=t.target,[i,s]=this.getNode(e);i&&(this.highlighter.unhighlight(),this.highlighter.highlight([i]),this.region.Update(s),this.region.Show(i,this.highlighter))}getNode(t){const e=t;for(;t&&t!==this.node;){if(this.nodeQuery(t))return[t,this.nodeAccess(t)];t=t.parentNode}for(t=e;t;){if(this.nodeQuery(t))return[t,this.nodeAccess(t)];const e=t.childNodes[0];t=e&&"defs"===e.tagName?t.childNodes[1]:e}return[null,null]}}class tt extends Z{}class et extends Z{}class it extends Z{constructor(t,e,i,s){super(t,e,new D(t),s,(t=>this.highlighter.isMactionNode(t)),(()=>{})),this.document=t,this.pool=e,this.node=s}}class st extends V{constructor(t,e,i,s,o){super(t,e,null,s),this.document=t,this.pool=e,this.region=i,this.node=s,this.mml=o,this.stoppable=!1}Attach(){super.Attach(),this.Start()}Detach(){this.Stop(),super.Detach()}}class ot extends st{Start(){this.active||(this.active=!0,this.highlighter.highlightAll(this.node))}Stop(){this.active&&this.highlighter.unhighlightAll(),this.active=!1}}class rt extends st{constructor(){super(...arguments),this.contrast=new nt,this.leaves=[],this.modality="data-semantic-foreground"}Start(){this.active||(this.active=!0,this.node.hasAttribute("hasforegroundcolor")||(this.colorLeaves(),this.node.setAttribute("hasforegroundcolor","true")),this.leaves.forEach((t=>this.colorize(t))))}Stop(){this.active&&this.leaves.forEach((t=>this.uncolorize(t))),this.active=!1}colorLeaves(){this.leaves=Array.from(this.node.querySelectorAll("[data-semantic-id]:not([data-semantic-children])"));for(const t of this.leaves)t.setAttribute(this.modality,this.contrast.generate()),this.contrast.increment()}colorize(t){t.hasAttribute(this.modality)&&(t.setAttribute(this.modality+"-old",t.style.color),t.style.color=t.getAttribute(this.modality))}uncolorize(t){const e=this.modality+"-old";t.hasAttribute(e)&&(t.style.color=t.getAttribute(e))}}class nt{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=53}generate(){return nt.hsl2rgb(this.hue,this.sat,this.light)}increment(){this.hue=(this.hue+this.incr)%360}static hsl2rgb(t,e,i){e=e>1?e/100:e,i=i>1?i/100:i;const s=(1-Math.abs(2*i-1))*e,o=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let n=0,h=0,a=0;return 0<=t&&t<60?[n,h,a]=[s,o,0]:60<=t&&t<120?[n,h,a]=[o,s,0]:120<=t&&t<180?[n,h,a]=[0,s,o]:180<=t&&t<240?[n,h,a]=[0,o,s]:240<=t&&t<300?[n,h,a]=[o,0,s]:300<=t&&t<360&&([n,h,a]=[s,0,o]),`rgb(${255*(n+r)}, ${255*(h+r)}, ${255*(a+r)})`}}class ht{constructor(t){this.document=t,this.speechRegion=new K(this.document),this.brailleRegion=new F(this.document),this.magnifier=new U(this.document),this.tooltip1=new J(this.document),this.tooltip2=new J(this.document),this.tooltip3=new J(this.document)}}const at={speech:(t,e,i,...s)=>{const o=W.create(t,e,t.explorerRegions.speechRegion,i,t.explorerRegions.brailleRegion,t.explorerRegions.magnifier,s[0],s[1]);return o.sound=!0,o},mouseMagnifier:(t,e,i,...s)=>et.create(t,e,t.explorerRegions.magnifier,i,(t=>t.hasAttribute("data-semantic-type")),(t=>t)),hover:(t,e,i,...s)=>it.create(t,e,null,i),infoType:(t,e,i,...s)=>tt.create(t,e,t.explorerRegions.tooltip1,i,(t=>t.hasAttribute("data-semantic-type")),(t=>t.getAttribute("data-semantic-type"))),infoRole:(t,e,i,...s)=>tt.create(t,e,t.explorerRegions.tooltip2,i,(t=>t.hasAttribute("data-semantic-role")),(t=>t.getAttribute("data-semantic-role"))),infoPrefix:(t,e,i,...s)=>tt.create(t,e,t.explorerRegions.tooltip3,i,(t=>{var e;return null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-semantic-prefix-none")}),(t=>{var e;return null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"data-semantic-prefix-none")})),flame:(t,e,i,...s)=>ot.create(t,e,null,i),treeColoring:(t,e,i,...s)=>rt.create(t,e,null,i,...s)};class lt{constructor(){this.explorers={},this.attached=[],this._restart=[],this.speechExplorerKeys=["speech","braille","keyMagnifier"]}get highlighter(){if(this._renderer!==this.document.outputJax.name)return this._renderer=this.document.outputJax.name,this.setPrimaryHighlighter(),this._highlighter;const[t,e]=this.colorOptions();return this._highlighter.setColor(e,t),this._highlighter}init(t,e,i,s){this.document=t,this.mml=i,this.node=e,this.setPrimaryHighlighter();for(const t of Object.keys(at))this.explorers[t]=at[t](this.document,this,this.node,this.mml,s);this.setSecondaryHighlighter(),this.attach()}attach(){this.attached=[];const t=[],e=this.document.options.a11y;for(const[i,s]of Object.entries(this.explorers))s instanceof W?(s.stoppable=!1,t.unshift(s),this.speechExplorerKeys.some((t=>this.document.options.a11y[t]))?(s.Attach(),this.attached.push(i)):s.Detach()):e[i]||"speech"===i&&(e.braille||e.keyMagnifier)?(s.Attach(),this.attached.push(i)):s.Detach();for(const e of t)if(e.attached){e.stoppable=!0;break}}reattach(){for(const t of this.attached){const e=this.explorers[t];e.active&&(this._restart.push(t),e.Stop())}}restart(){this._restart.forEach((t=>{this.explorers[t].Start()})),this._restart=[]}setPrimaryHighlighter(){const[t,e]=this.colorOptions();this._highlighter=T(e,t,this.document.outputJax.name)}setSecondaryHighlighter(){this.secondaryHighlighter=T({color:"red"},{color:"black"},this.document.outputJax.name),this.speech.region.highlighter=this.secondaryHighlighter}highlight(t){this.highlighter.highlight(t)}unhighlight(){this.secondaryHighlighter.unhighlight(),this.highlighter.unhighlight()}get speech(){return this.explorers.speech}colorOptions(){const t=this.document.options.a11y;return[{color:t.foregroundColor.toLowerCase(),alpha:t.foregroundOpacity/100},{color:t.backgroundColor.toLowerCase(),alpha:t.backgroundOpacity/100}]}}const ct="Unix"===k.os;function dt(t,e){var i;return i=class extends t{constructor(){super(...arguments),this.refocus=null}get ariaRole(){return this.constructor.ariaRole}get roleDescription(){const t=this.constructor;return"none"===t.roleDescription?t.none:t.roleDescription}get none(){return this.constructor.none}attachSpeech(t){var e,i;super.attachSpeech(t),null===(i=null===(e=this.outputData.speechPromise)||void 0===e?void 0:e.then((()=>this.explorers.speech.attachSpeech())))||void 0===i||i.then((()=>{var t;(null===(t=this.explorers)||void 0===t?void 0:t.speech)&&(this.explorers.speech.restarted=this.refocus),this.refocus=null,this.explorers&&this.explorers.restart()}))}detachSpeech(t){super.detachSpeech(t),this.explorers.speech.detachSpeech()}explorable(t,i=!1){if(!(this.state()>=u.EXPLORER)){if(!this.isEscaped&&(t.options.enableExplorer||i)){const i=this.typesetRoot,s=e(this.root);this.explorers||(this.explorers=new lt),this.explorers.init(t,i,s,this)}this.state(u.EXPLORER)}}state(t=null,e=!1){if(t<u.EXPLORER&&this.explorers)for(const t of Object.values(this.explorers.explorers))t.active&&t.Stop();return super.state(t,e)}rerender(t,e=u.RERENDER){const i=this.setTemporaryFocus(t);super.rerender(t,e),this.clearTemporaryFocus(i)}setTemporaryFocus(t){var e;let i=null;if(this.explorers){const s=this.explorers.speech;if(i=(null==s?void 0:s.attached)?t.tmpFocus:null,i){this.refocus=null!==(e=s.semanticFocus())&&void 0!==e?e:null;const o=t.adaptor;o.append(o.body(),i)}this.explorers.reattach(),null==i||i.focus()}return i}clearTemporaryFocus(t){var e;if(t){(null!==(e=this.outputData.speechPromise)&&void 0!==e?e:Promise.resolve()).then((()=>setTimeout((()=>t.remove()),100)))}}},i.ariaRole=ct?"tree":"application",i.roleDescription="math",i.none="\x91",i}function ut(t){var e;return(e=class extends t{constructor(...t){super(...t),this.explorerRegions=null,this.activeItem=null;const e=this.constructor.ProcessBits;e.has("explorer")||e.allocate("explorer");const i=new v(this.mmlFactory),s=this.options;s.a11y.speechRules||(s.a11y.speechRules=`${s.sre.domain}-${s.sre.style}`);const o=s.MathItem=dt(s.MathItem,(t=>i.visitTree(t)));o.roleDescription=s.roleDescription,this.explorerRegions=new ht(this),"addStyles"in this&&this.addStyles(this.constructor.speechStyles);const r=this.adaptor,n="http://www.w3.org/2000/svg";this.infoIcon=r.node("mjx-help",{},[r.node("svg",{viewBox:"0 0 18 18",xmlns:n,"aria-hidden":"true"},[r.node("circle",{stroke:"none"},[],n),r.node("circle",{},[],n),r.node("line",{x1:9,y1:9,x2:9,y2:13},[],n),r.node("line",{x1:9,y1:5.5,x2:9,y2:5.5},[],n)],n)]),this.tmpFocus=this.adaptor.node("mjx-focus",{tabIndex:0,style:{outline:"none",display:"block",position:"absolute",top:0,left:"-10px",width:"1px",height:"1px",overflow:"hidden"},role:o.ariaRole,"aria-label":o.none,"aria-roledescription":o.none})}explorable(){if(!this.processed.isSet("explorer")){if(this.options.enableExplorer)for(const t of this.math)t.explorable(this);this.processed.set("explorer")}return this}rerender(t){const e=this.activeItem,i=null==e?void 0:e.setTemporaryFocus(this);return super.rerender(t),null==e||e.clearTemporaryFocus(i),this}state(t,e=!1){return super.state(t,e),t<u.EXPLORER&&this.processed.clear("explorer"),this}}).OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableExplorer:y,renderActions:f(Object.assign(Object.assign({},t.OPTIONS.renderActions),{explorable:[u.EXPLORER]})),sre:f(Object.assign(Object.assign({},t.OPTIONS.sre),{speech:"none"})),a11y:Object.assign(Object.assign({},t.OPTIONS.a11y),{align:"top",backgroundColor:"Blue",backgroundOpacity:20,flame:!1,foregroundColor:"Black",foregroundOpacity:100,highlight:"None",hover:!1,infoPrefix:!1,infoRole:!1,infoType:!1,keyMagnifier:!1,magnification:"None",magnify:"400%",mouseMagnifier:!1,subtitles:!1,treeColoring:!1,viewBraille:!1,voicing:!1,help:!0,roleDescription:"math",tabSelects:"all"})}),e.speechStyles={'mjx-container[has-speech="true"]':{position:"relative",cursor:"default"},"mjx-speech":{position:"absolute","z-index":-1,left:0,top:0,bottom:0,right:0},"mjx-speech:focus":{outline:"none"},"mjx-container .mjx-selected":{outline:"2px solid black"},"mjx-container > mjx-help":{display:"none",position:"absolute",top:"-.33em",right:"-.5em",width:".6em",height:".6em",cursor:"pointer"},'mjx-container[display="true"] > mjx-help':{right:0},"mjx-help > svg":{stroke:"black",width:"100%",height:"100%"},"mjx-help > svg > circle":{"stroke-width":"1.5px",cx:"9px",cy:"9px",r:"9px",fill:"white"},"mjx-help > svg > circle:nth-child(2)":{fill:"rgba(0, 0, 255, 0.2)",r:"7px"},"mjx-help > svg > line":{"stroke-width":"2.5px","stroke-linecap":"round"},"mjx-help:hover > svg > circle:nth-child(2)":{fill:"white"},"mjx-container.mjx-explorer-active > mjx-help":{display:"inline-flex","align-items":"center"},"mjx-help-sizer":{position:"fixed",width:"40%","max-width":"30em",top:"3em",left:"50%"},"mjx-help-dialog":{position:"absolute",width:"200%",left:"-100%",border:"3px outset","border-radius":"15px",color:"black","background-color":"#DDDDDD","z-index":"301","text-align":"right","font-style":"normal","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal",float:"none","box-shadow":"0px 10px 20px #808080",outline:"none"},"mjx-help-dialog > h1":{"font-size":"24px","text-align":"center",margin:".5em 0"},"mjx-help-dialog > div":{margin:"0 1em",padding:"3px",overflow:"auto",height:"20em",border:"2px inset black","background-color":"white","text-align":"left"},"mjx-help-dialog > input":{margin:".5em 2em"},"mjx-help-dialog kbd":{display:"inline-block",padding:"3px 5px","font-size":"11px","line-height":"10px",color:"#444d56","vertical-align":"middle","background-color":"#fafbfc",border:"solid 1.5px #c6cbd1","border-bottom-color":"#959da5","border-radius":"3px","box-shadow":"inset -.5px -1px 0 #959da5"},"mjx-help-dialog ul":{"list-style-type":"none"},"mjx-help-dialog li":{"margin-bottom":".5em"},"mjx-help-background":{position:"fixed",top:0,left:0,right:0,bottom:0}},e}function pt(t,e=null){return t.documentClass.prototype.attachSpeech||(t=m(t,e)),t.documentClass=ut(t.documentClass),t}function gt(t,e){var i;const s=G();for(const i in e)void 0!==t.options.a11y[i]?mt(t,i,e[i]):void 0!==s[i]&&(t.options.sre[i]=e[i]);e.roleDescription&&(t.options.MathItem.roleDescription=e.roleDescription);for(const e of t.math)null===(i=null==e?void 0:e.explorers)||void 0===i||i.attach()}function mt(t,e,i){switch(e){case"speechRules":{const[e,s]=i.split("-");t.options.sre.domain=e,t.options.sre.style=s;break}case"magnification":switch(i){case"None":t.options.a11y.magnification=i,t.options.a11y.keyMagnifier=!1,t.options.a11y.mouseMagnifier=!1;break;case"Keyboard":t.options.a11y.magnification=i,t.options.a11y.keyMagnifier=!0,t.options.a11y.mouseMagnifier=!1;break;case"Mouse":t.options.a11y.magnification=i,t.options.a11y.keyMagnifier=!1,t.options.a11y.mouseMagnifier=!0}break;case"highlight":switch(i){case"None":t.options.a11y.highlight=i,t.options.a11y.hover=!1,t.options.a11y.flame=!1;break;case"Hover":t.options.a11y.highlight=i,t.options.a11y.hover=!0,t.options.a11y.flame=!1;break;case"Flame":t.options.a11y.highlight=i,t.options.a11y.hover=!1,t.options.a11y.flame=!0}break;case"locale":t.options.sre.locale=i;break;default:t.options.a11y[e]=i}}p("EXPLORER",u.INSERTED+30),MathJax.loader&&MathJax.loader.checkVersion("a11y/explorer","4.0.0","a11y"),c({_:{a11y:{explorer_ts:a,explorer:{Explorer:s,ExplorerPool:h,Highlighter:e,KeyExplorer:o,MouseExplorer:r,Region:i,TreeExplorer:n}}}}),MathJax.startup&&y&&MathJax.startup.extendHandler((t=>pt(t)))})(); |