ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"],function(i,u,v){"use strict";var l=i("../lib/event");u.contextMenuHandler=function(c){var e=c.target,n=e.textInput.getElement();if(e.selection.isEmpty()){var a=e.getCursorPosition(),d=e.session.getWordRange(a.row,a.column),r=e.session.getTextRange(d);if(e.session.tokenRe.lastIndex=0,e.session.tokenRe.test(r)){var o=r+" \x01\x01";n.value=o,n.setSelectionRange(r.length,r.length+1),n.setSelectionRange(0,0),n.setSelectionRange(0,r.length);var g=!1;l.addListener(n,"keydown",function t(){l.removeListener(n,"keydown",t),g=!0}),e.textInput.setInputHandler(function(t){if(t==o)return"";if(0===t.lastIndexOf(o,0))return t.slice(o.length);if(t.substr(n.selectionEnd)==o)return t.slice(0,-o.length);if("\x01\x01"==t.slice(-2)){var s=t.slice(0,-2);if(" "==s.slice(-1))return g?s.substring(0,n.selectionEnd):(s=s.slice(0,-1),e.session.replace(d,s),"")}return t})}}};var x=i("../editor").Editor;i("../config").defineOptions(x.prototype,"editor",{spellcheck:{set:function(c){this.textInput.getElement().spellcheck=!!c,c?this.on("nativecontextmenu",u.contextMenuHandler):this.removeListener("nativecontextmenu",u.contextMenuHandler)},value:!0}})}),ace.require(["ace/ext/spellcheck"],function(i){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=i)});