1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import{g as tn}from"./index-d7fba904.js";function rn(xe,Ge){for(var T=0;T<Ge.length;T++){const z=Ge[T];if(typeof z!="string"&&!Array.isArray(z)){for(const ye in z)if(ye!=="default"&&!(ye in xe)){const B=Object.getOwnPropertyDescriptor(z,ye);B&&Object.defineProperty(xe,ye,B.get?B:{enumerable:!0,get:()=>z[ye]})}}}return Object.freeze(Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"}))}var rr={exports:{}};(function(xe,Ge){ace.define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"],function(T,z,ye){var B=T("../range").Range;function He(ne,K){for(var ie=K.column||ne.getOption("printMarginColumn"),Re=K.allowMerge!=!1,U=Math.min(K.startRow,K.endRow),be=Math.max(K.startRow,K.endRow),de=ne.session;U<=be;){var le=de.getLine(U);if(le.length>ie){var v=O(le,ie,5);if(v){var ue=/^\s*/.exec(le)[0];de.replace(new B(U,v.start,U,v.end),`
- `+ue)}be++}else if(Re&&/\S/.test(le)&&U!=be){var R=de.getLine(U+1);if(R&&/\S/.test(R)){var we=le.replace(/\s+$/,""),g=R.replace(/^\s+/,""),De=we+" "+g,v=O(De,ie,5);if(v&&v.start>we.length||De.length<ie){var pe=new B(U,we.length,U+1,R.length-g.length);de.replace(pe," "),U--,be--}else we.length<le.length&&de.remove(new B(U,we.length,U,le.length))}}U++}function O(Ae,Z,Fe){if(!(Ae.length<Z)){var $e=Ae.slice(0,Z),Ee=Ae.slice(Z),J=/^(?:(\s+)|(\S+)(\s+))/.exec(Ee),Q=/(?:(\s+)|(\s+)(\S+))$/.exec($e),q=0,Le=0;if(Q&&!Q[2]&&(q=Z-Q[1].length,Le=Z),J&&!J[2]&&(q||(q=Z),Le=Z+J[1].length),q)return{start:q,end:Le};if(Q&&Q[2]&&Q.index>Fe)return{start:Q.index,end:Q.index+Q[2].length};if(J&&J[2])return q=Z+J[2].length,{start:q,end:q+J[3].length}}}}function Ce(ne){if(ne.command.name=="insertstring"&&/\S/.test(ne.args)){var K=ne.editor,ie=K.selection.cursor;if(ie.column<=K.renderer.$printMarginColumn)return;var Re=K.session.$undoManager.$lastDelta;He(K,{startRow:ie.row,endRow:ie.row,allowMerge:!1}),Re!=K.session.$undoManager.$lastDelta&&K.session.markUndoGroup()}}var Xe=T("../editor").Editor;T("../config").defineOptions(Xe.prototype,"editor",{hardWrap:{set:function(ne){ne?this.commands.on("afterExec",Ce):this.commands.off("afterExec",Ce)},value:!1}}),z.hardWrap=He}),ace.define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/ext/hardwrap","ace/multi_select"],function(T,z,ye){var B=T("../range").Range,He=T("../lib/event_emitter").EventEmitter,Ce=T("../lib/dom"),Xe=T("../lib/oop"),ne=T("../lib/keys"),K=T("../lib/event"),ie=T("../search").Search,Re=T("../lib/useragent"),U=T("../search_highlight").SearchHighlight,be=T("../commands/multi_select_commands"),de=T("../mode/text").Mode.prototype.tokenRe,le=T("../ext/hardwrap").hardWrap;T("../multi_select");var v=function(e){this.ace=e,this.state={},this.marks={},this.options={},this.$uid=0,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this),this.onBeforeEndOperation=this.onBeforeEndOperation.bind(this),this.ace.on("change",this.onChange),this.ace.on("changeSelection",this.onSelectionChange),this.ace.on("beforeEndOperation",this.onBeforeEndOperation)};v.Pos=function(e,t){if(!(this instanceof g))return new g(e,t);this.line=e,this.ch=t},v.defineOption=function(e,t,r){},v.commands={redo:function(e){e.ace.redo()},undo:function(e){e.ace.undo()},newlineAndIndent:function(e){e.ace.insert(`
- `)},goLineLeft:function(e){e.ace.selection.moveCursorLineStart()},goLineRight:function(e){e.ace.selection.moveCursorLineEnd()}},v.keyMap={},v.addClass=v.rmClass=function(){},v.e_stop=v.e_preventDefault=K.stopEvent,v.keyName=function(e){var t=ne[e.keyCode]||e.key||"";return t.length==1&&(t=t.toUpperCase()),t=K.getModifierString(e).replace(/(^|-)\w/g,function(r){return r.toUpperCase()})+t,t},v.keyMap.default=function(e){return function(t){var r=t.ace.commands.commandKeyBinding[e.toLowerCase()];return r&&t.ace.execCommand(r)!==!1}},v.lookupKey=function e(t,r,n){r||(r="default"),typeof r=="string"&&(r=v.keyMap[r]);var i=typeof r=="function"?r(t):r[t];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(r.fallthrough){if(!Array.isArray(r.fallthrough))return e(t,r.fallthrough,n);for(var o=0;o<r.fallthrough.length;o++){var a=e(t,r.fallthrough[o],n);if(a)return a}}},v.findMatchingTag=function(e,t){return e.findMatchingTag(t)},v.findEnclosingTag=function(e,t){},v.signal=function(e,t,r){return e._signal(t,r)},v.on=K.addListener,v.off=K.removeListener,v.isWordChar=function(e){return e<""?/^\w$/.test(e):(de.lastIndex=0,de.test(e))},function(){Xe.implement(v.prototype,He),this.destroy=function(){this.ace.off("change",this.onChange),this.ace.off("changeSelection",this.onSelectionChange),this.ace.off("beforeEndOperation",this.onBeforeEndOperation),this.removeOverlay()},this.virtualSelectionMode=function(){return this.ace.inVirtualSelectionMode&&this.ace.selection.index},this.onChange=function(r){var n={text:r.action[0]=="i"?r.lines:[]},i=this.curOp=this.curOp||{};i.changeHandlers||(i.changeHandlers=this._eventRegistry.change&&this._eventRegistry.change.slice()),i.lastChange?i.lastChange.next=i.lastChange=n:i.lastChange=i.change=n,this.$updateMarkers(r)},this.onSelectionChange=function(){var r=this.curOp=this.curOp||{};r.cursorActivityHandlers||(r.cursorActivityHandlers=this._eventRegistry.cursorActivity&&this._eventRegistry.cursorActivity.slice()),this.curOp.cursorActivity=!0,this.ace.inMultiSelectMode&&this.ace.keyBinding.removeKeyboardHandler(be.keyboardHandler)},this.operation=function(r,n){if(!n&&this.curOp||n&&this.curOp&&this.curOp.force)return r();if((n||!this.ace.curOp)&&this.curOp&&this.onBeforeEndOperation(),!this.ace.curOp){var i=this.ace.prevOp;this.ace.startOperation({command:{name:"vim",scrollIntoView:"cursor"}})}var o=this.curOp=this.curOp||{};this.curOp.force=n;var a=r();return this.ace.curOp&&this.ace.curOp.command.name=="vim"&&(this.state.dialog&&(this.ace.curOp.command.scrollIntoView=this.ace.curOp.vimDialogScroll),this.ace.endOperation(),!o.cursorActivity&&!o.lastChange&&i&&(this.ace.prevOp=i)),(n||!this.ace.curOp)&&this.curOp&&this.onBeforeEndOperation(),a},this.onBeforeEndOperation=function(){var r=this.curOp;r&&(r.change&&this.signal("change",r.change,r),r&&r.cursorActivity&&this.signal("cursorActivity",null,r),this.curOp=null)},this.signal=function(r,n,i){var o=i?i[r+"Handlers"]:(this._eventRegistry||{})[r];if(o){o=o.slice();for(var a=0;a<o.length;a++)o[a](this,n)}},this.firstLine=function(){return 0},this.lastLine=function(){return this.ace.session.getLength()-1},this.lineCount=function(){return this.ace.session.getLength()},this.setCursor=function(r,n){typeof r=="object"&&(n=r.ch,r=r.line);var i=!this.curOp&&!this.ace.inVirtualSelectionMode;this.ace.inVirtualSelectionMode||this.ace.exitMultiSelectMode(),this.ace.session.unfold({row:r,column:n}),this.ace.selection.moveTo(r,n),i&&(this.ace.renderer.scrollCursorIntoView(),this.ace.endOperation())},this.getCursor=function(r){var n=this.ace.selection,i=r=="anchor"?n.isEmpty()?n.lead:n.anchor:r=="head"||!r?n.lead:n.getRange()[r];return R(i)},this.listSelections=function(r){var n=this.ace.multiSelect.rangeList.ranges;return!n.length||this.ace.inVirtualSelectionMode?[{anchor:this.getCursor("anchor"),head:this.getCursor("head")}]:n.map(function(i){return{anchor:this.clipPos(R(i.cursor==i.end?i.start:i.end)),head:this.clipPos(R(i.cursor))}},this)},this.setSelections=function(r,n){var i=this.ace.multiSelect,o=r.map(function(u){var f=ue(u.anchor),c=ue(u.head),d=B.comparePoints(f,c)<0?new B.fromPoints(f,c):new B.fromPoints(c,f);return d.cursor=B.comparePoints(d.start,c)?d.end:d.start,d});if(this.ace.inVirtualSelectionMode){this.ace.selection.fromOrientedRange(o[0]);return}n?o[n]&&o.push(o.splice(n,1)[0]):o=o.reverse(),i.toSingleRange(o[0].clone());for(var a=this.ace.session,l=0;l<o.length;l++){var s=a.$clipRangeToDocument(o[l]);i.addRange(s)}},this.setSelection=function(r,n,i){var o=this.ace.selection;o.moveTo(r.line,r.ch),o.selectTo(n.line,n.ch),i&&i.origin=="*mouse"&&this.onBeforeEndOperation()},this.somethingSelected=function(r){return!this.ace.selection.isEmpty()},this.clipPos=function(r){var n=this.ace.session.$clipPositionToDocument(r.line,r.ch);return R(n)},this.foldCode=function(r){this.ace.session.$toggleFoldWidget(r.line,{})},this.markText=function(r){return{clear:function(){},find:function(){}}},this.$updateMarkers=function(r){var n=r.action=="insert",i=r.start,o=r.end,a=(o.row-i.row)*(n?1:-1),l=(o.column-i.column)*(n?1:-1);n&&(o=i);for(var s in this.marks){var u=this.marks[s],f=B.comparePoints(u,i);if(!(f<0)){if(f===0&&n)if(u.bias==1)f=1;else{u.bias=-1;continue}var c=n?f:B.comparePoints(u,o);if(c>0){u.row+=a,u.column+=u.row==o.row?l:0;continue}!n&&c<=0&&(u.row=i.row,u.column=i.column,c===0&&(u.bias=1))}}};var e=function(r,n,i,o){this.cm=r,this.id=n,this.row=i,this.column=o,r.marks[this.id]=this};e.prototype.clear=function(){delete this.cm.marks[this.id]},e.prototype.find=function(){return R(this)},this.setBookmark=function(r,n){var i=new e(this,this.$uid++,r.line,r.ch);return(!n||!n.insertLeft)&&(i.$insertRight=!0),this.marks[i.id]=i,i},this.moveH=function(r,n){if(n=="char"){var i=this.ace.selection;i.clearSelection(),i.moveCursorBy(0,r)}},this.findPosV=function(r,n,i,o){if(i=="page"){var a=this.ace.renderer,l=a.layerConfig;n=n*Math.floor(l.height/l.lineHeight),i="line"}if(i=="line"){var s=this.ace.session.documentToScreenPosition(r.line,r.ch);o!=null&&(s.column=o),s.row+=n,s.row=Math.min(Math.max(0,s.row),this.ace.session.getScreenLength()-1);var u=this.ace.session.screenToDocumentPosition(s.row,s.column);return R(u)}else debugger},this.charCoords=function(r,n){if(n=="div"||!n){var i=this.ace.session.documentToScreenPosition(r.line,r.ch);return{left:i.column,top:i.row}}if(n=="local"){var o=this.ace.renderer,i=this.ace.session.documentToScreenPosition(r.line,r.ch),a=o.layerConfig.lineHeight,l=o.layerConfig.characterWidth,s=a*i.row;return{left:i.column*l,top:s,bottom:s+a}}},this.coordsChar=function(r,n){var i=this.ace.renderer;if(n=="local"){var o=Math.max(0,Math.floor(r.top/i.lineHeight)),a=Math.max(0,Math.floor(r.left/i.characterWidth)),l=i.session.screenToDocumentPosition(o,a);return R(l)}else if(n=="div")throw"not implemented"},this.getSearchCursor=function(r,n,i){var o=!1,a=!1;r instanceof RegExp&&!r.global&&(o=!r.ignoreCase,r=r.source,a=!0),r=="\\n"&&(r=`
- `,a=!1);var l=new ie;n.ch==null&&(n.ch=Number.MAX_VALUE);var s={row:n.line,column:n.ch},u=this,f=null;return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(c){l.setOptions({needle:r,caseSensitive:o,wrap:!1,backwards:c,regExp:a,start:f||s});var d=l.find(u.ace.session);return f=d,f&&[!f.isEmpty()]},from:function(){return f&&R(f.start)},to:function(){return f&&R(f.end)},replace:function(c){f&&(f.end=u.ace.session.doc.replace(f,c))}}},this.scrollTo=function(r,n){var i=this.ace.renderer,o=i.layerConfig,a=o.maxHeight;a-=(i.$size.scrollerHeight-i.lineHeight)*i.$scrollPastEnd,n!=null&&this.ace.session.setScrollTop(Math.max(0,Math.min(n,a))),r!=null&&this.ace.session.setScrollLeft(Math.max(0,Math.min(r,o.width)))},this.scrollInfo=function(){return 0},this.scrollIntoView=function(r,n){if(r){var i=this.ace.renderer,o={top:0,bottom:n};i.scrollCursorIntoView(ue(r),i.lineHeight*2/i.$size.scrollerHeight,o)}},this.getLine=function(r){return this.ace.session.getLine(r)},this.getRange=function(r,n){return this.ace.session.getTextRange(new B(r.line,r.ch,n.line,n.ch))},this.replaceRange=function(r,n,i){i||(i=n);var o=new B(n.line,n.ch,i.line,i.ch);return this.ace.session.$clipRangeToDocument(o),this.ace.session.replace(o,r)},this.replaceSelection=this.replaceSelections=function(r){var n=this.ace.selection;if(this.ace.inVirtualSelectionMode){this.ace.session.replace(n.getRange(),r[0]||"");return}n.inVirtualSelectionMode=!0;var i=n.rangeList.ranges;i.length||(i=[this.ace.multiSelect.getRange()]);for(var o=i.length;o--;)this.ace.session.replace(i[o],r[o]||"");n.inVirtualSelectionMode=!1},this.getSelection=function(){return this.ace.getSelectedText()},this.getSelections=function(){return this.listSelections().map(function(r){return this.getRange(r.anchor,r.head)},this)},this.getInputField=function(){return this.ace.textInput.getElement()},this.getWrapperElement=function(){return this.ace.container};var t={indentWithTabs:"useSoftTabs",indentUnit:"tabSize",tabSize:"tabSize",firstLineNumber:"firstLineNumber",readOnly:"readOnly"};this.setOption=function(r,n){switch(this.state[r]=n,r){case"indentWithTabs":r=t[r],n=!n;break;case"keyMap":this.state.$keyMap=n;return;default:r=t[r]}r&&this.ace.setOption(r,n)},this.getOption=function(r){var n,i=t[r];switch(i&&(n=this.ace.getOption(i)),r){case"indentWithTabs":return r=t[r],!n;case"keyMap":return this.state.$keyMap||"vim"}return i?n:this.state[r]},this.toggleOverwrite=function(r){return this.state.overwrite=r,this.ace.setOverwrite(r)},this.addOverlay=function(r){if(!this.$searchHighlight||!this.$searchHighlight.session){var n=new U(null,"ace_highlight-marker","text"),i=this.ace.session.addDynamicMarker(n);n.id=i.id,n.session=this.ace.session,n.destroy=function(a){n.session.off("change",n.updateOnChange),n.session.off("changeEditor",n.destroy),n.session.removeMarker(n.id),n.session=null},n.updateOnChange=function(a){var l=a.start.row;l==a.end.row?n.cache[l]=void 0:n.cache.splice(l,n.cache.length)},n.session.on("changeEditor",n.destroy),n.session.on("change",n.updateOnChange)}var o=new RegExp(r.query.source,"gmi");this.$searchHighlight=r.highlight=n,this.$searchHighlight.setRegexp(o),this.ace.renderer.updateBackMarkers()},this.removeOverlay=function(r){this.$searchHighlight&&this.$searchHighlight.session&&this.$searchHighlight.destroy()},this.getScrollInfo=function(){var r=this.ace.renderer,n=r.layerConfig;return{left:r.scrollLeft,top:r.scrollTop,height:n.maxHeight,width:n.width,clientHeight:n.height,clientWidth:n.width}},this.getValue=function(){return this.ace.getValue()},this.setValue=function(r){return this.ace.setValue(r,-1)},this.getTokenTypeAt=function(r){var n=this.ace.session.getTokenAt(r.line,r.ch);return n&&/comment|string/.test(n.type)?"string":""},this.findMatchingBracket=function(r){var n=this.ace.session.findMatchingBracket(ue(r));return{to:n&&R(n)}},this.findMatchingTag=function(r){var n=this.ace.session.getMatchingTags(ue(r));if(n)return{open:{from:R(n.openTag.start),to:R(n.openTag.end)},close:{from:R(n.closeTag.start),to:R(n.closeTag.end)}}},this.indentLine=function(r,n){n===!0?this.ace.session.indentRows(r,r," "):n===!1&&this.ace.session.outdentRows(new B(r,0,r,0))},this.indexFromPos=function(r){return this.ace.session.doc.positionToIndex(ue(r))},this.posFromIndex=function(r){return R(this.ace.session.doc.indexToPosition(r))},this.focus=function(r){return this.ace.textInput.focus()},this.blur=function(r){return this.ace.blur()},this.defaultTextHeight=function(r){return this.ace.renderer.layerConfig.lineHeight},this.scanForBracket=function(r,n,i,o){var a=o.bracketRegex.source,l=/paren|text|operator|tag/;if(n==1)var s=this.ace.session.$findClosingBracket(a.slice(1,2),ue(r),l);else var s=this.ace.session.$findOpeningBracket(a.slice(-2,-1),{row:r.line,column:r.ch+1},l);return s&&{pos:R(s)}},this.refresh=function(){return this.ace.resize(!0)},this.getMode=function(){return{name:this.getOption("mode")}},this.execCommand=function(r){if(v.commands.hasOwnProperty(r))return v.commands[r](this);if(r=="indentAuto")return this.ace.execCommand("autoindent");console.log(r+" is not implemented")},this.getLineNumber=function(r){return r.row},this.getLineHandle=function(r){return{text:this.ace.session.getLine(r),row:r}}}.call(v.prototype);function ue(e){return{row:e.line,column:e.ch}}function R(e){return new g(e.row,e.column)}var we=v.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};we.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var r=t==e;else var r=t&&(e.test?e.test(t):e(t));if(r)return++this.pos,t},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){throw"not implemented"},indentation:function(){throw"not implemented"},match:function(e,t,r){if(typeof e=="string"){var n=function(a){return r?a.toLowerCase():a},i=this.string.substr(this.pos,e.length);if(n(i)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}},v.defineExtension=function(e,t){v.prototype[e]=t},Ce.importCssString(`.normal-mode .ace_cursor{
- border: none;
- background-color: rgba(255,0,0,0.5);
- }
- .normal-mode .ace_hidden-cursors .ace_cursor{
- background-color: transparent;
- border: 1px solid red;
- opacity: 0.7
- }
- .ace_dialog {
- position: absolute;
- left: 0; right: 0;
- background: inherit;
- z-index: 15;
- padding: .1em .8em;
- overflow: hidden;
- color: inherit;
- }
- .ace_dialog-top {
- border-bottom: 1px solid #444;
- top: 0;
- }
- .ace_dialog-bottom {
- border-top: 1px solid #444;
- bottom: 0;
- }
- .ace_dialog input {
- border: none;
- outline: none;
- background: transparent;
- width: 20em;
- color: inherit;
- font-family: monospace;
- }`,"vimMode",!1),function(){function e(r,n,i){var o=r.ace.container,a;return a=o.appendChild(document.createElement("div")),i?a.className="ace_dialog ace_dialog-bottom":a.className="ace_dialog ace_dialog-top",typeof n=="string"?a.innerHTML=n:a.appendChild(n),a}function t(r,n){r.state.currentNotificationClose&&r.state.currentNotificationClose(),r.state.currentNotificationClose=n}v.defineExtension("openDialog",function(r,n,i){if(this.virtualSelectionMode())return;i||(i={}),t(this,null);var o=e(this,r,i.bottom),a=!1,l=this;this.state.dialog=o;function s(c){if(typeof c=="string")u.value=c;else{if(a||c&&c.type=="blur"&&document.activeElement===u)return;l.state.dialog==o&&(l.state.dialog=null,l.focus()),a=!0,o.remove(),i.onClose&&i.onClose(o);var d=l;d.state.vim&&(d.state.vim.status=null,d.ace._signal("changeStatus"),d.ace.renderer.$loop.schedule(d.ace.renderer.CHANGE_CURSOR))}}var u=o.getElementsByTagName("input")[0],f;return u?(i.value&&(u.value=i.value,i.selectValueOnOpen!==!1&&u.select()),i.onInput&&v.on(u,"input",function(c){i.onInput(c,u.value,s)}),i.onKeyUp&&v.on(u,"keyup",function(c){i.onKeyUp(c,u.value,s)}),v.on(u,"keydown",function(c){i&&i.onKeyDown&&i.onKeyDown(c,u.value,s)||(c.keyCode==13&&n(u.value),(c.keyCode==27||i.closeOnEnter!==!1&&c.keyCode==13)&&(v.e_stop(c),s()))}),i.closeOnBlur!==!1&&v.on(u,"blur",s),u.focus()):(f=o.getElementsByTagName("button")[0])&&(v.on(f,"click",function(){s(),l.focus()}),i.closeOnBlur!==!1&&v.on(f,"blur",s),f.focus()),s}),v.defineExtension("openNotification",function(r,n){if(this.virtualSelectionMode())return;t(this,s);var i=e(this,r,n&&n.bottom),o=!1,a,l=n&&typeof n.duration<"u"?n.duration:5e3;function s(){o||(o=!0,clearTimeout(a),i.remove())}return v.on(i,"click",function(u){v.e_preventDefault(u),s()}),l&&(a=setTimeout(s,l)),s})}();var g=v.Pos;function De(e,t){var r=e.state.vim;if(!r||r.insertMode)return t.head;var n=r.sel.head;if(!n)return t.head;if(!(r.visualBlock&&t.head.line!=n.line))return t.from()==t.anchor&&!t.empty()&&t.head.line==n.line&&t.head.ch!=n.ch?new g(t.head.line,t.head.ch-1):t.head}function pe(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),i=n.charCodeAt(t.ch);55296<=i&&i<=55551&&(r.ch+=1)}return{start:t,end:r}}var O=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<Del>",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],Ae=O.length,Z=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"global",shortName:"g"}];function Fe(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),v.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",Gt),We(e),v.on(e.getInputField(),"paste",pt(e))}function $e(e){e.setOption("disableInput",!1),e.off("cursorActivity",Gt),v.off(e.getInputField(),"paste",pt(e)),e.state.vim=null,Qe&&clearTimeout(Qe)}function Ee(e,t){this==v.keyMap.vim&&(e.options.$customCursor=null,v.rmClass(e.getWrapperElement(),"cm-fat-cursor")),(!t||t.attach!=J)&&$e(e)}function J(e,t){this==v.keyMap.vim&&(e.curOp&&(e.curOp.selectionChanged=!0),e.options.$customCursor=De,v.addClass(e.getWrapperElement(),"cm-fat-cursor")),(!t||t.attach!=J)&&Fe(e)}v.defineOption("vimMode",!1,function(e,t,r){t&&e.getOption("keyMap")!="vim"?e.setOption("keyMap","vim"):!t&&r!=v.Init&&/^vim/.test(e.getOption("keyMap"))&&e.setOption("keyMap","default")});function Q(e,t){if(t){if(this[e])return this[e];var r=ir(e);if(!r)return!1;var n=$.findKey(t,r);return typeof n=="function"&&v.signal(t,"vim-keypress",r),n}}var q={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},Le={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function ir(e){if(e.charAt(0)=="'")return e.charAt(1);var t=e.split(/-(?!$)/),r=t[t.length-1];if(t.length==1&&t[0].length==1)return!1;if(t.length==2&&t[0]=="Shift"&&r.length==1)return!1;for(var n=!1,i=0;i<t.length;i++){var o=t[i];o in q?t[i]=q[o]:n=!0,o in Le&&(t[i]=Le[o])}return n?(Ie(r)&&(t[t.length-1]=r.toLowerCase()),"<"+t.join("-")+">"):!1}function pt(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(N(e.getCursor(),0,1)),me.enterInsertMode(e,{},t))}),t.onPasteFn}var or=/[\d]/,Ve=[v.isWordChar,function(e){return e&&!v.isWordChar(e)&&!/\s/.test(e)}],Ye=[function(e){return/\S/.test(e)}];function Ze(e,t){for(var r=[],n=e;n<e+t;n++)r.push(String.fromCharCode(n));return r}var vt=Ze(65,26),gt=Ze(97,26),yt=Ze(48,10),ar=[].concat(vt,gt,yt,["<",">"]),Ct=[].concat(vt,gt,yt,["-",'"',".",":","_","/","+"]),qe;try{qe=new RegExp("^[\\p{Lu}]$","u")}catch{qe=/^[A-Z]$/}function et(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function tt(e){return/^[a-z]$/.test(e)}function sr(e){return"()[]{}".indexOf(e)!=-1}function lr(e){return or.test(e)}function Ie(e){return qe.test(e)}function G(e){return/^\s*$/.test(e)}function Te(e){return".?!".indexOf(e)!=-1}function rt(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var fe={};function Be(e,t,r,n,i){if(t===void 0&&!i)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),fe[e]={type:r,defaultValue:t,callback:i},n)for(var o=0;o<n.length;o++)fe[n[o]]=fe[e];t&&nt(e,t)}function nt(e,t,r,n){var i=fe[e];n=n||{};var o=n.scope;if(!i)return new Error("Unknown option: "+e);if(i.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}i.callback?(o!=="local"&&i.callback(t,void 0),o!=="global"&&r&&i.callback(t,r)):(o!=="local"&&(i.value=i.type=="boolean"?!!t:t),o!=="global"&&r&&(r.state.vim.options[e]={value:t}))}function ke(e,t,r){var n=fe[e];r=r||{};var i=r.scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){var o=t&&n.callback(void 0,t);return i!=="global"&&o!==void 0?o:i!=="local"?n.callback():void 0}else{var o=i!=="global"&&t&&t.state.vim.options[e];return(o||i!=="local"&&n||{}).value}}Be("filetype",void 0,"string",["ft"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.getOption("mode");return r=="null"?"":r}else{var r=e==""?"null":e;t.setOption("mode",r)}});var ur=function(){var e=100,t=-1,r=0,n=0,i=new Array(e);function o(s,u,f){var c=t%e,d=i[c];function p(C){var y=++t%e,k=i[y];k&&k.clear(),i[y]=s.setBookmark(C)}if(d){var h=d.find();h&&!X(h,u)&&p(u)}else p(u);p(f),r=t,n=t-e+1,n<0&&(n=0)}function a(s,u){t+=u,t>r?t=r:t<n&&(t=n);var f=i[(e+t)%e];if(f&&!f.find()){var c=u>0?1:-1,d,p=s.getCursor();do if(t+=c,f=i[(e+t)%e],f&&(d=f.find())&&!X(p,d))break;while(t<r&&t>n)}return f}function l(s,u){var f=t,c=a(s,u);return t=f,c&&c.find()}return{cachedCursor:void 0,add:o,find:l,move:a}},wt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function kt(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=wt()}kt.prototype={exitMacroRecordMode:function(){var e=w.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=w.registerController.getRegister(t);if(r){if(r.clear(),this.latestRegister=t,e.openDialog){var n=ge("span",{class:"cm-vim-message"},"recording @"+t);this.onRecordingDone=e.openDialog(n,null,{bottom:!0})}this.isRecording=!0}}};function We(e){return e.state.vim||(e.state.vim={inputState:new Ue,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}var w;function mt(){w={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ur(),macroModeState:new kt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Mt({}),searchHistoryController:new it,exCommandHistoryController:new it};for(var e in fe){var t=fe[e];t.value=t.defaultValue}}var Ke,$={enterVimMode:Fe,leaveVimMode:$e,buildKeyMap:function(){},getRegisterController:function(){return w.registerController},resetVimGlobalState_:mt,getVimGlobalState_:function(){return w},maybeInitVimState_:We,suppressErrorLogging:!1,InsertModeKey:ft,map:function(e,t,r){ae.map(e,t,r)},unmap:function(e,t){return ae.unmap(e,t)},noremap:function(e,t,r){function n(d){return d?[d]:["normal","insert","visual"]}for(var i=n(r),o=O.length,a=Ae,l=o-a;l<o&&i.length;l++){var s=O[l];if(s.keys==t&&(!r||!s.context||s.context===r)&&s.type.substr(0,2)!=="ex"&&s.type.substr(0,3)!=="key"){var u={};for(var f in s)u[f]=s[f];u.keys=e,r&&!u.context&&(u.context=r),this._mapCommand(u);var c=n(s.context);i=i.filter(function(d){return c.indexOf(d)===-1})}}},mapclear:function(e){var t=O.length,r=Ae,n=O.slice(0,t-r);if(O=O.slice(t-r),e)for(var i=n.length-1;i>=0;i--){var o=n[i];if(e!==o.context)if(o.context)this._mapCommand(o);else{var a=["normal","insert","visual"];for(var l in a)if(a[l]!==e){var s={};for(var u in o)s[u]=o[u];s.context=a[l],this._mapCommand(s)}}}},setOption:nt,getOption:ke,defineOption:Be,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');zt[e]=r,ae.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:tr,findKey:function(e,t,r){var n=We(e);function i(){var f=w.macroModeState;if(f.isRecording){if(t=="q")return f.exitMacroRecordMode(),V(e),!0;r!="mapping"&&Gr(f,t)}}function o(){if(t=="<Esc>"){if(n.visualMode)te(e);else if(n.insertMode)_e(e);else return;return V(e),!0}}function a(f){for(var c;f;)c=/<\w+-.+?>|<\w+>|./.exec(f),t=c[0],f=f.substring(c.index+t.length),$.handleKey(e,t,"mapping")}function l(){if(o())return!0;for(var f=n.inputState.keyBuffer=n.inputState.keyBuffer+t,c=t.length==1,d=ve.matchCommand(f,O,n.inputState,"insert");f.length>1&&d.type!="full";){var f=n.inputState.keyBuffer=f.slice(1),p=ve.matchCommand(f,O,n.inputState,"insert");p.type!="none"&&(d=p)}if(d.type=="none")return V(e),!1;if(d.type=="partial")return Ke&&window.clearTimeout(Ke),Ke=window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer&&V(e)},ke("insertModeEscKeysTimeout")),!c;if(Ke&&window.clearTimeout(Ke),c){for(var h=e.listSelections(),C=0;C<h.length;C++){var y=h[C].head;e.replaceRange("",N(y,0,-(f.length-1)),y,"+input")}w.macroModeState.lastInsertModeChanges.changes.pop()}return V(e),d.command}function s(){if(i()||o())return!0;var f=n.inputState.keyBuffer=n.inputState.keyBuffer+t;if(/^[1-9]\d*$/.test(f))return!0;var c=/^(\d*)(.*)$/.exec(f);if(!c)return V(e),!1;var d=n.visualMode?"visual":"normal",p=c[2]||c[1];n.inputState.operatorShortcut&&n.inputState.operatorShortcut.slice(-1)==p&&(p=n.inputState.operatorShortcut);var h=ve.matchCommand(p,O,n.inputState,d);return h.type=="none"?(V(e),!1):h.type=="partial"?!0:h.type=="clear"?(V(e),!0):(n.inputState.keyBuffer="",c=/^(\d*)(.*)$/.exec(f),c[1]&&c[1]!="0"&&n.inputState.pushRepeatDigit(c[1]),h.command)}var u;if(n.insertMode?u=l():u=s(),u!==!1)return u===!0?function(){return!0}:function(){if(!((u.operator||u.isEdit)&&e.getOption("readOnly")))return e.operation(function(){e.curOp.isVimOp=!0;try{u.type=="keyToKey"?a(u.toKeys):ve.processCommand(e,n,u)}catch(f){throw e.state.vim=void 0,We(e),$.suppressErrorLogging||console.log(f),f}return!0})}},handleEx:function(e,t){ae.processCommand(e,t)},defineMotion:cr,defineAction:dr,defineOperator:hr,mapCommand:Jr,_mapCommand:Jt,defineRegister:fr,exitVisualMode:te,exitInsertMode:_e};function Ue(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}Ue.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},Ue.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e};function V(e,t){e.state.vim.inputState=new Ue,v.signal(e,"vim-command-done",t)}function ee(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}ee.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push(`
- `),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(wt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};function fr(e,t){var r=w.registerController.registers;if(!e||e.length!=1)throw Error("Register name must be 1 character");r[e]=t,Ct.push(e)}function Mt(e){this.registers=e,this.unnamedRegister=e['"']=new ee,e["."]=new ee,e[":"]=new ee,e["/"]=new ee,e["+"]=new ee}Mt.prototype={pushText:function(e,t,r,n,i){if(e!=="_"){n&&r.charAt(r.length-1)!==`
- `&&(r+=`
- `);var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new ee(r,n,i);break;case"delete":case"change":r.indexOf(`
- `)==-1?this.registers["-"]=new ee(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new ee(r,n));break}this.unnamedRegister.setText(r,n,i);return}var a=Ie(e);a?o.pushText(r,n):o.setText(r,n,i),e==="+"&&typeof navigator<"u"&&typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText=="function"&&navigator.clipboard.writeText(r),this.unnamedRegister.setText(o.toString(),n)}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new ee),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&rt(e,Ct)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}};function it(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}it.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;this.initialPrefix===null&&(this.initialPrefix=e);for(var i=this.iterator+n;t?i>=0:i<r.length;i+=n)for(var o=r[i],a=0;a<=o.length;a++)if(this.initialPrefix==o.substring(0,a))return this.iterator=i,o;if(i>=r.length)return this.iterator=r.length,this.initialPrefix;if(i<0)return e},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var ve={matchCommand:function(e,t,r,n){var i=pr(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o,a=0;a<i.full.length;a++){var l=i.full[a];o||(o=l)}if(o.keys.slice(-11)=="<character>"){var s=gr(e);if(!s||s.length>1)return{type:"clear"};r.selectedCharacter=s}return{type:"full",command:o}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r);break}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=je(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator)if(n.operator==r.operator){n.motion="expandToLine",n.motionArgs={linewise:!0},this.evalInput(e,t);return}else V(e);n.operator=r.operator,n.operatorArgs=je(r.operatorArgs),r.keys.length>1&&(n.operatorShortcut=r.keys),r.exitVisualBlock&&(t.visualBlock=!1,Oe(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,i=je(r.operatorMotionArgs);i&&n&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,i=n.getRepeat(),o=!!i,a=je(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=n.registerName,V(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),me[r.action](e,a,t)},processSearch:function(e,t,r){if(!e.getSearchCursor)return;var n=r.searchArgs.forward,i=r.searchArgs.wholeWordOnly;re(e).setReversed(!n);var o=n?"/":"?",a=re(e).getQuery(),l=e.getScrollInfo();function s(y,k,m){w.searchHistoryController.pushInput(y),w.searchHistoryController.reset();try{Pe(e,y,k,m)}catch{A(e,"Invalid regex: "+y),V(e);return}ve.processMotion(e,t,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function u(y){s(y,!0,!0);var k=w.macroModeState;k.isRecording&&Yr(k,y)}function f(y,k,m){var M=v.keyName(y),x,P;M=="Up"||M=="Down"?(x=M=="Up",P=y.target?y.target.selectionEnd:0,k=w.searchHistoryController.nextMatch(k,x)||"",m(k),P&&y.target&&(y.target.selectionEnd=y.target.selectionStart=Math.min(P,y.target.value.length))):M!="Left"&&M!="Right"&&M!="Ctrl"&&M!="Alt"&&M!="Shift"&&w.searchHistoryController.reset();var I;try{I=Pe(e,k,!0,!0)}catch{}I?e.scrollIntoView(Vt(e,!n,I),30):(lt(e),e.scrollTo(l.left,l.top))}function c(y,k,m){var M=v.keyName(y);M=="Esc"||M=="Ctrl-C"||M=="Ctrl-["||M=="Backspace"&&k==""?(w.searchHistoryController.pushInput(k),w.searchHistoryController.reset(),Pe(e,a),lt(e),e.scrollTo(l.left,l.top),v.e_stop(y),V(e),m(),e.focus()):M=="Up"||M=="Down"?v.e_stop(y):M=="Ctrl-U"&&(v.e_stop(y),m(""))}switch(r.searchArgs.querySrc){case"prompt":var d=w.macroModeState;if(d.isPlaying){var C=d.replaySearchQueries.shift();s(C,!0,!1)}else Je(e,{onClose:u,prefix:o,desc:"(JavaScript regexp)",onKeyUp:f,onKeyDown:c});break;case"wordUnderCursor":var p=ze(e,!1,!0,!1,!0),h=!0;if(p||(p=ze(e,!1,!0,!1,!1),h=!1),!p)return;var C=e.getLine(p.start.line).substring(p.start.ch,p.end.ch);h&&i?C="\\b"+C+"\\b":C=yr(C),w.jumpList.cachedCursor=e.getCursor(),e.setCursor(p.start),s(C,!0,!1);break}},processEx:function(e,t,r){function n(o){w.exCommandHistoryController.pushInput(o),w.exCommandHistoryController.reset(),ae.processCommand(e,o),e.state.vim&&V(e)}function i(o,a,l){var s=v.keyName(o),u,f;(s=="Esc"||s=="Ctrl-C"||s=="Ctrl-["||s=="Backspace"&&a=="")&&(w.exCommandHistoryController.pushInput(a),w.exCommandHistoryController.reset(),v.e_stop(o),V(e),l(),e.focus()),s=="Up"||s=="Down"?(v.e_stop(o),u=s=="Up",f=o.target?o.target.selectionEnd:0,a=w.exCommandHistoryController.nextMatch(a,u)||"",l(a),f&&o.target&&(o.target.selectionEnd=o.target.selectionStart=Math.min(f,o.target.value.length))):s=="Ctrl-U"?(v.e_stop(o),l("")):s!="Left"&&s!="Right"&&s!="Ctrl"&&s!="Alt"&&s!="Shift"&&w.exCommandHistoryController.reset()}r.type=="keyToEx"?ae.processCommand(e,r.exArgs.input):t.visualMode?Je(e,{onClose:n,prefix:":",value:"'<,'>",onKeyDown:i,selectValueOnOpen:!1}):Je(e,{onClose:n,prefix:":",onKeyDown:i})},evalInput:function(e,t){var r=t.inputState,n=r.motion,i=r.motionArgs||{},o=r.operator,a=r.operatorArgs||{},l=r.registerName,s=t.sel,u=L(t.visualMode?W(e,s.head):e.getCursor("head")),f=L(t.visualMode?W(e,s.anchor):e.getCursor("anchor")),c=L(u),d=L(f),p,h,C;if(o&&this.recordLastEdit(t,r),r.repeatOverride!==void 0?C=r.repeatOverride:C=r.getRepeat(),C>0&&i.explicitRepeat?i.repeatIsExplicit=!0:(i.noRepeat||!i.explicitRepeat&&C===0)&&(C=1,i.repeatIsExplicit=!1),r.selectedCharacter&&(i.selectedCharacter=a.selectedCharacter=r.selectedCharacter),i.repeat=C,V(e),n){var y=ce[n](e,u,i,t,r);if(t.lastMotion=ce[n],!y)return;if(i.toJumplist){!o&&e.ace.curOp!=null&&(e.ace.curOp.command.scrollIntoView="center-animate");var k=w.jumpList,m=k.cachedCursor;m?(Rt(e,m,y),delete k.cachedCursor):Rt(e,u,y)}y instanceof Array?(h=y[0],p=y[1]):p=y,p||(p=L(u)),t.visualMode?(t.visualBlock&&p.ch===1/0||(p=W(e,p,c)),h&&(h=W(e,h)),h=h||d,s.anchor=h,s.head=p,Oe(e),he(e,t,"<",E(h,p)?h:p),he(e,t,">",E(h,p)?p:h)):o||(e.ace.curOp&&(e.ace.curOp.vimDialogScroll="center-animate"),p=W(e,p,c),e.setCursor(p.line,p.ch))}if(o){if(a.lastSel){h=d;var M=a.lastSel,x=Math.abs(M.head.line-M.anchor.line),P=Math.abs(M.head.ch-M.anchor.ch);M.visualLine?p=new g(d.line+x,d.ch):M.visualBlock?p=new g(d.line+x,d.ch+P):M.head.line==M.anchor.line?p=new g(d.line,d.ch+P):p=new g(d.line+x,d.ch),t.visualMode=!0,t.visualLine=M.visualLine,t.visualBlock=M.visualBlock,s=t.sel={anchor:h,head:p},Oe(e)}else t.visualMode&&(a.lastSel={anchor:L(s.anchor),head:L(s.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var I,D,b,S,F;if(t.visualMode){I=Y(s.head,s.anchor),D=Me(s.head,s.anchor),b=t.visualLine||a.linewise,S=t.visualBlock?"block":b?"line":"char";var j=pe(e,I,D);if(F=at(e,{anchor:j.start,head:j.end},S),b){var _=F.ranges;if(S=="block")for(var se=0;se<_.length;se++)_[se].head.ch=H(e,_[se].head.line);else S=="line"&&(_[0].head=new g(_[0].head.line+1,0))}}else{if(I=L(h||d),D=L(p||c),E(D,I)){var Ne=I;I=D,D=Ne}b=i.linewise||a.linewise,b?xr(e,I,D):i.forward&&Sr(e,I,D),S="char";var en=!i.inclusive||b,j=pe(e,I,D);F=at(e,{anchor:j.start,head:j.end},S,en)}e.setSelections(F.ranges,F.primary),t.lastMotion=null,a.repeat=C,a.registerName=l,a.linewise=b;var dt=xt[o](e,a,F.ranges,d,p);t.visualMode&&te(e,dt!=null),dt&&e.setCursor(dt)}},recordLastEdit:function(e,t,r){var n=w.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1,n.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},ce={moveToTopLine:function(e,t,r){var n=ut(e).top+r.repeat-1;return new g(n,oe(e.getLine(n)))},moveToMiddleLine:function(e){var t=ut(e),r=Math.floor((t.top+t.bottom)*.5);return new g(r,oe(e.getLine(r)))},moveToBottomLine:function(e,t,r){var n=ut(e).bottom-r.repeat+1;return new g(n,oe(e.getLine(n)))},expandToLine:function(e,t,r){var n=t;return new g(n.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=re(e),i=n.getQuery();if(i){var o=!r.forward;return o=n.isReversed()?!o:o,$t(e,i),Vt(e,o,i,r.repeat)}},findAndSelectNextInclusive:function(e,t,r,n,i){var o=re(e),a=o.getQuery();if(a){var l=!r.forward;l=o.isReversed()?!l:l;var s=Ur(e,l,a,r.repeat,n);if(s){if(i.operator)return s;var u=s[0],f=new g(s[1].line,s[1].ch-1);if(n.visualMode){(n.visualLine||n.visualBlock)&&(n.visualLine=!1,n.visualBlock=!1,v.signal(e,"vim-mode-change",{mode:"visual",subMode:""}));var c=n.sel.anchor;if(c)return o.isReversed()?r.forward?[c,u]:[c,f]:r.forward?[c,f]:[c,u]}else n.visualMode=!0,n.visualLine=!1,n.visualBlock=!1,v.signal(e,"vim-mode-change",{mode:"visual",subMode:""});return l?[f,u]:[u,f]}}},goToMark:function(e,t,r,n){var i=Wt(e,n,r.selectedCharacter);return i?r.linewise?{line:i.line,ch:oe(e.getLine(i.line))}:i:null},moveToOtherHighlightedEnd:function(e,t,r,n){if(n.visualBlock&&r.sameLine){var i=n.sel;return[W(e,new g(i.anchor.line,i.head.ch)),W(e,new g(i.head.line,i.anchor.ch))]}else return[n.sel.head,n.sel.anchor]},jumpToMark:function(e,t,r,n){for(var i=t,o=0;o<r.repeat;o++){var a=i;for(var l in n.marks)if(tt(l)){var s=n.marks[l].find(),u=r.forward?E(s,a):E(a,s);if(!u&&!(r.linewise&&s.line==a.line)){var f=X(a,i),c=r.forward?At(a,s,i):At(i,s,a);(f||c)&&(i=s)}}}return r.linewise&&(i=new g(i.line,oe(e.getLine(i.line)))),i},moveByCharacters:function(e,t,r){var n=t,i=r.repeat,o=r.forward?n.ch+i:n.ch-i;return new g(n.line,o)},moveByLines:function(e,t,r,n){var i=t,o=i.ch;switch(n.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:o=n.lastHPos;break;default:n.lastHPos=o}var a=r.repeat+(r.repeatOffset||0),l=r.forward?i.line+a:i.line-a,s=e.firstLine(),u=e.lastLine();if(l<s&&i.line==s)return this.moveToStartOfLine(e,t,r,n);if(l>u&&i.line==u)return Bt(e,t,r,n,!0);var f=e.ace.session.getFoldLine(l);return f&&(r.forward?l>f.start.row&&(l=f.end.row+1):l=f.start.row),r.toFirstChar&&(o=oe(e.getLine(l)),n.lastHPos=o),n.lastHSPos=e.charCoords(new g(l,o),"div").left,new g(l,o)},moveByDisplayLines:function(e,t,r,n){var i=t;switch(n.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:n.lastHSPos=e.charCoords(i,"div").left}var o=r.repeat,a=e.findPosV(i,r.forward?o:-o,"line",n.lastHSPos);if(a.hitSide)if(r.forward)var l=e.charCoords(a,"div"),s={top:l.top+8,left:n.lastHSPos},a=e.coordsChar(s,"div");else{var u=e.charCoords(new g(e.firstLine(),0),"div");u.left=n.lastHSPos,a=e.coordsChar(u,"div")}return n.lastHPos=a.ch,a},moveByPage:function(e,t,r){var n=t,i=r.repeat;return e.findPosV(n,r.forward?i:-i,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return Kt(e,t,r.repeat,n)},moveBySentence:function(e,t,r){var n=r.forward?1:-1;return Ir(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var i=e.getScrollInfo(),o=null,a=r.repeat;a||(a=i.clientHeight/(2*e.defaultTextHeight()));var l=e.charCoords(t,"local");if(r.repeat=a,o=ce.moveByDisplayLines(e,t,r,n),!o)return null;var s=e.charCoords(o,"local");return e.scrollTo(null,i.top+s.top-l.top),o},moveByWords:function(e,t,r){return Or(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,i=st(e,n,r.forward,r.selectedCharacter),o=r.forward?-1:1;return Et(o,r),i?(i.ch+=o,i):null},moveToCharacter:function(e,t,r){var n=r.repeat;return Et(0,r),st(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return Lr(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var i=r.repeat;return n.lastHPos=i-1,n.lastHSPos=e.charCoords(t,"div").left,Rr(e,i)},moveToEol:function(e,t,r,n){return Bt(e,t,r,n,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return new g(r.line,oe(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){for(var r=t,n=r.line,i=r.ch,o=e.getLine(n),a;i<o.length;i++)if(a=o.charAt(i),a&&sr(a)){var l=e.getTokenTypeAt(new g(n,i+1));if(l!=="string"&&l!=="comment")break}if(i<o.length){var s=/[<>]/.test(o[i])?/[(){}[\]<>]/:/[(){}[\]]/,u=e.findMatchingBracket(new g(n,i+1),{bracketRegex:s});return u.to}else return r},moveToStartOfLine:function(e,t){return new g(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var n=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(n=r.repeat-e.getOption("firstLineNumber")),new g(n,oe(e.getLine(n)))},moveToStartOfDisplayLine:function(e){return e.execCommand("goLineLeft"),e.getCursor()},moveToEndOfDisplayLine:function(e){e.execCommand("goLineRight");var t=e.getCursor();return t.sticky=="before"&&t.ch--,t},textObjectManipulation:function(e,t,r,n){var i={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},o={"'":!0,'"':!0,"`":!0},a=r.selectedCharacter;a=="b"?a="(":a=="B"&&(a="{");var l=!r.textObjectInner,s;if(i[a])s=Br(e,t,a,l);else if(o[a])s=Kr(e,t,a,l);else if(a==="W")s=ze(e,l,!0,!0);else if(a==="w")s=ze(e,l,!0,!1);else if(a==="p")if(s=Kt(e,t,r.repeat,0,l),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var u=n.inputState.operatorArgs;u&&(u.linewise=!0),s.end.line--}else if(a==="t")s=br(e,t,l);else if(a==="s"){var f=e.getLine(t.line);t.ch>0&&Te(f[t.ch])&&(t.ch-=1);var c=Pt(e,t,r.repeat,1,l),d=Pt(e,t,r.repeat,-1,l);G(e.getLine(d.line)[d.ch])&&G(e.getLine(c.line)[c.ch-1])&&(d={line:d.line,ch:d.ch+1}),s={start:d,end:c}}else return null;return e.state.vim.visualMode?mr(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,r){var n=w.lastCharacterSearch,i=r.repeat,o=r.forward===n.forward,a=(n.increment?1:0)*(o?-1:1);e.moveH(-a,"char"),r.inclusive=!!o;var l=st(e,i,o,n.selectedCharacter);return l?(l.ch+=a,l):(e.moveH(a,"char"),t)}};function cr(e,t){ce[e]=t}function St(e,t){for(var r=[],n=0;n<t;n++)r.push(e);return r}var xt={change:function(e,t,r){var n,i,o=e.state.vim,a=r[0].anchor,l=r[0].head;if(o.visualMode)if(t.fullLine)l.ch=Number.MAX_VALUE,l.line--,e.setSelection(a,l),i=e.getSelection(),e.replaceSelection(""),n=a;else{i=e.getSelection();var d=St("",r.length);e.replaceSelections(d),n=Y(r[0].head,r[0].anchor)}else{i=e.getRange(a,l);var s=o.lastEditInputState||{};if(s.motion=="moveByWords"&&!G(i)){var u=/\s+$/.exec(i);u&&s.motionArgs&&s.motionArgs.forward&&(l=N(l,0,-u[0].length),i=i.slice(0,-u[0].length))}var f=new g(a.line-1,Number.MAX_VALUE),c=e.firstLine()==e.lastLine();l.line>e.lastLine()&&t.linewise&&!c?e.replaceRange("",f,l):e.replaceRange("",a,l),t.linewise&&(c||(e.setCursor(f),v.commands.newlineAndIndent(e)),a.ch=Number.MAX_VALUE),n=a}w.registerController.pushText(t.registerName,"change",i,t.linewise,r.length>1),me.enterInsertMode(e,{head:n},e.state.vim)},delete:function(e,t,r){var n,i,o=e.state.vim;if(o.visualBlock){i=e.getSelection();var s=St("",r.length);e.replaceSelections(s),n=Y(r[0].head,r[0].anchor)}else{var a=r[0].anchor,l=r[0].head;t.linewise&&l.line!=e.firstLine()&&a.line==e.lastLine()&&a.line==l.line-1&&(a.line==e.firstLine()?a.ch=0:a=new g(a.line-1,H(e,a.line-1))),i=e.getRange(a,l),e.replaceRange("",a,l),n=a,t.linewise&&(n=ce.moveToFirstNonWhiteSpaceCharacter(e,a))}return w.registerController.pushText(t.registerName,"delete",i,t.linewise,o.visualBlock),W(e,n)},indent:function(e,t,r){var n=e.state.vim;if(e.indentMore)for(var i=n.visualMode?t.repeat:1,o=0;o<i;o++)t.indentRight?e.indentMore():e.indentLess();else{var a=r[0].anchor.line,l=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,i=n.visualMode?t.repeat:1;t.linewise&&l--;for(var s=a;s<=l;s++)for(var o=0;o<i;o++)e.indentLine(s,t.indentRight)}return ce.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},indentAuto:function(e,t,r){return r.length>1&&e.setSelection(r[0].anchor,r[r.length-1].head),e.execCommand("indentAuto"),ce.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,i){for(var o=e.getSelections(),a=[],l=t.toLower,s=0;s<o.length;s++){var u=o[s],f="";if(l===!0)f=u.toLowerCase();else if(l===!1)f=u.toUpperCase();else for(var c=0;c<u.length;c++){var d=u.charAt(c);f+=Ie(d)?d.toLowerCase():d.toUpperCase()}a.push(f)}return e.replaceSelections(a),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&r[0].anchor.line+1==r[0].head.line?ce.moveToFirstNonWhiteSpaceCharacter(e,n):t.linewise?n:Y(r[0].anchor,r[0].head)},yank:function(e,t,r,n){var i=e.state.vim,o=e.getSelection(),a=i.visualMode?Y(i.sel.anchor,i.sel.head,r[0].head,r[0].anchor):n;return w.registerController.pushText(t.registerName,"yank",o,t.linewise,i.visualBlock),a}};function hr(e,t){xt[e]=t}var me={jumpListWalk:function(e,t,r){if(!r.visualMode){var n=t.repeat,i=t.forward,o=w.jumpList,a=o.move(e,i?n:-n),l=a?a.find():void 0;l=l||e.getCursor(),e.setCursor(l),e.ace.curOp.command.scrollIntoView="center-animate"}},scroll:function(e,t,r){if(!r.visualMode){var n=t.repeat||1,i=e.defaultTextHeight(),o=e.getScrollInfo().top,a=i*n,l=t.forward?o+a:o-a,s=L(e.getCursor()),u=e.charCoords(s,"local");if(t.forward)l>u.top?(s.line+=(l-u.top)/i,s.line=Math.ceil(s.line),e.setCursor(s),u=e.charCoords(s,"local"),e.scrollTo(null,u.top)):e.scrollTo(null,l);else{var f=l+e.getScrollInfo().clientHeight;f<u.bottom?(s.line-=(u.bottom-f)/i,s.line=Math.floor(s.line),e.setCursor(s),u=e.charCoords(s,"local"),e.scrollTo(null,u.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,l)}}},scrollToCursor:function(e,t){var r=e.getCursor().line,n=e.charCoords(new g(r,0),"local"),i=e.getScrollInfo().clientHeight,o=n.top;switch(t.position){case"center":o=n.bottom-i/2;break;case"bottom":var a=new g(r,e.getLine(r).length-1),l=e.charCoords(a,"local"),s=l.bottom-o;o=o-i+s;break}e.scrollTo(null,o)},replayMacro:function(e,t,r){var n=t.selectedCharacter,i=t.repeat,o=w.macroModeState;for(n=="@"?n=o.latestRegister:o.latestRegister=n;i--;)Qr(e,r,o,n)},enterMacroRecordMode:function(e,t){var r=w.macroModeState,n=t.selectedCharacter;w.registerController.isValidRegister(n)&&r.enterMacroRecordMode(e,n)},toggleOverwrite:function(e){e.state.overwrite?(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),v.signal(e,"vim-mode-change",{mode:"insert"})):(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),v.signal(e,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(e,t,r){if(!e.getOption("readOnly")){r.insertMode=!0,r.insertModeRepeat=t&&t.repeat||1;var n=t?t.insertAt:null,i=r.sel,o=t.head||e.getCursor("head"),a=e.listSelections().length;if(n=="eol")o=new g(o.line,H(e,o.line));else if(n=="bol")o=new g(o.line,0);else if(n=="charAfter"){var l=pe(e,o,N(o,0,1));o=l.end}else if(n=="firstNonBlank"){var l=pe(e,o,ce.moveToFirstNonWhiteSpaceCharacter(e,o));o=l.end}else if(n=="startOfSelectedArea"){if(!r.visualMode)return;r.visualBlock?(o=new g(Math.min(i.head.line,i.anchor.line),Math.min(i.head.ch,i.anchor.ch)),a=Math.abs(i.head.line-i.anchor.line)+1):i.head.line<i.anchor.line?o=i.head:o=new g(i.anchor.line,0)}else if(n=="endOfSelectedArea"){if(!r.visualMode)return;r.visualBlock?(o=new g(Math.min(i.head.line,i.anchor.line),Math.max(i.head.ch,i.anchor.ch)+1),a=Math.abs(i.head.line-i.anchor.line)+1):i.head.line>=i.anchor.line?o=N(i.head,0,1):o=new g(i.anchor.line,0)}else if(n=="inplace"){if(r.visualMode)return}else n=="lastEdit"&&(o=Ut(e)||o);e.setOption("disableInput",!1),t&&t.replace?(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),v.signal(e,"vim-mode-change",{mode:"replace"})):(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),v.signal(e,"vim-mode-change",{mode:"insert"})),w.macroModeState.isPlaying||(e.on("change",Qt),v.on(e.getInputField(),"keydown",Yt)),r.visualMode&&te(e),Tt(e,o,a)}},toggleVisualMode:function(e,t,r){var n=t.repeat,i=e.getCursor(),o;if(r.visualMode)r.visualLine^t.linewise||r.visualBlock^t.blockwise?(r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,v.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),Oe(e)):te(e);else{r.visualMode=!0,r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,o=W(e,new g(i.line,i.ch+n-1));var a=pe(e,i,o);r.sel={anchor:a.start,head:a.end},v.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),Oe(e),he(e,r,"<",Y(i,o)),he(e,r,">",Me(i,o))}},reselectLastSelection:function(e,t,r){var n=r.lastSelection;if(r.visualMode&&Ot(e,r),n){var i=n.anchorMark.find(),o=n.headMark.find();if(!i||!o)return;r.sel={anchor:i,head:o},r.visualMode=!0,r.visualLine=n.visualLine,r.visualBlock=n.visualBlock,Oe(e),he(e,r,"<",Y(i,o)),he(e,r,">",Me(i,o)),v.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var n,i;if(r.visualMode){if(n=e.getCursor("anchor"),i=e.getCursor("head"),E(i,n)){var o=i;i=n,n=o}i.ch=H(e,i.line)-1}else{var a=Math.max(t.repeat,2);n=e.getCursor(),i=W(e,new g(n.line+a-1,1/0))}for(var l=0,s=n.line;s<i.line;s++){l=H(e,n.line);var u="",f=0;if(!t.keepSpaces){var c=e.getLine(n.line+1);f=c.search(/\S/),f==-1?f=c.length:u=" "}e.replaceRange(u,new g(n.line,l),new g(n.line+1,f))}var d=W(e,new g(n.line,l));r.visualMode&&te(e,!1),e.setCursor(d)},newLineAndEnterInsertMode:function(e,t,r){r.insertMode=!0;var n=L(e.getCursor());if(n.line===e.firstLine()&&!t.after)e.replaceRange(`
- `,new g(e.firstLine(),0)),e.setCursor(e.firstLine(),0);else{n.line=t.after?n.line:n.line-1,n.ch=H(e,n.line),e.setCursor(n);var i=v.commands.newlineAndIndentContinueComment||v.commands.newlineAndIndent;i(e)}this.enterInsertMode(e,{repeat:t.repeat},r)},paste:function(e,t,r){var n=this,i=w.registerController.getRegister(t.registerName),o=function(){var a=i.toString();n.continuePaste(e,t,r,a,i)};t.registerName==="+"&&typeof navigator<"u"&&typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText=="function"?navigator.clipboard.readText().then(function(a){n.continuePaste(e,t,r,a,i)},function(){o()}):o()},continuePaste:function(e,t,r,n,i){var o=L(e.getCursor());if(n){if(t.matchIndent){var a=e.getOption("tabSize"),l=function(_){var se=_.split(" ").length-1,Ne=_.split(" ").length-1;return se*a+Ne*1},s=e.getLine(e.getCursor().line),u=l(s.match(/^\s*/)[0]),f=n.replace(/\n$/,""),c=n!==f,d=l(n.match(/^\s*/)[0]),n=f.replace(/^\s*/gm,function(_){var se=u+(l(_)-d);if(se<0)return"";if(e.getOption("indentWithTabs")){var Ne=Math.floor(se/a);return Array(Ne+1).join(" ")}else return Array(se+1).join(" ")});n+=c?`
- `:""}if(t.repeat>1)var n=Array(t.repeat+1).join(n);var p=i.linewise,h=i.blockwise;if(h){n=n.split(`
- `),p&&n.pop();for(var C=0;C<n.length;C++)n[C]=n[C]==""?" ":n[C];o.ch+=t.after?1:0,o.ch=Math.min(H(e,o.line),o.ch)}else p?r.visualMode?n=r.visualLine?n.slice(0,-1):`
- `+n.slice(0,n.length-1)+`
- `:t.after?(n=`
- `+n.slice(0,n.length-1),o.ch=H(e,o.line)):o.ch=0:o.ch+=t.after?1:0;var y,k;if(r.visualMode){r.lastPastedText=n;var m,M=kr(e,r),x=M[0],P=M[1],I=e.getSelection(),D=e.listSelections(),b=new Array(D.length).join("1").split("1");r.lastSelection&&(m=r.lastSelection.headMark.find()),w.registerController.unnamedRegister.setText(I),h?(e.replaceSelections(b),P=new g(x.line+n.length-1,x.ch),e.setCursor(x),Lt(e,P),e.replaceSelections(n),y=x):r.visualBlock?(e.replaceSelections(b),e.setCursor(x),e.replaceRange(n,x,x),y=x):(e.replaceRange(n,x,P),y=e.posFromIndex(e.indexFromPos(x)+n.length-1)),m&&(r.lastSelection.headMark=e.setBookmark(m)),p&&(y.ch=0)}else if(h){e.setCursor(o);for(var C=0;C<n.length;C++){var S=o.line+C;S>e.lastLine()&&e.replaceRange(`
- `,new g(S,0));var F=H(e,S);F<o.ch&&Cr(e,S,o.ch)}e.setCursor(o),Lt(e,new g(o.line+n.length-1,o.ch)),e.replaceSelections(n),y=o}else e.replaceRange(n,o),p&&t.after?y=new g(o.line+1,oe(e.getLine(o.line+1))):p&&!t.after?y=new g(o.line,oe(e.getLine(o.line))):!p&&t.after?(k=e.indexFromPos(o),y=e.posFromIndex(k+n.length-1)):(k=e.indexFromPos(o),y=e.posFromIndex(k+n.length));r.visualMode&&te(e,!1),e.setCursor(y)}},undo:function(e,t){e.operation(function(){bt(e,v.commands.undo,t.repeat)(),e.setCursor(W(e,e.getCursor("start")))})},redo:function(e,t){bt(e,v.commands.redo,t.repeat)()},setRegister:function(e,t,r){r.inputState.registerName=t.selectedCharacter},setMark:function(e,t,r){var n=t.selectedCharacter;he(e,r,n,e.getCursor())},replace:function(e,t,r){var n=t.selectedCharacter,i=e.getCursor(),o,a,l=e.listSelections();if(r.visualMode)i=e.getCursor("start"),a=e.getCursor("end");else{var s=e.getLine(i.line);o=i.ch+t.repeat,o>s.length&&(o=s.length),a=new g(i.line,o)}var u=pe(e,i,a);if(i=u.start,a=u.end,n==`
- `)r.visualMode||e.replaceRange("",i,a),(v.commands.newlineAndIndentContinueComment||v.commands.newlineAndIndent)(e);else{var f=e.getRange(i,a);if(f=f.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n),f=f.replace(/[^\n]/g,n),r.visualBlock){var c=new Array(e.getOption("tabSize")+1).join(" ");f=e.getSelection(),f=f.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n),f=f.replace(/\t/g,c).replace(/[^\n]/g,n).split(`
- `),e.replaceSelections(f)}else e.replaceRange(f,i,a);r.visualMode?(i=E(l[0].anchor,l[0].head)?l[0].anchor:l[0].head,e.setCursor(i),te(e,!1)):e.setCursor(N(a,0,-1))}},incrementNumberToken:function(e,t){for(var r=e.getCursor(),n=e.getLine(r.line),i=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,o,a,l,s;(o=i.exec(n))!==null&&(a=o.index,l=a+o[0].length,!(r.ch<l)););if(!(!t.backtrack&&l<=r.ch)){if(o){var u=o[2]||o[4],f=o[3]||o[5],c=t.increase?1:-1,d={"0b":2,0:8,"":10,"0x":16}[u.toLowerCase()],p=parseInt(o[1]+f,d)+c*t.repeat;s=p.toString(d);var h=u?new Array(f.length-s.length+1+o[1].length).join("0"):"";s.charAt(0)==="-"?s="-"+u+h+s.substr(1):s=u+h+s;var C=new g(r.line,a),y=new g(r.line,l);e.replaceRange(s,C,y)}else return;e.setCursor(new g(r.line,a+s.length-1))}},repeatLastEdit:function(e,t,r){var n=r.lastEditInputState;if(n){var i=t.repeat;i&&t.repeatIsExplicit?r.lastEditInputState.repeatOverride=i:i=r.lastEditInputState.repeatOverride||i,Zt(e,r,i,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:_e};function dr(e,t){me[e]=t}function W(e,t,r){var n=e.state.vim,i=n.insertMode||n.visualMode,o=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),a=e.getLine(o),l=a.length-1+!!i,s=Math.min(Math.max(0,t.ch),l),u=a.charCodeAt(s);if(56320<u&&u<57343){var f=1;r&&r.line==o&&r.ch>s&&(f=-1),s+=f,s>l&&(s-=2)}return new g(o,s)}function je(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function N(e,t,r){return typeof t=="object"&&(r=t.ch,t=t.line),new g(e.line+t,e.ch+r)}function pr(e,t,r,n){for(var i,o=[],a=[],l=0;l<t.length;l++){var s=t[l];r=="insert"&&s.context!="insert"||s.context&&s.context!=r||n.operator&&s.type=="action"||!(i=vr(e,s.keys))||(i=="partial"&&o.push(s),i=="full"&&a.push(s))}return{partial:o.length&&o,full:a.length&&a}}function vr(e,t){if(t.slice(-11)=="<character>"){var r=t.length-11,n=e.slice(0,r),i=t.slice(0,r);return n==i&&e.length>r?"full":i.indexOf(n)==0?"partial":!1}else return e==t?"full":t.indexOf(e)==0?"partial":!1}function gr(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"<CR>":r=`
- `;break;case"<Space>":r=" ";break;default:r="";break}return r}function bt(e,t,r){return function(){for(var n=0;n<r;n++)t(e)}}function L(e){return new g(e.line,e.ch)}function X(e,t){return e.ch==t.ch&&e.line==t.line}function E(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function Y(e,t){return arguments.length>2&&(t=Y.apply(void 0,Array.prototype.slice.call(arguments,1))),E(e,t)?e:t}function Me(e,t){return arguments.length>2&&(t=Me.apply(void 0,Array.prototype.slice.call(arguments,1))),E(e,t)?t:e}function At(e,t,r){var n=E(e,t),i=E(t,r);return n&&i}function H(e,t){return e.getLine(t).length}function ot(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function yr(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Cr(e,t,r){var n=H(e,t),i=new Array(r-n+1).join(" ");e.setCursor(new g(t,n)),e.replaceRange(i,e.getCursor())}function Lt(e,t){var r=[],n=e.listSelections(),i=L(e.clipPos(t)),o=!X(t,i),a=e.getCursor("head"),l=wr(n,a),s=X(n[l].head,n[l].anchor),u=n.length-1,f=u-l>l?u:0,c=n[f].anchor,d=Math.min(c.line,i.line),p=Math.max(c.line,i.line),h=c.ch,C=i.ch,y=n[f].head.ch-h,k=C-h;y>0&&k<=0?(h++,o||C--):y<0&&k>=0?(h--,s||C++):y<0&&k==-1&&(h--,C++);for(var m=d;m<=p;m++){var M={anchor:new g(m,h),head:new g(m,C)};r.push(M)}return e.setSelections(r),t.ch=C,c.ch=h,c}function Tt(e,t,r){for(var n=[],i=0;i<r;i++){var o=N(t,i,0);n.push({anchor:o,head:o})}e.setSelections(n,0)}function wr(e,t,r){for(var n=0;n<e.length;n++){var i=r!="head"&&X(e[n].anchor,t),o=r!="anchor"&&X(e[n].head,t);if(i||o)return n}return-1}function kr(e,t){var r=t.lastSelection,n=function(){var o=e.listSelections(),a=o[0],l=o[o.length-1],s=E(a.anchor,a.head)?a.anchor:a.head,u=E(l.anchor,l.head)?l.head:l.anchor;return[s,u]},i=function(){var o=e.getCursor(),a=e.getCursor(),l=r.visualBlock;if(l){var s=l.width,u=l.height;a=new g(o.line+u,o.ch+s);for(var f=[],c=o.line;c<a.line;c++){var d=new g(c,o.ch),p=new g(c,a.ch),h={anchor:d,head:p};f.push(h)}e.setSelections(f)}else{var C=r.anchorMark.find(),y=r.headMark.find(),k=y.line-C.line,m=y.ch-C.ch;a={line:a.line+k,ch:k?a.ch:m+a.ch},r.visualLine&&(o=new g(o.line,0),a=new g(a.line,H(e,a.line))),e.setSelection(o,a)}return[o,a]};return t.visualMode?n():i()}function Ot(e,t){var r=t.sel.anchor,n=t.sel.head;t.lastPastedText&&(n=e.posFromIndex(e.indexFromPos(r)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(r),headMark:e.setBookmark(n),anchor:L(r),head:L(n),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function mr(e,t,r){var n=e.state.vim.sel,i=n.head,o=n.anchor,a;return E(r,t)&&(a=r,r=t,t=a),E(i,o)?(i=Y(t,i),o=Me(o,r)):(o=Y(t,o),i=Me(i,r),i=N(i,0,-1),i.ch==-1&&i.line!=e.firstLine()&&(i=new g(i.line-1,H(e,i.line-1)))),[o,i]}function Oe(e,t,i){var n=e.state.vim;t=t||n.sel;var i=i||n.visualLine?"line":n.visualBlock?"block":"char",o=at(e,t,i);e.setSelections(o.ranges,o.primary)}function at(e,t,r,n){var i=L(t.head),o=L(t.anchor);if(r=="char"){var a=!n&&!E(t.head,t.anchor)?1:0,l=E(t.head,t.anchor)?1:0;return i=N(t.head,0,a),o=N(t.anchor,0,l),{ranges:[{anchor:o,head:i}],primary:0}}else if(r=="line"){if(E(t.head,t.anchor))i.ch=0,o.ch=H(e,o.line);else{o.ch=0;var s=e.lastLine();i.line>s&&(i.line=s),i.ch=H(e,i.line)}return{ranges:[{anchor:o,head:i}],primary:0}}else if(r=="block"){var u=Math.min(o.line,i.line),f=o.ch,c=Math.max(o.line,i.line),d=i.ch;f<d?d+=1:f+=1;for(var p=c-u+1,h=i.line==u?0:p-1,C=[],y=0;y<p;y++)C.push({anchor:new g(u+y,f),head:new g(u+y,d)});return{ranges:C,primary:h}}}function Mr(e){var t=e.getCursor("head");return e.getSelection().length==1&&(t=Y(t,e.getCursor("anchor"))),t}function te(e,t){var r=e.state.vim;t!==!1&&e.setCursor(W(e,r.sel.head)),Ot(e,r),r.visualMode=!1,r.visualLine=!1,r.visualBlock=!1,r.insertMode||v.signal(e,"vim-mode-change",{mode:"normal"})}function Sr(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var i=n.split(`
- `);i.pop();for(var o,o=i.pop();i.length>0&&o&&G(o);o=i.pop())r.line--,r.ch=0;o?(r.line--,r.ch=H(e,r.line)):r.ch=0}}function xr(e,t,r){t.ch=0,r.ch=0,r.line++}function oe(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function ze(e,t,r,n,i){for(var o=Mr(e),a=e.getLine(o.line),l=o.ch,s=i?Ve[0]:Ye[0];!s(a.charAt(l));)if(l++,l>=a.length)return null;n?s=Ye[0]:(s=Ve[0],s(a.charAt(l))||(s=Ve[1]));for(var u=l,f=l;s(a.charAt(u))&&u<a.length;)u++;for(;s(a.charAt(f))&&f>=0;)f--;if(f++,t){for(var c=u;/\s/.test(a.charAt(u))&&u<a.length;)u++;if(c==u){for(var d=f;/\s/.test(a.charAt(f-1))&&f>0;)f--;f||(f=d)}}return{start:new g(o.line,f),end:new g(o.line,u)}}function br(e,t,r){var n=t;if(!v.findMatchingTag||!v.findEnclosingTag)return{start:n,end:n};var i=v.findMatchingTag(e,t)||v.findEnclosingTag(e,t);return!i||!i.open||!i.close?{start:n,end:n}:r?{start:i.open.from,end:i.close.to}:{start:i.open.to,end:i.close.from}}function Rt(e,t,r){X(t,r)||w.jumpList.add(e,t,r)}function Et(e,t){w.lastCharacterSearch.increment=e,w.lastCharacterSearch.forward=t.forward,w.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var Ar={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},It={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return e.index===0&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t=e.lastCh==="*"&&e.nextCh==="/";return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb=e.symb==="m"?"{":"}",e.reverseSymb=e.symb==="{"?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if(e.nextCh==="#"){var t=e.lineText.match(/^#(\w+)/)[1];if(t==="endif"){if(e.forward&&e.depth===0)return!0;e.depth++}else if(t==="if"){if(!e.forward&&e.depth===0)return!0;e.depth--}if(t==="else"&&e.depth===0)return!0}return!1}}};function Lr(e,t,r,n){var i=L(e.getCursor()),o=r?1:-1,a=r?e.lineCount():-1,l=i.ch,s=i.line,u=e.getLine(s),f={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:n,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[n],forward:r,depth:0,curMoveThrough:!1},c=Ar[n];if(!c)return i;var d=It[c].init,p=It[c].isComplete;for(d&&d(f);s!==a&&t;){if(f.index+=o,f.nextCh=f.lineText.charAt(f.index),!f.nextCh){if(s+=o,f.lineText=e.getLine(s)||"",o>0)f.index=0;else{var h=f.lineText.length;f.index=h>0?h-1:0}f.nextCh=f.lineText.charAt(f.index)}p(f)&&(i.line=s,i.ch=f.index,t--)}return f.nextCh||f.curMoveThrough?new g(s,f.index):i}function Tr(e,t,r,n,i){var o=t.line,a=t.ch,l=e.getLine(o),s=r?1:-1,u=n?Ye:Ve;if(i&&l==""){if(o+=s,l=e.getLine(o),!et(e,o))return null;a=r?0:l.length}for(;;){if(i&&l=="")return{from:0,to:0,line:o};for(var f=s>0?l.length:-1,c=f,d=f;a!=f;){for(var p=!1,h=0;h<u.length&&!p;++h)if(u[h](l.charAt(a))){for(c=a;a!=f&&u[h](l.charAt(a));)a+=s;if(d=a,p=c!=d,c==t.ch&&o==t.line&&d==c+s)continue;return{from:Math.min(c,d+1),to:Math.max(c,d),line:o}}p||(a+=s)}if(o+=s,!et(e,o))return null;l=e.getLine(o),a=s>0?0:l.length}}function Or(e,t,r,n,i,o){var a=L(t),l=[];(n&&!i||!n&&i)&&r++;for(var s=!(n&&i),u=0;u<r;u++){var f=Tr(e,t,n,o,s);if(!f){var c=H(e,e.lastLine());l.push(n?{line:e.lastLine(),from:c,to:c}:{line:0,from:0,to:0});break}l.push(f),t=new g(f.line,n?f.to-1:f.from)}var d=l.length!=r,p=l[0],h=l.pop();return n&&!i?(!d&&(p.from!=a.ch||p.line!=a.line)&&(h=l.pop()),new g(h.line,h.from)):n&&i?new g(h.line,h.to-1):!n&&i?(!d&&(p.to!=a.ch||p.line!=a.line)&&(h=l.pop()),new g(h.line,h.to)):new g(h.line,h.from)}function Bt(e,t,r,n,i){var o=t,a=new g(o.line+r.repeat-1,1/0),l=e.clipPos(a);return l.ch--,i||(n.lastHPos=1/0,n.lastHSPos=e.charCoords(l,"div").left),a}function st(e,t,r,n){for(var i=e.getCursor(),o=i.ch,a,l=0;l<t;l++){var s=e.getLine(i.line);if(a=Er(o,s,n,r,!0),a==-1)return null;o=a}return new g(e.getCursor().line,a)}function Rr(e,t){var r=e.getCursor().line;return W(e,new g(r,t-1))}function he(e,t,r,n){rt(r,ar)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function Er(e,t,r,n,i){var o;return n?(o=t.indexOf(r,e+1),o!=-1&&!i&&(o-=1)):(o=t.lastIndexOf(r,e-1),o!=-1&&!i&&(o+=1)),o}function Kt(e,t,r,n,i){var o=t.line,a=e.firstLine(),l=e.lastLine(),s,u,f=o;function c(k){return!/\S/.test(e.getLine(k))}function d(k,m,M){return M?c(k)!=c(k+m):!c(k)&&c(k+m)}function p(k){n=n>0?1:-1;var m=e.ace.session.getFoldLine(k);m&&k+n>m.start.row&&k+n<m.end.row&&(n=(n>0?m.end.row:m.start.row)-k)}if(n){for(;a<=f&&f<=l&&r>0;)p(f),d(f,n)&&r--,f+=n;return new g(f,0)}var h=e.state.vim;if(h.visualLine&&d(o,1,!0)){var C=h.sel.anchor;d(C.line,-1,!0)&&(!i||C.line!=o)&&(o+=1)}var y=c(o);for(f=o;f<=l&&r;f++)d(f,1,!0)&&(!i||c(f)!=y)&&r--;for(u=new g(f,0),f>l&&!y?y=!0:i=!1,f=o;f>a&&!((!i||c(f)==y||f==o)&&d(f,-1,!0));f--);return s=new g(f,0),{start:s,end:u}}function Pt(e,t,r,n,i){function o(u){u.pos+u.dir<0||u.pos+u.dir>=u.line.length?u.line=null:u.pos+=u.dir}function a(u,f,c,d){var p=u.getLine(f),h={line:p,ln:f,pos:c,dir:d};if(h.line==="")return{ln:h.ln,pos:h.pos};var C=h.pos;for(o(h);h.line!==null;){if(C=h.pos,Te(h.line[h.pos]))if(i){for(o(h);h.line!==null&&G(h.line[h.pos]);)C=h.pos,o(h);return{ln:h.ln,pos:C+1}}else return{ln:h.ln,pos:h.pos+1};o(h)}return{ln:h.ln,pos:C+1}}function l(u,f,c,d){var p=u.getLine(f),h={line:p,ln:f,pos:c,dir:d};if(h.line==="")return{ln:h.ln,pos:h.pos};var C=h.pos;for(o(h);h.line!==null;){if(!G(h.line[h.pos])&&!Te(h.line[h.pos]))C=h.pos;else if(Te(h.line[h.pos]))return i?G(h.line[h.pos+1])?{ln:h.ln,pos:h.pos+1}:{ln:h.ln,pos:C}:{ln:h.ln,pos:C};o(h)}return h.line=p,i&&G(h.line[h.pos])?{ln:h.ln,pos:h.pos}:{ln:h.ln,pos:C}}for(var s={ln:t.line,pos:t.ch};r>0;)n<0?s=l(e,s.ln,s.pos,n):s=a(e,s.ln,s.pos,n),r--;return new g(s.ln,s.pos)}function Ir(e,t,r,n){function i(s,u){if(u.pos+u.dir<0||u.pos+u.dir>=u.line.length){if(u.ln+=u.dir,!et(s,u.ln)){u.line=null,u.ln=null,u.pos=null;return}u.line=s.getLine(u.ln),u.pos=u.dir>0?0:u.line.length-1}else u.pos+=u.dir}function o(s,u,f,c){var y=s.getLine(u),d=y==="",p={line:y,ln:u,pos:f,dir:c},h={ln:p.ln,pos:p.pos},C=p.line==="";for(i(s,p);p.line!==null;){if(h.ln=p.ln,h.pos=p.pos,p.line===""&&!C)return{ln:p.ln,pos:p.pos};if(d&&p.line!==""&&!G(p.line[p.pos]))return{ln:p.ln,pos:p.pos};Te(p.line[p.pos])&&!d&&(p.pos===p.line.length-1||G(p.line[p.pos+1]))&&(d=!0),i(s,p)}var y=s.getLine(h.ln);h.pos=0;for(var k=y.length-1;k>=0;--k)if(!G(y[k])){h.pos=k;break}return h}function a(s,u,f,c){var C=s.getLine(u),d={line:C,ln:u,pos:f,dir:c},p={ln:d.ln,pos:null},h=d.line==="";for(i(s,d);d.line!==null;){if(d.line===""&&!h)return p.pos!==null?p:{ln:d.ln,pos:d.pos};if(Te(d.line[d.pos])&&p.pos!==null&&!(d.ln===p.ln&&d.pos+1===p.pos))return p;d.line!==""&&!G(d.line[d.pos])&&(h=!1,p={ln:d.ln,pos:d.pos}),i(s,d)}var C=s.getLine(p.ln);p.pos=0;for(var y=0;y<C.length;++y)if(!G(C[y])){p.pos=y;break}return p}for(var l={ln:t.line,pos:t.ch};r>0;)n<0?l=a(e,l.ln,l.pos,n):l=o(e,l.ln,l.pos,n),r--;return new g(l.ln,l.pos)}function Br(e,t,r,n){var i=t,o,a,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],s={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[r],u=e.getLine(i.line).charAt(i.ch),f=u===s?1:0;if(o=e.scanForBracket(new g(i.line,i.ch+f),-1,void 0,{bracketRegex:l}),a=e.scanForBracket(new g(i.line,i.ch+f),1,void 0,{bracketRegex:l}),!o||!a)return{start:i,end:i};if(o=o.pos,a=a.pos,o.line==a.line&&o.ch>a.ch||o.line>a.line){var c=o;o=a,a=c}return n?a.ch+=1:o.ch+=1,{start:o,end:a}}function Kr(e,t,r,n){var i=L(t),o=e.getLine(i.line),a=o.split(""),l,s,u,f,c=a.indexOf(r);if(i.ch<c?i.ch=c:c<i.ch&&a[i.ch]==r&&(s=i.ch,--i.ch),a[i.ch]==r&&!s)l=i.ch+1;else for(u=i.ch;u>-1&&!l;u--)a[u]==r&&(l=u+1);if(l&&!s)for(u=l,f=a.length;u<f&&!s;u++)a[u]==r&&(s=u);return!l||!s?{start:i,end:i}:(n&&(--l,++s),{start:new g(i.line,l),end:new g(i.line,s)})}Be("pcre",!0,"boolean");function _t(){}_t.prototype={getQuery:function(){return w.query},setQuery:function(e){w.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return w.isReversed},setReversed:function(e){w.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};function re(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new _t)}function Pr(e){return Nt(e,"/")}function _r(e){return Ht(e,"/")}function Nt(e,t){var r=Ht(e,t)||[];if(!r.length)return[];var n=[];if(r[0]===0){for(var i=0;i<r.length;i++)typeof r[i]=="number"&&n.push(e.substring(r[i]+1,r[i+1]));return n}}function Ht(e,t){t||(t="/");for(var r=!1,n=[],i=0;i<e.length;i++){var o=e.charAt(i);!r&&o==t&&n.push(i),r=!r&&o=="\\"}return n}function Nr(e){for(var t="|(){",r="}",n=!1,i=[],o=-1;o<e.length;o++){var a=e.charAt(o)||"",l=e.charAt(o+1)||"",s=l&&t.indexOf(l)!=-1;n?((a!=="\\"||!s)&&i.push(a),n=!1):a==="\\"?(n=!0,l&&r.indexOf(l)!=-1&&(s=!0),(!s||l==="\\")&&i.push(a)):(i.push(a),s&&l!=="\\"&&i.push("\\"))}return i.join("")}var Dt={"\\n":`
- `,"\\r":"\r","\\t":" "};function Hr(e){for(var t=!1,r=[],n=-1;n<e.length;n++){var i=e.charAt(n)||"",o=e.charAt(n+1)||"";Dt[i+o]?(r.push(Dt[i+o]),n++):t?(r.push(i),t=!1):i==="\\"?(t=!0,lr(o)||o==="$"?r.push("$"):o!=="/"&&o!=="\\"&&r.push("\\")):(i==="$"&&r.push("$"),r.push(i),o==="/"&&r.push("\\"))}return r.join("")}var Ft={"\\/":"/","\\\\":"\\","\\n":`
- `,"\\r":"\r","\\t":" ","\\&":"&"};function Dr(e){for(var t=new v.StringStream(e),r=[];!t.eol();){for(;t.peek()&&t.peek()!="\\";)r.push(t.next());var n=!1;for(var i in Ft)if(t.match(i,!0)){n=!0,r.push(Ft[i]);break}n||r.push(t.next())}return r.join("")}function Fr(e,t,r){var n=w.registerController.getRegister("/");if(n.setText(e),e instanceof RegExp)return e;var i=_r(e),o,a;if(!i.length)o=e;else{o=e.substring(0,i[0]);var l=e.substring(i[0]);a=l.indexOf("i")!=-1}if(!o)return null;ke("pcre")||(o=Nr(o)),r&&(t=/^[^A-Z]*$/.test(o));var s=new RegExp(o,t||a?"im":"m");return s}function ge(e){typeof e=="string"&&(e=document.createElement(e));for(var t,r=1;r<arguments.length;r++)if(t=arguments[r])if(typeof t!="object"&&(t=document.createTextNode(t)),t.nodeType)e.appendChild(t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(n[0]==="$"?e.style[n.slice(1)]=t[n]:e.setAttribute(n,t[n]));return e}function A(e,t){var r=ge("div",{$color:"red",$whiteSpace:"pre",class:"cm-vim-message"},t);e.openNotification?e.openNotification(r,{bottom:!0,duration:5e3}):alert(r.innerText)}function $r(e,t){return ge(document.createDocumentFragment(),ge("span",{$fontFamily:"monospace",$whiteSpace:"pre"},e,ge("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false"})),t&&ge("span",{$color:"#888"},t))}function Je(e,t){var r=$r(t.prefix,t.desc);if(e.openDialog)e.openDialog(r,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value});else{var n="";typeof t.prefix!="string"&&t.prefix&&(n+=t.prefix.textContent),t.desc&&(n+=" "+t.desc),t.onClose(prompt(n,""))}}function Vr(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n<r.length;n++){var i=r[n];if(e[i]!==t[i])return!1}return!0}return!1}function Pe(e,t,r,n){if(t){var i=re(e),o=Fr(t,!!r,!!n);if(o)return $t(e,o),Vr(o,i.getQuery())||i.setQuery(o),o}}function Wr(e){if(e.source.charAt(0)=="^")var t=!0;return{token:function(r){if(t&&!r.sol()){r.skipToEnd();return}var n=r.match(e,!1);if(n)return n[0].length==0?(r.next(),"searching"):!r.sol()&&(r.backUp(1),!e.exec(r.next()+n[0]))?(r.next(),null):(r.match(e),"searching");for(;!r.eol()&&(r.next(),!r.match(e,!1)););},query:e}}var Qe=0;function $t(e,t){clearTimeout(Qe),Qe=setTimeout(function(){if(e.state.vim){var r=re(e),n=r.getOverlay();(!n||t!=n.query)&&(n&&e.removeOverlay(n),n=Wr(t),e.addOverlay(n),e.showMatchesOnScrollbar&&(r.getScrollbarAnnotate()&&r.getScrollbarAnnotate().clear(),r.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),r.setOverlay(n))}},50)}function Vt(e,t,r,n){return n===void 0&&(n=1),e.operation(function(){for(var i=e.getCursor(),o=e.getSearchCursor(r,i),a=0;a<n;a++){var l=o.find(t);if(a==0&&l&&X(o.from(),i)){var s=t?o.from():o.to();l=o.find(t),l&&!l[0]&&X(o.from(),s)&&e.getLine(s.line).length==s.ch&&(l=o.find(t))}if(!l&&(o=e.getSearchCursor(r,t?new g(e.lastLine()):new g(e.firstLine(),0)),!o.find(t)))return}return o.from()})}function Ur(e,t,r,n,i){return n===void 0&&(n=1),e.operation(function(){var o=e.getCursor(),a=e.getSearchCursor(r,o),l=a.find(!t);!i.visualMode&&l&&X(a.from(),o)&&a.find(!t);for(var s=0;s<n;s++)if(l=a.find(t),!l&&(a=e.getSearchCursor(r,t?new g(e.lastLine()):new g(e.firstLine(),0)),!a.find(t)))return;return[a.from(),a.to()]})}function lt(e){var t=re(e);e.removeOverlay(re(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function jr(e,t,r){return typeof e!="number"&&(e=e.line),t instanceof Array?rt(e,t):typeof r=="number"?e>=t&&e<=r:e==t}function ut(e){var t=e.ace.renderer;return{top:t.getFirstFullyVisibleRow(),bottom:t.getLastFullyVisibleRow()}}function Wt(e,t,r){if(r=="'"||r=="`")return w.jumpList.find(e,-1)||new g(0,0);if(r==".")return Ut(e);var n=t.marks[r];return n&&n.find()}function Ut(e){var t=e.ace.session.$undoManager;if(t&&t.$lastDelta)return R(t.$lastDelta.end)}var jt=function(){this.buildCommandMap_()};jt.prototype={processCommand:function(e,t,r){var n=this;e.operation(function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)})},_processCommand:function(e,t,r){var n=e.state.vim,i=w.registerController.getRegister(":"),o=i.toString();n.visualMode&&te(e);var a=new v.StringStream(t);i.setText(t);var l=r||{};l.input=t;try{this.parseInput_(e,a,l)}catch(c){throw A(e,c.toString()),c}var s,u;if(!l.commandName)l.line!==void 0&&(u="move");else if(s=this.matchCommand_(l.commandName),s){if(u=s.name,s.excludeFromCommandHistory&&i.setText(o),this.parseCommandArgs_(a,l,s),s.type=="exToKey"){for(var f=0;f<s.toKeys.length;f++)$.handleKey(e,s.toKeys[f],"mapping");return}else if(s.type=="exToEx"){this.processCommand(e,s.toInput);return}}if(!u){A(e,'Not an editor command ":'+t+'"');return}try{zt[u](e,l),(!s||!s.possiblyAsync)&&l.callback&&l.callback()}catch(c){throw A(e,c.toString()),c}},parseInput_:function(e,t,r){t.eatWhile(":"),t.eat("%")?(r.line=e.firstLine(),r.lineEnd=e.lastLine()):(r.line=this.parseLineSpec_(e,t),r.line!==void 0&&t.eat(",")&&(r.lineEnd=this.parseLineSpec_(e,t)));var n=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n?r.commandName=n[1]:r.commandName=t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var n=t.next(),i=Wt(e,e.state.vim,n);if(!i)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,i.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:t.backUp(1);return}},parseLineSpecOffset_:function(e,t){var r=e.match(/^([+-])?(\d+)/);if(r){var n=parseInt(r[2],10);r[1]=="-"?t-=n:t+=n}return t},parseCommandArgs_:function(e,t,r){if(!e.eol()){t.argString=e.match(/.*/)[0];var n=r.argDelimiter||/\s+/,i=ot(t.argString).split(n);i.length&&i[0]&&(t.args=i)}},matchCommand_:function(e){for(var t=e.length;t>0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(n.name.indexOf(e)===0)return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e<Z.length;e++){var t=Z[e],r=t.shortName||t.name;this.commandMap_[r]=t}},map:function(e,t,r){if(e!=":"&&e.charAt(0)==":"){if(r)throw Error("Mode not supported for ex mappings");var n=e.substring(1);t!=":"&&t.charAt(0)==":"?this.commandMap_[n]={name:n,type:"exToEx",toInput:t.substring(1),user:!0}:this.commandMap_[n]={name:n,type:"exToKey",toKeys:t,user:!0}}else if(t!=":"&&t.charAt(0)==":"){var i={keys:e,type:"keyToEx",exArgs:{input:t.substring(1)}};r&&(i.context=r),O.unshift(i)}else{var i={keys:e,type:"keyToKey",toKeys:t};r&&(i.context=r),O.unshift(i)}},unmap:function(e,t){if(e!=":"&&e.charAt(0)==":"){if(t)throw Error("Mode not supported for ex mappings");var r=e.substring(1);if(this.commandMap_[r]&&this.commandMap_[r].user)return delete this.commandMap_[r],!0}else for(var n=e,i=0;i<O.length;i++)if(n==O[i].keys&&O[i].context===t)return O.splice(i,1),!0}};var zt={colorscheme:function(e,t){if(!t.args||t.args.length<1){A(e,e.getOption("theme"));return}e.setOption("theme",t.args[0])},map:function(e,t,r){var n=t.args;if(!n||n.length<2){e&&A(e,"Invalid mapping: "+t.input);return}ae.map(n[0],n[1],r)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,r){var n=t.args;(!n||n.length<1||!ae.unmap(n[0],r))&&e&&A(e,"No such mapping: "+t.input)},move:function(e,t){ve.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var r=t.args,n=t.setCfg||{};if(!r||r.length<1){e&&A(e,"Invalid mapping: "+t.input);return}var i=r[0].split("="),o=i[0],a=i[1],l=!1;if(o.charAt(o.length-1)=="?"){if(a)throw Error("Trailing characters: "+t.argString);o=o.substring(0,o.length-1),l=!0}a===void 0&&o.substring(0,2)=="no"&&(o=o.substring(2),a=!1);var s=fe[o]&&fe[o].type=="boolean";if(s&&a==null&&(a=!0),!s&&a===void 0||l){var u=ke(o,e,n);u instanceof Error?A(e,u.message):u===!0||u===!1?A(e," "+(u?"":"no")+o):A(e," "+o+"="+u)}else{var f=nt(o,a,e,n);f instanceof Error&&A(e,f.message)}},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var r=t.args,n=w.registerController.registers,i=`----------Registers----------
- `;if(r){var o;r=r.join("");for(var l=0;l<r.length;l++)if(o=r.charAt(l),!!w.registerController.isValidRegister(o)){var s=n[o]||new ee;i+='"'+o+" "+s.toString()+`
- `}}else for(var o in n){var a=n[o].toString();a.length&&(i+='"'+o+" "+a+`
- `)}A(e,i)},sort:function(e,t){var r,n,i,o,a;function l(){if(t.argString){var b=new v.StringStream(t.argString);if(b.eat("!")&&(r=!0),b.eol())return;if(!b.eatSpace())return"Invalid arguments";var S=b.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!S&&!b.eol())return"Invalid arguments";if(S[1]){n=S[1].indexOf("i")!=-1,i=S[1].indexOf("u")!=-1;var F=S[1].indexOf("d")!=-1||S[1].indexOf("n")!=-1&&1,j=S[1].indexOf("x")!=-1&&1,_=S[1].indexOf("o")!=-1&&1;if(F+j+_>1)return"Invalid arguments";o=F&&"decimal"||j&&"hex"||_&&"octal"}S[2]&&(a=new RegExp(S[2].substr(1,S[2].length-2),n?"i":""))}}var s=l();if(s){A(e,s+": "+t.argString);return}var u=t.line||e.firstLine(),f=t.lineEnd||t.line||e.lastLine();if(u==f)return;var c=new g(u,0),d=new g(f,H(e,f)),p=e.getRange(c,d).split(`
- `),h=a||(o=="decimal"?/(-?)([\d]+)/:o=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:o=="octal"?/([0-7]+)/:null),C=o=="decimal"?10:o=="hex"?16:o=="octal"?8:null,y=[],k=[];if(o||a)for(var m=0;m<p.length;m++){var M=a?p[m].match(a):null;M&&M[0]!=""?y.push(M):!a&&h.exec(p[m])?y.push(p[m]):k.push(p[m])}else k=p;function x(b,S){if(r){var F;F=b,b=S,S=F}n&&(b=b.toLowerCase(),S=S.toLowerCase());var j=o&&h.exec(b),_=o&&h.exec(S);return j?(j=parseInt((j[1]+j[2]).toLowerCase(),C),_=parseInt((_[1]+_[2]).toLowerCase(),C),j-_):b<S?-1:1}function P(b,S){if(r){var F;F=b,b=S,S=F}return n&&(b[0]=b[0].toLowerCase(),S[0]=S[0].toLowerCase()),b[0]<S[0]?-1:1}if(y.sort(a?P:x),a)for(var m=0;m<y.length;m++)y[m]=y[m].input;else o||k.sort(x);if(p=r?y.concat(k):k.concat(y),i){var I=p,D;p=[];for(var m=0;m<I.length;m++)I[m]!=D&&p.push(I[m]),D=I[m]}e.replaceRange(p.join(`
- `),c,d)},vglobal:function(e,t){this.global(e,t)},global:function(e,t){var r=t.argString;if(!r){A(e,"Regular Expression missing from global");return}var n=t.commandName[0]==="v",i=t.line!==void 0?t.line:e.firstLine(),o=t.lineEnd||t.line||e.lastLine(),a=Pr(r),l=r,s;if(a.length&&(l=a[0],s=a.slice(1,a.length).join("/")),l)try{Pe(e,l,!0,!0)}catch{A(e,"Invalid regex: "+l);return}for(var u=re(e).getQuery(),f=[],c=i;c<=o;c++){var d=e.getLineHandle(c),p=u.test(d.text);p!==n&&f.push(s?d:d.text)}if(!s){A(e,f.join(`
- `));return}var h=0,C=function(){if(h<f.length){var y=f[h++],k=e.getLineNumber(y);if(k==null){C();return}var m=k+1+s;ae.processCommand(e,m,{callback:C})}};C()},substitute:function(e,t){if(!e.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var r=t.argString,n=r?Nt(r,r[0]):[],i,o="",a,l,s,u=!1,f=!1;if(n.length)i=n[0],ke("pcre")&&i!==""&&(i=new RegExp(i).source),o=n[1],o!==void 0&&(ke("pcre")?o=Dr(o.replace(/([^\\])&/g,"$1$$&")):o=Hr(o),w.lastSubstituteReplacePart=o),a=n[2]?n[2].split(" "):[];else if(r&&r.length){A(e,"Substitutions should be of the form :s/pattern/replace/");return}if(a&&(l=a[0],s=parseInt(a[1]),l&&(l.indexOf("c")!=-1&&(u=!0),l.indexOf("g")!=-1&&(f=!0),ke("pcre")?i=i+"/"+l:i=i.replace(/\//g,"\\/")+"/"+l)),i)try{Pe(e,i,!0,!0)}catch{A(e,"Invalid regex: "+i);return}if(o=o||w.lastSubstituteReplacePart,o===void 0){A(e,"No previous substitute regular expression");return}var c=re(e),d=c.getQuery(),p=t.line!==void 0?t.line:e.getCursor().line,h=t.lineEnd||p;p==e.firstLine()&&h==e.lastLine()&&(h=1/0),s&&(p=h,h=p+s-1);var C=W(e,new g(p,0)),y=e.getSearchCursor(d,C);zr(e,u,f,p,h,y,d,o,t.callback)},redo:v.commands.redo,undo:v.commands.undo,write:function(e){v.commands.save?v.commands.save(e):e.save&&e.save()},nohlsearch:function(e){lt(e)},yank:function(e){var t=L(e.getCursor()),r=t.line,n=e.getLine(r);w.registerController.pushText("0","yank",n,!0,!0)},delmarks:function(e,t){if(!t.argString||!ot(t.argString)){A(e,"Argument required");return}for(var r=e.state.vim,n=new v.StringStream(ot(t.argString));!n.eol();){n.eatSpace();var i=n.pos;if(!n.match(/[a-zA-Z]/,!1)){A(e,"Invalid argument: "+t.argString.substring(i));return}var o=n.next();if(n.match("-",!0)){if(!n.match(/[a-zA-Z]/,!1)){A(e,"Invalid argument: "+t.argString.substring(i));return}var a=o,l=n.next();if(tt(a)&&tt(l)||Ie(a)&&Ie(l)){var s=a.charCodeAt(0),u=l.charCodeAt(0);if(s>=u){A(e,"Invalid argument: "+t.argString.substring(i));return}for(var f=0;f<=u-s;f++){var c=String.fromCharCode(s+f);delete r.marks[c]}}else{A(e,"Invalid argument: "+a+"-");return}}else delete r.marks[o]}}},ae=new jt;function zr(e,t,r,n,i,o,a,l,s){e.state.vim.exMode=!0;var u=!1,f,c,d;function p(){e.operation(function(){for(;!u;)h(),y();k()})}function h(){var M=e.getRange(o.from(),o.to()),x=M.replace(a,l),P=o.to().line;o.replace(x),c=o.to().line,i+=c-P,d=c<P}function C(){var M=f&&L(o.to()),x=o.findNext();return x&&!x[0]&&M&&X(o.from(),M)&&(x=o.findNext()),x}function y(){for(;C()&&jr(o.from(),n,i);)if(!(!r&&o.from().line==c&&!d)){e.scrollIntoView(o.from(),30),e.setSelection(o.from(),o.to()),f=o.from(),u=!1;return}u=!0}function k(M){if(M&&M(),e.focus(),f){e.setCursor(f);var x=e.state.vim;x.exMode=!1,x.lastHPos=x.lastHSPos=f.ch}s&&s()}function m(M,x,P){v.e_stop(M);var I=v.keyName(M);switch(I){case"Y":h(),y();break;case"N":y();break;case"A":var D=s;s=void 0,e.operation(p),s=D;break;case"L":h();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":k(P);break}return u&&k(P),!0}if(y(),u){A(e,"No matches for "+a.source);return}if(!t){p(),s&&s();return}Je(e,{prefix:ge("span","replace with ",ge("strong",l)," (y/n/a/q/l)"),onKeyDown:m})}v.keyMap.vim={attach:J,detach:Ee,call:Q};function _e(e){var t=e.state.vim,r=w.macroModeState,n=w.registerController.getRegister("."),i=r.isPlaying,o=r.lastInsertModeChanges;i||(e.off("change",Qt),v.off(e.getInputField(),"keydown",Yt)),!i&&t.insertModeRepeat>1&&(Zt(e,t,t.insertModeRepeat-1,!0),t.lastEditInputState.repeatOverride=t.insertModeRepeat),delete t.insertModeRepeat,t.insertMode=!1,e.setCursor(e.getCursor().line,e.getCursor().ch-1),e.setOption("keyMap","vim"),e.setOption("disableInput",!0),e.toggleOverwrite(!1),n.setText(o.changes.join("")),v.signal(e,"vim-mode-change",{mode:"normal"}),r.isRecording&&Xr(r)}function Jt(e){O.unshift(e)}function Jr(e,t,r,n,i){var o={keys:e,type:t};o[t]=r,o[t+"Args"]=n;for(var a in i)o[a]=i[a];Jt(o)}Be("insertModeEscKeysTimeout",200,"number"),v.keyMap["vim-insert"]={fallthrough:["default"],attach:J,detach:Ee,call:Q},v.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:J,detach:Ee,call:Q};function Qr(e,t,r,n){var i=w.registerController.getRegister(n);if(n==":"){i.keyBuffer[0]&&ae.processCommand(e,i.keyBuffer[0]),r.isPlaying=!1;return}var o=i.keyBuffer,a=0;r.isPlaying=!0,r.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l<o.length;l++)for(var s=o[l],u,f;s;)if(u=/<\w+-.+?>|<\w+>|./.exec(s),f=u[0],s=s.substring(u.index+f.length),$.handleKey(e,f,"macro"),t.insertMode){var c=i.insertModeChanges[a++].changes;w.macroModeState.lastInsertModeChanges.changes=c,qt(e,c,1),_e(e)}r.isPlaying=!1}function Gr(e,t){if(!e.isPlaying){var r=e.latestRegister,n=w.registerController.getRegister(r);n&&n.pushText(t)}}function Xr(e){if(!e.isPlaying){var t=e.latestRegister,r=w.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function Yr(e,t){if(!e.isPlaying){var r=e.latestRegister,n=w.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}function Qt(e,t){var r=w.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,n.ignoreCount>1)n.ignoreCount--;else if(t.origin=="+input"||t.origin=="paste"||t.origin===void 0){var i=e.listSelections().length;i>1&&(n.ignoreCount=i);var o=t.text.join(`
- `);n.maybeReset&&(n.changes=[],n.maybeReset=!1),o&&(e.state.overwrite&&!/\n/.test(o)?n.changes.push([o]):n.changes.push(o))}t=t.next}}function Gt(e){var t=e.state.vim;if(t.insertMode){var r=w.macroModeState;if(r.isPlaying)return;var n=r.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.maybeReset=!0}else e.curOp.isVimOp||Xt(e,t)}function Xt(e,t,r){var n=e.getCursor("anchor"),i=e.getCursor("head");if(t.visualMode&&!e.somethingSelected()?te(e,!1):!t.visualMode&&!t.insertMode&&e.somethingSelected()&&(t.visualMode=!0,t.visualLine=!1,v.signal(e,"vim-mode-change",{mode:"visual"})),t.visualMode){var o=E(i,n)?0:-1,a=E(i,n)?-1:0;i=N(i,0,o),n=N(n,0,a),t.sel={anchor:n,head:i},he(e,t,"<",Y(i,n)),he(e,t,">",Me(i,n))}else!t.insertMode&&!r&&(t.lastHPos=e.getCursor().ch)}function ft(e){this.keyName=e}function Yt(e){var t=w.macroModeState,r=t.lastInsertModeChanges,n=v.keyName(e);if(!n)return;function i(){return r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new ft(n)),!0}(n.indexOf("Delete")!=-1||n.indexOf("Backspace")!=-1)&&v.lookupKey(n,"vim-insert",i)}function Zt(e,t,r,n){var i=w.macroModeState;i.isPlaying=!0;var o=!!t.lastEditActionCommand,a=t.inputState;function l(){o?ve.processAction(e,t,t.lastEditActionCommand):ve.evalInput(e,t)}function s(f){if(i.lastInsertModeChanges.changes.length>0){f=t.lastEditActionCommand?f:1;var c=i.lastInsertModeChanges;qt(e,c.changes,f)}}if(t.inputState=t.lastEditInputState,o&&t.lastEditActionCommand.interlaceInsertRepeat)for(var u=0;u<r;u++)l(),s(1);else n||l(),s(r);t.inputState=a,t.insertMode&&!n&&_e(e),i.isPlaying=!1}function qt(e,t,r){function n(c){return typeof c=="string"?v.commands[c](e):c(e),!0}var i=e.getCursor("head"),o=w.macroModeState.lastInsertModeChanges.visualBlock;o&&(Tt(e,i,o+1),r=e.listSelections().length,e.setCursor(i));for(var a=0;a<r;a++){o&&e.setCursor(N(i,a,0));for(var l=0;l<t.length;l++){var s=t[l];if(s instanceof ft)v.lookupKey(s.keyName,"vim-insert",n);else if(typeof s=="string")e.replaceSelection(s);else{var u=e.getCursor(),f=N(u,0,s[0].length);e.replaceRange(s[0],u,f),e.setCursor(f)}}}o&&e.setCursor(N(i,0,1))}mt(),v.Vim=$;var Zr={return:"CR",backspace:"BS",delete:"Del",esc:"Esc",left:"Left",right:"Right",up:"Up",down:"Down",space:"Space",insert:"Ins",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",enter:"CR"};function qr(e,t,r){t.length>1&&t[0]=="n"&&(t=t.replace("numpad","")),t=Zr[t]||t;var n="";return r.ctrlKey&&(n+="C-"),r.altKey&&(n+="A-"),(n||t.length>1)&&r.shiftKey&&(n+="S-"),n+=t,n.length>1&&(n="<"+n+">"),n}var er=$.handleKey.bind($);$.handleKey=function(e,t,r){return e.operation(function(){return er(e,t,r)},!0)};function ct(e){var t=new e.constructor;return Object.keys(e).forEach(function(r){var n=e[r];Array.isArray(n)?n=n.slice():n&&typeof n=="object"&&n.constructor!=Object&&(n=ct(n)),t[r]=n}),e.sel&&(t.sel={head:e.sel.head&&L(e.sel.head),anchor:e.sel.anchor&&L(e.sel.anchor)}),t}function tr(e,t,r){var n=!1,i=$.maybeInitVimState_(e),o=i.visualBlock||i.wasInVisualBlock,a=e.ace.inMultiSelectMode;if(i.wasInVisualBlock&&!a?i.wasInVisualBlock=!1:a&&i.visualBlock&&(i.wasInVisualBlock=!0),t=="<Esc>"&&!i.insertMode&&!i.visualMode&&a)e.ace.exitMultiSelectMode();else if(o||!a||e.ace.inVirtualSelectionMode)n=$.handleKey(e,t,r);else{var l=ct(i);e.operation(function(){e.ace.forEachSelection(function(){var s=e.ace.selection;e.state.vim.lastHPos=s.$desiredColumn==null?s.lead.column:s.$desiredColumn;var u=e.getCursor("head"),f=e.getCursor("anchor"),c=E(u,f)?0:-1,d=E(u,f)?-1:0;u=N(u,0,c),f=N(f,0,d),e.state.vim.sel.head=u,e.state.vim.sel.anchor=f,n=er(e,t,r),s.$desiredColumn=e.state.vim.lastHPos==-1?null:e.state.vim.lastHPos,e.virtualSelectionMode()&&(e.state.vim=ct(l))}),e.curOp.cursorActivity&&!n&&(e.curOp.cursorActivity=!1)},!0)}return n&&!i.visualMode&&!i.insert&&i.visualMode!=e.somethingSelected()&&Xt(e,i,!0),n}z.CodeMirror=v;var Se=$.maybeInitVimState_;z.handler={$id:"ace/keyboard/vim",drawCursor:function(e,t,r,n,i){var o=this.state.vim||{},a=r.characterWidth,l=r.lineHeight,s=t.top,u=t.left;if(!o.insertMode){var f=n.cursor?B.comparePoints(n.cursor,n.start)<=0:i.selection.isBackwards()||i.selection.isEmpty();!f&&u>a&&(u-=a)}!o.insertMode&&o.status&&(l=l/2,s+=l),Ce.translate(e,u,s),Ce.setStyle(e.style,"width",a+"px"),Ce.setStyle(e.style,"height",l+"px")},$getDirectionForHighlight:function(e){var t=e.state.cm,r=Se(t);if(!r.insertMode)return e.session.selection.isBackwards()||e.session.selection.isEmpty()},handleKeyboard:function(e,t,r,n,i){var o=e.editor,a=o.state.cm,l=Se(a);if(n!=-1){if(l.insertMode||(t==-1?(r.charCodeAt(0)>255&&e.inputKey&&(r=e.inputKey,r&&e.inputHash==4&&(r=r.toUpperCase())),e.inputChar=r):t==4||t==0?e.inputKey==r&&e.inputHash==t&&e.inputChar?(r=e.inputChar,t=-1):(e.inputChar=null,e.inputKey=r,e.inputHash=t):e.inputChar=e.inputKey=null),a.state.overwrite&&l.insertMode&&r=="backspace"&&t==0)return{command:"gotoleft"};if(r=="c"&&t==1&&!Re.isMac&&o.getCopyText())return o.once("copy",function(){l.insertMode?o.selection.clearSelection():a.operation(function(){te(a)})}),{command:"null",passEvent:!0};if(r=="esc"&&!l.insertMode&&!l.visualMode&&!a.ace.inMultiSelectMode){var s=re(a),u=s.getOverlay();u&&a.removeOverlay(u)}if(t==-1||t&1||t===0&&r.length>1){var f=l.insertMode,c=qr(t,r,i||{});l.status==null&&(l.status="");var d=tr(a,c,"user");return l=Se(a),d&&l.status!=null?l.status+=c:l.status==null&&(l.status=""),a._signal("changeStatus"),!d&&(t!=-1||f)?void 0:{command:"null",passEvent:!d}}}},attach:function(e){e.state||(e.state={});var t=new v(e);e.state.cm=t,e.$vimModeHandler=this,v.keyMap.vim.attach(t),Se(t).status=null,t.on("vim-command-done",function(){t.virtualSelectionMode()||(Se(t).status=null,t.ace._signal("changeStatus"),t.ace.session.markUndoGroup())}),t.on("changeStatus",function(){t.ace.renderer.updateCursor(),t.ace._signal("changeStatus")}),t.on("vim-mode-change",function(){t.virtualSelectionMode()||(r(),t._signal("changeStatus"))});function r(){var n=Se(t).insertMode;t.ace.renderer.setStyle("normal-mode",!n),e.textInput.setCommandMode(!n),e.renderer.$keepTextAreaAtCursor=n,e.renderer.$blockCursor=!n}r(),e.renderer.$cursorLayer.drawCursor=this.drawCursor.bind(t)},detach:function(e){var t=e.state.cm;v.keyMap.vim.detach(t),t.destroy(),e.state.cm=null,e.$vimModeHandler=null,e.renderer.$cursorLayer.drawCursor=null,e.renderer.setStyle("normal-mode",!1),e.textInput.setCommandMode(!1),e.renderer.$keepTextAreaAtCursor=!0},getStatusText:function(e){var t=e.state.cm,r=Se(t);if(r.insertMode)return"INSERT";var n="";return r.visualMode&&(n+="VISUAL",r.visualLine&&(n+=" LINE"),r.visualBlock&&(n+=" BLOCK")),r.status&&(n+=(n?" ":"")+r.status),n}},$.defineOption({name:"wrap",set:function(e,t){t&&t.ace.setOption("wrap",e)},type:"boolean"},!1),$.defineEx("write","w",function(){console.log(":write is not implemented")}),O.push({keys:"zc",type:"action",action:"fold",actionArgs:{open:!1}},{keys:"zC",type:"action",action:"fold",actionArgs:{open:!1,all:!0}},{keys:"zo",type:"action",action:"fold",actionArgs:{open:!0}},{keys:"zO",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"za",type:"action",action:"fold",actionArgs:{toggle:!0}},{keys:"zA",type:"action",action:"fold",actionArgs:{toggle:!0,all:!0}},{keys:"zf",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"zd",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"<C-A-k>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAbove"}},{keys:"<C-A-j>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelow"}},{keys:"<C-A-S-k>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAboveSkipCurrent"}},{keys:"<C-A-S-j>",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelowSkipCurrent"}},{keys:"<C-A-h>",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreBefore"}},{keys:"<C-A-l>",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreAfter"}},{keys:"<C-A-S-h>",type:"action",action:"aceCommand",actionArgs:{name:"selectNextBefore"}},{keys:"<C-A-S-l>",type:"action",action:"aceCommand",actionArgs:{name:"selectNextAfter"}}),O.push({keys:"gq",type:"operator",operator:"hardWrap"}),$.defineOperator("hardWrap",function(e,t,r,n,i){var o=r[0].anchor.line,a=r[0].head.line;return t.linewise&&a--,le(e.ace,{startRow:o,endRow:a}),g(a,0)}),Be("textwidth",void 0,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.ace.getOption("printMarginColumn");return r}else{var n=Math.round(e);n>1&&t.ace.setOption("printMarginColumn",n)}}),me.aceCommand=function(e,t,r){e.vimCmd=t,e.ace.inVirtualSelectionMode?e.ace.on("beforeEndOperation",ht):ht(null,e.ace)};function ht(e,t){t.off("beforeEndOperation",ht);var r=t.state.cm.vimCmd;r&&t.execCommand(r.exec?r:r.name,r.args),t.curOp=t.prevOp}me.fold=function(e,t,r){e.ace.execCommand(["toggleFoldWidget","toggleFoldWidget","foldOther","unfoldall"][(t.all?2:0)+(t.open?1:0)])},z.handler.defaultKeymap=O,z.handler.actions=me,z.Vim=$}),function(){ace.require(["ace/keyboard/vim"],function(T){xe&&(xe.exports=T)})}()})(rr);var nr=rr.exports;const nn=tn(nr),an=rn({__proto__:null,default:nn},[nr]);export{an as k};
|