maidr 3.4.0 → 3.4.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/maidr.js CHANGED
@@ -567,7 +567,7 @@ Learn more: https://react.dev/warnings/version-mismatch`))}(),typeof Map=="funct
567
567
  You might need to use a local HTTP server (instead of file://): https://react.dev/link/react-devtools-faq`:""),"font-weight:bold")}Py.createRoot=function(e,t){if(!H(e))throw Error("Target container is not a DOM element.");am(e);var r=!1,u="",h=qS,y=gh,x=vh,C=null;return t!=null&&(t.hydrate?console.warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead."):typeof t=="object"&&t!==null&&t.$$typeof===dl&&console.error(`You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:
568
568
 
569
569
  let root = createRoot(domContainer);
570
- root.render(<App />);`),t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(u=t.identifierPrefix),t.onUncaughtError!==void 0&&(h=t.onUncaughtError),t.onCaughtError!==void 0&&(y=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(C=t.unstable_transitionCallbacks)),t=kv(e,1,!1,null,null,r,u,h,y,x,C,null),e[ys]=t.current,vd(e),new tm(t)},Py.hydrateRoot=function(e,t,r){if(!H(e))throw Error("Target container is not a DOM element.");am(e),t===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var u=!1,h="",y=qS,x=gh,C=vh,j=null,I=null;return r!=null&&(r.unstable_strictMode===!0&&(u=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(y=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(C=r.onRecoverableError),r.unstable_transitionCallbacks!==void 0&&(j=r.unstable_transitionCallbacks),r.formState!==void 0&&(I=r.formState)),t=kv(e,1,!0,t,r??null,u,h,y,x,C,j,I),t.context=Rn(null),r=t.current,u=Jo(r),u=yt(u),h=Vr(u),h.callback=null,jr(r,h,u),r=u,t.current.lanes=r,rn(t,r),Er(t),e[ys]=t.current,vd(e),new nm(t)},Py.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}(),Py}var p_;function O$(){if(p_)return AS.exports;p_=1;var n={};function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(n.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(l){console.error(l)}}}return n.NODE_ENV==="production"?(o(),AS.exports=T$()):AS.exports=x$(),AS.exports}var R$=O$();class A${constructor(o,l,c){q(this,"context");q(this,"focusStack");q(this,"plot");q(this,"reactRoot");q(this,"onChangeEmitter");q(this,"onChange");q(this,"currentInstruction","");q(this,"handleMouseEnter",o=>{o.currentTarget.setAttribute(de.TITLE,this.currentInstruction)});q(this,"handleMouseLeave",o=>{o.currentTarget.removeAttribute(de.TITLE)});this.context=o,this.focusStack=new gT,this.focusStack.push(this.context.scope),this.plot=l,this.reactRoot=R$.createRoot(c,{identifierPrefix:this.context.id}),this.reactRoot.render(b$),this.onChangeEmitter=new lp,this.onChange=this.onChangeEmitter.event,this.plot.addEventListener("click",()=>{const p=this.plot.closest(de.FIGURE),m=this.plot.closest(de.ARTICLE);p&&p.removeAttribute(de.TITLE),m&&m.removeAttribute(de.TITLE)}),this.addInstruction()}dispose(){var o;this.onChangeEmitter.dispose(),(o=this.reactRoot)==null||o.unmount(),this.reactRoot=null}addInstruction(){const o=this.context.getInstruction(!0);this.currentInstruction=o,this.plot.setAttribute(de.ARIA_LABEL,o),this.plot.setAttribute(de.ROLE,de.IMAGE),this.plot.tabIndex=0;const l=this.plot.closest(de.FIGURE),c=this.plot.closest(de.ARTICLE);l&&(l.setAttribute(de.TITLE,o),l.addEventListener("mouseenter",this.handleMouseEnter),l.addEventListener("mouseleave",this.handleMouseLeave)),c&&(c.setAttribute(de.TITLE,o),c.addEventListener("mouseenter",this.handleMouseEnter),c.addEventListener("mouseleave",this.handleMouseLeave))}removeInstruction(){this.plot.removeAttribute(de.ARIA_LABEL),this.plot.setAttribute(de.ROLE,de.APPLICATION),this.plot.tabIndex=-1;const o=this.plot.closest(de.FIGURE),l=this.plot.closest(de.ARTICLE);o&&(o.removeAttribute(de.TITLE),o.removeEventListener("mouseenter",this.handleMouseEnter),o.removeEventListener("mouseleave",this.handleMouseLeave)),l&&(l.removeAttribute(de.TITLE),l.removeEventListener("mouseenter",this.handleMouseEnter),l.removeEventListener("mouseleave",this.handleMouseLeave))}toggleFocus(o){this.focusStack.removeLast(o)||this.focusStack.push(o),this.context.toggleScope(o),this.addInstruction(),this.updateFocus(this.focusStack.peek())}updateFocus(o){this.addInstruction(),(o==="TRACE"||o==="SUBPLOT")&&this.plot.focus(),this.onChangeEmitter.fire({value:o})}}const zp=class zp{constructor(){}static get ctrl(){return zp.IS_MAC?"command":"ctrl"}static get alt(){return zp.IS_MAC?"option":"alt"}static get enter(){return zp.IS_MAC?"return":"enter"}};q(zp,"IS_MAC",(()=>{var l;return(((l=navigator.userAgentData)==null?void 0:l.platform)??navigator.platform).toLowerCase().includes("mac")})());let Ct=zp;const lx=[{description:"Navigate Data Points",key:"arrow keys"},{description:"Move to Next Layer",key:"page up"},{description:"Move to Previous Layer",key:"page down"},{description:"Go to Left/Right/Top/Bottom Extreme Point",key:`${Ct.ctrl} + arrow keys`},{description:"Toggle Braille Mode",key:"b"},{description:"Toggle Text Mode",key:"t"},{description:"Toggle Sonification Mode",key:"s"},{description:"Toggle Review Mode",key:"r"},{description:"Autoplay Outward",key:`${Ct.ctrl} + shift + arrow keys`},{description:"Stop Autoplay",key:`${Ct.ctrl}`},{description:"Speed Up Autoplay",key:". (period)"},{description:"Speed Down Autoplay",key:", (comma)"},{description:"Reset Autoplay Speed",key:"/ (slash)"},{description:"Replay Current Point",key:"space"},{description:"Announce Plot Title",key:"l t"},{description:"Announce X Label",key:"l x"},{description:"Announce Y Label",key:"l y"},{description:"Announce Fill (Z) Label",key:"l f"},{description:"Open Settings",key:`${Ct.ctrl} + ,`},{description:"Open Chat",key:"?"}],h_=[{description:"Move around Subplot",key:"arrow keys"},{description:"Activate Current Subplot",key:`${Ct.enter}`},{description:"Announce Plot Title",key:"l t"},{description:"Announce Subtitle",key:"l s"},{description:"Announce Caption",key:"l c"},{description:"Open Settings",key:`${Ct.ctrl} + ,`}];class C${constructor(o,l){q(this,"context");q(this,"display");q(this,"scopedMenuItems");this.context=o,this.display=l,this.scopedMenuItems={[cn.TRACE]:lx,[cn.TRACE_LABEL]:lx,[cn.BRAILLE]:lx,[cn.SUBPLOT]:h_,[cn.FIGURE_LABEL]:h_}}getMenuItems(){return this.scopedMenuItems[this.context.scope]??[]}toggle(){this.display.toggleFocus(cn.HELP)}}class w${constructor(){q(this,"highlightedElements");this.highlightedElements=new Set}dispose(){this.unhighlight()}update(o){if(o.empty)return;this.unhighlight();const l=o.type==="subplot"?o.trace:o;if(l.empty||l.highlight.empty)return;const c=l.highlight,p=Array.isArray(c.elements)?c.elements:[c.elements];this.highlight(p)}highlight(o){for(const l of o){const c=Kn.createHighlightElement(l,de.MAIDR_HIGHLIGHT_COLOR);c.id=`${de.MAIDR_HIGHLIGHT}-${Date.now()}-${Math.random()}`,this.highlightedElements.add(c)}}unhighlight(){this.highlightedElements.forEach(o=>o.remove()),this.highlightedElements.clear()}}class _${constructor(o,l){q(this,"context");q(this,"autoplay");this.context=o,this.autoplay=l}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("UPWARD",o)}}class M${constructor(o,l){q(this,"context");q(this,"autoplay");this.autoplay=l,this.context=o}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("DOWNWARD",o)}}class D${constructor(o,l){q(this,"context");q(this,"autoplay");this.autoplay=l,this.context=o}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("FORWARD",o)}}class N${constructor(o,l){q(this,"context");q(this,"autoplay");this.autoplay=l,this.context=o}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("BACKWARD",o)}}class z${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.stop()}}class U${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.speedUp()}}class L${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.speedDown()}}class k${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.resetSpeed()}}class xf{constructor(o,l){q(this,"context");q(this,"textViewModel");this.context=o,this.textViewModel=l}}class V$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="trace"&&!o.empty){const l=`X label is ${o.xAxis}`;this.textViewModel.update(l)}}}class j$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="trace"&&!o.empty){const l=`Y label is ${o.yAxis}`;this.textViewModel.update(l)}}}class B$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="trace"&&!o.empty){const l=`Fill is ${o.fill}`;this.textViewModel.update(l)}}}class $$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(!o.empty){if(o.type==="figure"){const l=`Figure title is ${o.title}`;this.textViewModel.update(l)}else if(o.type==="trace"){const l=`Subplot title is ${o.title}`;this.textViewModel.update(l)}}}}class H$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="figure"&&!o.empty){const l=`Subtitle is ${o.subtitle}`;this.textViewModel.update(l)}}}class I$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="figure"&&!o.empty){const l=`Caption is ${o.caption}`;this.textViewModel.update(l)}}}class Y$ extends xf{constructor(l,c,p,m,v){super(l,v);q(this,"audio");q(this,"brailleViewModel");q(this,"highlight");this.audio=c,this.highlight=p,this.brailleViewModel=m}execute(){const l=this.context.state;switch(l.type){case"figure":case"subplot":this.textViewModel.update(l);break;case"trace":this.textViewModel.update(l),this.audio.update(l),this.brailleViewModel.update(l),this.highlight.update(l);break}}}class G${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("UPWARD")}}class q${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("DOWNWARD")}}class P${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("BACKWARD")}}class X${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("FORWARD")}}class Q${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("UPWARD")}}class K${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("DOWNWARD")}}class Z${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("BACKWARD")}}class W${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("FORWARD")}}class F${constructor(o){q(this,"context");this.context=o}execute(){this.context.enterSubplot()}}class J${constructor(o){q(this,"context");this.context=o}execute(){this.context.exitSubplot()}}class e8{constructor(o){q(this,"context");this.context=o}execute(){this.context.stepTrace("UPWARD")}}class t8{constructor(o){q(this,"context");this.context=o}execute(){this.context.stepTrace("DOWNWARD")}}class n8{constructor(o,l){q(this,"context");q(this,"brailleViewModel");this.context=o,this.brailleViewModel=l}execute(){const o=this.context.state;o.type==="trace"&&this.brailleViewModel.toggle(o)}}class a8{constructor(o){q(this,"textViewModel");this.textViewModel=o}execute(){this.textViewModel.toggle()}}class o8{constructor(o){q(this,"audio");this.audio=o}execute(){this.audio.toggle()}}class r8{constructor(o,l){q(this,"context");q(this,"reviewViewModel");this.context=o,this.reviewViewModel=l}execute(){const o=this.context.state;o.type==="trace"&&this.reviewViewModel.toggle(o)}}class i8{constructor(o){q(this,"helpViewModel");this.helpViewModel=o}execute(){this.helpViewModel.toggle()}}class l8{constructor(o){q(this,"chatViewModel");this.chatViewModel=o}execute(){this.chatViewModel.toggle()}}class s8{constructor(o){q(this,"settingsViewModel");this.settingsViewModel=o}execute(){this.settingsViewModel.toggle()}}class m_{constructor(o,l){q(this,"context");q(this,"scope");this.context=o,this.scope=l}execute(){this.context.toggleScope(this.scope)}}class u8{constructor(o){q(this,"context");q(this,"audioService");q(this,"autoplayService");q(this,"highlightService");q(this,"brailleViewModel");q(this,"chatViewModel");q(this,"helpViewModel");q(this,"reviewViewModel");q(this,"settingsViewModel");q(this,"textViewModel");this.context=o.context,this.audioService=o.audioService,this.autoplayService=o.autoplayService,this.highlightService=o.highlightService,this.brailleViewModel=o.brailleViewModel,this.chatViewModel=o.chatViewModel,this.helpViewModel=o.helpViewModel,this.reviewViewModel=o.reviewViewModel,this.settingsViewModel=o.settingsViewModel,this.textViewModel=o.textViewModel}create(o){switch(o){case"MOVE_UP":return new G$(this.context);case"MOVE_DOWN":return new q$(this.context);case"MOVE_LEFT":return new P$(this.context);case"MOVE_RIGHT":return new X$(this.context);case"MOVE_TO_TOP_EXTREME":return new Q$(this.context);case"MOVE_TO_BOTTOM_EXTREME":return new K$(this.context);case"MOVE_TO_LEFT_EXTREME":return new Z$(this.context);case"MOVE_TO_RIGHT_EXTREME":return new W$(this.context);case"MOVE_TO_TRACE_CONTEXT":return new F$(this.context);case"MOVE_TO_SUBPLOT_CONTEXT":return new J$(this.context);case"MOVE_TO_NEXT_TRACE":return new e8(this.context);case"MOVE_TO_PREV_TRACE":return new t8(this.context);case"TOGGLE_AUDIO":return new o8(this.audioService);case"TOGGLE_BRAILLE":return new n8(this.context,this.brailleViewModel);case"TOGGLE_TEXT":return new a8(this.textViewModel);case"TOGGLE_REVIEW":return new r8(this.context,this.reviewViewModel);case"TOGGLE_HELP":return new i8(this.helpViewModel);case"TOGGLE_CHAT":return new l8(this.chatViewModel);case"TOGGLE_SETTINGS":return new s8(this.settingsViewModel);case"DESCRIBE_X":return new V$(this.context,this.textViewModel);case"DESCRIBE_Y":return new j$(this.context,this.textViewModel);case"DESCRIBE_FILL":return new B$(this.context,this.textViewModel);case"DESCRIBE_POINT":return new Y$(this.context,this.audioService,this.highlightService,this.brailleViewModel,this.textViewModel);case"DESCRIBE_TITLE":return new $$(this.context,this.textViewModel);case"DESCRIBE_SUBTITLE":return new H$(this.context,this.textViewModel);case"DESCRIBE_CAPTION":return new I$(this.context,this.textViewModel);case"ACTIVATE_FIGURE_LABEL_SCOPE":case"DEACTIVATE_FIGURE_LABEL_SCOPE":return new m_(this.context,cn.FIGURE_LABEL);case"ACTIVATE_TRACE_LABEL_SCOPE":case"DEACTIVATE_TRACE_LABEL_SCOPE":return new m_(this.context,cn.TRACE_LABEL);case"AUTOPLAY_UPWARD":return new _$(this.context,this.autoplayService);case"AUTOPLAY_DOWNWARD":return new M$(this.context,this.autoplayService);case"AUTOPLAY_FORWARD":return new D$(this.context,this.autoplayService);case"AUTOPLAY_BACKWARD":return new N$(this.context,this.autoplayService);case"STOP_AUTOPLAY":return new z$(this.autoplayService);case"SPEED_UP_AUTOPLAY":return new U$(this.autoplayService);case"SPEED_DOWN_AUTOPLAY":return new L$(this.autoplayService);case"RESET_AUTOPLAY_SPEED":return new k$(this.autoplayService);default:throw new Error(`Invalid command name: ${o}`)}}}const c8={ACTIVATE_TRACE_LABEL_SCOPE:"l",AUTOPLAY_UPWARD:`${Ct.ctrl}+shift+up`,AUTOPLAY_DOWNWARD:`${Ct.ctrl}+shift+down`,AUTOPLAY_FORWARD:`${Ct.ctrl}+shift+right`,AUTOPLAY_BACKWARD:`${Ct.ctrl}+shift+left`,STOP_AUTOPLAY:`${Ct.ctrl}, up, down, left, right`,SPEED_UP_AUTOPLAY:".",SPEED_DOWN_AUTOPLAY:",",RESET_AUTOPLAY_SPEED:"/",MOVE_UP:"up",MOVE_DOWN:"down",MOVE_RIGHT:"right",MOVE_LEFT:"left",MOVE_TO_TOP_EXTREME:`${Ct.ctrl}+up`,MOVE_TO_BOTTOM_EXTREME:`${Ct.ctrl}+down`,MOVE_TO_LEFT_EXTREME:`${Ct.ctrl}+left`,MOVE_TO_RIGHT_EXTREME:`${Ct.ctrl}+right`,MOVE_TO_NEXT_TRACE:"pageup",MOVE_TO_PREV_TRACE:"pagedown",TOGGLE_BRAILLE:"b",TOGGLE_TEXT:"t",TOGGLE_AUDIO:"s",TOGGLE_REVIEW:"r",TOGGLE_HELP:`${Ct.ctrl}+/`,TOGGLE_CHAT:"shift+/",TOGGLE_SETTINGS:`${Ct.ctrl}+,`,DESCRIBE_POINT:"space"},f8={TOGGLE_CHAT:"esc"},d8={DEACTIVATE_FIGURE_LABEL_SCOPE:"*",DESCRIBE_TITLE:"t",DESCRIBE_SUBTITLE:"s",DESCRIBE_CAPTION:"c",TOGGLE_HELP:`${Ct.ctrl}+/`},p8={TOGGLE_HELP:"esc"},h8={ACTIVATE_FIGURE_LABEL_SCOPE:"l",DESCRIBE_TITLE:"t",DESCRIBE_POINT:"space",MOVE_UP:"up",MOVE_DOWN:"down",MOVE_RIGHT:"right",MOVE_LEFT:"left",MOVE_TO_TOP_EXTREME:`${Ct.ctrl}+up`,MOVE_TO_BOTTOM_EXTREME:`${Ct.ctrl}+down`,MOVE_TO_LEFT_EXTREME:`${Ct.ctrl}+left`,MOVE_TO_RIGHT_EXTREME:`${Ct.ctrl}+right`,MOVE_TO_TRACE_CONTEXT:`${Ct.enter}`,TOGGLE_HELP:`${Ct.ctrl}+/`,TOGGLE_CHAT:"shift+/",TOGGLE_SETTINGS:`${Ct.ctrl}+,`},m8={DEACTIVATE_TRACE_LABEL_SCOPE:"*",DESCRIBE_X:"x",DESCRIBE_Y:"y",DESCRIBE_FILL:"f",DESCRIBE_TITLE:"t",DESCRIBE_SUBTITLE:"s",DESCRIBE_CAPTION:"c",TOGGLE_HELP:`${Ct.ctrl}+/`},y8={TOGGLE_BRAILLE:"b",TOGGLE_REVIEW:"r",ALLOW_DEFAULT:`up, down, left, right,
570
+ root.render(<App />);`),t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(u=t.identifierPrefix),t.onUncaughtError!==void 0&&(h=t.onUncaughtError),t.onCaughtError!==void 0&&(y=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(C=t.unstable_transitionCallbacks)),t=kv(e,1,!1,null,null,r,u,h,y,x,C,null),e[ys]=t.current,vd(e),new tm(t)},Py.hydrateRoot=function(e,t,r){if(!H(e))throw Error("Target container is not a DOM element.");am(e),t===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var u=!1,h="",y=qS,x=gh,C=vh,j=null,I=null;return r!=null&&(r.unstable_strictMode===!0&&(u=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(y=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(C=r.onRecoverableError),r.unstable_transitionCallbacks!==void 0&&(j=r.unstable_transitionCallbacks),r.formState!==void 0&&(I=r.formState)),t=kv(e,1,!0,t,r??null,u,h,y,x,C,j,I),t.context=Rn(null),r=t.current,u=Jo(r),u=yt(u),h=Vr(u),h.callback=null,jr(r,h,u),r=u,t.current.lanes=r,rn(t,r),Er(t),e[ys]=t.current,vd(e),new nm(t)},Py.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}(),Py}var p_;function O$(){if(p_)return AS.exports;p_=1;var n={};function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(n.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(l){console.error(l)}}}return n.NODE_ENV==="production"?(o(),AS.exports=T$()):AS.exports=x$(),AS.exports}var R$=O$();class A${constructor(o,l,c){q(this,"context");q(this,"focusStack");q(this,"plot");q(this,"reactRoot");q(this,"onChangeEmitter");q(this,"onChange");q(this,"currentInstruction","");q(this,"handleMouseEnter",o=>{o.currentTarget.setAttribute(de.TITLE,this.currentInstruction)});q(this,"handleMouseLeave",o=>{o.currentTarget.removeAttribute(de.TITLE)});this.context=o,this.focusStack=new gT,this.focusStack.push(this.context.scope),this.plot=l,this.reactRoot=R$.createRoot(c,{identifierPrefix:this.context.id}),this.reactRoot.render(b$),this.onChangeEmitter=new lp,this.onChange=this.onChangeEmitter.event,this.plot.addEventListener("click",()=>{const p=this.plot.closest(de.FIGURE),m=this.plot.closest(de.ARTICLE);p&&p.removeAttribute(de.TITLE),m&&m.removeAttribute(de.TITLE)}),this.removeInstruction()}dispose(){var o;this.addInstruction(),this.onChangeEmitter.dispose(),(o=this.reactRoot)==null||o.unmount(),this.reactRoot=null}addInstruction(){const o=this.context.getInstruction(!0);this.currentInstruction=o,this.plot.setAttribute(de.ARIA_LABEL,o),this.plot.setAttribute(de.ROLE,de.IMAGE),this.plot.tabIndex=0;const l=this.plot.closest(de.FIGURE),c=this.plot.closest(de.ARTICLE);l&&(l.setAttribute(de.TITLE,o),l.addEventListener("mouseenter",this.handleMouseEnter),l.addEventListener("mouseleave",this.handleMouseLeave)),c&&(c.setAttribute(de.TITLE,o),c.addEventListener("mouseenter",this.handleMouseEnter),c.addEventListener("mouseleave",this.handleMouseLeave))}removeInstruction(){this.plot.removeAttribute(de.ARIA_LABEL),this.plot.setAttribute(de.ROLE,de.APPLICATION),this.plot.tabIndex=-1;const o=this.plot.closest(de.FIGURE),l=this.plot.closest(de.ARTICLE);o&&(o.removeAttribute(de.TITLE),o.removeEventListener("mouseenter",this.handleMouseEnter),o.removeEventListener("mouseleave",this.handleMouseLeave)),l&&(l.removeAttribute(de.TITLE),l.removeEventListener("mouseenter",this.handleMouseEnter),l.removeEventListener("mouseleave",this.handleMouseLeave))}toggleFocus(o){this.focusStack.removeLast(o)||this.focusStack.push(o),this.context.toggleScope(o),this.updateFocus(this.focusStack.peek())}updateFocus(o){(o==="TRACE"||o==="SUBPLOT")&&this.plot.focus(),this.onChangeEmitter.fire({value:o})}}const zp=class zp{constructor(){}static get ctrl(){return zp.IS_MAC?"command":"ctrl"}static get alt(){return zp.IS_MAC?"option":"alt"}static get enter(){return zp.IS_MAC?"return":"enter"}};q(zp,"IS_MAC",(()=>{var l;return(((l=navigator.userAgentData)==null?void 0:l.platform)??navigator.platform).toLowerCase().includes("mac")})());let Ct=zp;const lx=[{description:"Navigate Data Points",key:"arrow keys"},{description:"Move to Next Layer",key:"page up"},{description:"Move to Previous Layer",key:"page down"},{description:"Go to Left/Right/Top/Bottom Extreme Point",key:`${Ct.ctrl} + arrow keys`},{description:"Toggle Braille Mode",key:"b"},{description:"Toggle Text Mode",key:"t"},{description:"Toggle Sonification Mode",key:"s"},{description:"Toggle Review Mode",key:"r"},{description:"Autoplay Outward",key:`${Ct.ctrl} + shift + arrow keys`},{description:"Stop Autoplay",key:`${Ct.ctrl}`},{description:"Speed Up Autoplay",key:". (period)"},{description:"Speed Down Autoplay",key:", (comma)"},{description:"Reset Autoplay Speed",key:"/ (slash)"},{description:"Replay Current Point",key:"space"},{description:"Announce Plot Title",key:"l t"},{description:"Announce X Label",key:"l x"},{description:"Announce Y Label",key:"l y"},{description:"Announce Fill (Z) Label",key:"l f"},{description:"Open Settings",key:`${Ct.ctrl} + ,`},{description:"Open Chat",key:"?"}],h_=[{description:"Move around Subplot",key:"arrow keys"},{description:"Activate Current Subplot",key:`${Ct.enter}`},{description:"Announce Plot Title",key:"l t"},{description:"Announce Subtitle",key:"l s"},{description:"Announce Caption",key:"l c"},{description:"Open Settings",key:`${Ct.ctrl} + ,`}];class C${constructor(o,l){q(this,"context");q(this,"display");q(this,"scopedMenuItems");this.context=o,this.display=l,this.scopedMenuItems={[cn.TRACE]:lx,[cn.TRACE_LABEL]:lx,[cn.BRAILLE]:lx,[cn.SUBPLOT]:h_,[cn.FIGURE_LABEL]:h_}}getMenuItems(){return this.scopedMenuItems[this.context.scope]??[]}toggle(){this.display.toggleFocus(cn.HELP)}}class w${constructor(){q(this,"highlightedElements");this.highlightedElements=new Set}dispose(){this.unhighlight()}update(o){if(o.empty)return;this.unhighlight();const l=o.type==="subplot"?o.trace:o;if(l.empty||l.highlight.empty)return;const c=l.highlight,p=Array.isArray(c.elements)?c.elements:[c.elements];this.highlight(p)}highlight(o){for(const l of o){const c=Kn.createHighlightElement(l,de.MAIDR_HIGHLIGHT_COLOR);c.id=`${de.MAIDR_HIGHLIGHT}-${Date.now()}-${Math.random()}`,this.highlightedElements.add(c)}}unhighlight(){this.highlightedElements.forEach(o=>o.remove()),this.highlightedElements.clear()}}class _${constructor(o,l){q(this,"context");q(this,"autoplay");this.context=o,this.autoplay=l}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("UPWARD",o)}}class M${constructor(o,l){q(this,"context");q(this,"autoplay");this.autoplay=l,this.context=o}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("DOWNWARD",o)}}class D${constructor(o,l){q(this,"context");q(this,"autoplay");this.autoplay=l,this.context=o}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("FORWARD",o)}}class N${constructor(o,l){q(this,"context");q(this,"autoplay");this.autoplay=l,this.context=o}execute(){const o=this.context.state;o.type==="trace"&&!o.empty&&this.autoplay.start("BACKWARD",o)}}class z${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.stop()}}class U${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.speedUp()}}class L${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.speedDown()}}class k${constructor(o){q(this,"autoplay");this.autoplay=o}execute(){this.autoplay.resetSpeed()}}class xf{constructor(o,l){q(this,"context");q(this,"textViewModel");this.context=o,this.textViewModel=l}}class V$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="trace"&&!o.empty){const l=`X label is ${o.xAxis}`;this.textViewModel.update(l)}}}class j$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="trace"&&!o.empty){const l=`Y label is ${o.yAxis}`;this.textViewModel.update(l)}}}class B$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="trace"&&!o.empty){const l=`Fill is ${o.fill}`;this.textViewModel.update(l)}}}class $$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(!o.empty){if(o.type==="figure"){const l=`Figure title is ${o.title}`;this.textViewModel.update(l)}else if(o.type==="trace"){const l=`Subplot title is ${o.title}`;this.textViewModel.update(l)}}}}class H$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="figure"&&!o.empty){const l=`Subtitle is ${o.subtitle}`;this.textViewModel.update(l)}}}class I$ extends xf{constructor(o,l){super(o,l)}execute(){const o=this.context.state;if(o.type==="figure"&&!o.empty){const l=`Caption is ${o.caption}`;this.textViewModel.update(l)}}}class Y$ extends xf{constructor(l,c,p,m,v){super(l,v);q(this,"audio");q(this,"brailleViewModel");q(this,"highlight");this.audio=c,this.highlight=p,this.brailleViewModel=m}execute(){const l=this.context.state;switch(l.type){case"figure":case"subplot":this.textViewModel.update(l);break;case"trace":this.textViewModel.update(l),this.audio.update(l),this.brailleViewModel.update(l),this.highlight.update(l);break}}}class G${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("UPWARD")}}class q${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("DOWNWARD")}}class P${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("BACKWARD")}}class X${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveOnce("FORWARD")}}class Q${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("UPWARD")}}class K${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("DOWNWARD")}}class Z${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("BACKWARD")}}class W${constructor(o){q(this,"context");this.context=o}execute(){this.context.moveToExtreme("FORWARD")}}class F${constructor(o){q(this,"context");this.context=o}execute(){this.context.enterSubplot()}}class J${constructor(o){q(this,"context");this.context=o}execute(){this.context.exitSubplot()}}class e8{constructor(o){q(this,"context");this.context=o}execute(){this.context.stepTrace("UPWARD")}}class t8{constructor(o){q(this,"context");this.context=o}execute(){this.context.stepTrace("DOWNWARD")}}class n8{constructor(o,l){q(this,"context");q(this,"brailleViewModel");this.context=o,this.brailleViewModel=l}execute(){const o=this.context.state;o.type==="trace"&&this.brailleViewModel.toggle(o)}}class a8{constructor(o){q(this,"textViewModel");this.textViewModel=o}execute(){this.textViewModel.toggle()}}class o8{constructor(o){q(this,"audio");this.audio=o}execute(){this.audio.toggle()}}class r8{constructor(o,l){q(this,"context");q(this,"reviewViewModel");this.context=o,this.reviewViewModel=l}execute(){const o=this.context.state;o.type==="trace"&&this.reviewViewModel.toggle(o)}}class i8{constructor(o){q(this,"helpViewModel");this.helpViewModel=o}execute(){this.helpViewModel.toggle()}}class l8{constructor(o){q(this,"chatViewModel");this.chatViewModel=o}execute(){this.chatViewModel.toggle()}}class s8{constructor(o){q(this,"settingsViewModel");this.settingsViewModel=o}execute(){this.settingsViewModel.toggle()}}class m_{constructor(o,l){q(this,"context");q(this,"scope");this.context=o,this.scope=l}execute(){this.context.toggleScope(this.scope)}}class u8{constructor(o){q(this,"context");q(this,"audioService");q(this,"autoplayService");q(this,"highlightService");q(this,"brailleViewModel");q(this,"chatViewModel");q(this,"helpViewModel");q(this,"reviewViewModel");q(this,"settingsViewModel");q(this,"textViewModel");this.context=o.context,this.audioService=o.audioService,this.autoplayService=o.autoplayService,this.highlightService=o.highlightService,this.brailleViewModel=o.brailleViewModel,this.chatViewModel=o.chatViewModel,this.helpViewModel=o.helpViewModel,this.reviewViewModel=o.reviewViewModel,this.settingsViewModel=o.settingsViewModel,this.textViewModel=o.textViewModel}create(o){switch(o){case"MOVE_UP":return new G$(this.context);case"MOVE_DOWN":return new q$(this.context);case"MOVE_LEFT":return new P$(this.context);case"MOVE_RIGHT":return new X$(this.context);case"MOVE_TO_TOP_EXTREME":return new Q$(this.context);case"MOVE_TO_BOTTOM_EXTREME":return new K$(this.context);case"MOVE_TO_LEFT_EXTREME":return new Z$(this.context);case"MOVE_TO_RIGHT_EXTREME":return new W$(this.context);case"MOVE_TO_TRACE_CONTEXT":return new F$(this.context);case"MOVE_TO_SUBPLOT_CONTEXT":return new J$(this.context);case"MOVE_TO_NEXT_TRACE":return new e8(this.context);case"MOVE_TO_PREV_TRACE":return new t8(this.context);case"TOGGLE_AUDIO":return new o8(this.audioService);case"TOGGLE_BRAILLE":return new n8(this.context,this.brailleViewModel);case"TOGGLE_TEXT":return new a8(this.textViewModel);case"TOGGLE_REVIEW":return new r8(this.context,this.reviewViewModel);case"TOGGLE_HELP":return new i8(this.helpViewModel);case"TOGGLE_CHAT":return new l8(this.chatViewModel);case"TOGGLE_SETTINGS":return new s8(this.settingsViewModel);case"DESCRIBE_X":return new V$(this.context,this.textViewModel);case"DESCRIBE_Y":return new j$(this.context,this.textViewModel);case"DESCRIBE_FILL":return new B$(this.context,this.textViewModel);case"DESCRIBE_POINT":return new Y$(this.context,this.audioService,this.highlightService,this.brailleViewModel,this.textViewModel);case"DESCRIBE_TITLE":return new $$(this.context,this.textViewModel);case"DESCRIBE_SUBTITLE":return new H$(this.context,this.textViewModel);case"DESCRIBE_CAPTION":return new I$(this.context,this.textViewModel);case"ACTIVATE_FIGURE_LABEL_SCOPE":case"DEACTIVATE_FIGURE_LABEL_SCOPE":return new m_(this.context,cn.FIGURE_LABEL);case"ACTIVATE_TRACE_LABEL_SCOPE":case"DEACTIVATE_TRACE_LABEL_SCOPE":return new m_(this.context,cn.TRACE_LABEL);case"AUTOPLAY_UPWARD":return new _$(this.context,this.autoplayService);case"AUTOPLAY_DOWNWARD":return new M$(this.context,this.autoplayService);case"AUTOPLAY_FORWARD":return new D$(this.context,this.autoplayService);case"AUTOPLAY_BACKWARD":return new N$(this.context,this.autoplayService);case"STOP_AUTOPLAY":return new z$(this.autoplayService);case"SPEED_UP_AUTOPLAY":return new U$(this.autoplayService);case"SPEED_DOWN_AUTOPLAY":return new L$(this.autoplayService);case"RESET_AUTOPLAY_SPEED":return new k$(this.autoplayService);default:throw new Error(`Invalid command name: ${o}`)}}}const c8={ACTIVATE_TRACE_LABEL_SCOPE:"l",AUTOPLAY_UPWARD:`${Ct.ctrl}+shift+up`,AUTOPLAY_DOWNWARD:`${Ct.ctrl}+shift+down`,AUTOPLAY_FORWARD:`${Ct.ctrl}+shift+right`,AUTOPLAY_BACKWARD:`${Ct.ctrl}+shift+left`,STOP_AUTOPLAY:`${Ct.ctrl}, up, down, left, right`,SPEED_UP_AUTOPLAY:".",SPEED_DOWN_AUTOPLAY:",",RESET_AUTOPLAY_SPEED:"/",MOVE_UP:"up",MOVE_DOWN:"down",MOVE_RIGHT:"right",MOVE_LEFT:"left",MOVE_TO_TOP_EXTREME:`${Ct.ctrl}+up`,MOVE_TO_BOTTOM_EXTREME:`${Ct.ctrl}+down`,MOVE_TO_LEFT_EXTREME:`${Ct.ctrl}+left`,MOVE_TO_RIGHT_EXTREME:`${Ct.ctrl}+right`,MOVE_TO_NEXT_TRACE:"pageup",MOVE_TO_PREV_TRACE:"pagedown",TOGGLE_BRAILLE:"b",TOGGLE_TEXT:"t",TOGGLE_AUDIO:"s",TOGGLE_REVIEW:"r",TOGGLE_HELP:`${Ct.ctrl}+/`,TOGGLE_CHAT:"shift+/",TOGGLE_SETTINGS:`${Ct.ctrl}+,`,DESCRIBE_POINT:"space"},f8={TOGGLE_CHAT:"esc"},d8={DEACTIVATE_FIGURE_LABEL_SCOPE:"*",DESCRIBE_TITLE:"t",DESCRIBE_SUBTITLE:"s",DESCRIBE_CAPTION:"c",TOGGLE_HELP:`${Ct.ctrl}+/`},p8={TOGGLE_HELP:"esc"},h8={ACTIVATE_FIGURE_LABEL_SCOPE:"l",DESCRIBE_TITLE:"t",DESCRIBE_POINT:"space",MOVE_UP:"up",MOVE_DOWN:"down",MOVE_RIGHT:"right",MOVE_LEFT:"left",MOVE_TO_TOP_EXTREME:`${Ct.ctrl}+up`,MOVE_TO_BOTTOM_EXTREME:`${Ct.ctrl}+down`,MOVE_TO_LEFT_EXTREME:`${Ct.ctrl}+left`,MOVE_TO_RIGHT_EXTREME:`${Ct.ctrl}+right`,MOVE_TO_TRACE_CONTEXT:`${Ct.enter}`,TOGGLE_HELP:`${Ct.ctrl}+/`,TOGGLE_CHAT:"shift+/",TOGGLE_SETTINGS:`${Ct.ctrl}+,`},m8={DEACTIVATE_TRACE_LABEL_SCOPE:"*",DESCRIBE_X:"x",DESCRIBE_Y:"y",DESCRIBE_FILL:"f",DESCRIBE_TITLE:"t",DESCRIBE_SUBTITLE:"s",DESCRIBE_CAPTION:"c",TOGGLE_HELP:`${Ct.ctrl}+/`},y8={TOGGLE_BRAILLE:"b",TOGGLE_REVIEW:"r",ALLOW_DEFAULT:`up, down, left, right,
571
571
  ${Ct.ctrl}+up, ${Ct.ctrl}+down,
572
572
  ${Ct.ctrl}+left, ${Ct.ctrl}+right,
573
573
  pageup, pagedown, home, end,