backy-docs/public/js/mathjax/a11y/explorer.js

1 line
32 KiB
JavaScript
Raw Permalink Normal View History

2023-02-20 04:21:20 +00:00
!function(){"use strict";var t={18:function(t,e,o){var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,o=1,r=arguments.length;o<r;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],r=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var r,n,i=o.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a},l=this&&this.__spreadArray||function(t,e){for(var o=0,r=e.length,n=t.length;o<r;o++,n++)t[n]=e[o];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.setA11yOption=e.setA11yOptions=e.ExplorerHandler=e.ExplorerMathDocumentMixin=e.ExplorerMathItemMixin=void 0;var h=o(769),c=o(511),p=o(77),u=o(433),d=o(850),f=o(269),y=o(85),v=o(854),g=o(367);function m(t,e){return function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.explorers={},e.attached=[],e.restart=[],e.refocus=!1,e.savedId=null,e}return n(o,t),o.prototype.explorable=function(t,o){if(void 0===o&&(o=!1),!(this.state()>=h.STATE.EXPLORER)){if(!this.isEscaped&&(t.options.enableExplorer||o)){var r=this.typesetRoot,n=e(this.root);this.savedId&&(this.typesetRoot.setAttribute("sre-explorer-id",this.savedId),this.savedId=null),this.explorers=function(t,e,o){var r,n,i={};try{for(var s=a(Object.keys(_)),l=s.next();!l.done;l=s.next()){var h=l.value;i[h]=_[h](t,e,o)}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}(t,r,n),this.attachExplorers(t)}this.state(h.STATE.EXPLORER)}},o.prototype.attachExplorers=function(t){var e,o,r,n;this.attached=[];var i=[];try{for(var s=a(Object.keys(this.explorers)),l=s.next();!l.done;l=s.next()){var h=l.value;(u=this.explorers[h])instanceof f.AbstractKeyExplorer&&(u.AddEvents(),u.stoppable=!1,i.unshift(u)),t.options.a11y[h]?(u.Attach(),this.attached.push(h)):u.Detach()}}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(e)throw e.error}}try{for(var c=a(i),p=c.next();!p.done;p=c.next()){var u;if((u=p.value).attached){u.stoppable=!0;break}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}},o.prototype.rerender=function(e,o){var r,n;void 0===o&&(o=h.STATE.RERENDER),this.savedId=this.typesetRoot.getAttribute("sre-explorer-id"),this.refocus=window.document.activeElement===this.typesetRoot;try{for(var i=a(this.attached),s=i.next();!s.done;s=i.next()){var l=s.value,c=this.explorers[l];c.active&&(this.restart.push(l),c.Stop())}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.prototype.rerender.call(this,e,o)},o.prototype.updateDocument=function(e){var o=this;t.prototype.updateDocument.call(this,e),this.refocus&&this.typesetRoot.focus(),this.restart.forEach((function(t){return o.explorers[t].Start()})),this.restart=[],this.refocus=!1},o}(t)}function x(t){var e;return(e=function(t){function e(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var r=t.apply(this,l([],s(e)))||this,n=r.constructor.ProcessBits;n.has("explorer")||n.allocate("explorer");var i=new u.SerializedMmlVisitor(