import{g as tn}from"./index-b2e76ed2.js";function rn(xe,Ge){for(var T=0;Tz[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.lengthFe)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;o0){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.post},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:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",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:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",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:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",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",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",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:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",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:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",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:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",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",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",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:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',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",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:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",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"):!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"]),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;rr?t=r:t0?1:-1,d,p=s.getCursor();do if(t+=c,f=i[(e+t)%e],f&&(d=f.find())&&!X(p,d))break;while(tn)}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=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==""){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;C0||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)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"){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;ou&&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]/.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;ne.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;o1&&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;su.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=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;s1)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;Ce.lastLine()&&e.replaceRange(` `,new g(S,0));var F=H(e,S);Fs.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.chs&&(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"){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"":r=` `;break;case"":r=" ";break;default:r="";break}return r}function bt(e,t,r){return function(){for(var n=0;n2&&(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;is&&(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;f0&&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=0;)f--;if(f++,t){for(var c=u;/\s/.test(a.charAt(u))&&u0;)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;h0?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;u0?1:-1;var m=e.ace.session.getFoldLine(k);m&&k+n>m.start.row&&k+n0?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;y0;)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-1&&!l;u--)a[u]==r&&(l=u+1);if(l&&!s)for(u=l,f=a.length;u=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@~])/);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;e1)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=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=c1&&(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|<\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;u1&&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==""&&!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:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAbove"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelow"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAboveSkipCurrent"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelowSkipCurrent"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreBefore"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreAfter"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectNextBefore"}},{keys:"",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};