@krainovsd/markdown-editor 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index-Byjf17iv.js +501 -0
- package/lib/cjs/index-Byjf17iv.js.map +1 -0
- package/lib/cjs/index-lPo-3QDL.js +1374 -0
- package/lib/cjs/index-lPo-3QDL.js.map +1 -0
- package/lib/cjs/index.js +14 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/extensions/compartments/index.js +8 -0
- package/lib/esm/extensions/compartments/index.js.map +1 -0
- package/lib/esm/extensions/init-extensions.js +45 -0
- package/lib/esm/extensions/init-extensions.js.map +1 -0
- package/lib/esm/extensions/keymaps/init-key-map.js +91 -0
- package/lib/esm/extensions/keymaps/init-key-map.js.map +1 -0
- package/lib/esm/extensions/listeners/get-change-event.js +14 -0
- package/lib/esm/extensions/listeners/get-change-event.js.map +1 -0
- package/lib/esm/extensions/listeners/get-focus-event.js +16 -0
- package/lib/esm/extensions/listeners/get-focus-event.js.map +1 -0
- package/lib/esm/extensions/listeners/init-listeners.js +9 -0
- package/lib/esm/extensions/listeners/init-listeners.js.map +1 -0
- package/lib/esm/extensions/markdown/blockquote/blockquote-constants.js +6 -0
- package/lib/esm/extensions/markdown/blockquote/blockquote-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/blockquote/blockquote-decoration.js +99 -0
- package/lib/esm/extensions/markdown/blockquote/blockquote-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/blockquote/blockquote-widget.js +25 -0
- package/lib/esm/extensions/markdown/blockquote/blockquote-widget.js.map +1 -0
- package/lib/esm/extensions/markdown/bold/bold-constants.js +5 -0
- package/lib/esm/extensions/markdown/bold/bold-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/bold/bold-decoration.js +41 -0
- package/lib/esm/extensions/markdown/bold/bold-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/code/code-constants.js +6 -0
- package/lib/esm/extensions/markdown/code/code-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/code/code-decoration.js +109 -0
- package/lib/esm/extensions/markdown/code/code-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/code/code-widget.js +83 -0
- package/lib/esm/extensions/markdown/code/code-widget.js.map +1 -0
- package/lib/esm/extensions/markdown/header/header-constants.js +6 -0
- package/lib/esm/extensions/markdown/header/header-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/header/header-decoration.js +64 -0
- package/lib/esm/extensions/markdown/header/header-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/horizontal/horizontal-constants.js +4 -0
- package/lib/esm/extensions/markdown/horizontal/horizontal-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/horizontal/horizontal-decoration.js +31 -0
- package/lib/esm/extensions/markdown/horizontal/horizontal-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/image/image-constants.js +8 -0
- package/lib/esm/extensions/markdown/image/image-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/image/image-decoration.js +75 -0
- package/lib/esm/extensions/markdown/image/image-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/image/image-widget.js +184 -0
- package/lib/esm/extensions/markdown/image/image-widget.js.map +1 -0
- package/lib/esm/extensions/markdown/index.js +2 -0
- package/lib/esm/extensions/markdown/index.js.map +1 -0
- package/lib/esm/extensions/markdown/init-markdown.js +18 -0
- package/lib/esm/extensions/markdown/init-markdown.js.map +1 -0
- package/lib/esm/extensions/markdown/italic/italic-constants.js +5 -0
- package/lib/esm/extensions/markdown/italic/italic-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/italic/italic-decoration.js +77 -0
- package/lib/esm/extensions/markdown/italic/italic-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/link/auto-link-decoration.js +24 -0
- package/lib/esm/extensions/markdown/link/auto-link-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/link/link-constants.js +10 -0
- package/lib/esm/extensions/markdown/link/link-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/link/link-decoration.js +51 -0
- package/lib/esm/extensions/markdown/link/link-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/link/link-label-decoration.js +22 -0
- package/lib/esm/extensions/markdown/link/link-label-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/link/link-widget.js +144 -0
- package/lib/esm/extensions/markdown/link/link-widget.js.map +1 -0
- package/lib/esm/extensions/markdown/list/list-constants.js +7 -0
- package/lib/esm/extensions/markdown/list/list-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/list/list-decoration.js +38 -0
- package/lib/esm/extensions/markdown/list/list-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/list/list-widget.js +33 -0
- package/lib/esm/extensions/markdown/list/list-widget.js.map +1 -0
- package/lib/esm/extensions/markdown/markdown-decoration.js +105 -0
- package/lib/esm/extensions/markdown/markdown-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/markdown-parser.js +6 -0
- package/lib/esm/extensions/markdown/markdown-parser.js.map +1 -0
- package/lib/esm/extensions/markdown/mention/mention-constants.js +6 -0
- package/lib/esm/extensions/markdown/mention/mention-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/mention/mention-decoration.js +37 -0
- package/lib/esm/extensions/markdown/mention/mention-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/mention/mention-parser.js +25 -0
- package/lib/esm/extensions/markdown/mention/mention-parser.js.map +1 -0
- package/lib/esm/extensions/markdown/strike-through/strike-through-constants.js +4 -0
- package/lib/esm/extensions/markdown/strike-through/strike-through-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/strike-through/strike-through-decoration.js +32 -0
- package/lib/esm/extensions/markdown/strike-through/strike-through-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/styles.module.scss.js +8 -0
- package/lib/esm/extensions/markdown/styles.module.scss.js.map +1 -0
- package/lib/esm/extensions/markdown/todo/todo-constants.js +6 -0
- package/lib/esm/extensions/markdown/todo/todo-constants.js.map +1 -0
- package/lib/esm/extensions/markdown/todo/todo-decoration.js +35 -0
- package/lib/esm/extensions/markdown/todo/todo-decoration.js.map +1 -0
- package/lib/esm/extensions/markdown/todo/todo-widget.js +51 -0
- package/lib/esm/extensions/markdown/todo/todo-widget.js.map +1 -0
- package/lib/esm/extensions/settings/init-settings.js +19 -0
- package/lib/esm/extensions/settings/init-settings.js.map +1 -0
- package/lib/esm/extensions/theme/init-theme.js +15 -0
- package/lib/esm/extensions/theme/init-theme.js.map +1 -0
- package/lib/esm/extensions/theme/theme-constants.js +17 -0
- package/lib/esm/extensions/theme/theme-constants.js.map +1 -0
- package/lib/esm/extensions/theme/themes/get-dark-theme.js +40 -0
- package/lib/esm/extensions/theme/themes/get-dark-theme.js.map +1 -0
- package/lib/esm/extensions/theme/themes/get-highlight-template.js +35 -0
- package/lib/esm/extensions/theme/themes/get-highlight-template.js.map +1 -0
- package/lib/esm/extensions/theme/themes/get-light-theme.js +40 -0
- package/lib/esm/extensions/theme/themes/get-light-theme.js.map +1 -0
- package/lib/esm/extensions/theme/themes/get-theme-template.js +69 -0
- package/lib/esm/extensions/theme/themes/get-theme-template.js.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/lib/utils/copy-to-clipboard.js +35 -0
- package/lib/esm/lib/utils/copy-to-clipboard.js.map +1 -0
- package/lib/esm/lib/utils/get-decoration.js +24 -0
- package/lib/esm/lib/utils/get-decoration.js.map +1 -0
- package/lib/esm/lib/utils/is-in-range.js +8 -0
- package/lib/esm/lib/utils/is-in-range.js.map +1 -0
- package/lib/esm/lib/utils/is-range-overlap.js +6 -0
- package/lib/esm/lib/utils/is-range-overlap.js.map +1 -0
- package/lib/esm/lib/utils/tick.js +22 -0
- package/lib/esm/lib/utils/tick.js.map +1 -0
- package/lib/esm/module/Editor/Editor.js +91 -0
- package/lib/esm/module/Editor/Editor.js.map +1 -0
- package/lib/esm/module/Editor/lib/init-editor-provider.js +32 -0
- package/lib/esm/module/Editor/lib/init-editor-provider.js.map +1 -0
- package/lib/esm/module/Editor/lib/init-editor-state.js +18 -0
- package/lib/esm/module/Editor/lib/init-editor-state.js.map +1 -0
- package/lib/esm/module/Editor/lib/init-editor.js +27 -0
- package/lib/esm/module/Editor/lib/init-editor.js.map +1 -0
- package/lib/esm/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +29 -0
- package/lib/esm/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js.map +1 -0
- package/lib/index.d.ts +137 -0
- package/package.json +30 -23
- package/lib/cjs/editor-qKPDa91b.js +0 -2
- package/lib/cjs/editor-qKPDa91b.js.map +0 -1
- package/lib/cjs/markdown_plugin-IXFRDWyN.js +0 -2
- package/lib/cjs/markdown_plugin-IXFRDWyN.js.map +0 -1
- package/lib/cjs/vendor_vim-BHa51_r7.js +0 -2
- package/lib/cjs/vendor_vim-BHa51_r7.js.map +0 -1
- package/lib/cjs/vendor_y.next-CVyX1ZQB.js +0 -2
- package/lib/cjs/vendor_y.next-CVyX1ZQB.js.map +0 -1
- package/lib/cjs/vendor_y.websocket-Dr9ojjFR.js +0 -2
- package/lib/cjs/vendor_y.websocket-Dr9ojjFR.js.map +0 -1
- package/lib/cjs/vendor_yjs-DXWp84x5.js +0 -2
- package/lib/cjs/vendor_yjs-DXWp84x5.js.map +0 -1
- package/lib/esm/editor-CLyV23xt.js +0 -2
- package/lib/esm/editor-CLyV23xt.js.map +0 -1
- package/lib/esm/markdown_plugin-DdBeaig8.js +0 -2
- package/lib/esm/markdown_plugin-DdBeaig8.js.map +0 -1
- package/lib/esm/vendor_vim-PF2jWG0J.js +0 -2
- package/lib/esm/vendor_vim-PF2jWG0J.js.map +0 -1
- package/lib/esm/vendor_y.next-B9hhKe5T.js +0 -2
- package/lib/esm/vendor_y.next-B9hhKe5T.js.map +0 -1
- package/lib/esm/vendor_y.websocket-gIpX3Cmo.js +0 -2
- package/lib/esm/vendor_y.websocket-gIpX3Cmo.js.map +0 -1
- package/lib/esm/vendor_yjs-otxZW90b.js +0 -2
- package/lib/esm/vendor_yjs-otxZW90b.js.map +0 -1
- package/tmp/app/helpers/common-test.d.ts +0 -1
- package/tmp/app/helpers/full-example.d.ts +0 -1
- package/tmp/app/helpers/index.d.ts +0 -5
- package/tmp/app/helpers/random-color.d.ts +0 -1
- package/tmp/app/helpers/random-string.d.ts +0 -1
- package/tmp/app/helpers/stress-test.d.ts +0 -1
- package/tmp/app/index.d.ts +0 -1
- package/tmp/extensions/compartments/index.d.ts +0 -4
- package/tmp/extensions/index.d.ts +0 -8
- package/tmp/extensions/init-extensions.d.ts +0 -14
- package/tmp/extensions/keymaps/bold-keymap.d.ts +0 -2
- package/tmp/extensions/keymaps/index.d.ts +0 -1
- package/tmp/extensions/keymaps/init-key-map.d.ts +0 -23
- package/tmp/extensions/keymaps/italic-key-map.d.ts +0 -2
- package/tmp/extensions/keymaps/line-through-key-map.d.ts +0 -2
- package/tmp/extensions/keymaps/underline-key-map.d.ts +0 -2
- package/tmp/extensions/listeners/get-change-event.d.ts +0 -6
- package/tmp/extensions/listeners/get-focus-event.d.ts +0 -8
- package/tmp/extensions/listeners/index.d.ts +0 -3
- package/tmp/extensions/listeners/init-listeners.d.ts +0 -4
- package/tmp/extensions/markdown/blockquote/blockquote-constants.d.ts +0 -3
- package/tmp/extensions/markdown/blockquote/blockquote-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/blockquote/blockquote-widget.d.ts +0 -6
- package/tmp/extensions/markdown/blockquote/index.d.ts +0 -1
- package/tmp/extensions/markdown/bold/bold-constants.d.ts +0 -2
- package/tmp/extensions/markdown/bold/bold-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/bold/index.d.ts +0 -1
- package/tmp/extensions/markdown/code/code-constants.d.ts +0 -3
- package/tmp/extensions/markdown/code/code-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/code/code-widget.d.ts +0 -13
- package/tmp/extensions/markdown/code/index.d.ts +0 -1
- package/tmp/extensions/markdown/header/header-constants.d.ts +0 -3
- package/tmp/extensions/markdown/header/header-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/header/index.d.ts +0 -1
- package/tmp/extensions/markdown/horizontal/horizontal-constants.d.ts +0 -1
- package/tmp/extensions/markdown/horizontal/horizontal-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/horizontal/index.d.ts +0 -1
- package/tmp/extensions/markdown/image/image-constants.d.ts +0 -5
- package/tmp/extensions/markdown/image/image-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/image/image-widget.d.ts +0 -14
- package/tmp/extensions/markdown/image/index.d.ts +0 -1
- package/tmp/extensions/markdown/index.d.ts +0 -2
- package/tmp/extensions/markdown/init-markdown.d.ts +0 -3
- package/tmp/extensions/markdown/italic/index.d.ts +0 -1
- package/tmp/extensions/markdown/italic/italic-constants.d.ts +0 -2
- package/tmp/extensions/markdown/italic/italic-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/link/auto-link-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/link/index.d.ts +0 -2
- package/tmp/extensions/markdown/link/link-constants.d.ts +0 -7
- package/tmp/extensions/markdown/link/link-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/link/link-label-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/link/link-widget.d.ts +0 -17
- package/tmp/extensions/markdown/list/index.d.ts +0 -1
- package/tmp/extensions/markdown/list/list-constants.d.ts +0 -4
- package/tmp/extensions/markdown/list/list-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/list/list-widget.d.ts +0 -7
- package/tmp/extensions/markdown/markdown-decoration.d.ts +0 -5
- package/tmp/extensions/markdown/markdown-parser.d.ts +0 -2
- package/tmp/extensions/markdown/markdown-types.d.ts +0 -24
- package/tmp/extensions/markdown/mention/index.d.ts +0 -1
- package/tmp/extensions/markdown/mention/mention-constants.d.ts +0 -3
- package/tmp/extensions/markdown/mention/mention-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/mention/mention-parser.d.ts +0 -2
- package/tmp/extensions/markdown/strike-through/index.d.ts +0 -1
- package/tmp/extensions/markdown/strike-through/strike-through-constants.d.ts +0 -1
- package/tmp/extensions/markdown/strike-through/strike-through-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/todo/index.d.ts +0 -1
- package/tmp/extensions/markdown/todo/todo-constants.d.ts +0 -3
- package/tmp/extensions/markdown/todo/todo-decoration.d.ts +0 -2
- package/tmp/extensions/markdown/todo/todo-widget.d.ts +0 -11
- package/tmp/extensions/settings/index.d.ts +0 -1
- package/tmp/extensions/settings/init-settings.d.ts +0 -6
- package/tmp/extensions/theme/index.d.ts +0 -4
- package/tmp/extensions/theme/init-theme.d.ts +0 -3
- package/tmp/extensions/theme/theme-constants.d.ts +0 -14
- package/tmp/extensions/theme/theme-types.d.ts +0 -39
- package/tmp/extensions/theme/themes/get-dark-theme.d.ts +0 -2
- package/tmp/extensions/theme/themes/get-highlight-template.d.ts +0 -6
- package/tmp/extensions/theme/themes/get-light-theme.d.ts +0 -2
- package/tmp/extensions/theme/themes/get-theme-template.d.ts +0 -2
- package/tmp/extensions/theme/themes/index.d.ts +0 -2
- package/tmp/index.d.ts +0 -3
- package/tmp/lib/index.d.ts +0 -1
- package/tmp/lib/utils/copy-to-clipboard.d.ts +0 -1
- package/tmp/lib/utils/get-decoration.d.ts +0 -26
- package/tmp/lib/utils/index.d.ts +0 -6
- package/tmp/lib/utils/is-in-range.d.ts +0 -2
- package/tmp/lib/utils/is-range-overlap.d.ts +0 -1
- package/tmp/lib/utils/random-string.d.ts +0 -1
- package/tmp/lib/utils/tick.d.ts +0 -10
- package/tmp/module/Editor/Editor.d.ts +0 -18
- package/tmp/module/Editor/Editor.types.d.ts +0 -13
- package/tmp/module/Editor/index.d.ts +0 -3
- package/tmp/module/Editor/lib/index.d.ts +0 -1
- package/tmp/module/Editor/lib/init-editor-provider.d.ts +0 -9
- package/tmp/module/Editor/lib/init-editor-state.d.ts +0 -7
- package/tmp/module/Editor/lib/init-editor.d.ts +0 -7
- package/tmp/module/index.d.ts +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./editor-qKPDa91b.js");const t="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class n{constructor(e,n,r=0,i=e.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=o?e=>o(t(e)):t,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return e.codePointAt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=e.fromCodePoint(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=e.codePointSize(t);let i=this.normalize(n);if(i.length)for(let e=0,t=r;;e++){let o=i.charCodeAt(e),s=this.match(o,t,this.bufferPos+this.bufferStart);if(e==i.length-1){if(s)return this.value=s,this;break}t==r&&e<n.length&&n.charCodeAt(e)==o&&t++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,o=!0)),o||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(n.prototype[Symbol.iterator]=function(){return this});const r={from:-1,to:-1,match:/.*/.exec("")},i="gm"+(null==/x/.unicode?"":"u");class o{constructor(e,t,n,o=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=r,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new l(e,t,n,o,s);this.re=new RegExp(t,i+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let a=e.lineAt(o);this.curLineStart=a.from,this.matchPos=c(e,o),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=c(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const s=new WeakMap;class a{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=s.get(e);if(!r||r.from>=n||r.to<=t){let r=new a(t,e.sliceString(t,n));return s.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),s.set(e,new a(o,i)),new a(t,i.slice(t-o,n-o))}}class l{constructor(e,t,n,o,s){this.text=e,this.to=s,this.done=!1,this.value=r,this.matchPos=c(e,o),this.re=new RegExp(t,i+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=a.get(e,o,this.chunkEnd(o+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=c(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=a.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function c(e,t){if(t>=e.length)return t;let n,r=e.lineAt(t);for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(o.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this});class h{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,i),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new v(this):new f(this)}getCursor(t,n=0,r){let i=t.doc?t:e.EditorState.create({doc:t});return null==r&&(r=i.doc.length),this.regexp?m(this,i,n,r):d(this,i,n,r)}}class u{constructor(e){this.spec=e}}function d(t,r,i,o){return new n(r.doc,t.unquoted,i,o,t.caseSensitive?void 0:e=>e.toLowerCase(),t.wholeWord?(s=r.doc,a=r.charCategorizer(r.selection.main.head),(t,n,r,i)=>((i>t||i+r.length<n)&&(i=Math.max(0,t-2),r=s.sliceString(i,Math.min(s.length,n+2))),!(a(p(r,t-i))==e.CharCategory.Word&&a(g(r,t-i))==e.CharCategory.Word||a(g(r,n-i))==e.CharCategory.Word&&a(p(r,n-i))==e.CharCategory.Word))):void 0);var s,a}class f extends u{constructor(e){super(e)}nextMatch(e,t,n){let r=d(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=d(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=d(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!r||r.from==t&&r.to==n?null:r}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=d(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=d(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function m(t,n,r,i){return new o(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=n.charCategorizer(n.selection.main.head),(t,n,r)=>!r[0].length||(s(p(r.input,r.index))!=e.CharCategory.Word||s(g(r.input,r.index))!=e.CharCategory.Word)&&(s(g(r.input,r.index+r[0].length))!=e.CharCategory.Word||s(p(r.input,r.index+r[0].length))!=e.CharCategory.Word)):void 0},r,i);var s}function p(t,n){return t.slice(e.findClusterBreak(t,n,!1),n)}function g(t,n){return t.slice(n,e.findClusterBreak(t,n))}class v extends u{nextMatch(e,t,n){let r=m(this.spec,e,n,e.doc.length).next();return r.done&&(r=m(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=m(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,((t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n<e.match.length?e.match[n]:t))}matchAll(e,t){let n=m(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=m(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const y=e.StateEffect.define();function C(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{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"},{keys:"<Del>",type:"keyToKey",toKeys:"x"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b"},{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:"'<register>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",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:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{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:"@<register>",type:"action",action:"replayMacro"},{keys:"q<register>",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<register>",type:"action",action:"setMark"},{keys:'"<register>',type:"action",action:"setRegister"},{keys:"<C-r><register>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{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<register>",type:"motion",motion:"textObjectManipulation"},{keys:"i<register>",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"}],i=r.length,o=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{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:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],s=_("");function a(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(re(e.getCursor(),0,1)),ee.enterInsertMode(e,{},t))}),t.onPasteFn}var l,c=/[\d]/,h=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],u=[function(e){return/\S/.test(e)}],d=["<",">"],f=["-",'"',".",":","_","/","+"],m=/^\w$/;try{l=new RegExp("^[\\p{Lu}]$","u")}catch(e){l=/^[A-Z]$/}function p(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function g(e){return/^[a-z]$/.test(e)}function v(e){return l.test(e)}function y(e){return/^\s*$/.test(e)}function C(e){return-1!=".?!".indexOf(e)}function w(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var k={};function x(e,t,n,r,i){if(void 0===t&&!i)throw Error("defaultValue is required unless callback is provided");if(n||(n="string"),k[e]={type:n,defaultValue:t,callback:i},r)for(var o=0;o<r.length;o++)k[r[o]]=k[e];t&&S(e,t)}function S(e,t,n,r){var i=k[e],o=(r=r||{}).scope;if(!i)return new Error("Unknown option: "+e);if("boolean"==i.type){if(t&&!0!==t)return new Error("Invalid argument: "+e+"="+t);!1!==t&&(t=!0)}i.callback?("local"!==o&&i.callback(t,void 0),"global"!==o&&n&&i.callback(t,n)):("local"!==o&&(i.value="boolean"==i.type?!!t:t),"global"!==o&&n&&(n.state.vim.options[e]={value:t}))}function M(e,t,n){var r=k[e],i=(n=n||{}).scope;if(!r)return new Error("Unknown option: "+e);if(r.callback){let e=t&&r.callback(void 0,t);return"global"!==i&&void 0!==e?e:"local"!==i?r.callback():void 0}return("global"!==i&&t&&t.state.vim.options[e]||"local"!==i&&r||{}).value}x("filetype",void 0,"string",["ft"],(function(e,t){if(void 0!==t){if(void 0===e){let e=t.getOption("mode");return"null"==e?"":e}{let n=""==e?"null":e;t.setOption("mode",n)}}})),x("textwidth",80,"number",["tw"],(function(e,t){if(void 0!==t){if(void 0===e)return t.getOption("textwidth");var n=Math.round(e);n>1&&t.setOption("textwidth",n)}}));var L,b,A=function(){var e=100,t=-1,n=0,r=0,i=new Array(e);function o(o,s){(t+=s)>n?t=n:t<r&&(t=r);var a=i[(e+t)%e];if(a&&!a.find()){var l,c=s>0?1:-1,h=o.getCursor();do{if((a=i[(e+(t+=c))%e])&&(l=a.find())&&!ae(h,l))break}while(t<n&&t>r)}return a}return{cachedCursor:void 0,add:function(o,s,a){var l=i[t%e];function c(n){var r=++t%e,s=i[r];s&&s.clear(),i[r]=o.setBookmark(n)}if(l){var h=l.find();h&&!ae(h,s)&&c(s)}else c(s);c(a),n=t,(r=t-e+1)<0&&(r=0)},find:function(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()},move:o}},E=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class O{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=E()}exitMacroRecordMode(){var e=L.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=L.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=je("span",{class:"cm-vim-message"},"recording @"+t);this.onRecordingDone=e.openDialog(r,null,{bottom:!0})}this.isRecording=!0}}}function T(e){return e.state.vim||(e.state.vim={inputState:new $,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{},expectLiteralNext:!1}),e.state.vim}function R(){for(var e in L={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:A(),macroModeState:new O,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new z({}),searchHistoryController:new J,exCommandHistoryController:new J},k){var t=k[e];t.value=t.defaultValue}}var B,I={enterVimMode:function(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",st),T(t),e.on(t.getInputField(),"paste",a(t))},leaveVimMode:function(t){t.setOption("disableInput",!1),t.off("cursorActivity",st),e.off(t.getInputField(),"paste",a(t)),t.state.vim=null,Ue&&clearTimeout(Ue)},buildKeyMap:function(){},getRegisterController:function(){return L.registerController},resetVimGlobalState_:R,getVimGlobalState_:function(){return L},maybeInitVimState_:T,suppressErrorLogging:!1,InsertModeKey:lt,map:function(e,t,n){tt.map(e,t,n)},unmap:function(e,t){return tt.unmap(e,t)},noremap:function(e,t,n){tt.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=i,o=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var s=o.length-1;s>=0;s--){var a=o[s];if(e!==a.context)if(a.context)this._mapCommand(a);else{var l=["normal","insert","visual"];for(var c in l)if(l[c]!==e){var h=Object.assign({},a);h.context=l[c],this._mapCommand(h)}}}},langmap:j,vimKeyFromEvent:V,setOption:S,getOption:M,defineOption:x,defineEx:function(e,t,n){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;et[e]=n,tt.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if("function"==typeof r)return r()},multiSelectHandleKey:function(e,t,n){var r=T(e),i=e,o=!1,s=(r=I.maybeInitVimState_(i),r.visualBlock||r.wasInVisualBlock),a=i.isInMultiSelectMode();r.wasInVisualBlock&&!a?r.wasInVisualBlock=!1:a&&r.visualBlock&&(r.wasInVisualBlock=!0);if("<Esc>"!=t||r.insertMode||r.visualMode||!a||"<Esc>"!=r.status)if(s||!a||i.inVirtualSelectionMode)o=I.handleKey(i,t,n);else{var l=ft(r),c=r.inputState.changeQueueList||[];i.operation((function(){i.curOp&&(i.curOp.isVimOp=!0);var e=0;i.forEachSelection((function(){i.state.vim.inputState.changeQueue=c[e];var r=i.getCursor("head"),s=i.getCursor("anchor"),a=le(r,s)?0:-1,h=le(r,s)?-1:0;r=re(r,0,a),s=re(s,0,h),i.state.vim.sel.head=r,i.state.vim.sel.anchor=s,o=I.handleKey(i,t,n),i.virtualSelection&&(c[e]=i.state.vim.inputState.changeQueue,i.state.vim=ft(l)),e++})),i.curOp?.cursorActivity&&!o&&(i.curOp.cursorActivity=!1),i.state.vim=r,r.inputState.changeQueueList=c,r.inputState.changeQueue=null}),!0)}else q(i);!o||r.visualMode||r.insert||r.visualMode==i.somethingSelected()||at(i,r);return o},findKey:function(e,t,n){var i,o=T(e),s=e;function a(){var e=L.macroModeState;if(e.isRecording){if("q"==t)return e.exitMacroRecordMode(),q(s),!0;"mapping"!=n&&function(e,t){if(e.isPlaying)return;var n=e.latestRegister,r=L.registerController.getRegister(n);r&&r.pushText(t)}(e,t)}}function l(){if("<Esc>"==t){if(o.visualMode)we(s);else{if(!o.insertMode)return;nt(s)}return q(s),!0}}return i=o.insertMode?function(){if(l())return!0;o.inputState.keyBuffer.push(t);var e=o.inputState.keyBuffer.join(""),n=1==t.length,i=X.matchCommand(e,r,o.inputState,"insert"),a=o.inputState.changeQueue;if("none"==i.type)return q(s),!1;if("partial"==i.type){if(i.expectLiteralNext&&(o.expectLiteralNext=!0),b&&window.clearTimeout(b),b=n&&window.setTimeout((function(){o.insertMode&&o.inputState.keyBuffer.length&&q(s)}),M("insertModeEscKeysTimeout")),n){var c=s.listSelections();a&&a.removed.length==c.length||(a=o.inputState.changeQueue=new U),a.inserted+=t;for(var h=0;h<c.length;h++){var u=ce(c[h].anchor,c[h].head),d=he(c[h].anchor,c[h].head),f=s.getRange(u,s.state.overwrite?re(d,0,1):d);a.removed[h]=(a.removed[h]||"")+f}}return!n}if(o.expectLiteralNext=!1,b&&window.clearTimeout(b),i.command&&a){for(c=s.listSelections(),h=0;h<c.length;h++){var m=c[h].head;s.replaceRange(a.removed[h]||"",re(m,0,-a.inserted.length),m,"+input")}L.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||q(s),i.command}():function(){if(a()||l())return!0;o.inputState.keyBuffer.push(t);var e=o.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(e))return!0;var n=/^(\d*)(.*)$/.exec(e);if(!n)return q(s),!1;var i=o.visualMode?"visual":"normal",c=n[2]||n[1];o.inputState.operatorShortcut&&o.inputState.operatorShortcut.slice(-1)==c&&(c=o.inputState.operatorShortcut);var h=X.matchCommand(c,r,o.inputState,i);return"none"==h.type?(q(s),!1):"partial"==h.type?(h.expectLiteralNext&&(o.expectLiteralNext=!0),!0):"clear"==h.type?(q(s),!0):(o.expectLiteralNext=!1,o.inputState.keyBuffer.length=0,(n=/^(\d*)(.*)$/.exec(e))&&n[1]&&"0"!=n[1]&&o.inputState.pushRepeatDigit(n[1]),h.command)}(),!1===i?o.insertMode||1!==t.length?void 0:function(){return!0}:!0===i?function(){return!0}:function(){return s.operation((function(){s.curOp.isVimOp=!0;try{"keyToKey"==i.type?D(s,i.toKeys,i):X.processCommand(s,o,i)}catch(e){throw s.state.vim=void 0,T(s),I.suppressErrorLogging||console.log(e),e}return!0}))}},handleEx:function(e,t){tt.processCommand(e,t)},defineMotion:function(e,t){G[e]=t},defineAction:function(e,t){ee[e]=t},defineOperator:function(e,t){Y[e]=t},mapCommand:function(e,t,n,r,i){var o={keys:e,type:t};for(var s in o[t]=n,o[t+"Args"]=r,i)o[s]=i[s];rt(o)},_mapCommand:rt,defineRegister:function(e,t){var n=L.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(n[e])throw Error("Register already defined "+e);n[e]=t,f.push(e)},exitVisualMode:we,exitInsertMode:nt},N=[],K=!1;function P(e){if("<"==e[0]){var t=e.toLowerCase().slice(1,-1),n=t.split("-");if("lt"==(t=n.pop()||""))e="<";else if("space"==t)e=" ";else if("cr"==t)e="\n";else if(H[t]){var r=B.value,i={key:H[t],target:{value:r,selectionEnd:r.length,selectionStart:r.length}};return B.onKeyDown&&B.onKeyDown(i,B.value,s),void(B&&B.onKeyUp&&B.onKeyUp(i,B.value,s))}}if("\n"==e){var o=B;B=null,o.onClose&&o.onClose(o.value)}else B.value=(B.value||"")+e;function s(e){"string"==typeof e?B.value=e:B=null}}function D(e,t,n){var r=K;if(n){if(-1!=N.indexOf(n))return;N.push(n),K=0!=n.noremap}try{for(var i,o=T(e),s=/<(?:[CSMA]-)*\w+>|./gi;i=s.exec(t);){var a=i[0],l=o.insertMode;if(B)P(a);else if(!I.handleKey(e,a,"mapping")&&l&&o.insertMode){if("<"==a[0]){var c=a.toLowerCase().slice(1,-1),h=c.split("-");if("lt"==(c=h.pop()||""))a="<";else if("space"==c)a=" ";else if("cr"==c)a="\n";else{if(H.hasOwnProperty(c)){ut(e,a=H[c]);continue}a=a[0],s.lastIndex=i.index+1}}e.replaceSelection(a)}}}finally{if(N.pop(),K=!!N.length&&r,!N.length&&B){var u=B;B=null,$e(e,u)}}}var F={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},W={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},H={};function V(t,n){var r=t.key;if(!W[r]){r.length>1&&"n"==r[0]&&(r=r.replace("Numpad","")),r=F[r]||r;var i="";if(t.ctrlKey&&(i+="C-"),t.altKey&&(i+="A-"),t.metaKey&&(i+="M-"),e.isMac&&t.altKey&&!t.metaKey&&!t.ctrlKey&&(i=i.slice(2)),(i||r.length>1)&&t.shiftKey&&(i+="S-"),n&&!n.expectLiteralNext&&1==r.length)if(s.keymap&&r in s.keymap)0==s.remapCtrl&&i||(r=s.keymap[r]);else if(r.charCodeAt(0)>255){var o=t.code?.slice(-1)||"";t.shiftKey||(o=o.toLowerCase()),o&&(r=o)}return(i+=r).length>1&&(i="<"+i+">"),i}}function j(e,t){s.string!==e&&(s=_(e)),s.remapCtrl=t}function _(e){let t={};if(!e)return{keymap:t,string:""};function n(e){return e.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map((e=>{if(!e)return;const r=e.split(/((?:[^\\;]|\\.)+);/);if(3==r.length){const e=n(r[1]),i=n(r[2]);if(e.length!==i.length)return;for(let n=0;n<e.length;++n)t[e[n]]=i[n]}else if(1==r.length){const r=n(e);if(r.length%2!=0)return;for(let e=0;e<r.length;e+=2)t[r[e]]=r[e+1]}})),{keymap:t,string:e}}"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(F)).forEach((function(e){H[(F[e]||"").toLowerCase()]=H[e.toLowerCase()]=e})),x("langmap",void 0,"string",["lmap"],(function(e,t){if(void 0===e)return s.string;j(e)}));class ${constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null,this.changeQueue=null}pushRepeatDigit(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)}getRepeat(){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 q(t,n){t.state.vim.inputState=new $,t.state.vim.expectLiteralNext=!1,e.signal(t,"vim-command-done",n)}function U(){this.removed=[],this.inserted=""}class Q{constructor(e,t,n){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}setText(e,t,n){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!n}pushText(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)}pushInsertModeChanges(e){this.insertModeChanges.push(E(e))}pushSearchQuery(e){this.searchQueries.push(e)}clear(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1}toString(){return this.keyBuffer.join("")}}class z{constructor(e){this.registers=e,this.unnamedRegister=e['"']=new Q,e["."]=new Q,e[":"]=new Q,e["/"]=new Q,e["+"]=new Q}pushText(e,t,n,r,i){if("_"!==e){r&&"\n"!==n.charAt(n.length-1)&&(n+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(o){v(e)?o.pushText(n,r):o.setText(n,r,i),"+"===e&&navigator.clipboard.writeText(n),this.unnamedRegister.setText(o.toString(),r)}else{switch(t){case"yank":this.registers[0]=new Q(n,r,i);break;case"delete":case"change":-1==n.indexOf("\n")?this.registers["-"]=new Q(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new Q(n,r))}this.unnamedRegister.setText(n,r,i)}}}getRegister(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new Q),this.registers[e]):this.unnamedRegister}isValidRegister(e){return e&&(w(e,f)||m.test(e))}shiftNumericRegisters_(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}}class J{constructor(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}nextMatch(e,t){var n=this.historyBuffer,r=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var i=this.iterator+r;t?i>=0:i<n.length;i+=r)for(var o=n[i],s=0;s<=o.length;s++)if(this.initialPrefix==o.substring(0,s))return this.iterator=i,o;return i>=n.length?(this.iterator=n.length,this.initialPrefix):i<0?e:void 0}pushInput(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)}reset(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}}var X={matchCommand:function(e,t,n,r){var o,s=function(e,t,n,r){r.operator&&(n="operatorPending");for(var o,s=[],a=[],l=K?t.length-i:0;l<t.length;l++){var c=t[l];"insert"==n&&"insert"!=c.context||c.context&&c.context!=n||r.operator&&"action"==c.type||!(o=ie(e,c.keys))||("partial"==o&&s.push(c),"full"==o&&a.push(c))}return{partial:s.length&&s,full:a.length&&a}}(e,t,r,n);if(!s.full&&!s.partial)return{type:"none"};if(!s.full&&s.partial)return{type:"partial",expectLiteralNext:1==s.partial.length&&"<character>"==s.partial[0].keys.slice(-11)};for(var a=0;a<s.full.length;a++){var l=s.full[a];o||(o=l)}if("<character>"==o.keys.slice(-11)||"<register>"==o.keys.slice(-10)){var c=function(e){var t=/^.*(<[^>]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(n.length>1)switch(n){case"<CR>":case"<S-CR>":n="\n";break;case"<Space>":case"<S-Space>":n=" ";break;default:n=""}return n}(e);if(!c||c.length>1)return{type:"clear"};n.selectedCharacter=c}return{type:"full",command:o}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case"motion":this.processMotion(e,t,n);break;case"operator":this.processOperator(e,t,n);break;case"operatorMotion":this.processOperatorMotion(e,t,n);break;case"action":this.processAction(e,t,n);break;case"search":this.processSearch(e,t,n);break;case"ex":case"keyToEx":this.processEx(e,t,n)}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=ne(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var r=t.inputState;if(r.operator){if(r.operator==n.operator)return r.motion="expandToLine",r.motionArgs={linewise:!0,repeat:1},void this.evalInput(e,t);q(e)}r.operator=n.operator,r.operatorArgs=ne(n.operatorArgs),n.keys.length>1&&(r.operatorShortcut=n.keys),n.exitVisualBlock&&(t.visualBlock=!1,ye(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var r=t.visualMode,i=ne(n.operatorMotionArgs);i&&r&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),r||this.processMotion(e,t,n)},processAction:function(e,t,n){var r=t.inputState,i=r.getRepeat(),o=!!i,s=ne(n.actionArgs)||{repeat:1};r.selectedCharacter&&(s.selectedCharacter=r.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),s.repeat=i||1,s.repeatIsExplicit=o,s.registerName=r.registerName,q(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,r,n),ee[n.action](e,s,t)},processSearch:function(t,n,r){if(t.getSearchCursor){var i=r.searchArgs.forward,o=r.searchArgs.wholeWordOnly;Pe(t).setReversed(!i);var s=i?"/":"?",a=Pe(t).getQuery(),l=t.getScrollInfo();switch(r.searchArgs.querySrc){case"prompt":var c=L.macroModeState;if(c.isPlaying){d(c.replaySearchQueries.shift(),!0,!1)}else $e(t,{onClose:function(e){t.scrollTo(l.left,l.top),d(e,!0,!0);var n=L.macroModeState;n.isRecording&&function(e,t){if(!e.isPlaying){var n=e.latestRegister,r=L.registerController.getRegister(n);r&&r.pushSearchQuery&&r.pushSearchQuery(t)}}(n,e)},prefix:s,desc:"(JavaScript regexp)",onKeyUp:function(e,n,r){var o,s,a,c=V(e);"<Up>"==c||"<Down>"==c?(o="<Up>"==c,s=e.target?e.target.selectionEnd:0,r(n=L.searchHistoryController.nextMatch(n,o)||""),s&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(s,e.target.value.length))):c&&"<Left>"!=c&&"<Right>"!=c&&L.searchHistoryController.reset();try{a=qe(t,n,!0,!0)}catch(e){}a?t.scrollIntoView(ze(t,!i,a),30):(Je(t),t.scrollTo(l.left,l.top))},onKeyDown:function(n,r,i){var o=V(n);"<Esc>"==o||"<C-c>"==o||"<C-[>"==o||"<BS>"==o&&""==r?(L.searchHistoryController.pushInput(r),L.searchHistoryController.reset(),qe(t,a),Je(t),t.scrollTo(l.left,l.top),e.e_stop(n),q(t),i(),t.focus()):"<Up>"==o||"<Down>"==o?e.e_stop(n):"<C-u>"==o&&(e.e_stop(n),i(""))}});break;case"wordUnderCursor":var h=xe(t,{noSymbol:!0}),u=!0;if(h||(h=xe(t,{noSymbol:!1}),u=!1),!h)return _e(t,"No word under cursor"),void q(t);let n=t.getLine(h.start.line).substring(h.start.ch,h.end.ch);n=u&&o?"\\b"+n+"\\b":n.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),L.jumpList.cachedCursor=t.getCursor(),t.setCursor(h.start),d(n,!0,!1)}}function d(e,i,o){L.searchHistoryController.pushInput(e),L.searchHistoryController.reset();try{qe(t,e,i,o)}catch(n){return _e(t,"Invalid regex: "+e),void q(t)}X.processMotion(t,n,{keys:"",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}},processEx:function(t,n,r){function i(e){L.exCommandHistoryController.pushInput(e),L.exCommandHistoryController.reset(),tt.processCommand(t,e),t.state.vim&&q(t)}function o(n,r,i){var o,s,a=V(n);("<Esc>"==a||"<C-c>"==a||"<C-[>"==a||"<BS>"==a&&""==r)&&(L.exCommandHistoryController.pushInput(r),L.exCommandHistoryController.reset(),e.e_stop(n),q(t),i(),t.focus()),"<Up>"==a||"<Down>"==a?(e.e_stop(n),o="<Up>"==a,s=n.target?n.target.selectionEnd:0,i(r=L.exCommandHistoryController.nextMatch(r,o)||""),s&&n.target&&(n.target.selectionEnd=n.target.selectionStart=Math.min(s,n.target.value.length))):"<C-u>"==a?(e.e_stop(n),i("")):a&&"<Left>"!=a&&"<Right>"!=a&&L.exCommandHistoryController.reset()}"keyToEx"==r.type?tt.processCommand(t,r.exArgs.input):n.visualMode?$e(t,{onClose:i,prefix:":",value:"'<,'>",onKeyDown:o,selectValueOnOpen:!1}):$e(t,{onClose:i,prefix:":",onKeyDown:o})},evalInput:function(e,r){var i,o,s,a=r.inputState,l=a.motion,c=a.motionArgs||{repeat:1},h=a.operator,u=a.operatorArgs||{},d=a.registerName,f=r.sel,m=se(r.visualMode?te(e,f.head):e.getCursor("head")),p=se(r.visualMode?te(e,f.anchor):e.getCursor("anchor")),g=se(m),v=se(p);if(h&&this.recordLastEdit(r,a),(s=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat())>0&&c.explicitRepeat?c.repeatIsExplicit=!0:(c.noRepeat||!c.explicitRepeat&&0===s)&&(s=1,c.repeatIsExplicit=!1),a.selectedCharacter&&(c.selectedCharacter=u.selectedCharacter=a.selectedCharacter),c.repeat=s,q(e),l){var C=G[l](e,m,c,r,a);if(r.lastMotion=G[l],!C)return;if(c.toJumplist){var w=L.jumpList,k=w.cachedCursor;k?(Se(e,k,C),delete w.cachedCursor):Se(e,m,C)}C instanceof Array?(o=C[0],i=C[1]):i=C,i||(i=se(m)),r.visualMode?(r.visualBlock&&i.ch===1/0||(i=te(e,i,g)),o&&(o=te(e,o)),o=o||v,f.anchor=o,f.head=i,ye(e),Te(e,r,"<",le(o,i)?o:i),Te(e,r,">",le(o,i)?i:o)):h||(i=te(e,i,g),e.setCursor(i.line,i.ch))}if(h){if(u.lastSel){o=v;var x=u.lastSel,S=Math.abs(x.head.line-x.anchor.line),M=Math.abs(x.head.ch-x.anchor.ch);i=x.visualLine?new t(v.line+S,v.ch):x.visualBlock?new t(v.line+S,v.ch+M):x.head.line==x.anchor.line?new t(v.line,v.ch+M):new t(v.line+S,v.ch),r.visualMode=!0,r.visualLine=x.visualLine,r.visualBlock=x.visualBlock,f=r.sel={anchor:o,head:i},ye(e)}else r.visualMode&&(u.lastSel={anchor:se(f.anchor),head:se(f.head),visualBlock:r.visualBlock,visualLine:r.visualLine});var b,A,E,O,T;if(r.visualMode){if(b=ce(f.head,f.anchor),A=he(f.head,f.anchor),E=r.visualLine||u.linewise,O=r.visualBlock?"block":E?"line":"char",T=Ce(e,{anchor:(N=n(e,b,A)).start,head:N.end},O),E){var R=T.ranges;if("block"==O)for(var B=0;B<R.length;B++)R[B].head.ch=de(e,R[B].head.line);else"line"==O&&(R[0].head=new t(R[0].head.line+1,0))}}else{if(b=se(o||v),le(A=se(i||g),b)){var I=b;b=A,A=I}(E=c.linewise||u.linewise)?function(e,t,n){t.ch=0,n.ch=0,n.line++}(0,b,A):c.forward&&function(e,t,n){var r=e.getRange(t,n);if(/\n\s*$/.test(r)){var i=r.split("\n");i.pop();for(var o=i.pop();i.length>0&&o&&y(o);o=i.pop())n.line--,n.ch=0;o?(n.line--,n.ch=de(e,n.line)):n.ch=0}}(e,b,A),O="char";var N,K=!c.inclusive||E;T=Ce(e,{anchor:(N=n(e,b,A)).start,head:N.end},O,K)}e.setSelections(T.ranges,T.primary),r.lastMotion=null,u.repeat=s,u.registerName=d,u.linewise=E;var P=Y[h](e,u,T.ranges,v,i);r.visualMode&&we(e,null!=P),P&&e.setCursor(P)}},recordLastEdit:function(e,t,n){var r=L.macroModeState;r.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=n,r.lastInsertModeChanges.changes=[],r.lastInsertModeChanges.expectCursorActivityForChange=!1,r.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},G={moveToTopLine:function(e,n,r){var i=Ge(e).top+r.repeat-1;return new t(i,ke(e.getLine(i)))},moveToMiddleLine:function(e){var n=Ge(e),r=Math.floor(.5*(n.top+n.bottom));return new t(r,ke(e.getLine(r)))},moveToBottomLine:function(e,n,r){var i=Ge(e).bottom-r.repeat+1;return new t(i,ke(e.getLine(i)))},expandToLine:function(e,n,r){return new t(n.line+r.repeat-1,1/0)},findNext:function(e,t,n){var r=Pe(e),i=r.getQuery();if(i){var o=!n.forward;return o=r.isReversed()?!o:o,Qe(e,i),ze(e,o,i,n.repeat)}},findAndSelectNextInclusive:function(n,r,i,o,s){var a=Pe(n),l=a.getQuery();if(l){var c=!i.forward,h=function(e,n,r,i,o){return e.operation((function(){void 0===i&&(i=1);var s=e.getCursor(),a=e.getSearchCursor(r,s),l=a.find(!n);!o.visualMode&&l&&ae(a.from(),s)&&a.find(!n);for(var c=0;c<i;c++)if(!(l=a.find(n))&&!(a=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0))).find(n))return;return[a.from(),a.to()]}))}(n,c=a.isReversed()?!c:c,l,i.repeat,o);if(h){if(s.operator)return h;var u=h[0],d=new t(h[1].line,h[1].ch-1);if(o.visualMode){(o.visualLine||o.visualBlock)&&(o.visualLine=!1,o.visualBlock=!1,e.signal(n,"vim-mode-change",{mode:"visual",subMode:""}));var f=o.sel.anchor;if(f)return a.isReversed()?i.forward?[f,u]:[f,d]:i.forward?[f,d]:[f,u]}else o.visualMode=!0,o.visualLine=!1,o.visualBlock=!1,e.signal(n,"vim-mode-change",{mode:"visual",subMode:""});return c?[d,u]:[u,d]}}},goToMark:function(e,t,n,r){var i=Ze(e,r,n.selectedCharacter||"");return i?n.linewise?{line:i.line,ch:ke(e.getLine(i.line))}:i:null},moveToOtherHighlightedEnd:function(e,n,r,i){if(i.visualBlock&&r.sameLine){var o=i.sel;return[te(e,new t(o.anchor.line,o.head.ch)),te(e,new t(o.head.line,o.anchor.ch))]}return[i.sel.head,i.sel.anchor]},jumpToMark:function(e,n,r,i){for(var o=n,s=0;s<r.repeat;s++){var a=o;for(var l in i.marks)if(g(l)){var c=i.marks[l].find();if(!((r.forward?le(c,a):le(a,c))||r.linewise&&c.line==a.line)){var h=ae(a,o),u=r.forward?ue(a,c,o):ue(o,c,a);(h||u)&&(o=c)}}}return r.linewise&&(o=new t(o.line,ke(e.getLine(o.line)))),o},moveByCharacters:function(e,n,r){var i=n,o=r.repeat,s=r.forward?i.ch+o:i.ch-o;return new t(i.line,s)},moveByLines:function(e,n,r,i){var o=n,s=o.ch;switch(i.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:s=i.lastHPos;break;default:i.lastHPos=s}var a=r.repeat+(r.repeatOffset||0),l=r.forward?o.line+a:o.line-a,c=e.firstLine(),h=e.lastLine(),u=e.findPosV(o,r.forward?a:-a,"line",i.lastHSPos);return(r.forward?u.line>l:u.line<l)&&(l=u.line,s=u.ch),l<c&&o.line==c?this.moveToStartOfLine(e,n,r,i):l>h&&o.line==h?Ee(e,n,r,i,!0):(r.toFirstChar&&(s=ke(e.getLine(l)),i.lastHPos=s),i.lastHSPos=e.charCoords(new t(l,s),"div").left,new t(l,s))},moveByDisplayLines:function(e,n,r,i){var o=n;switch(i.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:i.lastHSPos=e.charCoords(o,"div").left}var s=r.repeat,a=e.findPosV(o,r.forward?s:-s,"line",i.lastHSPos);if(a.hitSide)if(r.forward){var l={top:e.charCoords(a,"div").top+8,left:i.lastHSPos};a=e.coordsChar(l,"div")}else{var c=e.charCoords(new t(e.firstLine(),0),"div");c.left=i.lastHSPos,a=e.coordsChar(c,"div")}return i.lastHPos=a.ch,a},moveByPage:function(e,t,n){var r=t,i=n.repeat;return e.findPosV(r,n.forward?i:-i,"page")},moveByParagraph:function(e,t,n){var r=n.forward?1:-1;return Be(e,t,n.repeat,r).start},moveBySentence:function(e,n,r){var i=r.forward?1:-1;return function(e,n,r,i){function o(e,t){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!p(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}function s(e,t,n,r){var i=""===(c=e.getLine(t)),s={line:c,ln:t,pos:n,dir:r},a={ln:s.ln,pos:s.pos},l=""===s.line;for(o(e,s);null!==s.line;){if(a.ln=s.ln,a.pos=s.pos,""===s.line&&!l)return{ln:s.ln,pos:s.pos};if(i&&""!==s.line&&!y(s.line[s.pos]))return{ln:s.ln,pos:s.pos};!C(s.line[s.pos])||i||s.pos!==s.line.length-1&&!y(s.line[s.pos+1])||(i=!0),o(e,s)}var c=e.getLine(a.ln);a.pos=0;for(var h=c.length-1;h>=0;--h)if(!y(c[h])){a.pos=h;break}return a}function a(e,t,n,r){var i={line:l=e.getLine(t),ln:t,pos:n,dir:r},s={ln:i.ln,pos:null},a=""===i.line;for(o(e,i);null!==i.line;){if(""===i.line&&!a)return null!==s.pos?s:{ln:i.ln,pos:i.pos};if(C(i.line[i.pos])&&null!==s.pos&&(i.ln!==s.ln||i.pos+1!==s.pos))return s;""===i.line||y(i.line[i.pos])||(a=!1,s={ln:i.ln,pos:i.pos}),o(e,i)}var l=e.getLine(s.ln);s.pos=0;for(var c=0;c<l.length;++c)if(!y(l[c])){s.pos=c;break}return s}var l={ln:n.line,pos:n.ch};for(;r>0;)l=i<0?a(e,l.ln,l.pos,i):s(e,l.ln,l.pos,i),r--;return new t(l.ln,l.pos)}(e,n,r.repeat,i)},moveByScroll:function(e,t,n,r){var i,o=e.getScrollInfo(),s=n.repeat;s||(s=o.clientHeight/(2*e.defaultTextHeight()));var a=e.charCoords(t,"local");if(n.repeat=s,!(i=G.moveByDisplayLines(e,t,n,r)))return null;var l=e.charCoords(i,"local");return e.scrollTo(null,o.top+l.top-a.top),i},moveByWords:function(e,n,r){return function(e,n,r,i,o,s){var a=se(n),l=[];(i&&!o||!i&&o)&&r++;for(var c=!(i&&o),h=0;h<r;h++){var u=Ae(e,n,i,s,c);if(!u){var d=de(e,e.lastLine());l.push(i?{line:e.lastLine(),from:d,to:d}:{line:0,from:0,to:0});break}l.push(u),n=new t(u.line,i?u.to-1:u.from)}var f=l.length!=r,m=l[0],p=l.pop();return i&&!o?(f||m.from==a.ch&&m.line==a.line||(p=l.pop()),p&&new t(p.line,p.from)):i&&o?p&&new t(p.line,p.to-1):!i&&o?(f||m.to==a.ch&&m.line==a.line||(p=l.pop()),p&&new t(p.line,p.to)):p&&new t(p.line,p.from)}(e,n,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,n){var r=Oe(e,n.repeat,n.forward,n.selectedCharacter,t),i=n.forward?-1:1;return Me(i,n),r?(r.ch+=i,r):null},moveToCharacter:function(e,t,n){var r=n.repeat;return Me(0,n),Oe(e,r,n.forward,n.selectedCharacter,t)||t},moveToSymbol:function(e,n,r){var i=r.repeat;return r.selectedCharacter&&function(e,n,r,i){var o=se(e.getCursor()),s=r?1:-1,a=r?e.lineCount():-1,l=o.ch,c=o.line,h=e.getLine(c),u={lineText:h,nextCh:h.charAt(l),lastCh:null,index:l,symb:i,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[i],forward:r,depth:0,curMoveThrough:!1},d=Le[i];if(!d)return o;var f=be[d].init,m=be[d].isComplete;f&&f(u);for(;c!==a&&n;){if(u.index+=s,u.nextCh=u.lineText.charAt(u.index),!u.nextCh){if(c+=s,u.lineText=e.getLine(c)||"",s>0)u.index=0;else{var p=u.lineText.length;u.index=p>0?p-1:0}u.nextCh=u.lineText.charAt(u.index)}m(u)&&(o.line=c,o.ch=u.index,n--)}if(u.nextCh||u.curMoveThrough)return new t(c,u.index);return o}(e,i,r.forward,r.selectedCharacter)||n},moveToColumn:function(e,n,r,i){var o=r.repeat;return i.lastHPos=o-1,i.lastHSPos=e.charCoords(n,"div").left,function(e,n){var r=e.getCursor().line;return te(e,new t(r,n-1))}(e,o)},moveToEol:function(e,t,n,r){return Ee(e,t,n,r,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,n){var r=n;return new t(r.line,ke(e.getLine(r.line)))},moveToMatchedSymbol:function(e,n){for(var r,i=n,o=i.line,s=i.ch,a=e.getLine(o);s<a.length;s++)if((r=a.charAt(s))&&-1!="()[]{}".indexOf(r)){var l=e.getTokenTypeAt(new t(o,s+1));if("string"!==l&&"comment"!==l)break}if(s<a.length){var c="<"===r||">"===r?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(new t(o,s),{bracketRegex:c}).to}return i},moveToStartOfLine:function(e,n){return new t(n.line,0)},moveToLineOrEdgeOfDocument:function(e,n,r){var i=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(i=r.repeat-e.getOption("firstLineNumber")),new t(i,ke(e.getLine(i)))},moveToStartOfDisplayLine:function(e){return e.execCommand("goLineLeft"),e.getCursor()},moveToEndOfDisplayLine:function(e){e.execCommand("goLineRight");var t=e.getCursor();return"before"==t.sticky&&t.ch--,t},textObjectManipulation:function(n,r,i,o){var s=i.selectedCharacter||"";"b"==s?s="(":"B"==s&&(s="{");var a,l,c=!i.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"}[s]){if(l=!0,!(a=Ne(n,r,s,c))){var h=n.getSearchCursor(new RegExp("\\"+s,"g"),r);h.find()&&(a=Ne(n,h.from(),s,c))}}else if({"'":!0,'"':!0,"`":!0}[s])l=!0,a=function(e,n,r,i){var o,s,a,l,c=se(n),h=e.getLine(c.line),u=h.split(""),d=u.indexOf(r);if(c.ch<d)c.ch=d;else if(d<c.ch&&u[c.ch]==r){var f=/string/.test(e.getTokenTypeAt(re(n,0,1))),m=/string/.test(e.getTokenTypeAt(n));f&&!m||(s=c.ch,--c.ch)}if(u[c.ch]!=r||s)for(a=c.ch;a>-1&&!o;a--)u[a]==r&&(o=a+1);else o=c.ch+1;if(o&&!s)for(a=o,l=u.length;a<l&&!s;a++)u[a]==r&&(s=a);if(!o||!s)return{start:c,end:c};i&&(--o,++s);return{start:new t(c.line,o),end:new t(c.line,s)}}(n,r,s,c);else if("W"===s||"w"===s)for(var u=i.repeat||1;u-- >0;){var d=xe(n,{inclusive:c,innerWord:!c,bigWord:"W"===s,noSymbol:"W"===s,multiline:!0},a&&a.end);d&&(a||(a=d),a.end=d.end)}else if("p"===s)if(a=Be(n,r,i.repeat,0,c),i.linewise=!0,o.visualMode)o.visualLine||(o.visualLine=!0);else{var f=o.inputState.operatorArgs;f&&(f.linewise=!0),a.end.line--}else if("t"===s)a=function(t,n,r){var i=n;if(!e.findMatchingTag||!e.findEnclosingTag)return{start:i,end:i};var o=e.findMatchingTag(t,n)||e.findEnclosingTag(t,n);if(!o||!o.open||!o.close)return{start:i,end:i};if(r)return{start:o.open.from,end:o.close.to};return{start:o.open.to,end:o.close.from}}(n,r,c);else if("s"===s){var m=n.getLine(r.line);r.ch>0&&C(m[r.ch])&&(r.ch-=1);var p=Ie(n,r,i.repeat,1,c),g=Ie(n,r,i.repeat,-1,c);y(n.getLine(g.line)[g.ch])&&y(n.getLine(p.line)[p.ch-1])&&(g={line:g.line,ch:g.ch+1}),a={start:g,end:p}}return a?n.state.vim.visualMode?function(e,n,r,i){var o,s=e.state.vim.sel,a=i?n:s.head,l=i?n:s.anchor;le(r,n)&&(o=r,r=n,n=o);le(a,l)?(a=ce(n,a),l=he(l,r)):(l=ce(n,l),-1==(a=re(a=he(a,r),0,-1)).ch&&a.line!=e.firstLine()&&(a=new t(a.line-1,de(e,a.line-1))));return[l,a]}(n,a.start,a.end,l):[a.start,a.end]:null},repeatLastCharacterSearch:function(e,t,n){var r=L.lastCharacterSearch,i=n.repeat,o=n.forward===r.forward,s=(r.increment?1:0)*(o?-1:1);e.moveH(-s,"char"),n.inclusive=!!o;var a=Oe(e,i,o,r.selectedCharacter);return a?(a.ch+=s,a):(e.moveH(s,"char"),t)}};function Z(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n}var Y={change:function(e,n,r){var i,o,s=e.state.vim,a=r[0].anchor,l=r[0].head;if(s.visualMode)if(n.fullLine)l.ch=Number.MAX_VALUE,l.line--,e.setSelection(a,l),o=e.getSelection(),e.replaceSelection(""),i=a;else{o=e.getSelection();var c=Z("",r.length);e.replaceSelections(c),i=ce(r[0].head,r[0].anchor)}else{o=e.getRange(a,l);var h=s.lastEditInputState;if("moveByWords"==h?.motion&&!y(o)){var u=/\s+$/.exec(o);u&&h.motionArgs&&h.motionArgs.forward&&(l=re(l,0,-u[0].length),o=o.slice(0,-u[0].length))}n.linewise&&(a=new t(a.line,ke(e.getLine(a.line))),l.line>a.line&&(l=new t(l.line-1,Number.MAX_VALUE))),e.replaceRange("",a,l),i=a}L.registerController.pushText(n.registerName,"change",o,n.linewise,r.length>1),ee.enterInsertMode(e,{head:i},e.state.vim)},delete:function(e,n,r){var i,o,s=e.state.vim;if(s.visualBlock){o=e.getSelection();var a=Z("",r.length);e.replaceSelections(a),i=ce(r[0].head,r[0].anchor)}else{var l=r[0].anchor,c=r[0].head;n.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=new t(l.line-1,de(e,l.line-1))),o=e.getRange(l,c),e.replaceRange("",l,c),i=l,n.linewise&&(i=G.moveToFirstNonWhiteSpaceCharacter(e,l))}return L.registerController.pushText(n.registerName,"delete",o,n.linewise,s.visualBlock),te(e,i)},indent:function(e,t,n){var r=e.state.vim,i=r.visualMode?t.repeat||0:1;if(e.indentMore)for(var o=0;o<i;o++)t.indentRight?e.indentMore():e.indentLess();else{var s=n[0].anchor.line,a=r.visualBlock?n[n.length-1].anchor.line:n[0].head.line;t.linewise&&a--;for(var l=s;l<=a;l++)for(o=0;o<i;o++)e.indentLine(l,t.indentRight)}return G.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},indentAuto:function(e,t,n){return e.execCommand("indentAuto"),G.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},hardWrap:function(e,n,r,i){if(e.hardWrap){var o=r[0].anchor.line,s=r[0].head.line;n.linewise&&s--;var a=e.hardWrap({from:o,to:s});return a>o&&n.linewise&&a--,n.keepCursor?i:new t(a,0)}},changeCase:function(e,t,n,r,i){for(var o=e.getSelections(),s=[],a=t.toLower,l=0;l<o.length;l++){var c=o[l],h="";if(!0===a)h=c.toLowerCase();else if(!1===a)h=c.toUpperCase();else for(var u=0;u<c.length;u++){var d=c.charAt(u);h+=v(d)?d.toLowerCase():d.toUpperCase()}s.push(h)}return e.replaceSelections(s),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?G.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:ce(n[0].anchor,n[0].head)},yank:function(e,t,n,r){var i=e.state.vim,o=e.getSelection(),s=i.visualMode?ce(i.sel.anchor,i.sel.head,n[0].head,n[0].anchor):r;return L.registerController.pushText(t.registerName,"yank",o,t.linewise,i.visualBlock),s}};var ee={jumpListWalk:function(e,t,n){if(!n.visualMode){var r=t.repeat||1,i=t.forward,o=L.jumpList.move(e,i?r:-r),s=o?o.find():void 0;s=s||e.getCursor(),e.setCursor(s)}},scroll:function(e,t,n){if(!n.visualMode){var r=t.repeat||1,i=e.defaultTextHeight(),o=e.getScrollInfo().top,s=i*r,a=t.forward?o+s:o-s,l=se(e.getCursor()),c=e.charCoords(l,"local");if(t.forward)a>c.top?(l.line+=(a-c.top)/i,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,a);else{var h=a+e.getScrollInfo().clientHeight;h<c.bottom?(l.line-=(c.bottom-h)/i,l.line=Math.floor(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,a)}}},scrollToCursor:function(e,n){var r=e.getCursor().line,i=e.charCoords(new t(r,0),"local"),o=e.getScrollInfo().clientHeight,s=i.top;switch(n.position){case"center":s=i.bottom-o/2;break;case"bottom":var a=new t(r,e.getLine(r).length-1);s=s-o+(e.charCoords(a,"local").bottom-s)}e.scrollTo(null,s)},replayMacro:function(e,t,n){var r=t.selectedCharacter||"",i=t.repeat||1,o=L.macroModeState;for("@"==r?r=o.latestRegister:o.latestRegister=r;i--;)it(e,n,o,r)},enterMacroRecordMode:function(e,t){var n=L.macroModeState,r=t.selectedCharacter;L.registerController.isValidRegister(r)&&n.enterMacroRecordMode(e,r)},toggleOverwrite:function(t){t.state.overwrite?(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})):(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(r,i,o){if(!r.getOption("readOnly")){o.insertMode=!0,o.insertModeRepeat=i&&i.repeat||1;var s=i?i.insertAt:null,a=o.sel,l=i.head||r.getCursor("head"),c=r.listSelections().length;if("eol"==s)l=new t(l.line,de(r,l.line));else if("bol"==s)l=new t(l.line,0);else if("charAfter"==s){l=n(r,l,re(l,0,1)).end}else if("firstNonBlank"==s){l=n(r,l,G.moveToFirstNonWhiteSpaceCharacter(r,l)).end}else if("startOfSelectedArea"==s){if(!o.visualMode)return;o.visualBlock?(l=new t(Math.min(a.head.line,a.anchor.line),Math.min(a.head.ch,a.anchor.ch)),c=Math.abs(a.head.line-a.anchor.line)+1):l=a.head.line<a.anchor.line?a.head:new t(a.anchor.line,0)}else if("endOfSelectedArea"==s){if(!o.visualMode)return;o.visualBlock?(l=new t(Math.min(a.head.line,a.anchor.line),Math.max(a.head.ch,a.anchor.ch)+1),c=Math.abs(a.head.line-a.anchor.line)+1):l=a.head.line>=a.anchor.line?re(a.head,0,1):new t(a.anchor.line,0)}else if("inplace"==s){if(o.visualMode)return}else"lastEdit"==s&&(l=Ye(r)||l);r.setOption("disableInput",!1),i&&i.replace?(r.toggleOverwrite(!0),r.setOption("keyMap","vim-replace"),e.signal(r,"vim-mode-change",{mode:"replace"})):(r.toggleOverwrite(!1),r.setOption("keyMap","vim-insert"),e.signal(r,"vim-mode-change",{mode:"insert"})),L.macroModeState.isPlaying||(r.on("change",ot),o.insertEnd&&o.insertEnd.clear(),o.insertEnd=r.setBookmark(l,{insertLeft:!0}),e.on(r.getInputField(),"keydown",ct)),o.visualMode&&we(r),ge(r,l,c)}},toggleVisualMode:function(r,i,o){var s,a=i.repeat,l=r.getCursor();if(o.visualMode)o.visualLine!=!!i.linewise||o.visualBlock!=!!i.blockwise?(o.visualLine=!!i.linewise,o.visualBlock=!!i.blockwise,e.signal(r,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ye(r)):we(r);else{o.visualMode=!0,o.visualLine=!!i.linewise,o.visualBlock=!!i.blockwise;var c=n(r,l,s=te(r,new t(l.line,l.ch+a-1)));o.sel={anchor:c.start,head:c.end},e.signal(r,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ye(r),Te(r,o,"<",ce(l,s)),Te(r,o,">",he(l,s))}},reselectLastSelection:function(t,n,r){var i=r.lastSelection;if(r.visualMode&&ve(t,r),i){var o=i.anchorMark.find(),s=i.headMark.find();if(!o||!s)return;r.sel={anchor:o,head:s},r.visualMode=!0,r.visualLine=i.visualLine,r.visualBlock=i.visualBlock,ye(t),Te(t,r,"<",ce(o,s)),Te(t,r,">",he(o,s)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""})}},joinLines:function(e,n,r){var i,o;if(r.visualMode){if(i=e.getCursor("anchor"),le(o=e.getCursor("head"),i)){var s=o;o=i,i=s}o.ch=de(e,o.line)-1}else{var a=Math.max(n.repeat,2);i=e.getCursor(),o=te(e,new t(i.line+a-1,1/0))}for(var l=0,c=i.line;c<o.line;c++){l=de(e,i.line);var h="",u=0;if(!n.keepSpaces){var d=e.getLine(i.line+1);-1==(u=d.search(/\S/))?u=d.length:h=" "}e.replaceRange(h,new t(i.line,l),new t(i.line+1,u))}var f=te(e,new t(i.line,l));r.visualMode&&we(e,!1),e.setCursor(f)},newLineAndEnterInsertMode:function(n,r,i){i.insertMode=!0;var o=se(n.getCursor());o.line!==n.firstLine()||r.after?(o.line=r.after?o.line:o.line-1,o.ch=de(n,o.line),n.setCursor(o),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(n)):(n.replaceRange("\n",new t(n.firstLine(),0)),n.setCursor(n.firstLine(),0));this.enterInsertMode(n,{repeat:r.repeat},i)},paste:function(e,t,n){var r=L.registerController.getRegister(t.registerName);if("+"===t.registerName)navigator.clipboard.readText().then((i=>{this.continuePaste(e,t,n,i,r)}));else{var i=r.toString();this.continuePaste(e,t,n,i,r)}},continuePaste:function(e,n,r,i,o){var s=se(e.getCursor());if(i){if(n.matchIndent){var a=e.getOption("tabSize"),l=function(e){var t=e.split("\t").length-1,n=e.split(" ").length-1;return t*a+1*n},c=e.getLine(e.getCursor().line),h=l(c.match(/^\s*/)[0]),u=i.replace(/\n$/,""),d=i!==u,f=l(i.match(/^\s*/)[0]);i=u.replace(/^\s*/gm,(function(t){var n=h+(l(t)-f);if(n<0)return"";if(e.getOption("indentWithTabs")){var r=Math.floor(n/a);return Array(r+1).join("\t")}return Array(n+1).join(" ")}));i+=d?"\n":""}if(n.repeat>1)i=Array(n.repeat+1).join(i);var m,p=o.linewise,g=o.blockwise;if(g){i=i.split("\n"),p&&i.pop();for(var v=0;v<i.length;v++)i[v]=""==i[v]?" ":i[v];s.ch+=n.after?1:0,s.ch=Math.min(de(e,s.line),s.ch)}else p?r.visualMode?i=r.visualLine?i.slice(0,-1):"\n"+i.slice(0,i.length-1)+"\n":n.after?(i="\n"+i.slice(0,i.length-1),s.ch=de(e,s.line)):s.ch=0:s.ch+=n.after?1:0;if(r.visualMode){var y;r.lastPastedText=i;var C=function(e,n){var r=n.lastSelection,i=function(){var t=e.listSelections(),n=t[0],r=t[t.length-1];return[le(n.anchor,n.head)?n.anchor:n.head,le(r.anchor,r.head)?r.head:r.anchor]},o=function(){var n=e.getCursor(),i=e.getCursor(),o=r.visualBlock;if(o){var s=o.width,a=o.height;i=new t(n.line+a,n.ch+s);for(var l=[],c=n.line;c<i.line;c++){var h={anchor:new t(c,n.ch),head:new t(c,i.ch)};l.push(h)}e.setSelections(l)}else{var u=r.anchorMark.find(),d=r.headMark.find(),f=d.line-u.line,m=d.ch-u.ch;i={line:i.line+f,ch:f?i.ch:m+i.ch},r.visualLine&&(n=new t(n.line,0),i=new t(i.line,de(e,i.line))),e.setSelection(n,i)}return[n,i]};return n.visualMode?i():o()}(e,r),w=C[0],k=C[1],x=e.getSelection(),S=e.listSelections(),M=new Array(S.length).join("1").split("1");r.lastSelection&&(y=r.lastSelection.headMark.find()),L.registerController.unnamedRegister.setText(x),g?(e.replaceSelections(M),k=new t(w.line+i.length-1,w.ch),e.setCursor(w),pe(e,k),e.replaceSelections(i),m=w):r.visualBlock?(e.replaceSelections(M),e.setCursor(w),e.replaceRange(i,w,w),m=w):(e.replaceRange(i,w,k),m=e.posFromIndex(e.indexFromPos(w)+i.length-1)),y&&(r.lastSelection.headMark=e.setBookmark(y)),p&&(m.ch=0)}else if(g){e.setCursor(s);for(v=0;v<i.length;v++){(b=s.line+v)>e.lastLine()&&e.replaceRange("\n",new t(b,0)),de(e,b)<s.ch&&me(e,b,s.ch)}e.setCursor(s),pe(e,new t(s.line+i.length-1,s.ch)),e.replaceSelections(i),m=s}else if(e.replaceRange(i,s),p){var b=n.after?s.line+1:s.line;m=new t(b,ke(e.getLine(b)))}else m=se(s),/\n/.test(i)||(m.ch+=i.length-(n.after?1:0));r.visualMode&&we(e,!1),e.setCursor(m)}},undo:function(t,n){t.operation((function(){oe(t,e.commands.undo,n.repeat)(),t.setCursor(te(t,t.getCursor("start")))}))},redo:function(t,n){oe(t,e.commands.redo,n.repeat)()},setRegister:function(e,t,n){n.inputState.registerName=t.selectedCharacter},insertRegister:function(e,t,n){var r=t.selectedCharacter,i=L.registerController.getRegister(r),o=i&&i.toString();o&&e.replaceSelection(o)},oneNormalCommand:function(t,n,r){nt(t,!0),r.insertModeReturn=!0,e.on(t,"vim-command-done",(function n(){r.visualMode||(r.insertModeReturn&&(r.insertModeReturn=!1,r.insertMode||ee.enterInsertMode(t,{},r)),e.off(t,"vim-command-done",n))}))},setMark:function(e,t,n){var r=t.selectedCharacter;r&&Te(e,n,r,e.getCursor())},replace:function(r,i,o){var s,a,l=i.selectedCharacter||"",c=r.getCursor(),h=r.listSelections();if(o.visualMode)c=r.getCursor("start"),a=r.getCursor("end");else{var u=r.getLine(c.line);(s=c.ch+i.repeat)>u.length&&(s=u.length),a=new t(c.line,s)}var d=n(r,c,a);if(c=d.start,a=d.end,"\n"==l)o.visualMode||r.replaceRange("",c,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(r);else{var f=r.getRange(c,a);if(f=(f=f.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,l)).replace(/[^\n]/g,l),o.visualBlock){var m=new Array(r.getOption("tabSize")+1).join(" "),p=(f=(f=r.getSelection()).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,l)).replace(/\t/g,m).replace(/[^\n]/g,l).split("\n");r.replaceSelections(p)}else r.replaceRange(f,c,a);o.visualMode?(c=le(h[0].anchor,h[0].head)?h[0].anchor:h[0].head,r.setCursor(c),we(r,!1)):r.setCursor(re(a,0,-1))}},incrementNumberToken:function(e,n){for(var r,i,o,s,a=e.getCursor(),l=e.getLine(a.line),c=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(r=c.exec(l))&&(o=(i=r.index)+r[0].length,!(a.ch<o)););if((n.backtrack||!(o<=a.ch))&&r){var h=r[2]||r[4],u=r[3]||r[5],d=n.increase?1:-1,f={"0b":2,0:8,"":10,"0x":16}[h.toLowerCase()];s=(parseInt(r[1]+u,f)+d*n.repeat).toString(f);var m=h?new Array(u.length-s.length+1+r[1].length).join("0"):"";s="-"===s.charAt(0)?"-"+h+m+s.substr(1):h+m+s;var p=new t(a.line,i),g=new t(a.line,o);e.replaceRange(s,p,g),e.setCursor(new t(a.line,i+s.length-1))}},repeatLastEdit:function(e,t,n){var r=n.lastEditInputState;if(r){var i=t.repeat;i&&t.repeatIsExplicit?r.repeatOverride=i:i=r.repeatOverride||i,ht(e,n,i,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:function(e,t){nt(e)}};function te(e,n,r){var i=e.state.vim,o=i.insertMode||i.visualMode,s=Math.min(Math.max(e.firstLine(),n.line),e.lastLine()),a=e.getLine(s),l=a.length-1+Number(!!o),c=Math.min(Math.max(0,n.ch),l),h=a.charCodeAt(c);if(56320<=h&&h<=57343){var u=1;r&&r.line==s&&r.ch>c&&(u=-1),(c+=u)>l&&(c-=2)}return new t(s,c)}function ne(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function re(e,n,r){return"object"==typeof n&&(r=n.ch,n=n.line),new t(e.line+n,e.ch+r)}function ie(e,t){const n="<character>"==t.slice(-11),r="<register>"==t.slice(-10);if(n||r){var i=t.length-(n?11:10),o=e.slice(0,i),s=t.slice(0,i);return o==s&&e.length>i?"full":0==s.indexOf(o)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function oe(e,t,n){return function(){for(var r=0;r<n;r++)t(e)}}function se(e){return new t(e.line,e.ch)}function ae(e,t){return e.ch==t.ch&&e.line==t.line}function le(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function ce(e,t){return arguments.length>2&&(t=ce.apply(void 0,Array.prototype.slice.call(arguments,1))),le(e,t)?e:t}function he(e,t){return arguments.length>2&&(t=he.apply(void 0,Array.prototype.slice.call(arguments,1))),le(e,t)?t:e}function ue(e,t,n){var r=le(e,t),i=le(t,n);return r&&i}function de(e,t){return e.getLine(t).length}function fe(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function me(e,n,r){var i=de(e,n),o=new Array(r-i+1).join(" ");e.setCursor(new t(n,i)),e.replaceRange(o,e.getCursor())}function pe(e,n){var r=[],i=e.listSelections(),o=se(e.clipPos(n)),s=!ae(n,o),a=function(e,t){for(var n=0;n<e.length;n++){var r=ae(e[n].anchor,t),i=ae(e[n].head,t);if(r||i)return n}return-1}(i,e.getCursor("head")),l=ae(i[a].head,i[a].anchor),c=i.length-1,h=c-a>a?c:0,u=i[h].anchor,d=Math.min(u.line,o.line),f=Math.max(u.line,o.line),m=u.ch,p=o.ch,g=i[h].head.ch-m,v=p-m;g>0&&v<=0?(m++,s||p--):g<0&&v>=0?(m--,l||p++):g<0&&-1==v&&(m--,p++);for(var y=d;y<=f;y++){var C={anchor:new t(y,m),head:new t(y,p)};r.push(C)}return e.setSelections(r),n.ch=p,u.ch=m,u}function ge(e,t,n){for(var r=[],i=0;i<n;i++){var o=re(t,i,0);r.push({anchor:o,head:o})}e.setSelections(r,0)}function ve(e,t){var n=t.sel.anchor,r=t.sel.head;t.lastPastedText&&(r=e.posFromIndex(e.indexFromPos(n)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(n),headMark:e.setBookmark(r),anchor:se(n),head:se(r),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ye(e,t,n){var r=e.state.vim;t=t||r.sel,n||(n=r.visualLine?"line":r.visualBlock?"block":"char");var i=Ce(e,t,n);e.setSelections(i.ranges,i.primary)}function Ce(e,n,r,i){var o=se(n.head),s=se(n.anchor);if("char"==r){var a=i||le(n.head,n.anchor)?0:1,l=le(n.head,n.anchor)?1:0;return o=re(n.head,0,a),{ranges:[{anchor:s=re(n.anchor,0,l),head:o}],primary:0}}if("line"==r){if(le(n.head,n.anchor))o.ch=0,s.ch=de(e,s.line);else{s.ch=0;var c=e.lastLine();o.line>c&&(o.line=c),o.ch=de(e,o.line)}return{ranges:[{anchor:s,head:o}],primary:0}}if("block"==r){var h=Math.min(s.line,o.line),u=s.ch,d=Math.max(s.line,o.line),f=o.ch;u<f?f+=1:u+=1;for(var m=d-h+1,p=o.line==h?0:m-1,g=[],v=0;v<m;v++)g.push({anchor:new t(h+v,u),head:new t(h+v,f)});return{ranges:g,primary:p}}throw"never happens"}function we(t,n){var r=t.state.vim;!1!==n&&t.setCursor(te(t,r.sel.head)),ve(t,r),r.visualMode=!1,r.visualLine=!1,r.visualBlock=!1,r.insertMode||e.signal(t,"vim-mode-change",{mode:"normal"})}function ke(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function xe(e,{inclusive:n,innerWord:r,bigWord:i,noSymbol:o,multiline:s},a){var l,c=a||function(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=ce(t,e.getCursor("anchor"))),t}(e),d=e.getLine(c.line),f=d,m=c.line,p=m,g=c.ch,v=o?h[0]:u[0];if(r&&/\s/.test(d.charAt(g)))v=function(e){return/\s/.test(e)};else{for(;!v(d.charAt(g));)if(++g>=d.length){if(!s)return null;g--,l=Ae(e,c,!0,i,!0);break}i?v=u[0]:(v=h[0])(d.charAt(g))||(v=h[1])}for(var y=g,C=g;v(d.charAt(C))&&C>=0;)C--;if(C++,l)y=l.to,p=l.line,(f=e.getLine(p))||0!=y||y++;else for(;v(d.charAt(y))&&y<d.length;)y++;if(n){var w=y,k=c.ch<=C&&/\s/.test(d.charAt(c.ch));if(!k)for(;/\s/.test(f.charAt(y))&&y<f.length;)y++;if(w==y||k){for(var x=C;/\s/.test(d.charAt(C-1))&&C>0;)C--;C||k||(C=x)}}return{start:new t(m,C),end:new t(p,y)}}function Se(e,t,n){ae(t,n)||L.jumpList.add(e,t,n)}function Me(e,t){L.lastCharacterSearch.increment=e,L.lastCharacterSearch.forward=t.forward,L.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var Le={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},be={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 0===e.index&&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="m"===e.symb?"{":"}",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("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};function Ae(e,t,n,r,i){var o=t.line,s=t.ch,a=e.getLine(o),l=n?1:-1,c=r?u:h;if(i&&""==a){if(o+=l,a=e.getLine(o),!p(e,o))return null;s=n?0:a.length}for(;;){if(i&&""==a)return{from:0,to:0,line:o};for(var d=l>0?a.length:-1,f=d,m=d;s!=d;){for(var g=!1,v=0;v<c.length&&!g;++v)if(c[v](a.charAt(s))){for(f=s;s!=d&&c[v](a.charAt(s));)s+=l;if(g=f!=(m=s),f==t.ch&&o==t.line&&m==f+l)continue;return{from:Math.min(f,m+1),to:Math.max(f,m),line:o}}g||(s+=l)}if(!p(e,o+=l))return null;a=e.getLine(o),s=l>0?0:a.length}}function Ee(e,n,r,i,o){var s=new t(n.line+r.repeat-1,1/0),a=e.clipPos(s);return a.ch--,o||(i.lastHPos=1/0,i.lastHSPos=e.charCoords(a,"div").left),s}function Oe(e,n,r,i,o){if(i){for(var s,a=o||e.getCursor(),l=a.ch,c=0;c<n;c++){if(-1==(s=Re(l,e.getLine(a.line),i,r,!0)))return;l=s}return null!=s?new t(e.getCursor().line,s):void 0}}function Te(e,t,n,r){(w(n,d)||m.test(n))&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function Re(e,t,n,r,i){var o;return r?-1==(o=t.indexOf(n,e+1))||i||(o-=1):-1==(o=t.lastIndexOf(n,e-1))||i||(o+=1),o}function Be(e,n,r,i,o){var s,a=n.line,l=e.firstLine(),c=e.lastLine(),h=a;function u(t){return!e.getLine(t)}function d(e,t,n){return n?u(e)!=u(e+t):!u(e)&&u(e+t)}if(i){for(;l<=h&&h<=c&&r>0;)d(h,i)&&r--,h+=i;return{start:new t(h,0),end:n}}var f=e.state.vim;if(f.visualLine&&d(a,1,!0)){var m=f.sel.anchor;d(m.line,-1,!0)&&(o&&m.line==a||(a+=1))}var p=u(a);for(h=a;h<=c&&r;h++)d(h,1,!0)&&(o&&u(h)==p||r--);for(s=new t(h,0),h>c&&!p?p=!0:o=!1,h=a;h>l&&(o&&u(h)!=p&&h!=a||!d(h,-1,!0));h--);return{start:new t(h,0),end:s}}function Ie(e,n,r,i,o){function s(e){e.pos+e.dir<0||e.pos+e.dir>=e.line.length?e.line=null:e.pos+=e.dir}function a(e,t,n,r){var i={line:e.getLine(t),ln:t,pos:n,dir:r};if(""===i.line)return{ln:i.ln,pos:i.pos};var a=i.pos;for(s(i);null!==i.line;){if(a=i.pos,C(i.line[i.pos])){if(o){for(s(i);null!==i.line&&y(i.line[i.pos]);)a=i.pos,s(i);return{ln:i.ln,pos:a+1}}return{ln:i.ln,pos:i.pos+1}}s(i)}return{ln:i.ln,pos:a+1}}function l(e,t,n,r){var i=e.getLine(t),a={line:i,ln:t,pos:n,dir:r};if(""===a.line)return{ln:a.ln,pos:a.pos};var l=a.pos;for(s(a);null!==a.line;){if(y(a.line[a.pos])||C(a.line[a.pos])){if(C(a.line[a.pos]))return o&&y(a.line[a.pos+1])?{ln:a.ln,pos:a.pos+1}:{ln:a.ln,pos:l}}else l=a.pos;s(a)}return a.line=i,o&&y(a.line[a.pos])?{ln:a.ln,pos:a.pos}:{ln:a.ln,pos:l}}for(var c={ln:n.line,pos:n.ch};r>0;)c=i<0?l(e,c.ln,c.pos,i):a(e,c.ln,c.pos,i),r--;return new t(c.ln,c.pos)}function Ne(e,n,r,i){var o=n,s={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],a={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[r],l=e.getLine(o.line).charAt(o.ch)===a?1:0,c=e.scanForBracket(new t(o.line,o.ch+l),-1,void 0,{bracketRegex:s}),h=e.scanForBracket(new t(o.line,o.ch+l),1,void 0,{bracketRegex:s});if(!c||!h)return null;var u=c.pos,d=h.pos;if(u.line==d.line&&u.ch>d.ch||u.line>d.line){var f=u;u=d,d=f}return i?d.ch+=1:u.ch+=1,{start:u,end:d}}x("pcre",!0,"boolean");class Ke{getQuery(){return L.query}setQuery(e){L.query=e}getOverlay(){return this.searchOverlay}setOverlay(e){this.searchOverlay=e}isReversed(){return L.isReversed}setReversed(e){L.isReversed=e}getScrollbarAnnotate(){return this.annotate}setScrollbarAnnotate(e){this.annotate=e}}function Pe(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Ke)}function De(e,t){var n=Fe(e,t)||[];if(!n.length)return[];var r=[];if(0===n[0]){for(var i=0;i<n.length;i++)"number"==typeof n[i]&&r.push(e.substring(n[i]+1,n[i+1]));return r}}function Fe(e,t){t||(t="/");for(var n=!1,r=[],i=0;i<e.length;i++){var o=e.charAt(i);n||o!=t||r.push(i),n=!n&&"\\"==o}return r}var We={"\\n":"\n","\\r":"\r","\\t":"\t"};var He={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t","\\&":"&"};function Ve(e,t,n){if(L.registerController.getRegister("/").setText(e),e instanceof RegExp)return e;var r,i,o=Fe(e,"/");o.length?(r=e.substring(0,o[0]),i=-1!=e.substring(o[0]).indexOf("i")):r=e;return r?(M("pcre")||(r=function(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||"",o=e.charAt(r+1)||"",s=o&&-1!="|(){".indexOf(o);t?("\\"===i&&s||n.push(i),t=!1):"\\"===i?(t=!0,o&&-1!="}".indexOf(o)&&(s=!0),s&&"\\"!==o||n.push(i)):(n.push(i),s&&"\\"!==o&&n.push("\\"))}return n.join("")}(r)),n&&(t=/^[^A-Z]*$/.test(r)),new RegExp(r,t||i?"im":"m")):null}function je(e){"string"==typeof e&&(e=document.createElement(e));for(var t,n=1;n<arguments.length;n++)if(t=arguments[n])if("object"!=typeof t&&(t=document.createTextNode(t)),t.nodeType)e.appendChild(t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("$"===r[0]?e.style[r.slice(1)]=t[r]:e.setAttribute(r,t[r]));return e}function _e(e,t){var n=je("div",{$color:"red",$whiteSpace:"pre",class:"cm-vim-message"},t);e.openNotification?e.openNotification(n,{bottom:!0,duration:5e3}):alert(n.innerText)}function $e(e,t){if(N.length)return t.value||(t.value=""),void(B=t);var n,r,i=(n=t.prefix,r=t.desc,je("div",{$display:"flex"},je("span",{$fontFamily:"monospace",$whiteSpace:"pre",$flex:1},n,je("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false",$width:"100%"})),r&&je("span",{$color:"#888"},r)));if(e.openDialog)e.openDialog(i,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value});else{var o="";"string"!=typeof t.prefix&&t.prefix&&(o+=t.prefix.textContent),t.desc&&(o+=" "+t.desc),t.onClose(prompt(o,""))}}function qe(e,t,n,r){if(t){var i=Pe(e),o=Ve(t,!!n,!!r);if(o)return Qe(e,o),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var n=["global","multiline","ignoreCase","source"],r=0;r<n.length;r++){var i=n[r];if(e[i]!==t[i])return!1}return!0}return!1}(o,i.getQuery())||i.setQuery(o),o}}var Ue=0;function Qe(e,t){clearTimeout(Ue),Pe(e).highlightTimeout=Ue,Ue=setTimeout((function(){if(e.state.vim){var n=Pe(e);n.highlightTimeout=null;var r=n.getOverlay();r&&t==r.query||(r&&e.removeOverlay(r),r=function(e){if("^"==e.source.charAt(0))var t=!0;return{token:function(n){if(!t||n.sol()){var r=n.match(e,!1);if(r)return 0==r[0].length?(n.next(),"searching"):n.sol()||(n.backUp(1),e.exec(n.next()+r[0]))?(n.match(e),"searching"):(n.next(),null);for(;!n.eol()&&(n.next(),!n.match(e,!1)););}else n.skipToEnd()},query:e}}(t),e.addOverlay(r),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(r))}}),50)}function ze(e,n,r,i){return e.operation((function(){void 0===i&&(i=1);for(var o=e.getCursor(),s=e.getSearchCursor(r,o),a=0;a<i;a++){var l=s.find(n);if(0==a&&l&&ae(s.from(),o)){var c=n?s.from():s.to();(l=s.find(n))&&!l[0]&&ae(s.from(),c)&&e.getLine(c.line).length==c.ch&&(l=s.find(n))}if(!l&&!(s=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0))).find(n))return}return s.from()}))}function Je(e){var t=Pe(e);t.highlightTimeout&&(clearTimeout(t.highlightTimeout),t.highlightTimeout=null),e.removeOverlay(Pe(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function Xe(e,t,n){return"number"!=typeof e&&(e=e.line),t instanceof Array?w(e,t):"number"==typeof n?e>=t&&e<=n:e==t}function Ge(e){var t=e.getScrollInfo(),n=e.coordsChar({left:0,top:6+t.top},"local"),r=t.clientHeight-10+t.top,i=e.coordsChar({left:0,top:r},"local");return{top:n.line,bottom:i.line}}function Ze(e,n,r){if("'"==r||"`"==r)return L.jumpList.find(e,-1)||new t(0,0);if("."==r)return Ye(e);var i=n.marks[r];return i&&i.find()}function Ye(e){if(e.getLastEditEnd)return e.getLastEditEnd();for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return se(t[n].changes[0].to)}var et={colorscheme:function(e,t){!t.args||t.args.length<1?_e(e,e.getOption("theme")):e.setOption("theme",t.args[0])},map:function(e,t,n,r){var i=t.args;!i||i.length<2?e&&_e(e,"Invalid mapping: "+t.input):tt.map(i[0],i[1],n,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")},omap:function(e,t){this.map(e,t,"operatorPending")},noremap:function(e,t){this.map(e,t,void 0,!0)},inoremap:function(e,t){this.map(e,t,"insert",!0)},nnoremap:function(e,t){this.map(e,t,"normal",!0)},vnoremap:function(e,t){this.map(e,t,"visual",!0)},onoremap:function(e,t){this.map(e,t,"operatorPending",!0)},unmap:function(e,t,n){var r=t.args;(!r||r.length<1||!tt.unmap(r[0],n))&&e&&_e(e,"No such mapping: "+t.input)},mapclear:function(e,t){I.mapclear()},imapclear:function(e,t){I.mapclear("insert")},nmapclear:function(e,t){I.mapclear("normal")},vmapclear:function(e,t){I.mapclear("visual")},omapclear:function(e,t){I.mapclear("operatorPending")},move:function(e,t){X.processCommand(e,e.state.vim,{keys:"",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1)e&&_e(e,"Invalid mapping: "+t.input);else{var i=n[0].split("="),o=i.shift()||"",s=i.length>0?i.join("="):void 0,a=!1,l=!1;if("?"==o.charAt(o.length-1)){if(s)throw Error("Trailing characters: "+t.argString);o=o.substring(0,o.length-1),a=!0}else"!"==o.charAt(o.length-1)&&(o=o.substring(0,o.length-1),l=!0);void 0===s&&"no"==o.substring(0,2)&&(o=o.substring(2),s=!1);var c=k[o]&&"boolean"==k[o].type;if(c&&(l?s=!M(o,e,r):null==s&&(s=!0)),!c&&void 0===s||a){var h=M(o,e,r);h instanceof Error?_e(e,h.message):_e(e,!0===h||!1===h?" "+(h?"":"no")+o:" "+o+"="+h)}else{var u=S(o,s,e,r);u instanceof Error&&_e(e,u.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 n=t.args,r=L.registerController.registers,i="----------Registers----------\n\n";if(n)for(var o=n.join(""),s=0;s<o.length;s++){a=o.charAt(s);if(L.registerController.isValidRegister(a))i+='"'+a+" "+(r[a]||new Q).toString()+"\n"}else for(var a in r){var l=r[a].toString();l.length&&(i+='"'+a+" "+l+"\n")}_e(e,i)},sort:function(n,r){var i,o,s,a,l;var c=function(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(i=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!n||!t.eol())return"Invalid arguments";if(n[1]){o=-1!=n[1].indexOf("i"),s=-1!=n[1].indexOf("u");var c=-1!=n[1].indexOf("d")||-1!=n[1].indexOf("n"),h=-1!=n[1].indexOf("x"),u=-1!=n[1].indexOf("o");if(Number(c)+Number(h)+Number(u)>1)return"Invalid arguments";a=(c?"decimal":h&&"hex")||u&&"octal"}n[2]&&(l=new RegExp(n[2].substr(1,n[2].length-2),o?"i":""))}}();if(c)_e(n,c+": "+r.argString);else{var h=r.line||n.firstLine(),u=r.lineEnd||r.line||n.lastLine();if(h!=u){var d=new t(h,0),f=new t(u,de(n,u)),m=n.getRange(d,f).split("\n"),p="decimal"==a?/(-?)([\d]+)/:"hex"==a?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==a?/([0-7]+)/:null,g="decimal"==a?10:"hex"==a?16:"octal"==a?8:void 0,v=[],y=[];if(a||l)for(var C=0;C<m.length;C++){var w=l?m[C].match(l):null;w&&""!=w[0]?v.push(w):p&&p.exec(m[C])?v.push(m[C]):y.push(m[C])}else y=m;if(v.sort(l?function(e,t){var n;return i&&(n=e,e=t,t=n),o&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}:S),l)for(C=0;C<v.length;C++)v[C]=v[C].input;else a||y.sort(S);if(m=i?v.concat(y):y.concat(v),s){var k,x=m;m=[];for(C=0;C<x.length;C++)x[C]!=k&&m.push(x[C]),k=x[C]}n.replaceRange(m.join("\n"),d,f)}}function S(e,t){var n;i&&(n=e,e=t,t=n);o&&(e=e.toLowerCase(),t=t.toLowerCase());var r=p&&p.exec(e),s=p&&p.exec(t);return r&&s?parseInt((r[1]+r[2]).toLowerCase(),g)-parseInt((s[1]+s[2]).toLowerCase(),g):e<t?-1:1}},vglobal:function(e,t){this.global(e,t)},normal:function(e,t){var n=t.argString;if(n&&"!"==n[0]&&(n=n.slice(1),K=!0),n=n.trimStart()){var r=t.line;if("number"==typeof r)for(var i=isNaN(t.lineEnd)?r:t.lineEnd,o=r;o<=i;o++)e.setCursor(o,0),D(e,t.argString.trimStart()),e.state.vim.insertMode&&nt(e,!0);else D(e,t.argString.trimStart()),e.state.vim.insertMode&&nt(e,!0)}else _e(e,"Argument is required.")},global:function(e,t){var n=t.argString;if(n){var r="v"===t.commandName[0];"!"===n[0]&&"g"===t.commandName[0]&&(r=!0,n=n.slice(1));var i=void 0!==t.line?t.line:e.firstLine(),o=t.lineEnd||t.line||e.lastLine(),s=function(e){return De(e,"/")}(n),a=n,l="";if(s&&s.length&&(a=s[0],l=s.slice(1,s.length).join("/")),a)try{qe(e,a,!0,!0)}catch(t){return void _e(e,"Invalid regex: "+a)}for(var c=Pe(e).getQuery(),h=[],u=i;u<=o;u++){var d=e.getLine(u);c.test(d)!==r&&h.push(l?e.getLineHandle(u):d)}if(l){var f=0,m=function(){if(f<h.length){var t=h[f++],n=e.getLineNumber(t);if(null==n)return void m();var r=n+1+l;tt.processCommand(e,r,{callback:m})}else e.releaseLineHandles&&e.releaseLineHandles()};m()}else _e(e,h.join("\n"))}else _e(e,"Regular Expression missing from global")},substitute:function(n,r){if(!n.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var i,o,s,a=r.argString,l=a?De(a,a[0]):[],h="",u="",d=!1,f=!1;if(l&&l.length)h=l[0],M("pcre")&&""!==h&&(h=new RegExp(h).source),void 0!==(u=l[1])&&(u=M("pcre")?function(t){for(var n=new e.StringStream(t),r=[];!n.eol();){for(;n.peek()&&"\\"!=n.peek();)r.push(n.next());var i=!1;for(var o in He)if(n.match(o,!0)){i=!0,r.push(He[o]);break}i||r.push(n.next())}return r.join("")}(u.replace(/([^\\])&/g,"$1$$&")):function(e){for(var t,n=!1,r=[],i=-1;i<e.length;i++){var o=e.charAt(i)||"",s=e.charAt(i+1)||"";We[o+s]?(r.push(We[o+s]),i++):n?(r.push(o),n=!1):"\\"===o?(n=!0,t=s,c.test(t)||"$"===s?r.push("$"):"/"!==s&&"\\"!==s&&r.push("\\")):("$"===o&&r.push("$"),r.push(o),"/"===s&&r.push("\\"))}return r.join("")}(u),L.lastSubstituteReplacePart=u),i=l[2]?l[2].split(" "):[];else if(a&&a.length)return void _e(n,"Substitutions should be of the form :s/pattern/replace/");if(i&&(o=i[0],s=parseInt(i[1]),o&&(-1!=o.indexOf("c")&&(d=!0),-1!=o.indexOf("g")&&(f=!0),h=M("pcre")?h+"/"+o:h.replace(/\//g,"\\/")+"/"+o)),h)try{qe(n,h,!0,!0)}catch(e){return void _e(n,"Invalid regex: "+h)}if(void 0!==(u=u||L.lastSubstituteReplacePart)){var m=Pe(n).getQuery(),p=void 0!==r.line?r.line:n.getCursor().line,g=r.lineEnd||p;p==n.firstLine()&&g==n.lastLine()&&(g=1/0),s&&(g=(p=g)+s-1);var v=te(n,new t(p,0)),y=n.getSearchCursor(m,v);!function(t,n,r,i,o,s,a,l,c){t.state.vim.exMode=!0;var h,u,d,f=!1;function m(){t.operation((function(){for(;!f;)p(),v();y()}))}function p(){var e=t.getRange(s.from(),s.to()).replace(a,l),n=s.to().line;s.replace(e),u=s.to().line,o+=u-n,d=u<n}function g(){var e=h&&se(s.to()),t=s.findNext();return t&&!t[0]&&e&&ae(s.from(),e)&&(t=s.findNext()),t}function v(){for(;g()&&Xe(s.from(),i,o);)if(r||s.from().line!=u||d)return t.scrollIntoView(s.from(),30),t.setSelection(s.from(),s.to()),h=s.from(),void(f=!1);f=!0}function y(e){if(e&&e(),t.focus(),h){t.setCursor(h);var n=t.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=h.ch}c&&c()}function C(n,r,i){switch(e.e_stop(n),V(n)){case"y":p(),v();break;case"n":v();break;case"a":var o=c;c=void 0,t.operation(m),c=o;break;case"l":p();case"q":case"<Esc>":case"<C-c>":case"<C-[>":y(i)}return f&&y(i),!0}if(v(),f)return void _e(t,"No matches for "+a.source);if(!n)return m(),void(c&&c());$e(t,{prefix:je("span","replace with ",je("strong",l)," (y/n/a/q/l)"),onKeyDown:C})}(n,d,f,p,g,y,m,u,r.callback)}else _e(n,"No previous substitute regular expression")},startinsert:function(e,t){D(e,"!"==t.argString?"A":"i",{})},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){Je(e)},yank:function(e){var t=se(e.getCursor()).line,n=e.getLine(t);L.registerController.pushText("0","yank",n,!0,!0)},delete:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;Y.delete(e,{linewise:!0},[{anchor:new t(r,0),head:new t(i+1,0)}])},join:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;e.setCursor(new t(r,0)),ee.joinLines(e,{repeat:i-r},e.state.vim)},delmarks:function(t,n){if(n.argString&&fe(n.argString))for(var r=t.state.vim,i=new e.StringStream(fe(n.argString));!i.eol();){i.eatSpace();var o=i.pos;if(!i.match(/[a-zA-Z]/,!1))return void _e(t,"Invalid argument: "+n.argString.substring(o));var s=i.next();if(i.match("-",!0)){if(!i.match(/[a-zA-Z]/,!1))return void _e(t,"Invalid argument: "+n.argString.substring(o));var a=s,l=i.next();if(!a||!l||g(a)!=g(l))return void _e(t,"Invalid argument: "+a+"-");var c=a.charCodeAt(0),h=l.charCodeAt(0);if(c>=h)return void _e(t,"Invalid argument: "+n.argString.substring(o));for(var u=0;u<=h-c;u++){var d=String.fromCharCode(c+u);delete r.marks[d]}}else s&&delete r.marks[s]}else _e(t,"Argument required")}},tt=new class{constructor(){this.commandMap_,this.buildCommandMap_()}processCommand(e,t,n){var r=this;e.operation((function(){e.curOp.isVimOp=!0,r._processCommand(e,t,n)}))}_processCommand(t,n,r){var i=t.state.vim,o=L.registerController.getRegister(":"),s=o.toString(),a=new e.StringStream(n);o.setText(n);var l,c,h=r||{};h.input=n;try{this.parseInput_(t,a,h)}catch(e){throw _e(t,e+""),e}if(i.visualMode&&we(t),h.commandName){if(l=this.matchCommand_(h.commandName)){if(c=l.name,l.excludeFromCommandHistory&&o.setText(s),this.parseCommandArgs_(a,h,l),"exToKey"==l.type)return void D(t,l.toKeys,l);if("exToEx"==l.type)return void this.processCommand(t,l.toInput)}}else void 0!==h.line&&(c="move");if(c)try{et[c](t,h),l&&l.possiblyAsync||!h.callback||h.callback()}catch(e){throw _e(t,e+""),e}else _e(t,'Not an editor command ":'+n+'"')}parseInput_(e,t,n){t.eatWhile(":"),t.eat("%")?(n.line=e.firstLine(),n.lineEnd=e.lastLine()):(n.line=this.parseLineSpec_(e,t),void 0!==n.line&&t.eat(",")&&(n.lineEnd=this.parseLineSpec_(e,t))),null==n.line?e.state.vim.visualMode?(n.selectionLine=Ze(e,e.state.vim,"<")?.line,n.selectionLineEnd=Ze(e,e.state.vim,">")?.line):n.selectionLine=e.getCursor().line:(n.selectionLine=n.line,n.selectionLineEnd=n.lineEnd);var r=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n.commandName=r?r[1]:t.match(/.*/)[0],n}parseLineSpec_(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var r=t.next(),i=Ze(e,e.state.vim,r);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:return void t.backUp(1)}}parseLineSpecOffset_(e,t){var n=e.match(/^([+-])?(\d+)/);if(n){var r=parseInt(n[2],10);"-"==n[1]?t-=r:t+=r}return t}parseCommandArgs_(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)[0];var r=n.argDelimiter||/\s+/,i=fe(t.argString).split(r);i.length&&i[0]&&(t.args=i)}}matchCommand_(e){for(var t=e.length;t>0;t--){var n=e.substring(0,t);if(this.commandMap_[n]){var r=this.commandMap_[n];if(0===r.name.indexOf(e))return r}}return null}buildCommandMap_(){this.commandMap_={};for(var e=0;e<o.length;e++){var t=o[e],n=t.shortName||t.name;this.commandMap_[n]=t}}map(e,t,n,i){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var o=e.substring(1);":"!=t&&":"==t.charAt(0)?this.commandMap_[o]={name:o,type:"exToEx",toInput:t.substring(1),user:!0}:this.commandMap_[o]={name:o,type:"exToKey",toKeys:t,user:!0}}else{var s={keys:e,type:"keyToKey",toKeys:t,noremap:!!i};n&&(s.context=n),r.unshift(s)}}unmap(e,t){if(":"!=e&&":"==e.charAt(0)){if(t)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return delete this.commandMap_[n],!0}else for(var i=e,o=0;o<r.length;o++)if(i==r[o].keys&&r[o].context===t)return r.splice(o,1),!0}};function nt(t,n){var r=t.state.vim,i=L.macroModeState,o=L.registerController.getRegister("."),s=i.isPlaying,a=i.lastInsertModeChanges;s||(t.off("change",ot),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=void 0,e.off(t.getInputField(),"keydown",ct)),!s&&r.insertModeRepeat>1&&(ht(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,n||t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),o.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),i.isRecording&&function(e){if(e.isPlaying)return;var t=e.latestRegister,n=L.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}(i)}function rt(e){r.unshift(e)}function it(e,t,n,r){var i=L.registerController.getRegister(r);if(":"==r)return i.keyBuffer[0]&&tt.processCommand(e,i.keyBuffer[0]),void(n.isPlaying=!1);var o=i.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var a=0;a<o.length;a++)for(var l,c,h=o[a],u=/<(?:[CSMA]-)*\w+>|./gi;l=u.exec(h);)if(c=l[0],I.handleKey(e,c,"macro"),t.insertMode){var d=i.insertModeChanges[s++].changes;L.macroModeState.lastInsertModeChanges.changes=d,dt(e,d,1),nt(e)}n.isPlaying=!1}function ot(e,t){var n=L.macroModeState,r=n.lastInsertModeChanges;if(!n.isPlaying)for(var i=e.state.vim;t;){if(r.expectCursorActivityForChange=!0,r.ignoreCount>1)r.ignoreCount--;else if("+input"==t.origin||"paste"==t.origin||void 0===t.origin){var o=e.listSelections().length;o>1&&(r.ignoreCount=o);var s=t.text.join("\n");if(r.maybeReset&&(r.changes=[],r.maybeReset=!1),s)if(e.state.overwrite&&!/\n/.test(s))r.changes.push([s]);else{if(s.length>1){var a=i&&i.insertEnd&&i.insertEnd.find(),l=e.getCursor();if(a&&a.line==l.line){var c=a.ch-l.ch;c>0&&c<s.length&&(r.changes.push([s,c]),s="")}}s&&r.changes.push(s)}}t=t.next}}function st(e){var t=e.state.vim;if(t.insertMode){var n=L.macroModeState;if(n.isPlaying)return;var r=n.lastInsertModeChanges;r.expectCursorActivityForChange?r.expectCursorActivityForChange=!1:(r.maybeReset=!0,t.insertEnd&&t.insertEnd.clear(),t.insertEnd=e.setBookmark(e.getCursor(),{insertLeft:!0}))}else e.curOp?.isVimOp||at(e,t)}function at(t,n){var r=t.getCursor("anchor"),i=t.getCursor("head");if(n.visualMode&&!t.somethingSelected()?we(t,!1):n.visualMode||n.insertMode||!t.somethingSelected()||(n.visualMode=!0,n.visualLine=!1,e.signal(t,"vim-mode-change",{mode:"visual"})),n.visualMode){var o=le(i,r)?0:-1,s=le(i,r)?-1:0;i=re(i,0,o),r=re(r,0,s),n.sel={anchor:r,head:i},Te(t,n,"<",ce(i,r)),Te(t,n,">",he(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function lt(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}function ct(t){var n=L.macroModeState.lastInsertModeChanges,r=e.keyName?e.keyName(t):t.key;r&&(-1==r.indexOf("Delete")&&-1==r.indexOf("Backspace")||(n.maybeReset&&(n.changes=[],n.maybeReset=!1),n.changes.push(new lt(r,t))))}function ht(e,t,n,r){var i=L.macroModeState;i.isPlaying=!0;var o=t.lastEditActionCommand,s=t.inputState;function a(){o?X.processAction(e,t,o):X.evalInput(e,t)}function l(n){if(i.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=i.lastInsertModeChanges;dt(e,r.changes,n)}}if(t.inputState=t.lastEditInputState,o&&o.interlaceInsertRepeat)for(var c=0;c<n;c++)a(),l(1);else r||a(),l(n);t.inputState=s,t.insertMode&&!r&&nt(e),i.isPlaying=!1}function ut(t,n){e.lookupKey(n,"vim-insert",(function(n){return"string"==typeof n?e.commands[n](t):n(t),!0}))}function dt(e,t,n){var r=e.getCursor("head"),i=L.macroModeState.lastInsertModeChanges.visualBlock;i&&(ge(e,r,i+1),n=e.listSelections().length,e.setCursor(r));for(var o=0;o<n;o++){i&&e.setCursor(re(r,o,0));for(var s=0;s<t.length;s++){var a=t[s];if(a instanceof lt)ut(e,a.keyName);else if("string"==typeof a)e.replaceSelection(a);else{var l=e.getCursor(),c=re(l,0,a[0].length-(a[1]||0));e.replaceRange(a[0],l,a[1]?l:c),e.setCursor(c)}}}i&&e.setCursor(re(r,0,1))}function ft(e){var t=new e.constructor;return Object.keys(e).forEach((function(n){if("insertEnd"!=n){var r=e[n];Array.isArray(r)?r=r.slice():r&&"object"==typeof r&&r.constructor!=Object&&(r=ft(r)),t[n]=r}})),e.sel&&(t.sel={head:e.sel.head&&se(e.sel.head),anchor:e.sel.anchor&&se(e.sel.anchor)}),t}return x("insertModeEscKeysTimeout",200,"number"),R(),I}function w(e,t){var n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var i=e.line(r);return Math.min(i.from+Math.max(0,n),i.to)}function k(e,t){let n=e.lineAt(t);return{line:n.number-1,ch:t-n.from}}class x{constructor(e,t){this.line=e,this.ch=t}}function S(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||[]).concat(n)}}function M(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{var r=e._handlers,i=r&&r[t];if(i){var o=i.indexOf(n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function L(e,t,...n){var r,i=null===(r=e._handlers)||void 0===r?void 0:r[t];if(i)for(var o=0;o<i.length;++o)i[o](...n)}function b(e,...t){if(e)for(var n=0;n<e.length;++n)e[n](...t)}let A;try{A=new RegExp("[\\w\\p{Alphabetic}\\p{Number}_]","u")}catch(e){A=/[\w]/}function E(e,t){var n=e.cm6;if(!n.state.readOnly){var r="input.type.compose";if(e.curOp&&(e.curOp.lastChange||(r="input.type.compose.start")),t.annotations)try{t.annotations.some((function(e){"input"==e.value&&(e.value=r)}))}catch(e){console.error(e)}else t.userEvent=r;return n.dispatch(t)}}function O(t,n){var r;t.curOp&&(t.curOp.$changeStart=void 0),(n?e.undo:e.redo)(t.cm6);let i=null===(r=t.curOp)||void 0===r?void 0:r.$changeStart;null!=i&&t.cm6.dispatch({selection:{anchor:i}})}class T{constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}openDialog(e,t,n){return function(e,t,n,r){r||(r={});B(e,void 0);var i=R(e,t,r.bottom),o=!1;function s(t){if("string"==typeof t)a.value=t;else{if(o)return;o=!0,N(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}I(e,i);var a=i.getElementsByTagName("input")[0];a&&(r.value&&(a.value=r.value,!1!==r.selectValueOnOpen&&a.select()),r.onInput&&T.on(a,"input",(function(e){r.onInput(e,a.value,s)})),r.onKeyUp&&T.on(a,"keyup",(function(e){r.onKeyUp(e,a.value,s)})),T.on(a,"keydown",(function(e){r&&r.onKeyDown&&r.onKeyDown(e,a.value,s)||(13==e.keyCode&&n(a.value),(27==e.keyCode||!1!==r.closeOnEnter&&13==e.keyCode)&&(a.blur(),T.e_stop(e),s()))})),!1!==r.closeOnBlur&&T.on(a,"blur",(function(){setTimeout((function(){document.activeElement!==a&&s()}))})),a.focus());return s}(this,e,t,n)}openNotification(e,t){return function(e,t,n){B(e,a);var r,i=R(e,t,n&&n.bottom),o=!1,s=n&&void 0!==n.duration?n.duration:5e3;function a(){o||(o=!0,clearTimeout(r),i.remove(),N(e,i))}i.onclick=function(e){e.preventDefault(),a()},I(e,i),s&&(r=setTimeout(a,s));return a}(this,e,t)}on(e,t){S(this,e,t)}off(e,t){M(this,e,t)}signal(e,t,n){L(this,e,t,n)}indexFromPos(e){return w(this.cm6.state.doc,e)}posFromIndex(e){return k(this.cm6.state.doc,e)}foldCode(t){let n=this.cm6,r=n.state.selection.ranges,i=w(this.cm6.state.doc,t),o=e.EditorSelection.create([e.EditorSelection.range(i,i)],0).ranges;n.state.selection.ranges=o,e.foldCode(n),n.state.selection.ranges=r}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,t){"object"==typeof e&&(t=e.ch,e=e.line);var n=w(this.cm6.state.doc,{line:e,ch:t||0});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var t=this.cm6.state.selection.main,n="head"!=e&&e?"anchor"==e?t.anchor:"start"==e?t.from:"end"==e?t.to:null:t.head;if(null==n)throw new Error("Invalid cursor type");return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map((t=>({anchor:k(e,t.anchor),head:k(e,t.head)})))}setSelections(t,n){var r=this.cm6.state.doc,i=t.map((t=>{var n=w(r,t.head),i=w(r,t.anchor);return n==i?e.EditorSelection.cursor(n,1):e.EditorSelection.range(i,n)}));this.cm6.dispatch({selection:e.EditorSelection.create(i,n)})}setSelection(e,t,n){this.setSelections([{anchor:e,head:t}],0),n&&"*mouse"==n.origin&&this.onBeforeEndOperation()}getLine(e){var t=this.cm6.state.doc;return e<0||e>=t.lines?"":this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:e,index:this.indexFromPos(new x(e,0))}}getLineNumber(t){var n=this.$lineHandleChanges;if(!n)return null;for(var r=t.index,i=0;i<n.length;i++)if(null==(r=n[i].changes.mapPos(r,1,e.MapMode.TrackAfter)))return null;var o=this.posFromIndex(r);return 0==o.ch?o.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(e,t){var n=this.cm6.state.doc;return this.cm6.state.sliceDoc(w(n,e),w(n,t))}replaceRange(e,t,n,r){n||(n=t);var i=this.cm6.state.doc;E(this,{changes:{from:w(i,t),to:w(i,n),insert:e}})}replaceSelection(e){E(this,this.cm6.state.replaceSelection(e))}replaceSelections(e){E(this,{changes:this.cm6.state.selection.ranges.map(((t,n)=>({from:t.from,to:t.to,insert:e[n]||""})))})}getSelection(){return this.getSelections().join("\n")}getSelections(){var e=this.cm6;return e.state.selection.ranges.map((t=>e.state.sliceDoc(t.from,t.to)))}somethingSelected(){return this.cm6.state.selection.ranges.some((e=>!e.empty))}getInputField(){return this.cm6.contentDOM}clipPos(e){var t=this.cm6.state.doc,n=e.ch,r=e.line+1;r<1&&(r=1,n=0),r>t.lines&&(r=t.lines,n=Number.MAX_VALUE);var i=t.line(r);return n=Math.min(Math.max(0,n),i.to-i.from),new x(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(t){var n=this.cm6;return n.dispatch({changes:{from:0,to:n.state.doc.length,insert:t},selection:e.EditorSelection.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(t,n){var r=this.cm6.state,i=w(r.doc,t),o=e.matchBrackets(r,i+1,-1);return o&&o.end||(o=e.matchBrackets(r,i,1))&&o.end?{to:k(r.doc,o.end.from)}:{to:void 0}}scanForBracket(e,t,n,r){return function(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,a=[],l=function(e){return e&&e.bracketRegex||/[(){}[\]]/}(i),c=n>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),h=t.line;h!=c;h+=n){var u=e.getLine(h);if(u){var d=n>0?0:u.length-1,f=n>0?u.length:-1;if(!(u.length>o))for(h==t.line&&(d=t.ch-(n<0?1:0));d!=f;d+=n){var m=u.charAt(d);if(l.test(m)){var p=K[m];if(p&&">"==p.charAt(1)==n>0)a.push(m);else{if(!a.length)return{pos:new x(h,d),ch:m};a.pop()}}}}}return h-n!=(n>0?e.lastLine():e.firstLine())&&null}(this,e,t,0,r)}indentLine(e,t){t?this.indentMore():this.indentLess()}indentMore(){e.indentMore(this.cm6)}indentLess(){e.indentLess(this.cm6)}execCommand(t){if("indentAuto"==t)T.commands.indentAuto(this);else if("goLineLeft"==t)e.cursorLineBoundaryBackward(this.cm6);else if("goLineRight"==t){e.cursorLineBoundaryForward(this.cm6);let t=this.cm6.state,n=t.selection.main.head;n<t.doc.length&&"\n"!==t.sliceDoc(n,n+1)&&e.cursorCharBackward(this.cm6)}else console.log(t+" is not implemented")}setBookmark(e,t){var n=(null==t?void 0:t.insertLeft)?1:-1,r=this.indexFromPos(e);return new D(this,r,n)}addOverlay({query:e}){let t=new h({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(t.valid){t.forVim=!0,this.cm6Query=t;let e=y.of(t);return this.cm6.dispatch({effects:e}),t}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let t=y.of(this.cm6Query);this.cm6.dispatch({effects:t})}getSearchCursor(e,t){var n=this,r=null,i=null;null==t.ch&&(t.ch=Number.MAX_VALUE);var s=w(n.cm6.state.doc,t),a=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,(function(e,t){return t||"\\"+e}));function l(t,n=0,r=t.length){return new o(t,a,{ignoreCase:e.ignoreCase},n,r)}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;if(e){let e=r?r.from==r.to?r.to-1:r.from:s;r=function(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-1e4*n),o=l(r,i,t),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==e||s.from>i+10))return s;if(i==e)return null}}(0,e)}else{let e=r?r.from==r.to?r.to+1:r.to:s;r=function(e){var t=n.cm6.state.doc;if(e>t.length)return null;let r=l(t,e).next();return r.done?null:r.value}(e)}return i=r&&{from:k(t,r.from),to:k(t,r.to),match:r.match},r&&r.match},from:function(){return null==i?void 0:i.from},to:function(){return null==i?void 0:i.to},replace:function(e){r&&(E(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=k(n.cm6.state.doc,r.to)))}}}findPosV(t,n,r,i){let{cm6:o}=this;const s=o.state.doc;let a="page"==r?o.dom.clientHeight:0;const l=w(s,t);let c=e.EditorSelection.cursor(l,1,void 0,i),h=Math.round(Math.abs(n));for(let e=0;e<h;e++)"page"==r?c=o.moveVertically(c,n>0,a):"line"==r&&(c=o.moveVertically(c,n>0));let u=k(s,c.head);return(n<0&&0==c.head&&0!=i&&0==t.line&&0!=t.ch||n>0&&c.head==s.length&&u.ch!=i&&t.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=w(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),o=-n.top;return{left:((null==i?void 0:i.left)||0)-n.left,top:((null==i?void 0:i.top)||0)+o,bottom:((null==i?void 0:i.bottom)||0)+o}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return k(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){null!=e&&(this.cm6.scrollDOM.scrollLeft=e),null!=t&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(t,n){if(t){var r=this.indexFromPos(t);this.cm6.dispatch({effects:e.EditorView.scrollIntoView(r)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:"scroll"})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption("mode")}}setSize(e,t){this.cm6.dom.style.width=e+4+"px",this.cm6.dom.style.height=t+"px",this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let t in this.marks){this.marks[t].update(e.changes)}this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map((t=>t.map(e.changes))));var t=this.curOp=this.curOp||{};e.changes.iterChanges(((e,n,r,i,o)=>{(null==t.$changeStart||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var s={text:o.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=s:t.lastChange=t.change=s}),!0),t.changeHandlers||(t.changeHandlers=this._handlers.change&&this._handlers.change.slice())}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||(e.cursorActivityHandlers=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice()),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||(this.curOp={$d:0}),this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&b(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(b(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if("char"==t){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case"keyMap":this.state.keyMap=t;break;case"textwidth":this.state.textwidth=t}}getOption(t){switch(t){case"firstLineNumber":return 1;case"tabSize":return this.cm6.state.tabSize||4;case"readOnly":return this.cm6.state.readOnly;case"indentWithTabs":return"\t"==this.cm6.state.facet(e.indentUnit);case"indentUnit":return this.cm6.state.facet(e.indentUnit).length||2;case"textwidth":return this.state.textwidth;case"keyMap":return this.state.keyMap||"vim"}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(t){var n,r=this.indexFromPos(t),i=e.ensureSyntaxTree(this.cm6.state,r),o=null==i?void 0:i.resolve(r),s=(null===(n=null==o?void 0:o.type)||void 0===n?void 0:n.name)||"";return/comment/i.test(s)?"comment":/string/i.test(s)?"string":""}overWriteSelection(t){var n=this.cm6.state.doc,r=this.cm6.state.selection,i=r.ranges.map((t=>{if(t.empty){var r=t.to<n.length?n.sliceString(t.from,t.to+1):"";if(r&&!/\n/.test(r))return e.EditorSelection.range(t.from,t.to+1)}return t}));this.cm6.dispatch({selection:e.EditorSelection.create(i,r.mainIndex)}),this.replaceSelection(t)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(t){var n=this.cm6.state.selection;this.virtualSelection=e.EditorSelection.create(n.ranges,n.mainIndex);for(var r=0;r<this.virtualSelection.ranges.length;r++){var i=this.virtualSelection.ranges[r];i&&(this.cm6.dispatch({selection:e.EditorSelection.create([i])}),t(),this.virtualSelection.ranges[r]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(e){return function(e,t){var n,r=t.column||e.getOption("textwidth")||80,i=0!=t.allowMerge,o=Math.min(t.from,t.to),s=Math.max(t.from,t.to);for(;o<=s;){var a=e.getLine(o);if(a.length>r){if(h=m(a,r,5)){var l=null===(n=/^\s*/.exec(a))||void 0===n?void 0:n[0];e.replaceRange("\n"+l,new x(o,h.start),new x(o,h.end))}s++}else if(i&&/\S/.test(a)&&o!=s){var c=e.getLine(o+1);if(c&&/\S/.test(c)){var h,u=a.replace(/\s+$/,""),d=c.replace(/^\s+/,""),f=u+" "+d;(h=m(f,r,5))&&h.start>u.length||f.length<r?(e.replaceRange(" ",new x(o,u.length),new x(o+1,c.length-d.length)),o--,s--):u.length<a.length&&e.replaceRange("",new x(o,u.length),new x(o,a.length))}}o++}return o;function m(e,t,n){if(!(e.length<t)){var r=e.slice(0,t),i=e.slice(t),o=/^(?:(\s+)|(\S+)(\s+))/.exec(i),s=/(?:(\s+)|(\s+)(\S+))$/.exec(r),a=0,l=0;return s&&!s[2]&&(a=t-s[1].length,l=t),o&&!o[2]&&(a||(a=t),l=t+o[1].length),a?{start:a,end:l}:s&&s[2]&&s.index>n?{start:s.index,end:s.index+s[2].length}:o&&o[2]?{start:a=t+o[2].length,end:a+o[3].length}:void 0}}}(this,e)}}function R(e,t,n){var r=document.createElement("div");return r.appendChild(t),r}function B(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function I(e,t){var n=e.state.dialog;e.state.dialog=t,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),T.signal(e,"dialog"))}function N(e,t){e.state.dialog==t&&(e.state.dialog=null,T.signal(e,"dialog"))}T.isMac="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),T.Pos=x,T.StringStream=e.StringStream,T.commands={cursorCharLeft:function(t){e.cursorCharLeft(t.cm6)},redo:function(e){O(e,!1)},undo:function(e){O(e,!0)},newlineAndIndent:function(t){e.insertNewlineAndIndent({state:t.cm6.state,dispatch:e=>E(t,e)})},indentAuto:function(t){e.indentSelection(t.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},T.isWordChar=function(e){return A.test(e)},T.keys={},T.addClass=function(e,t){},T.rmClass=function(e,t){},T.e_preventDefault=function(e){e.preventDefault()},T.e_stop=function(e){var t,n;null===(t=null==e?void 0:e.stopPropagation)||void 0===t||t.call(e),null===(n=null==e?void 0:e.preventDefault)||void 0===n||n.call(e)},T.lookupKey=function(e,t,n){var r=T.keys[e];r&&n(r)},T.on=S,T.off=M,T.signal=L,T.findMatchingTag=function(e,t){},T.findEnclosingTag=function(t,n){var r,i,o=t.cm6.state,s=t.indexFromPos(n);if(s<o.doc.length){"<"==o.sliceDoc(s,s+1)&&s++}var a=e.ensureSyntaxTree(o,s),l=(null==a?void 0:a.resolve(s))||null;for(;l;){if("OpenTag"==(null===(r=l.firstChild)||void 0===r?void 0:r.type.name)&&"CloseTag"==(null===(i=l.lastChild)||void 0===i?void 0:i.type.name))return{open:P(o.doc,l.firstChild),close:P(o.doc,l.lastChild)};l=l.parent}},T.keyName=void 0;var K={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function P(e,t){return{from:k(e,t.from),to:k(e,t.to)}}class D{constructor(e,t,n){this.cm=e,this.id=e.$mid++,this.offset=t,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return null==this.offset?null:this.cm.posFromIndex(this.offset)}update(t){null!=this.offset&&(this.offset=t.mapPos(this.offset,this.assoc,e.MapMode.TrackDel))}}let F=e.getDrawSelectionConfig||function(){let e={cursorBlinkRate:1200};return function(){return e}}();class W{constructor(e,t,n,r,i,o,s,a,l,c){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=o,this.color=s,this.className=a,this.letter=l,this.partial=c}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",e.style.height=this.height+"px",e.style.lineHeight=this.height+"px",e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?"transparent":this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}}class H{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer cm-vimCursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=F(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+"ms"}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName="cm-blink"==this.cursorLayer.style.animationName?"cm-blink2":"cm-blink"),function(e){return F(e.startState)!=F(e.state)}(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=_(this.cm,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some(((e,t)=>!e.eq(this.cursors[t])))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent="";for(const t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach(((e,n)=>e.adjust(t[n])));this.cursors=e}}destroy(){this.cursorLayer.remove()}}const V={".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-fat-cursor":{position:"absolute",background:"#ff9696",border:"none",whiteSpace:"pre"},"&:not(.cm-focused) .cm-fat-cursor":{background:"none",outline:"solid 1px #ff9696",color:"transparent !important"}},j=e.Prec.highest(e.EditorView.theme(V));function _(t,n,r,i){var o,s;let a=r.head,l=!1,c=1,h=t.state.vim;if(h&&(!h.insertMode||t.state.overwrite)){if(l=!0,h.visualBlock&&!i)return null;r.anchor<r.head&&a--,t.state.overwrite?c=.2:h.status&&(c=.5)}if(l){let t=a<n.state.doc.length&&n.state.sliceDoc(a,a+1);t&&/[\uDC00-\uDFFF]/.test(t)&&a>1&&(a--,t=n.state.sliceDoc(a,a+1));let r=n.coordsAtPos(a,1);if(!r)return null;let l=function(t){let n=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==e.Direction.LTR?n.left:n.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}(n),h=n.domAtPos(a),d=h?h.node:n.contentDOM;for(;h&&h.node instanceof HTMLElement;)d=h.node,h={node:h.node.childNodes[h.offset],offset:0};if(!(d instanceof HTMLElement)){if(!d.parentNode)return null;d=d.parentNode}let f=getComputedStyle(d),m=r.left,p=null===(s=(o=n).coordsForChar)||void 0===s?void 0:s.call(o,a);if(p&&(m=p.left),t&&"\n"!=t&&"\r"!=t)if("\t"==t){t=" ";var u=n.coordsAtPos(a+1,-1);u&&(m=u.left-(u.left-r.left)/parseInt(f.tabSize))}else/[\uD800-\uDBFF]/.test(t)&&a<n.state.doc.length-1&&(t+=n.state.sliceDoc(a+1,a+2));else t=" ";let g=r.bottom-r.top;return new W(m-l.left,r.top-l.top+g*(1-c),g*c,f.fontFamily,f.fontSize,f.fontWeight,f.color,i?"cm-fat-cursor cm-cursor-primary":"cm-fat-cursor cm-cursor-secondary",t,1!=c)}return null}var $="undefined"!=typeof navigator&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent);const q=C(T),U=e.EditorView.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:"none"},".cm-vim-panel":{padding:"0px 10px",fontFamily:"monospace",minHeight:"1.3em"},".cm-vim-panel input":{border:"none",outline:"none",backgroundColor:"inherit"},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"}}),Q=e.ViewPlugin.fromClass(class{constructor(t){this.status="",this.query=null,this.decorations=e.Decoration.none,this.waitForCopy=!1,this.lastKeydown="",this.useNextTextInput=!1,this.compositionText="",this.view=t;const n=this.cm=new T(t);q.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new H(t,n),this.updateClass(),this.cm.on("vim-command-done",(()=>{n.state.vim&&(n.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()})),this.cm.on("vim-mode-change",(e=>{n.state.vim&&(n.state.vim.mode=e.mode,e.subMode&&(n.state.vim.mode+=" block"),n.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())})),this.cm.on("dialog",(()=>{this.cm.state.statusbar?this.updateStatus():t.dispatch({effects:J.of(!!this.cm.state.dialog)})})),this.dom=document.createElement("span"),this.dom.style.cssText="position: absolute; right: 10px; top: 1px",this.statusButton=document.createElement("span"),this.statusButton.onclick=e=>{q.handleKey(this.cm,"<Esc>","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(e){var t;if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions)for(let n of e.transactions)for(let e of n.effects)if(e.is(y)){if(null===(t=e.value)||void 0===t?void 0:t.forVim){let t=e.value.create();this.highlight(t)}else this.highlight(null)}this.blockCursor.update(e)}updateClass(){const e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent="",e.appendChild(n));else{e.textContent="";var r=(t.mode||"normal").toUpperCase();t.insertModeReturn&&(r+="(C-O)"),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){q.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(t){if(this.query=t,!t)return this.decorations=e.Decoration.none;let{view:n}=this,r=new e.RangeSetBuilder;for(let e=0,i=n.visibleRanges,o=i.length;e<o;e++){let{from:s,to:a}=i[e];for(;e<o-1&&a>i[e+1].from-500;)a=i[++e].to;t.highlight(n.state,s,a,((e,t)=>{r.add(e,t,z)}))}return this.decorations=r.finish()}handleKey(e,t){const n=this.cm;let r=n.state.vim;if(!r)return;const i=q.vimKeyFromEvent(e,r);if(T.signal(this.cm,"inputEvent",{type:"handleKey",key:i}),!i)return;if("<Esc>"==i&&!r.insertMode&&!r.visualMode&&this.query){const e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if("<C-c>"===i&&!T.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||"")+i;let o=q.multiSelectHandleKey(n,i,"user");return r=q.maybeInitVimState_(n),!o&&r.insertMode&&n.state.overwrite&&(e.key&&1==e.key.length&&!/\n/.test(e.key)?(o=!0,n.overWriteSelection(e.key)):"Backspace"==e.key&&(o=!0,T.commands.cursorCharLeft(n))),o&&(T.signal(this.cm,"vim-keypress",i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!o}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then((()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation((()=>{e.curOp&&(e.curOp.isVimOp=!0),q.handleKey(e,"<Esc>","user")})))})))},compositionstart:function(e,t){this.useNextTextInput=!0,T.signal(this.cm,"inputEvent",e)},compositionupdate:function(e,t){T.signal(this.cm,"inputEvent",e)},compositionend:function(e,t){T.signal(this.cm,"inputEvent",e)},keypress:function(e,t){T.signal(this.cm,"inputEvent",e),"Dead"==this.lastKeydown&&this.handleKey(e,t)},keydown:function(e,t){T.signal(this.cm,"inputEvent",e),this.lastKeydown=e.key,"Unidentified"==this.lastKeydown||"Process"==this.lastKeydown||"Dead"==this.lastKeydown?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[e.EditorView.inputHandler.of(((e,t,n,r)=>{var i,o,s=Y(e);if(!s)return!1;var a=null===(i=s.state)||void 0===i?void 0:i.vim,l=s.state.vimPlugin;if(a&&!a.insertMode&&!(null===(o=s.curOp)||void 0===o?void 0:o.isVimOp)){if("\0\0"===r)return!0;if(T.signal(s,"inputEvent",{type:"text",text:r,from:t,to:n}),1==r.length&&l.useNextTextInput){if(a.expectLiteralNext&&e.composing)return l.compositionText=r,!1;if(l.compositionText){var c=l.compositionText;l.compositionText="";var h=e.state.selection.main.head;if(c===e.state.sliceDoc(h-c.length,h)){var u=s.getCursor();s.replaceRange("",s.posFromIndex(h-c.length),u)}}return l.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),function(e){var t=e.scrollDOM.parentElement;if(!t)return;if($)return e.contentDOM.textContent="\0\0",void e.contentDOM.dispatchEvent(new CustomEvent("compositionend"));var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}(e),!0}}return!1}))],decorations:e=>e.decorations});const z=e.Decoration.mark({class:"cm-searchMatch"}),J=e.StateEffect.define(),X=e.StateField.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(J)&&(e=n.value);return e},provide:t=>e.showPanel.from(t,(e=>e?G:null))});function G(e){let t=document.createElement("div");t.className="cm-vim-panel";let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function Z(e){let t=document.createElement("div");t.className="cm-vim-panel";let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function Y(e){return e.cm||null}exports.CodeMirror=T,exports.Vim=q,exports.getCM=Y,exports.vim=function(t={}){return[U,Q,j,t.status?e.showPanel.of(Z):X]};
|
|
2
|
-
//# sourceMappingURL=vendor_vim-BHa51_r7.js.map
|