ace.define("ace/ext/chromevox",["require","exports","module","ace/editor","ace/config"],function(e,o,n){function t(){return"undefined"!=typeof cvox&&cvox&&cvox.Api}function r(e){if(t())So(e);else{if(Eo++,Eo>=ko)return;window.setTimeout(r,500,e)}}var c={};c.SpeechProperty,c.Cursor,c.Token,c.Annotation;var i={rate:.8,pitch:.4,volume:.9},a={rate:1,pitch:.5,volume:.9},u={rate:.8,pitch:.8,volume:.9},s={rate:.8,pitch:.3,volume:.9},p={rate:.8,pitch:.7,volume:.9},d={rate:.8,pitch:.8,volume:.9},l={punctuationEcho:"none",relativePitch:-.6},f="ALERT_NONMODAL",v="ALERT_MODAL",m="INVALID_KEYPRESS",g="insertMode",A="start",h=[{substr:";",newSubstr:" semicolon "},{substr:":",newSubstr:" colon "}],S={SPEAK_ANNOT:"annots",SPEAK_ALL_ANNOTS:"all_annots",TOGGLE_LOCATION:"toggle_location",SPEAK_MODE:"mode",SPEAK_ROW_COL:"row_col",TOGGLE_DISPLACEMENT:"toggle_displacement",FOCUS_TEXT:"focus_text"},E="CONTROL + SHIFT ";c.editor=null;var k=null,x={},y=!1,w=!1,T=!1,C=null,b={},O={},_=function(e){return E+String.fromCharCode(e)},L=function(){var e=c.editor.keyBinding.getKeyboardHandler();return"ace/keyboard/vim"===e.$id},N=function(e){return c.editor.getSession().getTokenAt(e.row,e.column+1)},K=function(e){return c.editor.getSession().getLine(e.row)},P=function(e){x[e.row]&&cvox.Api.playEarcon(f),y?(cvox.Api.stop(),V(e),X(N(e)),q(e.row,1)):q(e.row,0)},I=function(e){var o=K(e),n=o.substr(e.column-1);0===e.column&&(n=" "+o);var t=/^\W(\w+)/,r=t.exec(n);return null!==r},M={constant:{prop:i},entity:{prop:u},keyword:{prop:s},storage:{prop:p},variable:{prop:d},meta:{prop:a,replace:[{substr:"",newSubstr:" close tag "},{substr:"<",newSubstr:" tag start "},{substr:">",newSubstr:" tag end "}]}},D={prop:D},G=function(e,o){for(var n=e,t=0;tr;r++)t.value+=e[r].value;return t},B=function(e){if(e.length<=1)return e;for(var o=[],n=0,t=1;t0&&cvox.Api.playEarcon(f),eo(o)},no=function(e){var o=e.type+" "+e.text+" on "+ro(e.row,e.column);o=o.replace(";","semicolon"),cvox.Api.speak(o,1)},to=function(e){var o=x[e];for(var n in o)no(o[n])},ro=function(e,o){return"row "+(e+1)+" column "+(o+1)},co=function(){cvox.Api.speak(ro(k.row,k.column))},io=function(){for(var e in x)to(e)},ao=function(){if(L())switch(c.editor.keyBinding.$data.state){case g:cvox.Api.speak("Insert mode");break;case A:cvox.Api.speak("Command mode")}},uo=function(){y=!y,cvox.Api.speak(y?"Speak location on row change enabled.":"Speak location on row change disabled.")},so=function(){w=!w,cvox.Api.speak(w?"Speak displacement on column changes.":"Speak current character or word on column changes.")},po=function(e){if(e.ctrlKey&&e.shiftKey){var o=b[e.keyCode];o&&o.func()}},lo=function(e,o){if(L()){var n=o.keyBinding.$data.state;if(n!==C){switch(n){case g:cvox.Api.playEarcon(v),cvox.Api.setKeyEcho(!0);break;case A:cvox.Api.playEarcon(v),cvox.Api.setKeyEcho(!1)}C=n}}},fo=function(e){var o=e.detail.customCommand,n=O[o];n&&(n.func(),c.editor.focus())},vo=function(){var e=Ao.map(function(e){return{desc:e.desc+_(e.keyCode),cmd:e.cmd}}),o=document.querySelector("body");o.setAttribute("contextMenuActions",JSON.stringify(e)),o.addEventListener("ATCustomEvent",fo,!0)},mo=function(e){e.match?q(k.row,0):cvox.Api.playEarcon(m)},go=function(){c.editor.focus()},Ao=[{keyCode:49,func:function(){to(k.row)},cmd:S.SPEAK_ANNOT,desc:"Speak annotations on line"},{keyCode:50,func:io,cmd:S.SPEAK_ALL_ANNOTS,desc:"Speak all annotations"},{keyCode:51,func:ao,cmd:S.SPEAK_MODE,desc:"Speak Vim mode"},{keyCode:52,func:uo,cmd:S.TOGGLE_LOCATION,desc:"Toggle speak row location"},{keyCode:53,func:co,cmd:S.SPEAK_ROW_COL,desc:"Speak row and column"},{keyCode:54,func:so,cmd:S.TOGGLE_DISPLACEMENT,desc:"Toggle speak displacement"},{keyCode:55,func:go,cmd:S.FOCUS_TEXT,desc:"Focus text"}],ho=function(){c.editor=editor,editor.getSession().selection.on("changeCursor",j),editor.getSession().selection.on("changeSelection",z),editor.getSession().on("change",Q),editor.getSession().on("changeAnnotation",oo),editor.on("changeStatus",lo),editor.on("findSearchBox",mo),editor.container.addEventListener("keydown",po),k=editor.selection.getCursor()},So=function(e){ho(),Ao.forEach(function(e){b[e.keyCode]=e,O[e.cmd]=e}),e.on("focus",ho),L()&&cvox.Api.setKeyEcho(!1),vo()},Eo=0,ko=15,xo=e("../editor").Editor;e("../config").defineOptions(xo.prototype,"editor",{enableChromevoxEnhancements:{set:function(e){e&&r(this)},value:!0}})}),function(){ace.require(["ace/ext/chromevox"],function(){})}();