diff options
author | Wu Cheng-Han | 2016-09-18 16:40:51 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-09-18 16:40:51 +0800 |
commit | 42145e401983994d813ce0bf0ea775e6473a070e (patch) | |
tree | af5a660005f2e7d267953e2b0d61b668e30f86e6 /public/vendor | |
parent | 591134007ca70a542239badc61073f0be515abf4 (diff) |
Update to support tiddlywiki and mediawiki syntax highlighting in editor
Diffstat (limited to 'public/vendor')
-rw-r--r-- | public/vendor/codemirror/codemirror.min.js | 32 | ||||
-rw-r--r-- | public/vendor/codemirror/compress.sh | 2 | ||||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/README.salvus | 16 | ||||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/img/black4.png | bin | 0 -> 91 bytes | |||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/img/ext2.png | bin | 0 -> 91 bytes | |||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/img/ext4.png | bin | 0 -> 91 bytes | |||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/img/link4.png | bin | 0 -> 91 bytes | |||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/img/template4.png | bin | 0 -> 91 bytes | |||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/img/template8.png | bin | 0 -> 91 bytes | |||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/mediawiki.css | 110 | ||||
-rwxr-xr-x | public/vendor/codemirror/mode/mediawiki/mediawiki.js | 791 |
11 files changed, 935 insertions, 16 deletions
diff --git a/public/vendor/codemirror/codemirror.min.js b/public/vendor/codemirror/codemirror.min.js index 869690ee..e4bf1f6e 100644 --- a/public/vendor/codemirror/codemirror.min.js +++ b/public/vendor/codemirror/codemirror.min.js @@ -1,16 +1,16 @@ -!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Di(n):{},Di(ra,n,!1),p(n);var i=n.value;"string"==typeof i&&(i=new Ma(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Oo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new zi,keySeq:null,specialChars:null};var l=this;xo&&wo<11&&setTimeout(function(){l.display.input.reset(!0)},20),$t(this),Yi(),wt(this),this.curOp.forceUpdate=!0,Qn(this,i),n.autofocus&&!Oo||l.hasFocus()?setTimeout(Bi(yr,this),20):br(this);for(var u in na)na.hasOwnProperty(u)&&na[u](this,n[u],ia);w(this),n.finishInit&&n.finishInit(this);for(var f=0;f<la.length;++f)la[f](this);Ct(this),_o&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=$i("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=$i("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=$i("div",null,"CodeMirror-code"),n.selectionDiv=$i("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=$i("div",null,"CodeMirror-cursors"),n.measure=$i("div",null,"CodeMirror-measure"),n.lineMeasure=$i("div",null,"CodeMirror-measure"),n.lineSpace=$i("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=$i("div",[$i("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=$i("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=$i("div",null,null,"position: absolute; height: "+Ra+"px; width: 1px;"),n.gutters=$i("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=$i("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=$i("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),xo&&wo<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),_o||yo&&Oo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Be(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(es(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ja(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Rt(e),ct(e),setTimeout(function(){y(e)},100)}function o(e){var t=kt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/xt(e.display)-3);return function(i){if(Cn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&ri(e,t)})}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ct(e)}function l(e){c(e),Rt(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;Ui(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild($i("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function f(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=vn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=yn(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function d(e){var t=e.display,r=e.doc;t.maxLine=Jn(r,r.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=f(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function p(e){var t=qi(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ue(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function m(e,t,r){this.cm=r;var n=this.vert=$i("div",[$i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=$i("div",[$i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),za(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),za(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,xo&&wo<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ja(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),za(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?ar(t,e):or(t,e)},t),t.display.scrollbars.addClass&&es(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,h(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function k(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-$e(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ii(t,n),a=ii(t,i);if(r&&r.ensure){var s=r.ensure.from.line,l=r.ensure.to.line;s<o?(o=s,a=ii(t,oi(Jn(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ii(t,oi(Jn(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var s=r[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function w(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=_(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild($i("div",[$i("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function _(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function C(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function S(e,t,r){var n=e.display;this.viewport=t,this.visible=k(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ge(e),this.force=r,this.dims=I(e),this.events=[]}function M(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ve(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ve(e)+"px",t.scrollbarsClipped=!0)}function L(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Dt(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Ht(e))return!1;w(e)&&(Dt(e),t.dims=I(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Do&&(o=wn(e.doc,o),a=_n(e.doc,a));var s=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Wt(e,o,a),r.viewOffset=oi(Jn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=Ht(e);if(!s&&0==l&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Vi();return l>4&&(r.lineDiv.style.display="none"),N(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Vi()!=c&&c.offsetHeight&&c.focus(),Ui(r.cursorDiv),Ui(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Be(e,400)),r.updateLineNumbers=null,!0}function T(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ge(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ue(e.display)-Xe(e),r.top)}),t.visible=k(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&L(e,t);n=!1){O(e);var i=h(e);qe(e),y(e,i),E(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new S(e,t);if(L(e,r)){O(e),T(e,r);var n=h(e);qe(e),y(e,n),E(e,n),r.finish()}}function E(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ve(e)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(xo&&wo<8){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(i<2&&(i=kt(t)),(l>.001||l<-.001)&&(ri(o.line,i),z(o.line),o.rest))for(var c=0;c<o.rest.length;c++)z(o.rest[c])}}}function z(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function I(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:C(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function N(e,t,r){function n(t){var r=t.nextSibling;return _o&&zo&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,s=a.firstChild,l=i.view,c=i.viewFrom,u=0;u<l.length;u++){var f=l[u];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;s!=f.node;)s=n(s);var d=o&&null!=t&&t<=c&&f.lineNumber;f.changes&&(qi(f.changes,"gutter")>-1&&(d=!1),q(e,f,c,r)),d&&(Ui(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(_(e.options,c)))),s=f.node.nextSibling}else{var p=H(e,f,c,r);a.insertBefore(p,s)}c+=f.size}for(;s;)s=n(s)}function q(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?D(e,t):"gutter"==o?F(e,t,r,n):"class"==o?B(t):"widget"==o&&W(e,t,n)}t.changes=null}function P(e){return e.node==e.text&&(e.node=$i("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),xo&&wo<8&&(e.node.style.zIndex=2)),e.node}function R(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=P(e);e.background=r.insertBefore($i("div",null,t),r.firstChild)}}function j(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Bn(e,t)}function D(e,t){var r=t.text.className,n=j(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,B(t)):r&&(t.text.className=r)}function B(e){R(e),e.line.wrapClass?P(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function F(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=P(t);t.gutterBackground=$i("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=P(t),a=t.gutter=$i("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild($i("div",_(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.options.gutters.length;++s){var l=e.options.gutters[s],c=o.hasOwnProperty(l)&&o[l];c&&a.appendChild($i("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[l]+"px; width: "+n.gutterWidth[l]+"px"))}}}function W(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}U(e,t,r)}function H(e,t,r,n){var i=j(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),B(t),F(e,t,r,n),U(e,t,n),t.node}function U(e,t,r){if(K(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)K(e,t.rest[n],t,r,!1)}function K(e,t,r,n,i){if(t.widgets)for(var o=P(r),a=0,s=t.widgets;a<s.length;++a){var l=s[a],c=$i("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),V(l,c,r,n),e.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Mi(l,"redraw")}}function V(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function G(e){return Bo(e.line,e.ch)}function X(e,t){return Fo(e,t)<0?t:e}function Z(e,t){return Fo(e,t)<0?e:t}function Y(e){e.state.focused||(e.display.input.focus(),yr(e))}function Q(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i,s=o.splitLines(t),l=null;if(a&&n.ranges.length>1)if(Wo&&Wo.text.join("\n")==t){if(n.ranges.length%Wo.text.length==0){l=[];for(var c=0;c<Wo.text.length;c++)l.push(o.splitLines(Wo.text[c]))}}else s.length==n.ranges.length&&(l=Pi(s,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var u=n.ranges[c],f=u.from(),d=u.to();u.empty()&&(r&&r>0?f=Bo(f.line,f.ch-r):e.state.overwrite&&!a?d=Bo(d.line,Math.min(Jn(o,d.line).text.length,d.ch+Ni(s).length)):Wo&&Wo.lineWise&&Wo.text.join("\n")==t&&(f=d=Bo(f.line,0)));var p=e.curOp.updateInput,h={from:f,to:d,text:l?l[c%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Lr(e.doc,h),Mi(e,"inputRead",e,h)}t&&!a&&ee(e,t),Dr(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ot(t,function(){Q(t,r,0,null,"paste")}),!0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){a=Fr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Jn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fr(e,i.head.line,"smart"));a&&Mi(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:Bo(i,0),head:Bo(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function re(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function ne(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new zi,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ie(){var e=$i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=$i("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return _o?e.style.width="1000px":e.setAttribute("wrap","off"),Eo&&(e.style.border="1px solid black"),re(e),t}function oe(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new zi,this.gracePeriod=!1}function ae(e,t){var r=et(e,t.line);if(!r||r.hidden)return null;var n=Jn(e.doc,t.line),i=Ye(r,n,t.line),o=ai(n),a="left";if(o){var s=fo(o,t.ch);a=s%2?"right":"left"}var l=nt(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function se(e,t){return t&&(e.bad=!0),e}function le(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return se(e.clipPos(Bo(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return ce(o,t,r)}}function ce(e,t,r){function n(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?c.map:u[i],a=0;a<o.length;a+=3){var s=o[a+2];if(s==t||s==r){var l=ni(i<0?e.line:e.rest[i]),f=o[a]+n;return(n<0||s!=t)&&(f=o[a+(n?1:0)]),Bo(l,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Za(i,t))return se(Bo(ni(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ni(e.rest):e.line;return se(Bo(ni(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var c=e.measure,u=c.maps,f=n(s,l,r);if(f)return se(f,o);for(var d=l.nextSibling,p=s?s.nodeValue.length-r:0;d;d=d.nextSibling){if(f=n(d,d.firstChild,0))return se(Bo(f.line,f.ch-p),o);p+=d.textContent.length}for(var h=l.previousSibling,p=r;h;h=h.previousSibling){if(f=n(h,h.firstChild,-1))return se(Bo(f.line,f.ch+p),o);p+=d.textContent.length}}function ue(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(Bo(n,0),Bo(i+1,0),o(+f));return void(d.length&&(u=d[0].find())&&(s+=ei(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p<t.childNodes.length;p++)a(t.childNodes[p]);/^(pre|div|p)$/i.test(t.nodeName)&&(l=!0)}else if(3==t.nodeType){var h=t.nodeValue;if(!h)return;l&&(s+=c,l=!1),s+=h}}for(var s="",l=!1,c=e.doc.lineSeparator();a(t),t!=r;)t=t.nextSibling;return s}function fe(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function pe(e,t){var r=e[t];e.sort(function(e,t){return Fo(e.from(),t.from())}),t=qi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Fo(o.to(),i.from())>=0){var a=Z(o.from(),i.from()),s=X(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new de(l?s:a,l?a:s))}}return new fe(e,t)}function he(e,t){return new fe([new de(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Bo(e.first,0);var r=e.first+e.size-1;return t.line>r?Bo(r,Jn(e,r).text.length):ve(t,Jn(e,t.line).text.length)}function ve(e,t){var r=e.ch;return null==r||r>t?Bo(e.line,t):r<0?Bo(e.line,0):e}function ye(e,t){return t>=e.first&&t<e.first+e.size}function be(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ge(e,t[n]);return r}function ke(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Fo(r,i)<0;o!=Fo(n,i)<0?(i=r,r=n):o!=Fo(r,n)<0&&(r=n)}return new de(i,r)}return new de(n||r,r)}function xe(e,t,r,n){Le(e,new fe([ke(e,e.sel.primary(),t,r)],0),n)}function we(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=ke(e,e.sel.ranges[i],t[i],null);var o=pe(n,e.sel.primIndex);Le(e,o,r)}function _e(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Le(e,pe(i,e.sel.primIndex),n)}function Ce(e,t,r,n){Le(e,he(t,r),n)}function Se(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new de(ge(e,t[r].anchor),ge(e,t[r].head))},origin:r&&r.origin};return qa(e,"beforeSelectionChange",e,n),e.cm&&qa(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?pe(n.ranges,n.ranges.length-1):t}function Me(e,t,r){var n=e.history.done,i=Ni(n);i&&i.ranges?(n[n.length-1]=t,Te(e,t,r)):Le(e,t,r)}function Le(e,t,r){Te(e,t,r),pi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Te(e,t,r){(Ei(e,"beforeSelectionChange")||e.cm&&Ei(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,r));var n=r&&r.bias||(Fo(t.primary().head,e.sel.primary().head)<0?-1:1);Ae(e,Oe(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Dr(e.cm)}function Ae(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ai(e.cm)),Mi(e,"cursorActivity",e))}function Ee(e){Ae(e,Oe(e,e.sel,null,!1),Da)}function Oe(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],l=Ie(e,a.anchor,s&&s.anchor,r,n),c=Ie(e,a.head,s&&s.head,r,n);(i||l!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(l,c))}return i?pe(i,t.primIndex):t}function ze(e,t,r,n,i){var o=Jn(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker;if((null==s.from||(l.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(l.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(qa(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(r){var c,u=l.find(n<0?1:-1);if((n<0?l.inclusiveRight:l.inclusiveLeft)&&(u=Ne(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=Fo(u,r))&&(n<0?c<0:c>0))return ze(e,u,t,n,i)}var f=l.find(n<0?-1:1);return(n<0?l.inclusiveLeft:l.inclusiveRight)&&(f=Ne(e,f,n,f.line==t.line?o:null)),f?ze(e,f,t,n,i):null}}return t}function Ie(e,t,r,n,i){var o=n||1,a=ze(e,t,r,o,i)||!i&&ze(e,t,r,o,!0)||ze(e,t,r,-o,i)||!i&&ze(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Bo(e.first,0))}function Ne(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ge(e,Bo(t.line-1)):null:r>0&&t.ch==(n||Jn(e,t.line)).text.length?t.line<e.first+e.size-1?Bo(t.line+1,0):null:new Bo(t.line,t.ch+r)}function qe(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Pe(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var s=r.sel.ranges[a],l=s.empty();(l||e.options.showCursorWhenSelecting)&&Re(e,s.head,i),l||je(e,s,o)}return n}function Re(e,t,r){var n=mt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild($i("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild($i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}$(".other-cursor").each(function(t,r){var n=parseInt($(r).attr("data-line")),i=parseInt($(r).attr("data-ch")),o=parseFloat($(r).attr("data-offset-left")),a=parseFloat($(r).attr("data-offset-top")),s=e.charCoords({line:n,ch:i},"windows");$(r)[0].style.left=s.left+o+"px",$(r)[0].style.top=s.top+a+"px"})}function je(e,t,r){function n(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild($i("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ht(e,Bo(t,r),"div",f,n)}var s,l,f=Jn(a,t),d=f.text.length;return ro(ai(f),r||0,null==i?d:i,function(e,t,a){var f,p,h,m=o(e,"left");if(e==t)f=m,p=h=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}p=m.left,h=f.right}null==r&&0==e&&(p=c),f.top-m.top>3&&(n(p,m.top,null,m.bottom),p=c,m.bottom<f.top&&n(p,m.bottom,null,f.top)),null==i&&t==d&&(h=u),(!s||m.top<s.top||m.top==s.top&&m.left<s.left)&&(s=m),(!l||f.bottom>l.bottom||f.bottom==l.bottom&&f.right>l.right)&&(l=f),p<c+1&&(p=c),n(p,f.top,h-p,f.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ke(e.display),c=l.left,u=Math.max(o.sizerWidth,Ge(e)-o.sizer.offsetLeft)-l.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var p=Jn(a,f.line),h=Jn(a,d.line),m=kn(p)==kn(h),g=i(f.line,f.ch,m?p.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top<v.top-2?(n(g.right,g.top,null,g.bottom),n(c,v.top,v.left,v.bottom)):n(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&n(c,g.bottom,null,v.top)}r.appendChild(s)}function De(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Be(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Bi(Fe,e))}function Fe(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ua(t.mode,He(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=Pn(e,o,s?ua(t.mode,n):n,!0);o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!f&&d<a.length;++d)f=a[d]!=o.styles[d];f&&i.push(t.frontier),o.stateAfter=s?n:ua(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&jn(e,o.text,n),o.stateAfter=t.frontier%5==0?ua(t.mode,n):null;if(++t.frontier,+new Date>r)return Be(e,e.options.workDelay),!0}),i.length&&Ot(e,function(){for(var t=0;t<i.length;t++)jt(e,i[t],"text")})}}function We(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>a;--s){if(s<=o.first)return o.first;var l=Jn(o,s-1);if(l.stateAfter&&(!r||s<=o.frontier))return s;var c=Wa(l.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}function He(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=We(e,t,r),a=o>n.first&&Jn(n,o-1).stateAfter;return a=a?ua(n.mode,a):fa(n.mode),n.iter(o,t,function(r){jn(e,r.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=s?ua(n.mode,a):null,++o}),r&&(n.frontier=o),a}function $e(e){return e.lineSpace.offsetTop}function Ue(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ke(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ki(e.measure,$i("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ve(e){return Ra-e.display.nativeBarWidth}function Ge(e){return e.display.scroller.clientWidth-Ve(e)-e.display.barWidth}function Xe(e){return e.display.scroller.clientHeight-Ve(e)-e.display.barHeight}function Ze(e,t,r){var n=e.options.lineWrapping,i=n&&Ge(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],c=a[s+1];Math.abs(l.bottom-c.bottom)>2&&o.push((l.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Ye(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(ni(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Qe(e,t){t=kn(t);var r=ni(t),n=e.display.externalMeasured=new qt(e.doc,t,r);n.lineN=r;var i=n.built=Bn(e,n);return n.text=i.pre,Ki(e.display.lineMeasure,i.pre),n}function Je(e,t,r,n){return rt(e,tt(e,t),r,n)}function et(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Bt(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function tt(e,t){var r=ni(t),n=et(e,r);n&&!n.text?n=null:n&&n.changes&&(q(e,n,r,I(e)),e.curOp.forceUpdate=!0),n||(n=Qe(e,t));var i=Ye(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function rt(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ze(e,t.view,t.rect),t.hasHeights=!0), -o=ot(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function nt(e,t,r){for(var n,i,o,a,s=0;s<e.length;s+=3){var l=e[s],c=e[s+1];if(t<l?(i=0,o=1,a="left"):t<c?(i=t-l,o=i+1):(s==e.length-3||t==c&&e[s+3]>t)&&(o=c-l,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[s+2],l==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],a="left";if("right"==r&&i==c-l)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)n=e[(s+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:c}}function it(e,t){var r=Ko;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var n=e.length-1;n>=0&&(r=e[n]).left==r.right;n--);return r}function ot(e,t,r,n){var i,o=nt(t.map,r,n),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;s&&Hi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&Hi(t.line.text.charAt(o.coverStart+l));)++l;if(i=xo&&wo<9&&0==s&&l==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():it(Ka(a,s,l).getClientRects(),n),i.left||i.right||0==s)break;l=s,s-=1,c="right"}xo&&wo<11&&(i=at(e.display.measure,i))}else{s>0&&(c=n="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==n?f.length-1:0]:a.getBoundingClientRect()}if(xo&&wo<9&&!s&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+xt(e.display),top:d.top,bottom:d.bottom}:Ko}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);var v=u?g[u-1]:0,y=g[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=p,b.rbottom=h),b}function at(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!to(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function st(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lt(e){e.display.externalMeasure=null,Ui(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)st(e.display.view[t])}function ct(e){lt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ut(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ft(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dt(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Ln(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=oi(t);if("local"==n?a+=$e(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==n?0:ft());var l=s.left+("window"==n?0:ut());r.left+=l,r.right+=l}return r.top+=a,r.bottom+=a,r}function pt(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ut(),i-=ft();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function ht(e,t,r,n,i){return n||(n=Jn(e.doc,t.line)),dt(e,n,Je(e,n,t.ch,i),r)}function mt(e,t,r,n,i,o){function a(t,a){var s=rt(e,i,t,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,dt(e,n,s,r)}function s(e,t){var r=l[t],n=r.level%2;return e==no(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=io(r)-(r.level%2?0:1),n=!0):e==io(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=no(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Jn(e.doc,t.line),i||(i=tt(e,n));var l=ai(n),c=t.ch;if(!l)return a(c);var u=fo(l,c),f=s(c,u);return null!=ls&&(f.other=s(c,ls)),f}function gt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=xt(e.display)*t.ch);var n=Jn(e.doc,t.line),i=oi(n)+$e(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function vt(e,t,r,n){var i=Bo(e,t);return i.xRel=n,r&&(i.outside=!0),i}function yt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return vt(n.first,0,!0,-1);var i=ii(n,r),o=n.first+n.size-1;if(i>o)return vt(n.first+n.size-1,Jn(n,o).text.length,!0,1);t<0&&(t=0);for(var a=Jn(n,i);;){var s=bt(e,a,i,t,r),l=yn(a),c=l&&l.find(0,!0);if(!l||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=ni(a=c.to.line)}}function bt(e,t,r,n,i){function o(n){var i=mt(e,Bo(r,n),"line",t,c);return s=!0,a>i.bottom?i.left-l:a<i.top?i.left+l:(s=!1,i.left)}var a=i-oi(t),s=!1,l=2*e.display.wrapper.clientWidth,c=tt(e,t),u=ai(t),f=t.text.length,d=oo(t),p=ao(t),h=o(d),m=s,g=o(p),v=s;if(n>g)return vt(r,p,v,1);for(;;){if(u?p==d||p==ho(t,d,1):p-d<=1){var y=n<h||n-h<=g-n?d:p,b=y==d?m:v,k=n-(y==d?h:g);if(v&&!u&&!/\s/.test(t.text.charAt(y))&&k>0&&y<t.text.length&&c.view.measure.heights.length>1){var x=rt(e,c,y,"right");a<=x.bottom&&a>=x.top&&Math.abs(n-x.right)<k&&(b=!1,y++,k=n-x.right)}for(;Hi(t.text.charAt(y));)++y;var w=vt(r,y,b,k<-1?-1:k>1?1:0);return w}var _=Math.ceil(f/2),C=d+_;if(u){C=d;for(var S=0;S<_;++S)C=ho(t,C,1)}var M=o(C);M>n?(p=C,g=M,(v=s)&&(g+=1e3),f=_):(d=C,h=M,m=s,f-=_)}}function kt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ho){Ho=$i("pre");for(var t=0;t<49;++t)Ho.appendChild(document.createTextNode("x")),Ho.appendChild($i("br"));Ho.appendChild(document.createTextNode("x"))}Ki(e.measure,Ho);var r=Ho.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Ui(e.measure),r||1}function xt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=$i("span","xxxxxxxxxx"),r=$i("pre",[t]);Ki(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function wt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Go},Vo?Vo.ops.push(e.curOp):e.curOp.ownsGroup=Vo={ops:[e.curOp],delayedCallbacks:[]}}function _t(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Ct(e){var t=e.curOp,r=t.ownsGroup;if(r)try{_t(r)}finally{Vo=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;St(r)}}function St(e){for(var t=e.ops,r=0;r<t.length;r++)Mt(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Tt(t[r]);for(var r=0;r<t.length;r++)At(t[r]);for(var r=0;r<t.length;r++)Et(t[r])}function Mt(e){var t=e.cm,r=t.display;M(t),e.updateMaxLine&&d(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Lt(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Tt(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=h(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Je(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection(e.focus))}function At(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ar(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==Vi()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&E(t,e.barMeasure),e.selectionChanged&&De(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Y(e.cm)}function Et(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&T(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=qr(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Nr(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||qa(o[s],"hide");if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&qa(a[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&qa(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ot(e,t){if(e.curOp)return t();wt(e);try{return t()}finally{Ct(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);wt(e);try{return t.apply(e,arguments)}finally{Ct(e)}}}function It(e){return function(){if(this.curOp)return e.apply(this,arguments);wt(this);try{return e.apply(this,arguments)}finally{Ct(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);wt(t);try{return e.apply(this,arguments)}finally{Ct(t)}}}function qt(e,t,r){this.line=t,this.rest=xn(t),this.size=this.rest?ni(Ni(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Cn(e,t)}function Pt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new qt(e.doc,Jn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Rt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Do&&wn(e.doc,t)<i.viewTo&&Dt(e);else if(r<=i.viewFrom)Do&&_n(e.doc,r+n)>i.viewFrom?Dt(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Dt(e);else if(t<=i.viewFrom){var o=Ft(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Dt(e)}else if(r>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Dt(e)}else{var a=Ft(e,t,t,-1),s=Ft(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):Dt(e)}var l=i.externalMeasured;l&&(r<l.lineN?l.lineN+=n:t<l.lineN+l.size&&(i.externalMeasured=null))}function jt(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Bt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);qi(a,r)==-1&&a.push(r)}}}function Dt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function Ft(e,t,r,n){var i,o=Bt(e,t),a=e.display.view;if(!Do||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,l=e.display.viewFrom;s<o;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;wn(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Wt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Bt(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Pt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Bt(e,r)))),n.viewTo=r}function Ht(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function $t(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;za(i.scroller,"mousedown",zt(e,Xt)),xo&&wo<11?za(i.scroller,"dblclick",zt(e,function(t){if(!Ti(e,t)){var r=Gt(e,t);if(r&&!er(e,t)&&!Vt(e.display,t)){Aa(t);var n=e.findWordAt(r);xe(e.doc,n.anchor,n.head)}}})):za(i.scroller,"dblclick",function(t){Ti(e,t)||Aa(t)}),Ro||za(i.scroller,"contextmenu",function(t){kr(e,t)});var o,a={end:0};za(i.scroller,"touchstart",function(t){if(!Ti(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),za(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),za(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Vt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(s,s):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(s):new de(Bo(s.line,0),ge(e.doc,Bo(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Aa(r)}t()}),za(i.scroller,"touchcancel",t),za(i.scroller,"scroll",function(){i.scroller.clientHeight&&(or(e,i.scroller.scrollTop),ar(e,i.scroller.scrollLeft,!0),qa(e,"scroll",e))}),za(i.scroller,"mousewheel",function(t){sr(e,t)}),za(i.scroller,"DOMMouseScroll",function(t){sr(e,t)}),za(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ti(e,t)||Oa(t)},over:function(t){Ti(e,t)||(nr(e,t),Oa(t))},start:function(t){rr(e,t)},drop:zt(e,tr),leave:function(t){Ti(e,t)||ir(e)}};var s=i.input.getField();za(s,"keyup",function(t){mr.call(e,t)}),za(s,"keydown",zt(e,pr)),za(s,"keypress",zt(e,gr)),za(s,"focus",Bi(yr,e)),za(s,"blur",Bi(br,e))}function Ut(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?za:Na;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Kt(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Vt(e,t){for(var r=_i(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Gt(e,t,r,n){var i=e.display;if(!r&&"true"==_i(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,c=yt(e,o,a);if(n&&1==c.xRel&&(l=Jn(e.doc,c.line).text).length==c.ch){var u=Wa(l,l.length,e.options.tabSize)-l.length;c=Bo(c.line,Math.max(0,Math.round((o-Ke(e.display).left)/xt(e.display))-u))}return c}function Xt(e){var t=this,r=t.display;if(!(Ti(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Vt(r,e))return void(_o||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!er(t,e)){var n=Gt(t,e);switch(window.focus(),Ci(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Zt(t,e,n):_i(e)==r.scroller&&Aa(e);break;case 2:_o&&(t.state.lastMiddleDown=+new Date),n&&xe(t.doc,n),setTimeout(function(){r.input.focus()},20),Aa(e);break;case 3:Ro?kr(t,e):vr(t)}}}}function Zt(e,t,r){xo?setTimeout(Bi(Y,e),0):e.curOp.focus=Vi();var n,i=+new Date;Uo&&Uo.time>i-400&&0==Fo(Uo.pos,r)?n="triple":$o&&$o.time>i-400&&0==Fo($o.pos,r)?(n="double",Uo={time:i,pos:r}):(n="single",$o={time:i,pos:r});var o,a=e.doc.sel,s=zo?t.metaKey:t.ctrlKey;e.options.dragDrop&&rs&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(Fo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(Fo(o.to(),r)>0||r.xRel<0)?Yt(e,t,r,s):Qt(e,t,r,n,s)}function Yt(e,t,r,n){var i=e.display,o=+new Date,a=zt(e,function(s){_o&&(i.scroller.draggable=!1),e.state.draggingText=!1,Na(document,"mouseup",a),Na(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Aa(s),!n&&+new Date-200<o&&xe(e.doc,r),_o||xo&&9==wo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});_o&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=zo?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),za(document,"mouseup",a),za(i.scroller,"drop",a)}function Qt(e,t,r,n,i){function o(t){if(0!=Fo(g,t))if(g=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Wa(Jn(c,r.line).text,r.ch,o),s=Wa(Jn(c,t.line).text,t.ch,o),l=Math.min(a,s),p=Math.max(a,s),h=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));h<=m;h++){var v=Jn(c,h).text,y=Ha(v,l,o);l==p?i.push(new de(Bo(h,y),Bo(h,y))):v.length>y&&i.push(new de(Bo(h,y),Bo(h,Ha(v,p,o))))}i.length||i.push(new de(r,r)),Le(c,pe(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,k=b.anchor,x=t;if("single"!=n){if("double"==n)var w=e.findWordAt(t);else var w=new de(Bo(t.line,0),ge(c,Bo(t.line+1,0)));Fo(w.anchor,k)>0?(x=w.head,k=Z(b.from(),w.anchor)):(x=w.anchor,k=X(b.to(),w.head))}var i=d.ranges.slice(0);i[f]=new de(ge(c,k),x),Le(c,pe(i,f),Ba)}}function a(t){var r=++y,i=Gt(e,t,!0,"rect"==n);if(i)if(0!=Fo(i,g)){e.curOp.focus=Vi(),o(i);var s=k(l,c);(i.line>=s.to||i.line<s.from)&&setTimeout(zt(e,function(){y==r&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(zt(e,function(){y==r&&(l.scroller.scrollTop+=u,a(t))}),50)}}function s(t){e.state.selectingText=!1,y=1/0,Aa(t),l.input.focus(),Na(document,"mousemove",b),Na(document,"mouseup",x),c.history.lastSelOrigin=null}var l=e.display,c=e.doc;Aa(t);var u,f,d=c.sel,p=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(r),u=f>-1?p[f]:new de(r,r)):(u=c.sel.primary(),f=c.sel.primIndex),Io?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(u=new de(r,r)),r=Gt(e,t,!0,!0),f=-1;else if("double"==n){var h=e.findWordAt(r);u=e.display.shift||c.extend?ke(c,u,h.anchor,h.head):h}else if("triple"==n){var m=new de(Bo(r.line,0),ge(c,Bo(r.line+1,0)));u=e.display.shift||c.extend?ke(c,u,m.anchor,m.head):m}else u=ke(c,u,r);i?f==-1?(f=p.length,Le(c,pe(p.concat([u]),f),{scroll:!1,origin:"*mouse"})):p.length>1&&p[f].empty()&&"single"==n&&!t.shiftKey?(Le(c,pe(p.slice(0,f).concat(p.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),d=c.sel):_e(c,f,u,Ba):(f=0,Le(c,new fe([u],0),Ba),d=c.sel);var g=r,v=l.wrapper.getBoundingClientRect(),y=0,b=zt(e,function(e){Ci(e)?a(e):s(e)}),x=zt(e,s);e.state.selectingText=x,za(document,"mousemove",b),za(document,"mouseup",x)}function Jt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Aa(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ei(e,r))return wi(t);o-=s.top-a.viewOffset;for(var l=0;l<e.options.gutters.length;++l){var c=a.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=i){var u=ii(e.doc,o),f=e.options.gutters[l];return qa(e,r,e,u,f,t),wi(t)}}}function er(e,t){return Jt(e,t,"gutterClick",!0)}function tr(e){var t=this;if(ir(t),!Ti(t,e)&&!Vt(t.display,e)){Aa(e),xo&&(Xo=+new Date);var r=Gt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,s=function(e,n){if(!t.options.allowDropFileTypes||qi(t.options.allowDropFileTypes,e.type)!=-1){var s=new FileReader;s.onload=zt(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var l={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Lr(t.doc,l),Me(t.doc,he(r,ta(l)))}}),s.readAsText(e)}},l=0;l<i;++l)s(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!t.state.draggingText.copy)var c=t.listSelections();if(Te(t.doc,he(r,r)),c)for(var l=0;l<c.length;++l)Ir(t.doc,"",c[l].anchor,c[l].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function rr(e,t){if(xo&&(!e.state.draggingText||+new Date-Xo<100))return void Oa(t);if(!Ti(e,t)&&!Vt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Lo)){var r=$i("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Mo&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),Mo&&r.parentNode.removeChild(r)}}function nr(e,t){var r=Gt(e,t);if(r){var n=document.createDocumentFragment();Re(e,r,n),e.display.dragCursor||(e.display.dragCursor=$i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ki(e.display.dragCursor,n)}}function ir(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function or(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,yo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),yo&&A(e),Be(e,100))}function ar(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function sr(e,t){var r=Qo(t),n=r.x,i=r.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(n&&s||i&&l){if(i&&zo&&_o)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var f=0;f<u.length;f++)if(u[f].node==c){e.display.currentWheelTarget=c;break e}if(n&&!yo&&!Mo&&null!=Yo)return i&&l&&or(e,Math.max(0,Math.min(a.scrollTop+i*Yo,a.scrollHeight-a.clientHeight))),ar(e,Math.max(0,Math.min(a.scrollLeft+n*Yo,a.scrollWidth-a.clientWidth))),(!i||i&&l)&&Aa(t),void(o.wheelStartX=null);if(i&&null!=Yo){var d=i*Yo,p=e.doc.scrollTop,h=p+o.wrapper.clientHeight;d<0?p=Math.max(0,p+d-50):h=Math.min(e.doc.height,h+d+50),A(e,{top:p,bottom:h})}Zo<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Yo=(Yo*Zo+r)/(Zo+1),++Zo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function lr(e,t,r){if("string"==typeof t&&(t=da[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=ja}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function cr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=ha(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&ha(t,e.options.extraKeys,r,e)||ha(t,e.options.keyMap,r,e)}function ur(e,t,r,n){var i=e.state.keySeq;if(i){if(ma(t))return"handled";Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=cr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Mi(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(Aa(r),De(e)),i&&!o&&/\'$/.test(t)?(Aa(r),!0):!!o}function fr(e,t){var r=ga(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?ur(e,"Shift-"+r,t,function(t){return lr(e,t,!0)})||ur(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return lr(e,t)}):ur(e,r,t,function(t){return lr(e,t)}))}function dr(e,t,r){return ur(e,"'"+r+"'",t,function(t){return lr(e,t,!0)})}function pr(e){var t=this;if(t.curOp.focus=Vi(),!Ti(t,e)){xo&&wo<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=fr(t,e);Mo&&(ea=n?r:null,!n&&88==r&&!os&&(zo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||hr(t)}}function hr(e){function t(e){18!=e.keyCode&&e.altKey||(Ja(r,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t))}var r=e.display.lineDiv;es(r,"CodeMirror-crosshair"),za(document,"keyup",t),za(document,"mouseover",t)}function mr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ti(this,e)}function gr(e){var t=this;if(!(Vt(t.display,e)||Ti(t,e)||e.ctrlKey&&!e.altKey||zo&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(Mo&&r==ea)return ea=null,void Aa(e);if(!Mo||e.which&&!(e.which<10)||!fr(t,e)){var i=String.fromCharCode(null==n?r:n);dr(t,e,i)||t.display.input.onKeyPress(e)}}}function vr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,br(e))},100)}function yr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(qa(e,"focus",e),e.state.focused=!0,es(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),_o&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),De(e))}function br(e){e.state.delayingBlurEvent||(e.state.focused&&(qa(e,"blur",e),e.state.focused=!1,Ja(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function kr(e,t){Vt(e.display,t)||xr(e,t)||Ti(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function xr(e,t){return!!Ei(e,"gutterContextMenu")&&Jt(e,t,"gutterContextMenu",!1)}function wr(e,t){if(Fo(e,t.from)<0)return e;if(Fo(e,t.to)<=0)return ta(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ta(t).ch-t.to.ch),Bo(r,n)}function _r(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(wr(i.anchor,t),wr(i.head,t)))}return pe(r,e.sel.primIndex)}function Cr(e,t,r){return e.line==t.line?Bo(r.line,e.ch-t.ch+r.ch):Bo(r.line+(e.line-t.line),e.ch)}function Sr(e,t,r){for(var n=[],i=Bo(e.first,0),o=i,a=0;a<t.length;a++){var s=t[a],l=Cr(s.from,i,o),c=Cr(ta(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[a],f=Fo(u.head,u.anchor)<0;n[a]=new de(f?c:l,f?l:c)}else n[a]=new de(l,l)}return new fe(n,e.sel.primIndex)}function Mr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=ge(e,t)),r&&(this.to=ge(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),qa(e,"beforeChange",e,n),e.cm&&qa(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Lr(e,t,r){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Lr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ei(e,"beforeChange")||e.cm&&Ei(e.cm,"beforeChange"))||(t=Mr(e,t,!0))){var n=jo&&!r&&un(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Tr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Tr(e,t)}}function Tr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Fo(t.from,t.to)){var r=_r(e,t);fi(e,t,r,e.cm?e.cm.curOp.id:NaN),Or(e,t,r,sn(e,t));var n=[];Yn(e,function(e,r){r||qi(n,e.history)!=-1||(xi(e.history,t),n.push(e.history)),Or(e,t,null,sn(e,t))})}}function Ar(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l<a.length&&(n=a[l],r?!n.ranges||n.equals(e.sel):n.ranges);l++);if(l!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(hi(n,s),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];hi(o,s),s.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ei(e,"beforeChange")||e.cm&&Ei(e.cm,"beforeChange"),l=n.changes.length-1;l>=0;--l){var f=n.changes[l];if(f.origin=t,u&&!Mr(e,f,!1))return void(a.length=0);c.push(li(e,f));var d=l?_r(e,f):Ni(a);Or(e,f,d,cn(e,f)),!l&&e.cm&&e.cm.scrollIntoView({from:f.from,to:ta(f)});var p=[];Yn(e,function(e,t){t||qi(p,e.history)!=-1||(xi(e.history,f),p.push(e.history)),Or(e,f,null,cn(e,f))})}}}}function Er(e,t){if(0!=t&&(e.first+=t,e.sel=new fe(Pi(e.sel.ranges,function(e){return new de(Bo(e.anchor.line+t,e.anchor.ch),Bo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Rt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)jt(e.cm,n,"gutter")}}function Or(e,t,r,n){if(e.cm&&!e.cm.curOp)return zt(e.cm,Or)(e,t,r,n);if(t.to.line<e.first)return void Er(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Er(e,i),t={from:Bo(e.first,0),to:Bo(t.to.line+i,t.to.ch),text:[Ni(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Bo(o,Jn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ei(e,t.from,t.to),r||(r=_r(e,t)),e.cm?zr(e.cm,t,n):Gn(e,t,n),Te(e,r,Da)}}function zr(e,t,r){var n=e.doc,i=e.display,a=t.from,s=t.to,l=!1,c=a.line;e.options.lineWrapping||(c=ni(kn(Jn(n,a.line))),n.iter(c,s.line+1,function(e){if(e==i.maxLine)return l=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ai(e),Gn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Be(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?Rt(e):a.line!=s.line||1!=t.text.length||Vn(e.doc,t)?Rt(e,a.line,s.line+1,u):jt(e,a.line,"text");var d=Ei(e,"changes"),p=Ei(e,"change");if(p||d){var h={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};p&&Mi(e,"change",e,h),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Ir(e,t,r,n,i){if(n||(n=r),Fo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Lr(e,{from:r,to:n,text:t,origin:i})}function Nr(e,t){if(!Ti(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Ao){var o=$i("div","",null,"position: absolute; top: "+(t.top-r.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function qr(e,t,r,n){null==n&&(n=0);for(var i=0;i<5;i++){var o=!1,a=mt(e,t),s=r&&r!=t?mt(e,r):a,l=Rr(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-n,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(or(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(ar(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Pr(e,t,r,n,i){var o=Rr(e,t,r,n,i);null!=o.scrollTop&&or(e,o.scrollTop),null!=o.scrollLeft&&ar(e,o.scrollLeft)}function Rr(e,t,r,n,i){var o=e.display,a=kt(e.display);r<0&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Xe(e),c={};i-r>l&&(i=r+l);var u=e.doc.height+Ue(o),f=r<a,d=i>u-a;if(r<s)c.scrollTop=f?0:r;else if(i>s+l){var p=Math.min(r,(d?u:i)-l);p!=s&&(c.scrollTop=p); -}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=n-t>m;return g&&(n=t+m),t<10?c.scrollLeft=0:t<h?c.scrollLeft=Math.max(0,t-(g?0:10)):n>m+h-3&&(c.scrollLeft=n+(g?0:10)-m),c}function jr(e,t,r){null==t&&null==r||Br(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Dr(e){Br(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Bo(t.line,t.ch-1):t,n=Bo(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Br(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=gt(e,t.from),n=gt(e,t.to),i=Rr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=He(e,t):r="prev");var a=e.options.tabSize,s=Jn(o,t),l=Wa(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(c=o.mode.indent(i,s.text.slice(u.length),s.text),c==ja||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Wa(Jn(o,t-1).text,null,a):0:"add"==r?c=l+e.options.indentUnit:"subtract"==r?c=l-e.options.indentUnit:"number"==typeof r&&(c=l+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)d+=a,f+="\t";if(d<c&&(f+=Ii(c-d)),f!=u)return Ir(o,f,Bo(t,0),Bo(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var h=o.sel.ranges[p];if(h.head.line==t&&h.head.ch<u.length){var d=Bo(t,u.length);_e(o,p,new de(d,d));break}}}function Wr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Jn(e,me(e,t)):i=ni(t),null==i?null:(n(o,i)&&e.cm&&jt(e.cm,i,r),o)}function Hr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Fo(o.from,Ni(n).to)<=0;){var a=n.pop();if(Fo(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ot(e,function(){for(var t=n.length-1;t>=0;t--)Ir(e.doc,"",n[t].from,n[t].to,"+delete");Dr(e)})}function $r(e,t,r,n,i){function o(){var t=s+r;return!(t<e.first||t>=e.first+e.size)&&(s=t,u=Jn(e,t))}function a(e){var t=(i?ho:mo)(u,l,r,!0);if(null==t){if(e||!o())return!1;l=i?(r<0?ao:oo)(u):r<0?u.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,c=r,u=Jn(e,s);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,d="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||a(!h);h=!1){var m=u.text.charAt(l)||"\n",g=Fi(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||h||g||(g="s"),f&&f!=g){r<0&&(r=1,a());break}if(g&&(f=g),r>0&&!a(!h))break}var v=Ie(e,Bo(s,l),t,c,!0);return Fo(t,v)||(v.hitSide=!0),v}function Ur(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(r<0?1.5:.5)*kt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var l=yt(e,a,i);if(!l.outside)break;if(r<0?i<=0:i>=o.height){l.hitSide=!0;break}i+=5*r}return l}function Kr(t,r,n,i){e.defaults[t]=r,n&&(na[t]=i?function(e,t,r){r!=ia&&n(e,t,r)}:n)}function Vr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Gr(e){return"string"==typeof e?pa[e]:e}function Xr(e,t,r,n,i){if(n&&n.shared)return Zr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return zt(e.cm,Xr)(e,t,r,n,i);var o=new ba(e,i),a=Fo(t,r);if(n&&Di(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=$i("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(bn(e,t.line,t,r,o)||t.line!=r.line&&bn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&fi(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,l=t.line,c=e.cm;if(e.iter(l,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&kn(e)==c.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&ri(e,0),nn(e,new en(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Cn(e,t)&&ri(t,0)}),o.clearOnEnter&&za(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(jo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ya,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Rt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)jt(c,u,"text");o.atomic&&Ee(c.doc),Mi(c,"markerAdded",c,o)}return o}function Zr(e,t,r,n,i){n=Di(n),n.shared=!1;var o=[Xr(e,t,r,n,i)],a=o[0],s=n.widgetNode;return Yn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Xr(e,ge(e,t),ge(e,r),n,i));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;a=Ni(o)}),new ka(o,a)}function Yr(e){return e.findMarks(Bo(e.first,0),e.clipPos(Bo(e.lastLine())),function(e){return e.parent})}function Qr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(Fo(o,a)){var s=Xr(e,o,a,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}function Jr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Yn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];qi(n,o.doc)==-1&&(o.parent=null,r.markers.splice(i--,1))}}}function en(e,t,r){this.marker=e,this.from=t,this.to=r}function tn(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function rn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function nn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function on(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new en(a,o.from,l?null:o.to))}}return n}function an(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new en(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return n}function sn(e,t){if(t.full)return null;var r=ye(e,t.from.line)&&Jn(e,t.from.line).markedSpans,n=ye(e,t.to.line)&&Jn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==Fo(t.from,t.to),s=on(r,i,a),l=an(n,o,a),c=1==t.text.length,u=Ni(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null==d.to){var p=tn(l,d.marker);p?c&&(d.to=null==p.to?null:p.to+u):d.to=i}}if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null!=d.to&&(d.to+=u),null==d.from){var p=tn(s,d.marker);p||(d.from=u,c&&(s||(s=[])).push(d))}else d.from+=u,c&&(s||(s=[])).push(d)}s&&(s=ln(s)),l&&l!=s&&(l=ln(l));var h=[s];if(!c){var m,g=t.text.length-2;if(g>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(m||(m=[])).push(new en(s[f].marker,null,null));for(var f=0;f<g;++f)h.push(m);h.push(l)}return h}function ln(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function cn(e,t){var r=vi(e,t),n=sn(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue e;o.push(l)}else a&&(r[i]=a)}return r}function un(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&qi(n,r)!=-1||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],s=a.find(0),l=0;l<i.length;++l){var c=i[l];if(!(Fo(c.to,s.from)<0||Fo(c.from,s.to)>0)){var u=[l,1],f=Fo(c.from,s.from),d=Fo(c.to,s.to);(f<0||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),l+=u.length-1}}return i}function fn(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function dn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function pn(e){return e.inclusiveLeft?-1:0}function hn(e){return e.inclusiveRight?1:0}function mn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Fo(n.from,i.from)||pn(e)-pn(t);if(o)return-o;var a=Fo(n.to,i.to)||hn(e)-hn(t);return a?a:t.id-e.id}function gn(e,t){var r,n=Do&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||mn(r,i.marker)<0)&&(r=i.marker);return r}function vn(e){return gn(e,!0)}function yn(e){return gn(e,!1)}function bn(e,t,r,n,i){var o=Jn(e,t),a=Do&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var c=l.marker.find(0),u=Fo(c.from,r)||pn(l.marker)-pn(i),f=Fo(c.to,n)||hn(l.marker)-hn(i);if(!(u>=0&&f<=0||u<=0&&f>=0)&&(u<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?Fo(c.to,r)>=0:Fo(c.to,r)>0)||u>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?Fo(c.from,n)<=0:Fo(c.from,n)<0)))return!0}}}function kn(e){for(var t;t=vn(e);)e=t.find(-1,!0).line;return e}function xn(e){for(var t,r;t=yn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function wn(e,t){var r=Jn(e,t),n=kn(r);return r==n?t:ni(n)}function _n(e,t){if(t>e.lastLine())return t;var r,n=Jn(e,t);if(!Cn(e,n))return t;for(;r=yn(n);)n=r.find(1,!0).line;return ni(n)+1}function Cn(e,t){var r=Do&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Sn(e,t,n))return!0}}function Sn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Sn(e,n.line,tn(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Sn(e,t,i))return!0}function Mn(e,t,r){oi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&jr(e,null,r)}function Ln(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Za(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),Ki(t.display.measure,$i("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Tn(e,t,r,n){var i=new xa(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Wr(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Cn(e,t)){var n=oi(t)<e.scrollTop;ri(t,t.height+Ln(i)),n&&jr(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function An(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),fn(e),dn(e,r);var i=n?n(e):1;i!=e.height&&ri(e,i)}function En(e){e.parent=null,fn(e)}function On(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function zn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function In(t,r,n,i){for(var o=0;o<10;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Nn(e,t,r,n){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?ua(a.mode,u):u}}var o,a=e.doc,s=a.mode;t=ge(a,t);var l,c=Jn(a,t.line),u=He(e,t.line,r),f=new va(c.text,e.options.tabSize);for(n&&(l=[]);(n||f.pos<t.ch)&&!f.eol();)f.start=f.pos,o=In(s,f,u),n&&l.push(i(!0));return n?l:i()}function qn(e,t,r,n,i,o,a){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var l,c=0,u=null,f=new va(t,e.options.tabSize),d=e.options.addModeClass&&[null];for(""==t&&On(zn(r,n),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,a&&jn(e,t,n,f.pos),f.pos=t.length,l=null):l=On(In(r,f,n,d),o),d){var p=d[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){for(;c<f.start;)c=Math.min(f.start,c+5e4),i(c,u);u=l}f.start=f.pos}for(;c<f.pos;){var h=Math.min(f.pos,c+5e4);i(h,u),c=h}}function Pn(e,t,r,n){var i=[e.state.modeGen],o={};qn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var s=e.state.overlays[a],l=1,c=0;qn(e,t.text,s.mode,!0,function(e,t){for(var r=l;c<e;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,c=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,l-r,e,"cm-overlay "+t),l=r+2;else for(;r<l;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Rn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=He(e,ni(t)),i=Pn(e,t,t.text.length>e.options.maxHighlightLength?ua(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function jn(e,t,r,n){var i=e.doc.mode,o=new va(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&zn(i,r);!o.eol();)In(i,o,r),o.start=o.pos}function Dn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Ca:_a;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Bn(e,t){var r=$i("span",null,null,_o?"padding-right: .1px":null),n={pre:$i("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(xo||_o)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Wn,eo(e.display.measure)&&(o=ai(a))&&(n.addToken=$n(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&ni(a);Kn(a,n,Rn(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Xi(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Xi(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ji(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(_o){var l=n.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return qa(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Xi(n.pre.className,n.textClass||"")),n}function Fn(e){var t=$i("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Wn(e,t,r,n,i,o,a){if(t){var s=e.splitSpaces?Hn(t,e.trailingSpace):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),f=0;;){l.lastIndex=f;var d=l.exec(t),p=d?d.index-f:t.length-f;if(p){var h=document.createTextNode(s.slice(f,f+p));xo&&wo<9?u.appendChild($i("span",[h])):u.appendChild(h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!d)break;if(f+=p+1,"\t"==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild($i("span",Ii(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text","\t"),e.col+=g}else if("\r"==d[0]||"\n"==d[0]){var h=u.appendChild($i("span","\r"==d[0]?"␍":"","cm-invalidchar"));h.setAttribute("cm-text",d[0]),e.col+=1}else{var h=e.cm.options.specialCharPlaceholder(d[0]);h.setAttribute("cm-text",d[0]),xo&&wo<9?u.appendChild($i("span",[h])):u.appendChild(h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,u),xo&&wo<9&&(c=!0),e.pos+=t.length}if(e.trailingSpace=32==s.charCodeAt(t.length-1),r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=$i("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Hn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function $n(e,t){return function(r,n,i,o,a,s,l){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var f=0;f<t.length;f++){var d=t[f];if(d.to>c&&d.from<=c)break}if(d.to>=u)return e(r,n,i,o,a,s,l);e(r,n.slice(0,d.to-c),i,o,null,s,l),o=null,n=n.slice(d.to-c),c=d.to}}}function Un(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Kn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,s,l,c,u,f,d,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=c=u=f=s="",d=null,v=1/0;for(var y,b=[],k=0;k<n.length;++k){var x=n[k],w=x.marker;"bookmark"==w.type&&x.from==h&&w.widgetNode?b.push(w):x.from<=h&&(null==x.to||x.to>h||w.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&v>x.to&&(v=x.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==h&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(y||(y=[])).push(w.endStyle,x.to),w.title&&!f&&(f=w.title),w.collapsed&&(!d||mn(d.marker,w)<0)&&(d=x)):x.from>h&&v>x.from&&(v=x.from)}if(y)for(var k=0;k<y.length;k+=2)y[k+1]==v&&(c+=" "+y[k]);if(!d||d.from==h)for(var k=0;k<b.length;++k)Un(t,0,b[k]);if(d&&(d.from||0)==h){if(Un(t,(null==d.to?p+1:d.to)-h,d.marker,null==d.from),null==d.to)return;d.to==h&&(d=!1)}}if(h>=p)break;for(var _=Math.min(p,v);;){if(g){var C=h+g.length;if(!d){var S=C>_?g.slice(0,_-h):g;t.addToken(t,S,a?a+l:l,u,h+S.length==v?c:"",f,s)}if(C>=_){g=g.slice(_-h),h=_;break}h=C,u=""}g=i.slice(o,o=r[m++]),a=Dn(r[m++],t.cm.options)}}else for(var m=1;m<r.length;m+=2)t.addToken(t,i.slice(o,o=r[m]),Dn(r[m+1],t.cm.options))}function Vn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ni(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Gn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){An(e,r,i,n),Mi(e,"change",e,t)}function a(e,t){for(var r=e,o=[];r<t;++r)o.push(new wa(c[r],i(r),n));return o}var s=t.from,l=t.to,c=t.text,u=Jn(e,s.line),f=Jn(e,l.line),d=Ni(c),p=i(c.length-1),h=l.line-s.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Vn(e,t)){var m=a(0,c.length-1);o(f,f.text,p),h&&e.remove(s.line,h),m.length&&e.insert(s.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,s.ch)+d+u.text.slice(l.ch),p);else{var m=a(1,c.length-1);m.push(new wa(d+u.text.slice(l.ch),p,n)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(l.ch),i(0)),e.remove(s.line+1,h);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(f,d+f.text.slice(l.ch),p);var m=a(1,c.length-1);h>1&&e.remove(s.line+1,h-1),e.insert(s.line+1,m)}Mi(e,"change",e,t)}function Xn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Zn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Yn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var s=e.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;r&&!l||(t(s.doc,l),n(s.doc,e,l))}}}n(e,null,!0)}function Qn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,Rt(e)}function Jn(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function ei(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ti(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ri(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ni(e){if(null==e.parent)return null;for(var t=e.parent,r=qi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ii(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],s=a.height;if(t<s)break;t-=s}return r+n}function oi(e){e=kn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function ai(e){var t=e.order;return null==t&&(t=e.order=cs(e.text)),t}function si(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function li(e,t){var r={from:G(t.from),to:ta(t),text:ei(e,t.from,t.to)};return mi(e,r,t.from.line,t.to.line+1),Yn(e,function(e){mi(e,r,t.from.line,t.to.line+1)},!0),r}function ci(e){for(;e.length;){var t=Ni(e);if(!t.ranges)break;e.pop()}}function ui(e,t){return t?(ci(e.done),Ni(e.done)):e.done.length&&!Ni(e.done).ranges?Ni(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ni(e.done)):void 0}function fi(e,t,r,n){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ui(i,i.lastOp==n))){var s=Ni(o.changes);0==Fo(t.from,t.to)&&0==Fo(t.from,s.to)?s.to=ta(t):o.changes.push(li(e,t))}else{var l=Ni(i.done);for(l&&l.ranges||hi(e.sel,i.done),o={changes:[li(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||qa(e,"historyAdded")}}function di(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function pi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||di(e,o,Ni(i.done),t))?i.done[i.done.length-1]=t:hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ci(i.undone)}function hi(e,t){var r=Ni(t);r&&r.ranges&&r.equals(e)||t.push(e)}function mi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function gi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function vi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(gi(r[n]));return i}function yi(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?fe.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];i.push({changes:s});for(var l=0;l<a.length;++l){var c,u=a[l];if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&qi(t,Number(c[1]))>-1&&(Ni(s)[f]=u[f],delete u[f])}}}return i}function bi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ki(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)bi(o.ranges[s].anchor,t,r,n),bi(o.ranges[s].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var l=o.changes[s];if(r<l.from.line)l.from=Bo(l.from.line+n,l.from.ch),l.to=Bo(l.to.line+n,l.to.ch);else if(t<=l.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function xi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;ki(e.done,r,n,i),ki(e.undone,r,n,i)}function wi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function _i(e){return e.target||e.srcElement}function Ci(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),zo&&e.ctrlKey&&1==t&&(t=3),t}function Si(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():Ia:n||Ia}function Mi(e,t){function r(e){return function(){e.apply(null,o)}}var n=Si(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Vo?i=Vo.delayedCallbacks:Pa?i=Pa:(i=Pa=[],setTimeout(Li,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function Li(){var e=Pa;Pa=null;for(var t=0;t<e.length;++t)e[t]()}function Ti(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),qa(e,r||t.type,e,t),wi(t)||t.codemirrorIgnore}function Ai(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)qi(r,t[n])==-1&&r.push(t[n])}function Ei(e,t){return Si(e,t).length>0}function Oi(e){e.prototype.on=function(e,t){za(this,e,t)},e.prototype.off=function(e,t){Na(this,e,t)}}function zi(){this.id=null}function Ii(e){for(;$a.length<=e;)$a.push(Ni($a)+" ");return $a[e]}function Ni(e){return e[e.length-1]}function qi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Pi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Ri(){}function ji(e,t){var r;return Object.create?r=Object.create(e):(Ri.prototype=e,r=new Ri),t&&Di(t,r),r}function Di(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Bi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Fi(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Ga(e))||t.test(e):Ga(e)}function Wi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Hi(e){return e.charCodeAt(0)>=768&&Xa.test(e)}function $i(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function Ui(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ki(e,t){return Ui(e).appendChild(t)}function Vi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Gi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Xi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Gi(r[n]).test(t)&&(t+=" "+r[n]);return t}function Zi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Yi(){ts||(Qi(),ts=!0)}function Qi(){var e;za(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Zi(Kt)},100))}),za(window,"blur",function(){Zi(br)})}function Ji(e){if(null==Ya){var t=$i("span","");Ki(e,$i("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ya=t.offsetWidth<=1&&t.offsetHeight>2&&!(xo&&wo<8))}var r=Ya?$i("span",""):$i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function eo(e){if(null!=Qa)return Qa;var t=Ki(e,document.createTextNode("AخA")),r=Ka(t,0,1).getBoundingClientRect(),n=Ka(t,1,2).getBoundingClientRect();return Ui(e),!(!r||r.left==r.right)&&(Qa=n.right-r.right<3)}function to(e){if(null!=as)return as;var t=Ki(e,$i("span","x")),r=t.getBoundingClientRect(),n=Ka(t,0,1).getBoundingClientRect();return as=Math.abs(r.left-n.left)>1}function ro(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function no(e){return e.level%2?e.to:e.from}function io(e){return e.level%2?e.from:e.to}function oo(e){var t=ai(e);return t?no(t[0]):0}function ao(e){var t=ai(e);return t?io(Ni(t)):e.text.length}function so(e,t){var r=Jn(e.doc,t),n=kn(r);n!=r&&(t=ni(n));var i=ai(n),o=i?i[0].level%2?ao(n):oo(n):0;return Bo(t,o)}function lo(e,t){for(var r,n=Jn(e.doc,t);r=yn(n);)n=r.find(1,!0).line,t=null;var i=ai(n),o=i?i[0].level%2?oo(n):ao(n):n.text.length;return Bo(null==t?ni(n):t,o)}function co(e,t){var r=so(e,t.line),n=Jn(e.doc,r.line),i=ai(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return Bo(r.line,a?0:o)}return r}function uo(e,t,r){var n=e[0].level;return t==n||r!=n&&t<r}function fo(e,t){ls=null;for(var r,n=0;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(null!=r)return uo(e,i.level,e[r].level)?(i.from!=i.to&&(ls=r),n):(i.from!=i.to&&(ls=n),r);r=n}}return r}function po(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Hi(e.text.charAt(t)));return t}function ho(e,t,r,n){var i=ai(e);if(!i)return mo(e,t,r,n);for(var o=fo(i,t),a=i[o],s=po(e,t,a.level%2?-r:r,n);;){if(s>a.from&&s<a.to)return s;if(s==a.from||s==a.to)return fo(i,s)==o?s:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;s=r>0==a.level%2?po(e,a.to,-1,n):po(e,a.from,1,n)}}function mo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Hi(e.text.charAt(i));)i+=r;return i<0||i>e.text.length?null:i}var go=navigator.userAgent,vo=navigator.platform,yo=/gecko\/\d/i.test(go),bo=/MSIE \d/.test(go),ko=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(go),xo=bo||ko,wo=xo&&(bo?document.documentMode||6:ko[1]),_o=/WebKit\//.test(go),Co=_o&&/Qt\/\d+\.\d+/.test(go),So=/Chrome\//.test(go),Mo=/Opera\//.test(go),Lo=/Apple Computer/.test(navigator.vendor),To=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(go),Ao=/PhantomJS/.test(go),Eo=/AppleWebKit/.test(go)&&/Mobile\/\w+/.test(go),Oo=Eo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(go),zo=Eo||/Mac/.test(vo),Io=/\bCrOS\b/.test(go),No=/win/i.test(vo),qo=Mo&&go.match(/Version\/(\d*\.\d*)/);qo&&(qo=Number(qo[1])),qo&&qo>=15&&(Mo=!1,_o=!0);var Po=zo&&(Co||Mo&&(null==qo||qo<12.11)),Ro=yo||xo&&wo>=9,jo=!1,Do=!1;m.prototype=Di({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){ -this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=zo&&!To?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new zi,this.disableVert=new zi},enableZeroWidthBar:function(e,t){function r(){var n=e.getBoundingClientRect(),i=document.elementFromPoint(n.left+1,n.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Di({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},S.prototype.signal=function(e,t){Ei(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e<this.events.length;e++)qa.apply(null,this.events[e])};var Bo=e.Pos=function(e,t){return this instanceof Bo?(this.line=e,void(this.ch=t)):new Bo(e,t)},Fo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Wo=null;ne.prototype=Di({init:function(e){function t(e){if(!Ti(n,e)){if(n.somethingSelected())Wo={lineWise:!1,text:n.getSelections()},r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Wo.text.join("\n"),Ua(o));else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Wo={lineWise:!0,text:t.text},"cut"==e.type?n.setSelections(t.ranges,null,Da):(r.prevInput="",o.value=t.text.join("\n"),Ua(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}var r=this,n=this.cm,i=this.wrapper=ie(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),Eo&&(o.style.width="0px"),za(o,"input",function(){xo&&wo>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),za(o,"paste",function(e){Ti(n,e)||J(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),za(o,"cut",t),za(o,"copy",t),za(e.scroller,"paste",function(t){Vt(e,t)||Ti(n,t)||(n.state.pasteIncoming=!0,r.focus())}),za(e.lineSpace,"selectstart",function(t){Vt(e,t)||Aa(t)}),za(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),za(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Pe(e);if(e.options.moveInputWithCursor){var i=mt(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ki(r.cursorDiv,e.cursors),Ki(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=os&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.composing||(this.textarea.value=a),n.state.focused&&Ua(this.textarea),xo&&wo>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),xo&&wo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Oo||Vi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||is(t)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(xo&&wo>=9&&this.hasSelection===n||zo&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);o<a&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var s=this;return Ot(e,function(){Q(e,n.slice(o),r.length-o,null,s.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=n,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){xo&&wo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=f,a.style.cssText=u,xo&&wo<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!xo||xo&&wo<9)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==n.prevInput?zt(i,da.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,s=Gt(i,e),l=o.scroller.scrollTop;if(s&&!Mo){var c=i.options.resetSelectionOnContextMenu;c&&i.doc.sel.contains(s)==-1&&zt(i,Le)(i.doc,he(s),Da);var u=a.style.cssText,f=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var d=n.wrapper.getBoundingClientRect();if(a.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px; z-index: 1000; background: "+(xo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",_o)var p=window.scrollY;if(o.input.focus(),_o&&window.scrollTo(null,p),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),xo&&wo>=9&&t(),Ro){Oa(e);var h=function(){Na(window,"mouseup",h),setTimeout(r,20)};za(window,"mouseup",h)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Ri,needsContentAttribute:!1},ne.prototype),oe.prototype=Di({init:function(e){function t(e){if(!Ti(n,e)){if(n.somethingSelected())Wo={lineWise:!1,text:n.getSelections()},"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Wo={lineWise:!0,text:t.text},"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Da),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Eo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Wo.text.join("\n"));else{var r=ie(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Wo.text.join("\n");var o=document.activeElement;Ua(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;re(i),za(i,"paste",function(e){Ti(n,e)||J(e,n)}),za(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=he(Bo(i.head.line,a),Bo(i.head.line,a+t.length)))}}),za(i,"compositionupdate",function(e){r.composing.data=e.data}),za(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),za(i,"touchstart",function(){r.forceCompositionEnd()}),za(i,"input",function(){r.composing||!n.isReadOnly()&&r.pollContent()||Ot(r.cm,function(){Rt(n)})}),za(i,"copy",t),za(i,"cut",t)},prepareSelection:function(){var e=Pe(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Fo(Z(r,n),t.from())||0!=Fo(X(r,n),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ka(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(!yo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),s&&null==e.anchorNode?e.addRange(s):yo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ki(this.cm.display.cursorDiv,e.cursors),Ki(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Za(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Ot(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Ot(t,function(){Le(t.doc,he(r,n),Da),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Bt(e,n.line)))var a=ni(t.view[0].line),s=t.view[0].node;else var a=ni(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=Bt(e,i.line);if(l==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ni(t.view[l+1].line)-1,u=t.view[l+1].node.previousSibling;for(var f=e.doc.splitLines(ue(e,s,u,a,c)),d=ei(e.doc,Bo(a,0),Bo(c,Jn(e.doc,c).text.length));f.length>1&&d.length>1;)if(Ni(f)==Ni(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var p=0,h=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);p<v&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Ni(f),b=Ni(d),k=Math.min(y.length-(1==f.length?p:0),b.length-(1==d.length?p:0));h<k&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;f[f.length-1]=y.slice(0,y.length-h),f[0]=f[0].slice(p);var x=Bo(a,p),w=Bo(c,d.length?Ni(d).length-h:0);return f.length>1||f[0]||Fo(x,w)?(Ir(e.doc,f,x,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?zt(this.cm,Rt)(this.cm):e.data&&e.data!=e.startData&&zt(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Ri,resetPosition:Ri,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:ne,contenteditable:oe},fe.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=Fo(r.anchor,n.anchor)||0!=Fo(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new de(G(this.ranges[t].anchor),G(this.ranges[t].head));return new fe(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Fo(t,n.from())>=0&&Fo(e,n.to())<=0)return r}return-1}},de.prototype={from:function(){return Z(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ho,$o,Uo,Ko={left:0,right:0,top:0,bottom:0},Vo=null,Go=0,Xo=0,Zo=0,Yo=null;xo?Yo=-.53:yo?Yo=15:So?Yo=-.7:Lo&&(Yo=-1/3);var Qo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Qo(e);return t.x*=Yo,t.y*=Yo,t};var Jo=new zi,ea=null,ta=e.changeEnd=function(e){return e.text?Bo(e.from.line+e.text.length-1,Ni(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];r[e]==t&&"mode"!=e||(r[e]=t,na.hasOwnProperty(e)&&zt(this,na[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Gr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:It(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Rt(this)}),removeOverlay:It(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Rt(this)}}),indentLine:It(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ye(this.doc,e)&&Fr(this,e,t,r)}),indentSelection:It(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Fr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Dr(this));else{var o=i.from(),a=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l<r;++l)Fr(this,l,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&_e(this.doc,n,new de(o,c[n].to()),Da)}}}),getTokenAt:function(e,t){return Nn(this,e,t)},getLineTokens:function(e,t){return Nn(this,Bo(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Rn(this,Jn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var s=t?t.indexOf("cm-overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!ca.hasOwnProperty(t))return r;var n=ca[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var s=n._global[o];s.pred(i,this)&&qi(r,s.val)==-1&&r.push(s.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=me(r,null==e?r.first+r.size-1:e),He(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?ge(this.doc,e):e?n.from():n.to(),mt(this,r,t||"page")},charCoords:function(e,t){return ht(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=pt(this,e,t||"page"),yt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=pt(this,{top:e,left:0},t||"page").top,ii(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r,n=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,n=!0),r=Jn(this.doc,e)}else r=e;return dt(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-oi(r):0)},defaultTextHeight:function(){return kt(this.display)},defaultCharWidth:function(){return xt(this.display)},setGutterMarker:It(function(e,t,r){return Wr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Wi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:It(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,jt(t,n,"gutter"),Wi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Jn(this.doc,e),!e)return null}else{var t=ni(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=mt(this,ge(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Pr(this,s,a,s+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:It(pr),triggerOnKeyPress:It(gr),triggerOnKeyUp:mr,execCommand:function(e){if(da.hasOwnProperty(e))return da[e].call(null,this)},triggerElectric:It(function(e){ee(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);o<t&&(a=$r(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:It(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?$r(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},Fa)}),deleteH:It(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Hr(this,function(r){var i=$r(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var a=0,s=ge(this.doc,e);a<t;++a){var l=mt(this,s,"div");if(null==o?o=l.left:l.left=o,s=Ur(this,l,i,r),s.hitSide)break}return s},moveV:It(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return e<0?a.from():a.to();var s=mt(r,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=Ur(r,s,e,t);return"page"==t&&a==n.sel.primary()&&jr(r,null,ht(r,l,"div").top-s.top),l},Fa),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,r=Jn(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==r.length)&&n?--n:++i;for(var a=r.charAt(n),s=Fi(a,o)?function(e){return Fi(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Fi(e)};n>0&&s(r.charAt(n-1));)--n;for(;i<r.length&&s(r.charAt(i));)++i}return new de(Bo(e.line,n),Bo(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?es(this.display.cursorDiv,"CodeMirror-overwrite"):Ja(this.display.cursorDiv,"CodeMirror-overwrite"),qa(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Vi()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:It(function(e,t){null==e&&null==t||Br(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ve(this)-this.display.barHeight,width:e.scrollWidth-Ve(this)-this.display.barWidth,clientHeight:Xe(this),clientWidth:Ge(this)}},scrollIntoView:It(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:Bo(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Br(this),this.curOp.scrollToPos=e;else{var r=Rr(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:It(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(n.display.wrapper.style.width=r(e)),null!=t&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&<(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){jt(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,qa(n,"refresh",this)}),operation:function(e){return Ot(this,e)},refresh:It(function(){var e=this.display.cachedTextHeight;Rt(this),this.curOp.forceUpdate=!0,ct(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-kt(this.display))>.5)&&a(this),qa(this,"refresh",this)}),swapDoc:It(function(e){var t=this.doc;return t.cm=null,Qn(this,e),ct(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Mi(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Oi(e);var ra=e.defaults={},na=e.optionHandlers={},ia=e.Init={toString:function(){return"CodeMirror.Init"}};Kr("value","",function(e,t){e.setValue(t)},!0),Kr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Kr("indentUnit",2,r,!0),Kr("indentWithTabs",!1),Kr("smartIndent",!0),Kr("tabSize",4,function(e){n(e),ct(e),Rt(e)},!0),Kr("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,r.push(Bo(n,o))}n++});for(var i=r.length-1;i>=0;i--)Ir(e.doc,t,r[i],Bo(r[i].line,r[i].ch+t.length))}}),Kr("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test("\t")?"":"|\t"),"g"),n!=e.Init&&t.refresh()}),Kr("specialCharPlaceholder",Fn,function(e){e.refresh()},!0),Kr("electricChars",!0),Kr("inputStyle",Oo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Kr("rtlMoveVisually",!No),Kr("wholeLineUpdateBefore",!0),Kr("theme","default",function(e){s(e),l(e)},!0),Kr("keyMap","default",function(t,r,n){var i=Gr(r),o=n!=e.Init&&Gr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Kr("extraKeys",null),Kr("lineWrapping",!1,i,!0),Kr("gutters",[],function(e){p(e.options),l(e)},!0),Kr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Kr("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Kr("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Kr("lineNumbers",!1,function(e){p(e.options),l(e)},!0),Kr("firstLineNumber",1,l,!0),Kr("lineNumberFormatter",function(e){return e},l,!0),Kr("showCursorWhenSelecting",!1,qe,!0),Kr("resetSelectionOnContextMenu",!0),Kr("lineWiseCopyCut",!0),Kr("readOnly",!1,function(e,t){"nocursor"==t?(br(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Kr("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Kr("dragDrop",!0,Ut),Kr("allowDropFileTypes",null),Kr("cursorBlinkRate",530),Kr("cursorScrollMargin",0),Kr("cursorHeight",1,qe,!0),Kr("singleCursorHeightPerLine",!0,qe,!0),Kr("workTime",100),Kr("workDelay",100),Kr("flattenSpans",!0,n,!0),Kr("addModeClass",!1,n,!0),Kr("pollInterval",100),Kr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Kr("historyEventDelay",1250),Kr("viewportMargin",10,function(e){e.refresh()},!0),Kr("maxHighlightLength",1e4,n,!0),Kr("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Kr("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Kr("autofocus",null);var oa=e.modes={},aa=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),oa[t]=r},e.defineMIME=function(e,t){aa[e]=t},e.resolveMode=function(t){if("string"==typeof t&&aa.hasOwnProperty(t))t=aa[t];else if(t&&"string"==typeof t.name&&aa.hasOwnProperty(t.name)){var r=aa[t.name];"string"==typeof r&&(r={name:r}),t=ji(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=oa[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(sa.hasOwnProperty(r.name)){var o=sa[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var sa=e.modeExtensions={};e.extendMode=function(e,t){var r=sa.hasOwnProperty(e)?sa[e]:sa[e]={};Di(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ma.prototype[e]=t},e.defineOption=Kr;var la=[];e.defineInitHook=function(e){la.push(e)};var ca=e.helpers={};e.registerHelper=function(t,r,n){ca.hasOwnProperty(t)||(ca[t]=e[t]={_global:[]}),ca[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),ca[t]._global.push({pred:n,val:i})};var ua=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},fa=e.startState=function(e,t,r){return!e.startState||e.startState(t,r)};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var da=e.commands={selectAll:function(e){e.setSelection(Bo(e.firstLine(),0),Bo(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){Hr(e,function(t){if(t.empty()){var r=Jn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Bo(t.head.line+1,0)}:{from:t.head,to:Bo(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Hr(e,function(t){return{from:Bo(t.from().line,0),to:ge(e.doc,Bo(t.to().line+1,0))}})},delLineLeft:function(e){Hr(e,function(e){return{from:Bo(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Hr(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){Hr(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(Bo(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Bo(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return so(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return co(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return lo(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Fa)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Fa)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?co(e,t.head):n},Fa)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=Wa(e.getLine(o.line),o.ch,n);t.push(Ii(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Ot(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Jn(e.doc,i.line).text; -if(o)if(i.ch==o.length&&(i=new Bo(i.line,i.ch-1)),i.ch>0)i=new Bo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Bo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Jn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Bo(i.line-1,a.length-1),Bo(i.line,1),"+transpose")}r.push(new de(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Ot(e,function(){for(var t=e.listSelections().length,r=0;r<t;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}Dr(e)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},pa=e.keyMap={};pa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},pa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},pa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},pa["default"]=zo?pa.macDefault:pa.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Pi(r.split(" "),Vr),o=0;o<i.length;o++){var a,s;o==i.length-1?(s=i.join(" "),a=n):(s=i.slice(0,o+1).join(" "),a="...");var l=t[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else t[s]=a}delete e[r]}for(var c in t)e[c]=t[c];return e};var ha=e.lookupKey=function(e,t,r,n){t=Gr(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return ha(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=ha(e,t.fallthrough[o],r,n);if(a)return a}}},ma=e.isModifierKey=function(e){var t="string"==typeof e?e:ss[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},ga=e.keyName=function(e,t){if(Mo&&34==e.keyCode&&e["char"])return!1;var r=ss[e.keyCode],n=r;return null!=n&&!e.altGraphKey&&(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(Po?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(Po?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n)};e.fromTextArea=function(t,r){function n(){t.value=c.getValue()}if(r=r?Di(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=Vi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(za(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var s=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=s}}catch(l){}}r.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Na(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return c};var va=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};va.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));if(r)return++this.pos,t},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Wa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Wa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Wa(this.string,null,this.tabSize)-(this.lineStart?Wa(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ya=0,ba=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ya};Oi(ba),ba.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&wt(e),Ei(this,"clear")){var r=this.find();r&&Mi(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=tn(a.markedSpans,this);e&&!this.collapsed?jt(e,ni(a),"text"):e&&(null!=s.to&&(i=ni(a)),null!=s.from&&(n=ni(a))),a.markedSpans=rn(a.markedSpans,s),null==s.from&&this.collapsed&&!Cn(this.doc,a)&&e&&ri(a,kt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=kn(this.lines[o]),c=f(l);c>e.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Rt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ee(e.doc)),e&&Mi(e,"markerCleared",e,this),t&&Ct(e),this.parent&&this.parent.clear()}},ba.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],a=tn(o.markedSpans,this);if(null!=a.from&&(r=Bo(t?o:ni(o),a.from),e==-1))return r;if(null!=a.to&&(n=Bo(t?o:ni(o),a.to),1==e))return n}return r&&{from:r,to:n}},ba.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Ot(r,function(){var n=e.line,i=ni(e.line),o=et(r,i);if(o&&(st(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Cn(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var s=Ln(t)-a;s&&ri(n,n.height+s)}})},ba.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&qi(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ba.prototype.detachLine=function(e){if(this.lines.splice(qi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ya=0,ka=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Oi(ka),ka.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Mi(this,"clear")}},ka.prototype.find=function(e,t){return this.primary.find(e,t)};var xa=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Oi(xa),xa.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=ni(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=Ln(this);ri(r,Math.max(0,r.height-o)),e&&Ot(e,function(){Mn(e,r,-o),jt(e,n,"widget")})}},xa.prototype.changed=function(){var e=this.height,t=this.doc.cm,r=this.line;this.height=null;var n=Ln(this)-e;n&&(ri(r,r.height+n),t&&Ot(t,function(){t.curOp.forceUpdate=!0,Mn(t,r,n)}))};var wa=e.Line=function(e,t,r){this.text=e,dn(this,t),this.height=r?r(this):1};Oi(wa),wa.prototype.lineNo=function(){return ni(this)};var _a={},Ca={};Xn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,En(i),Mi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},Zn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Xn))){var s=[];this.collapse(s),this.children=[new Xn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,s=a;s<i.lines.length;){var l=new Xn(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++n,0,l),l.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Zn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=qi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Zn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Sa=0,Ma=e.Doc=function(e,t,r,n){if(!(this instanceof Ma))return new Ma(e,t,r,n);null==r&&(r=0),Zn.call(this,[new Xn([new wa("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Bo(r,0);this.sel=he(i),this.history=new si(null),this.id=++Sa,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Gn(this,{from:i,to:i,text:e}),Le(this,he(i),Da)};Ma.prototype=ji(Zn.prototype,{constructor:Ma,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ti(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Nt(function(e){var t=Bo(this.first,0),r=this.first+this.size-1;Lr(this,{from:t,to:Bo(r,Jn(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),Le(this,he(t))}),replaceRange:function(e,t,r,n){t=ge(this,t),r=r?ge(this,r):t,Ir(this,e,t,r,n)},getRange:function(e,t,r){var n=ei(this,ge(this,e),ge(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ye(this,e))return Jn(this,e)},getLineNumber:function(e){return ni(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Jn(this,e)),kn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||e===!1?r.to():r.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nt(function(e,t,r){Ce(this,ge(this,"number"==typeof e?Bo(e,t||0):e),null,r)}),setSelection:Nt(function(e,t,r){Ce(this,ge(this,e),ge(this,t||e),r)}),extendSelection:Nt(function(e,t,r){xe(this,ge(this,e),t&&ge(this,t),r)}),extendSelections:Nt(function(e,t){we(this,be(this,e),t)}),extendSelectionsBy:Nt(function(e,t){var r=Pi(this.sel.ranges,e);we(this,be(this,r),t)}),setSelections:Nt(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new de(ge(this,e[n].anchor),ge(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Le(this,pe(i,t),r)}}),addSelection:Nt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new de(ge(this,e),ge(this,t||e))),Le(this,pe(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ei(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ei(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Nt(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&Sr(this,n,t),o=n.length-1;o>=0;o--)Lr(this,n[o]);s?Me(this,s):this.cm&&Dr(this.cm)}),undo:Nt(function(){Ar(this,"undo")}),redo:Nt(function(){Ar(this,"redo")}),undoSelection:Nt(function(){Ar(this,"undo",!0)}),redoSelection:Nt(function(){Ar(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new si(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:yi(this.history.done),undone:yi(this.history.undone)}},setHistory:function(e){var t=this.history=new si(this.history.maxGeneration);t.done=yi(e.done.slice(0),null,!0),t.undone=yi(e.undone.slice(0),null,!0)},addLineClass:Nt(function(e,t,r){return Wr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(Gi(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Nt(function(e,t,r){return Wr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(Gi(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Nt(function(e,t,r){return Tn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Xr(this,ge(this,e),ge(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Xr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],r=Jn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ge(this,e),t=ge(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];null!=l.to&&i==e.line&&e.ch>=l.to||null==l.from&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||r&&!r(l.marker)||n.push(l.marker.parent||l.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;return o>e?(t=e,!0):(e-=o,void++r)}),ge(this,Bo(r,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new Ma(ti(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Ma(ti(this,t,r),e.mode||this.modeOption,t,this.lineSep);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Qr(n,Yr(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),Jr(Yr(this));break}}if(t.history==this.history){var i=[t.id];Yn(t,function(e){i.push(e.id)},!0),t.history=new si(null),t.history.done=yi(this.history.done,i),t.history.undone=yi(this.history.undone,i)}},iterLinkedDocs:function(e){Yn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ns(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Ma.prototype.eachLine=Ma.prototype.iter;var La="iter insert remove copy getEditor constructor".split(" ");for(var Ta in Ma.prototype)Ma.prototype.hasOwnProperty(Ta)&&qi(La,Ta)<0&&(e.prototype[Ta]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ma.prototype[Ta]));Oi(Ma);var Aa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Ea=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},Oa=e.e_stop=function(e){Aa(e),Ea(e)},za=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},Ia=[],Na=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else for(var n=Si(e,t,!1),i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}},qa=e.signal=function(e,t){var r=Si(e,t,!0);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Pa=null,Ra=30,ja=e.Pass={toString:function(){return"CodeMirror.Pass"}},Da={scroll:!1},Ba={origin:"*mouse"},Fa={origin:"+move"};zi.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Wa=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=n||0,a=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return a+(t-o);a+=s-o,a+=r-a%r,o=s+1}},Ha=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);o==-1&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},$a=[""],Ua=function(e){e.select()};Eo?Ua=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:xo&&(Ua=function(e){try{e.select()}catch(t){}});var Ka,Va=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ga=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Va.test(e))},Xa=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ka=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Za=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};xo&&wo<11&&(Vi=function(){try{return document.activeElement}catch(e){return document.body}});var Ya,Qa,Ja=e.rmClass=function(e,t){var r=e.className,n=Gi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},es=e.addClass=function(e,t){var r=e.className;Gi(t).test(r)||(e.className+=(r?" ":"")+t)},ts=!1,rs=function(){if(xo&&wo<9)return!1;var e=$i("div");return"draggable"in e||"dragDrop"in e}(),ns=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");a!=-1?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},is=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},os=function(){var e=$i("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),as=null,ss=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;e<10;e++)ss[e+48]=ss[e+96]=String(e);for(var e=65;e<=90;e++)ss[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)ss[e+111]=ss[e+63235]="F"+e}();var ls,cs=function(){function e(e){return e<=247?r.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1773?n.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,f=[],d=0;d<u;++d)f.push(n=e(r.charCodeAt(d)));for(var d=0,p=c;d<u;++d){var n=f[d];"m"==n?f[d]=p:p=n}for(var d=0,h=c;d<u;++d){var n=f[d];"1"==n&&"r"==h?f[d]="n":a.test(n)&&(h=n,"r"==n&&(f[d]="R"))}for(var d=1,p=f[0];d<u-1;++d){var n=f[d];"+"==n&&"1"==p&&"1"==f[d+1]?f[d]="1":","!=n||p!=f[d+1]||"1"!=p&&"n"!=p||(f[d]=p),p=n}for(var d=0;d<u;++d){var n=f[d];if(","==n)f[d]="N";else if("%"==n){for(var m=d+1;m<u&&"%"==f[m];++m);for(var g=d&&"!"==f[d-1]||m<u&&"1"==f[m]?"1":"N",v=d;v<m;++v)f[v]=g;d=m-1}}for(var d=0,h=c;d<u;++d){var n=f[d];"L"==h&&"1"==n?f[d]="L":a.test(n)&&(h=n)}for(var d=0;d<u;++d)if(o.test(f[d])){for(var m=d+1;m<u&&o.test(f[m]);++m);for(var y="L"==(d?f[d-1]:c),b="L"==(m<u?f[m]:c),g=y||b?"L":"R",v=d;v<m;++v)f[v]=g;d=m-1}for(var k,x=[],d=0;d<u;)if(s.test(f[d])){var w=d;for(++d;d<u&&s.test(f[d]);++d);x.push(new t(0,w,d))}else{var _=d,C=x.length;for(++d;d<u&&"L"!=f[d];++d);for(var v=_;v<d;)if(l.test(f[v])){_<v&&x.splice(C,0,new t(1,_,v));var S=v;for(++v;v<d&&l.test(f[v]);++v);x.splice(C,0,new t(2,S,v)),_=v}else++v;_<d&&x.splice(C,0,new t(1,_,d))}return 1==x[0].level&&(k=r.match(/^\s+/))&&(x[0].from=k[0].length,x.unshift(new t(0,0,k[0].length))),1==Ni(x).level&&(k=r.match(/\s+$/))&&(Ni(x).to-=k[0].length,x.push(new t(0,u-k[0].length,u))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Ni(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.17.1",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,r,n){return{startState:function(){return{base:e.startState(t),overlay:e.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:e.copyState(t,n.base),overlay:e.copyState(r,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=r.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||n&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,r){return t.indent(e.base,r)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),r.blankLine&&r.blankLine(e.overlay)}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function r(e,t){if(!e)return/(?:)/;var r="";return e instanceof RegExp?(e.ignoreCase&&(r="i"),e=e.source):e=String(e),new RegExp((t===!1?"":"^")+"(?:"+e+")",r)}function n(e){if(!e)return null;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],r=0;r<e.length;r++)t.push(e[r]&&e[r].replace(/\./g," "));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=r(e.regex),this.token=n(e.token),this.data=e}function o(e,t){return function(r,n){if(n.pending){var i=n.pending.shift();return 0==n.pending.length&&(n.pending=null),r.pos+=i.text.length,i.token}if(n.local){if(n.local.end&&r.match(n.local.end)){var o=n.local.endToken||null;return n.local=n.localState=null,o}var a,o=n.local.mode.token(r,n.localState);return n.local.endScan&&(a=n.local.endScan.exec(r.current()))&&(r.pos=r.start+a.index),o}for(var l=e[n.state],c=0;c<l.length;c++){var u=l[c],f=(!u.data.sol||r.sol())&&r.match(u.regex);if(f){if(u.data.next?n.state=u.data.next:u.data.push?((n.stack||(n.stack=[])).push(n.state),n.state=u.data.push):u.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),u.data.mode&&s(t,n,u.data.mode,u.token),u.data.indent&&n.indent.push(r.indentation()+t.indentUnit),u.data.dedent&&n.indent.pop(),f.length>2){n.pending=[];for(var d=2;d<f.length;d++)f[d]&&n.pending.push({text:f[d],token:u.token[d-1]});return r.backUp(f[0].length-(f[1]?f[1].length:0)),u.token[0]}return u.token&&u.token.join?u.token[0]:u.token}}return r.next(),null}}function a(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var r=0;for(var n in e)if(e.hasOwnProperty(n)){if(!t.hasOwnProperty(n)||!a(e[n],t[n]))return!1;r++}for(var n in t)t.hasOwnProperty(n)&&r--;return 0==r}function s(t,n,i,o){var s;if(i.persistent)for(var l=n.persistentStates;l&&!s;l=l.next)(i.spec?a(i.spec,l.spec):i.mode==l.mode)&&(s=l);var c=s?s.mode:i.mode||e.getMode(t,i.spec),u=s?s.state:e.startState(c);i.persistent&&!s&&(n.persistentStates={mode:c,spec:i.spec,state:u, -next:n.persistentStates}),n.localState=u,n.local={mode:c,end:i.end&&r(i.end),endScan:i.end&&i.forceEnd!==!1&&r(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function l(e,t){for(var r=0;r<t.length;r++)if(t[r]===e)return!0}function c(t,r){return function(n,i,o){if(n.local&&n.local.mode.indent)return n.local.mode.indent(n.localState,i,o);if(null==n.indent||n.local||r.dontIndentStates&&l(n.state,r.dontIndentStates)>-1)return e.Pass;var a=n.indent.length-1,s=t[n.state];e:for(;;){for(var c=0;c<s.length;c++){var u=s[c];if(u.data.dedent&&u.data.dedentIfLineStart!==!1){var f=u.regex.exec(i);if(f&&f[0]){a--,(u.next||u.push)&&(s=t[u.next||u.push]),i=i.slice(f[0].length);continue e}}}break}return a<0?0:n.indent[a]}}e.defineSimpleMode=function(t,r){e.defineMode(t,function(t){return e.simpleMode(t,r)})},e.simpleMode=function(r,n){t(n,"start");var a={},s=n.meta||{},l=!1;for(var u in n)if(u!=s&&n.hasOwnProperty(u))for(var f=a[u]=[],d=n[u],p=0;p<d.length;p++){var h=d[p];f.push(new i(h,n)),(h.indent||h.dedent)&&(l=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:l?[]:null}},copyState:function(t){var r={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(r.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(r.stack=t.stack.slice(0));for(var n=t.persistentStates;n;n=n.next)r.persistentStates={mode:n.mode,spec:n.spec,state:n.state==t.localState?r.localState:e.copyState(n.mode,n.state),next:r.persistentStates};return r},token:o(a,r),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:c(a,s)};if(s)for(var g in s)s.hasOwnProperty(g)&&(m[g]=s[g]);return m}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.multiplexingMode=function(t){function r(e,t,r,n){if("string"==typeof t){var i=e.indexOf(t,r);return n&&i>-1?i+t.length:i}var o=t.exec(r?e.slice(r):e);return o?o.index+r+(n?o[0].length:0):-1}var n=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(r){return{outer:e.copyState(t,r.outer),innerActive:r.innerActive,inner:r.innerActive&&e.copyState(r.innerActive.mode,r.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,s=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var l=a.close?r(s,a.close,i.pos,a.parseDelimiters):-1;if(l==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";l>-1&&(i.string=s.slice(0,l));var c=a.mode.token(i,o.inner);return l>-1&&(i.string=s),l==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,s=i.string,f=0;f<n.length;++f){var d=n[f],l=r(s,d.open,i.pos);if(l==i.pos)return d.parseDelimiters||i.match(d.open),o.innerActive=d,o.inner=e.startState(d.mode,t.indent?t.indent(o.outer,""):0),d.delimStyle&&d.delimStyle+" "+d.delimStyle+"-open";l!=-1&&l<u&&(u=l)}u!=1/0&&(i.string=s.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=s),p},indent:function(r,n){var i=r.innerActive?r.innerActive.mode:t;return i.indent?i.indent(r.innerActive?r.inner:r.outer,n):e.Pass},blankLine:function(r){var i=r.innerActive?r.innerActive.mode:t;if(i.blankLine&&i.blankLine(r.innerActive?r.inner:r.outer),r.innerActive)"\n"===r.innerActive.close&&(r.innerActive=r.inner=null);else for(var o=0;o<n.length;++o){var a=n[o];"\n"===a.open&&(r.innerActive=a,r.inner=e.startState(a.mode,i.indent?i.indent(r.outer,""):0))}},electricChars:t.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:t}}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a),e.removeLineClass(e.state.activeLines[t],"gutter",s)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],l=0;l<n.length;l++){var c=n[l];if(c.empty()){var u=e.getLineHandleVisualStart(c.head.line);i[i.length-1]!=u&&i.push(u)}}r(e.state.activeLines,i)||e.operation(function(){t(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap",o),e.addLineClass(i[r],"background",a),e.addLineClass(i[r],"gutter",s);e.state.activeLines=i})}function i(e,t){n(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background",s="CodeMirror-activeline-gutter";e.defineOption("styleActiveLine",!1,function(r,o,a){var s=a&&a!=e.Init;o&&!s?(r.state.activeLines=[],n(r,r.listSelections()),r.on("beforeSelectionChange",i)):!o&&s&&(r.off("beforeSelectionChange",i),t(r),delete r.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,i,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),i=i?e.clipPos(i):n(0,0),this.pos={from:i,to:i},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(r,i){if(r){t.lastIndex=0;for(var o,a,s=e.getLine(i.line).slice(0,i.ch),l=0;;){t.lastIndex=l;var c=t.exec(s);if(!c)break;if(o=c,a=o.index,l=o.index+(o[0].length||1),l==s.length)break}var u=o&&o[0].length||0;u||(0==a&&0==s.length?o=void 0:a!=e.getLine(i.line).length&&u++)}else{t.lastIndex=i.ch;var s=e.getLine(i.line),o=t.exec(s),u=o&&o[0].length||0,a=o&&o.index;a+u==s.length||u||(u=1)}if(o&&u)return{from:n(i.line,a),to:n(i.line,a+u),match:o}};else{var a=t;o&&(t=t.toLowerCase());var s=o?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)t.length?this.matches=function(i,o){if(i){var l=e.getLine(o.line).slice(0,o.ch),c=s(l),u=c.lastIndexOf(t);if(u>-1)return u=r(l,c,u),{from:n(o.line,u),to:n(o.line,u+a.length)}}else{var l=e.getLine(o.line).slice(o.ch),c=s(l),u=c.indexOf(t);if(u>-1)return u=r(l,c,u)+o.ch,{from:n(o.line,u),to:n(o.line,u+a.length)}}}:this.matches=function(){};else{var c=a.split("\n");this.matches=function(t,r){var i=l.length-1;if(t){if(r.line-(l.length-1)<e.firstLine())return;if(s(e.getLine(r.line).slice(0,c[i].length))!=l[l.length-1])return;for(var o=n(r.line,c[i].length),a=r.line-1,u=i-1;u>=1;--u,--a)if(l[u]!=s(e.getLine(a)))return;var f=e.getLine(a),d=f.length-c[0].length;if(s(f.slice(d))!=l[0])return;return{from:n(a,d),to:o}}if(!(r.line+(l.length-1)>e.lastLine())){var f=e.getLine(r.line),d=f.length-c[0].length;if(s(f.slice(d))==l[0]){for(var p=n(r.line,d),a=r.line+1,u=1;u<i;++u,++a)if(l[u]!=s(e.getLine(a)))return;if(s(e.getLine(a).slice(0,c[i].length))==l[i])return{from:p,to:n(a,c[i].length)}}}}}}}function r(e,t,r){if(e.length==t.length)return r;for(var n=Math.min(r,e.length);;){var i=e.slice(0,n).toLowerCase().length;if(i<r)++n;else{if(!(i>r))return n;--n}}}var n=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=n(e,0);return r.pos={from:t,to:t},r.atOccurrence=!1,!1}for(var r=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=n(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=n(i.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,r){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,r),this.pos.to=n(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,r,n){return new t(this.doc,e,r,n)}),e.defineDocExtension("getSearchCursor",function(e,r,n){return new t(this,e,r,n)}),e.defineExtension("selectMatches",function(t,r){for(var n=[],i=this.getSearchCursor(t,this.getCursor("from"),r);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)n.push({anchor:i.from(),head:i.to()});n.length&&this.setSelections(n,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var r=e.exec(t.string);return r&&r.index==t.pos?(t.pos+=r[0].length||1,"searching"):void(r?t.pos=r.index:t.skipToEnd())}}}function r(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new r)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,r){return e.getSearchCursor(t,r,i(t))}function a(e,t,r,n,i){e.openDialog(t,n,{value:r,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){h(e)},onKeyDown:i})}function s(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0}):i(prompt(r,n))}function l(e,t,r,n){e.openConfirm?e.openConfirm(t,n):confirm(r)&&n[0]()}function c(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],t[2].indexOf("i")==-1?"":"i")}catch(r){}else e=c(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function f(e,r,n){r.queryText=n,r.query=u(n),e.removeOverlay(r.overlay,i(r.query)),r.overlay=t(r.query,i(r.query)),e.addOverlay(r.overlay),e.showMatchesOnScrollbar&&(r.annotate&&(r.annotate.clear(),r.annotate=null),r.annotate=e.showMatchesOnScrollbar(r.query,i(r.query)))}function d(t,r,i,o){var l=n(t);if(l.query)return p(t,r);var c=t.getSelection()||l.lastQuery;if(i&&t.openDialog){var u=null,d=function(r,n){e.e_stop(n),r&&(r!=l.queryText&&(f(t,l,r),l.posFrom=l.posTo=t.getCursor()),u&&(u.style.opacity=1),p(t,n.shiftKey,function(e,r){var n;r.line<3&&document.querySelector&&(n=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>t.cursorCoords(r,"window").top&&((u=n).style.opacity=.4)}))};a(t,v,c,d,function(r,i){var o=e.keyMap[t.getOption("keyMap")][e.keyName(r)];"findNext"==o||"findPrev"==o?(e.e_stop(r),f(t,n(t),i),t.execCommand(o)):"find"!=o&&"findPersistent"!=o||(e.e_stop(r),d(i,r))}),o&&(f(t,l,c),p(t,r))}else s(t,v,"Search for:",c,function(e){e&&!l.query&&t.operation(function(){f(t,l,e),l.posFrom=l.posTo=t.getCursor(),p(t,r)})})}function p(t,r,i){t.operation(function(){var a=n(t),s=o(t,a.query,r?a.posFrom:a.posTo);(s.find(r)||(s=o(t,a.query,r?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),s.find(r)))&&(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))})}function h(e){e.operation(function(){var t=n(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function m(e,t,r){e.operation(function(){for(var n=o(e,t);n.findNext();)if("string"!=typeof t){var i=e.getRange(n.from(),n.to()).match(t);n.replace(r.replace(/\$(\d)/g,function(e,t){return i[t]}))}else n.replace(r)})}function g(e,t){if(!e.getOption("readOnly")){var r=e.getSelection()||n(e).lastQuery,i=t?"Replace all:":"Replace:";s(e,i+y,i,r,function(r){r&&(r=u(r),s(e,b,"Replace with:","",function(n){if(n=c(n),t)m(e,r,n);else{h(e);var i=o(e,r,e.getCursor("from")),a=function(){var t,c=i.from();!(t=i.findNext())&&(i=o(e,r),!(t=i.findNext())||c&&i.from().line==c.line&&i.from().ch==c.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,k,"Replace?",[function(){s(t)},a,function(){m(e,r,n)}]))},s=function(e){i.replace("string"==typeof r?n:n.replace(/\$(\d)/g,function(t,r){return e[r]})),a()};a()}}))})}}var v='Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',y=' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',b='With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',k="Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>";e.commands.find=function(e){h(e),d(e)},e.commands.findPersistent=function(e){h(e),d(e,!1,!0)},e.commands.findPersistentNext=function(e){d(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){d(e,!0,!0,!0)},e.commands.findNext=d,e.commands.findPrev=function(e){d(e,!0)},e.commands.clearSearch=h,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0}):i(prompt(r,n))}function r(e,t){var r=Number(t);return/^[-+]/.test(t)?e.getCursor().line+r:r-1}var n='Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>';e.commands.jumpToLine=function(e){var i=e.getCursor();t(e,n,"Jump to line:",i.line+1+":"+i.ch,function(t){if(t){var n;if(n=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(r(e,n[1]),Number(n[2]));else if(n=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(n[1])/100);/^[-+]/.test(n[1])&&(o=i.line+o+1),e.setCursor(o-1,i.ch)}else(n=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(r(e,n[1]),i.ch)}})},e.keyMap["default"]["Alt-G"]="jumpToLine"}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n){this.cm=e,this.options=n;var i={listenForChanges:!1};for(var o in n)i[o]=n[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=r,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function r(e,t,r){return e<=t?e:Math.max(t,e+r)}e.defineExtension("showMatchesOnScrollbar",function(e,r,n){return"string"==typeof n&&(n={className:n}),n||(n={}),new t(this,e,r,n)});var n=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t<this.matches.length;t++){var r=this.matches[t];if(r.from.line>=this.gap.to)break;r.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||n;i.findNext();){var r={from:i.from(),to:i.to()};if(r.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,r),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var n=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(r(this.gap.from,n,o),t.from.line),this.gap.to=Math.max(r(this.gap.to,n,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;a<this.matches.length;a++){var s=this.matches[a],l=r(s.from.line,n,o);l!=s.from.line&&(s.from=e.Pos(l,s.from.ch));var c=r(s.to.line,n,o);c!=s.to.line&&(s.to=e.Pos(c,s.to.ch))}clearTimeout(this.update);var u=this;this.update=setTimeout(function(){u.updateAfterChange()},250)},t.prototype.updateAfterChange=function(){this.findMatches(),this.annotation.update(this.matches)},t.prototype.clear=function(){this.cm.off("change",this.changeHandler),this.annotation.clear()}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options={};for(var t in c)this.options[t]=(e&&e.hasOwnProperty(t)?e:c)[t];this.overlay=this.timeout=null,this.matchesonscroll=null}function r(e){var t=e.state.matchHighlighter;clearTimeout(t.timeout),t.timeout=setTimeout(function(){o(e)},t.options.delay)}function n(e,t,r,n){var i=e.state.matchHighlighter;if(e.addOverlay(i.overlay=l(t,r,n)),i.options.annotateScrollbar&&e.showMatchesOnScrollbar){var o=r?new RegExp("\\b"+t+"\\b"):t;i.matchesonscroll=e.showMatchesOnScrollbar(o,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function i(e){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null,t.matchesonscroll&&(t.matchesonscroll.clear(),t.matchesonscroll=null))}function o(e){e.operation(function(){var t=e.state.matchHighlighter;if(i(e),!e.somethingSelected()&&t.options.showToken){for(var r=t.options.showToken===!0?/[\w$]/:t.options.showToken,o=e.getCursor(),s=e.getLine(o.line),l=o.ch,c=l;l&&r.test(s.charAt(l-1));)--l;for(;c<s.length&&r.test(s.charAt(c));)++c;return void(l<c&&n(e,s.slice(l,c),r,t.options.style))}var u=e.getCursor("from"),f=e.getCursor("to");if(u.line==f.line&&(!t.options.wordsOnly||a(e,u,f))){var d=e.getRange(u,f);t.options.trim&&(d=d.replace(/^\s+|\s+$/g,"")),d.length>=t.options.minChars&&n(e,d,!1,t.options.style)}})}function a(e,t,r){var n=e.getRange(t,r);if(null!==n.match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(r.ch<e.getLine(t.line).length){var i={line:r.line,ch:r.ch+1},o=e.getRange(r,i);if(null===o.match(/\W/))return!1}return!0}return!1}function s(e,t){return!(e.start&&t.test(e.string.charAt(e.start-1))||e.pos!=e.string.length&&t.test(e.string.charAt(e.pos)))}function l(e,t,r){return{token:function(n){return!n.match(e)||t&&!s(n,t)?(n.next(),void(n.skipTo(e.charAt(0))||n.skipToEnd())):r}}}var c={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};e.defineOption("highlightSelectionMatches",!1,function(n,a,s){s&&s!=e.Init&&(i(n),clearTimeout(n.state.matchHighlighter.timeout),n.state.matchHighlighter=null,n.off("cursorActivity",r)),a&&(n.state.matchHighlighter=new t(a),o(n),n.on("cursorActivity",r))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r,n){function i(t){var r=e.wheelEventPixels(t)["horizontal"==o.orientation?"x":"y"],n=o.pos;o.moveTo(o.pos+r),o.pos!=n&&e.e_preventDefault(t)}this.orientation=r,this.scroll=n,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=t+"-"+r,this.inner=this.node.appendChild(document.createElement("div"));var o=this;e.on(this.inner,"mousedown",function(t){function r(){e.off(document,"mousemove",n),e.off(document,"mouseup",r)}function n(e){return 1!=e.which?r():void o.moveTo(s+(e[i]-a)*(o.total/o.size))}if(1==t.which){e.e_preventDefault(t);var i="horizontal"==o.orientation?"pageX":"pageY",a=t[i],s=o.pos;e.on(document,"mousemove",n),e.on(document,"mouseup",r)}}),e.on(this.node,"click",function(t){e.e_preventDefault(t);var r,n=o.inner.getBoundingClientRect();r="horizontal"==o.orientation?t.clientX<n.left?-1:t.clientX>n.right?1:0:t.clientY<n.top?-1:t.clientY>n.bottom?1:0,o.moveTo(o.pos+r*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function r(e,r,n){this.addClass=e,this.horiz=new t(e,"horizontal",n),r(this.horiz.node),this.vert=new t(e,"vertical",n),r(this.vert.node),this.width=null}t.prototype.setPos=function(e,t){return e<0&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),!(!t&&e==this.pos)&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},t.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};var n=10;t.prototype.update=function(e,t,r){var i=this.screen!=t||this.total!=e||this.size!=r;i&&(this.screen=t,this.total=e,this.size=r);var o=this.screen*(this.size/this.total);o<n&&(this.size-=n-o,o=n),this.inner.style["horizontal"==this.orientation?"width":"height"]=o+"px",this.setPos(this.pos,i)},r.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var r=this.width||0,n=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=n?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(n?r:0)),this.vert.node.style.bottom=n?r+"px":"0"),n&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?r:0)-e.barLeft),this.horiz.node.style.right=i?r+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?r:0,bottom:n?r:0}},r.prototype.setScrollTop=function(e){this.vert.setPos(e)},r.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},r.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new r("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new r("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function r(e){clearTimeout(n.doRedraw),n.doRedraw=setTimeout(function(){n.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var n=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(n.doUpdate),n.doUpdate=setTimeout(function(){n.computeScale()&&r(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){r(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.getScrollerElement().scrollHeight;if(t!=this.hScale)return this.hScale=t,!0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(l!=e.line&&(l=e.line,c=r.getLineHandle(l)),a&&c.height>s)return r.charCoords(e,"local")[t?"top":"bottom"];var n=r.heightAtLine(c,"local");return n+(t?0:c.height)}e!==!1&&this.computeScale();var r=this.cm,n=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=r.getOption("lineWrapping"),s=a&&1.5*r.defaultTextHeight(),l=null,c=null;if(r.display.barWidth)for(var u,f=0;f<o.length;f++){for(var d=o[f],p=u||t(d.from,!0)*n,h=t(d.to,!1)*n;f<o.length-1&&(u=t(o[f+1].from,!0)*n,!(u>h+.9));)d=o[++f],h=t(d.to,!1)*n;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(1.5*r.display.barWidth,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className,d.id&&g.setAttribute("annotation-id",d.id)}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,n){this.cm=e,this.node=t,this.options=r,this.height=n,this.cleared=!1}function r(e){var t=e.getWrapperElement(),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n=parseInt(r.height),i=e.state.panels={setHeight:t.style.height,heightLeft:n,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(i.wrapper,t);var o=e.hasFocus();i.wrapper.appendChild(t),o&&e.focus(),e._setSize=e.setSize,null!=n&&(e.setSize=function(t,r){if(null==r)return this._setSize(t,r);if(i.setHeight=r,"number"!=typeof r){var o=/^(\d+\.?\d*)px$/.exec(r);o?r=Number(o[1]):(i.wrapper.style.height=r,r=i.wrapper.offsetHeight,i.wrapper.style.height="")}e._setSize(t,i.heightLeft+=r-n),n=r})}function n(e){var t=e.state.panels;e.state.panels=null;var r=e.getWrapperElement();t.wrapper.parentNode.replaceChild(r,t.wrapper),r.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}e.defineExtension("addPanel",function(e,n){n=n||{},this.state.panels||r(this);var i=this.state.panels,o=i.wrapper,a=this.getWrapperElement();n.after instanceof t&&!n.after.cleared?o.insertBefore(e,n.before.node.nextSibling):n.before instanceof t&&!n.before.cleared?o.insertBefore(e,n.before.node):n.replace instanceof t&&!n.replace.cleared?(o.insertBefore(e,n.replace.node),n.replace.clear()):"bottom"==n.position?o.appendChild(e):"before-bottom"==n.position?o.insertBefore(e,a.nextSibling):"after-top"==n.position?o.insertBefore(e,a):o.insertBefore(e,o.firstChild);var s=n&&n.height||e.offsetHeight;return this._setSize(null,i.heightLeft-=s),i.panels++,new t(this,e,n,s)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),e.wrapper.removeChild(this.node),0==--e.panels&&n(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,r=this.cm.state.panels;this.cm._setSize(null,r.height+=t-this.height),this.height=t}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function r(e){t(e);var r=e.state.placeholder=document.createElement("pre");r.style.cssText="height: 0; overflow: visible",r.className="CodeMirror-placeholder";var n=e.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n)),r.appendChild(n),e.display.lineSpace.insertBefore(r,e.display.lineSpace.firstChild)}function n(e){o(e)&&r(e)}function i(e){var n=e.getWrapperElement(),i=o(e);n.className=n.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?r(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(r,o,a){var s=a&&a!=e.Init;if(o&&!s)r.on("blur",n),r.on("change",i),r.on("swapDoc",i),i(r);else if(!o&&s){r.off("blur",n),r.off("change",i),r.off("swapDoc",i),t(r);var l=r.getWrapperElement();l.className=l.className.replace(" CodeMirror-empty","")}o&&!r.hasFocus()&&n(r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function r(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var r=e.state.fullScreenRestore;t.style.width=r.width,t.style.height=r.height,window.scrollTo(r.scrollLeft,r.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(n,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(n):r(n))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n){function i(){t.display.wrapper.offsetHeight?(r(t,n),t.display.lastWrapHeight!=t.display.wrapper.clientHeight&&t.refresh()):n.timeout=setTimeout(i,n.delay)}n.timeout=setTimeout(i,n.delay),n.hurry=function(){clearTimeout(n.timeout),n.timeout=setTimeout(i,50)},e.on(window,"mouseup",n.hurry),e.on(window,"keyup",n.hurry)}function r(t,r){clearTimeout(r.timeout),e.off(window,"mouseup",r.hurry),e.off(window,"keyup",r.hurry)}e.defineOption("autoRefresh",!1,function(e,n){e.state.autoRefresh&&(r(e,e.state.autoRefresh),e.state.autoRefresh=null),n&&0==e.display.wrapper.offsetHeight&&t(e,e.state.autoRefresh={delay:n.delay||250})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r){var n,i=e.getWrapperElement();return n=i.appendChild(document.createElement("div")),r?n.className="CodeMirror-dialog CodeMirror-dialog-bottom":n.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?n.innerHTML=t:n.appendChild(t),n}function r(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(n,i,o){function a(e){if("string"==typeof e)f.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),u.focus(),o.onClose&&o.onClose(l)}}o||(o={}),r(this,null);var s,l=t(this,n,o.bottom),c=!1,u=this,f=l.getElementsByTagName("input")[0];return f?(f.focus(),o.value&&(f.value=o.value,o.selectValueOnOpen!==!1&&f.select()),o.onInput&&e.on(f,"input",function(e){o.onInput(e,f.value,a)}),o.onKeyUp&&e.on(f,"keyup",function(e){o.onKeyUp(e,f.value,a)}),e.on(f,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,f.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(f.blur(),e.e_stop(t),a()),13==t.keyCode&&i(f.value,t))}),o.closeOnBlur!==!1&&e.on(f,"blur",a)):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(n,i,o){function a(){c||(c=!0,s.parentNode.removeChild(s),u.focus())}r(this,null);var s=t(this,n,o&&o.bottom),l=s.getElementsByTagName("button"),c=!1,u=this,f=1;l[0].focus();for(var d=0;d<l.length;++d){var p=l[d];!function(t){e.on(p,"click",function(r){e.e_preventDefault(r),a(),t&&t(u)})}(i[d]),e.on(p,"blur",function(){--f,setTimeout(function(){f<=0&&a()},200)}),e.on(p,"focus",function(){++f})}}),e.defineExtension("openNotification",function(n,i){function o(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}r(this,o);var a,s=t(this,n,i&&i.bottom),l=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t), -o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),l=t.ch-1,c=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(n&&u>0!=(l==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,l+1)),d=r(e,a(t.line,l+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,l),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:u>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=r>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=f;d+=r){var p=e.getLine(d);if(p){var h=r>0?0:p.length-1,m=r>0?p.length:-1;if(!(p.length>o))for(d==t.line&&(h=t.ch-(r<0?1:0));h!=m;h+=r){var g=p.charAt(h);if(u.test(g)&&(void 0===n||e.getTokenTypeAt(a(d,h+1))==n)){var v=s[g];if(">"==v.charAt(1)==r>0)c.push(g);else{if(!c.length)return{pos:a(d,h),ch:g};c.pop()}}}}}return d-r!=(r>0?e.lastLine():e.firstLine())&&null}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=e.listSelections(),c=0;c<l.length;c++){var u=l[c].empty()&&t(e,l[c].head,!1,n);if(u&&e.getLine(u.from.line).length<=i){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=i&&s.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:f}))}}if(s.length){o&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!r)return d;setTimeout(d,800)}}function i(e){e.operation(function(){l&&(l(),l=null),l=n(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.off("cursorActivity",i),l&&(l(),l=null)),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:f[t]}function r(e){return function(t){return s(t,e)}}function n(e){var t=e.state.closeBrackets;if(!t)return null;var r=e.getModeAt(e.getCursor());return r.closeBrackets||t}function i(r){var i=n(r);if(!i||r.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=r.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(r,a[s].head);if(!l||o.indexOf(l)%2!=0)return e.Pass}for(var s=a.length-1;s>=0;s--){var u=a[s].head;r.replaceRange("",d(u.line,u.ch-1),d(u.line,u.ch+1),"+delete")}}function o(r){var i=n(r),o=i&&t(i,"explode");if(!o||r.getOption("disableInput"))return e.Pass;for(var a=r.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(r,a[s].head);if(!l||o.indexOf(l)%2!=0)return e.Pass}r.operation(function(){r.replaceSelection("\n\n",null),r.execCommand("goCharLeft"),a=r.listSelections();for(var e=0;e<a.length;e++){var t=a[e].head.line;r.indentLine(t,null,!0),r.indentLine(t+1,null,!0)}})}function a(t){var r=e.cmpPos(t.anchor,t.head)>0;return{anchor:new d(t.anchor.line,t.anchor.ch+(r?-1:1)),head:new d(t.head.line,t.head.ch+(r?1:-1))}}function s(r,i){var o=n(r);if(!o||r.getOption("disableInput"))return e.Pass;var s=t(o,"pairs"),c=s.indexOf(i);if(c==-1)return e.Pass;for(var f,p=t(o,"triples"),h=s.charAt(c+1)==i,m=r.listSelections(),g=c%2==0,v=0;v<m.length;v++){var y,b=m[v],k=b.head,x=r.getRange(k,d(k.line,k.ch+1));if(g&&!b.empty())y="surround";else if(!h&&g||x!=i)if(h&&k.ch>1&&p.indexOf(i)>=0&&r.getRange(d(k.line,k.ch-2),k)==i+i&&(k.ch<=2||r.getRange(d(k.line,k.ch-3),d(k.line,k.ch-2))!=i))y="addFour";else if(h){if(e.isWordChar(x)||!u(r,k,i))return e.Pass;y="both"}else{if(!g||r.getLine(k.line).length!=k.ch&&!l(x,s)&&!/\s/.test(x))return e.Pass;y="both"}else y=p.indexOf(i)>=0&&r.getRange(k,d(k.line,k.ch+3))==i+i+i?"skipThree":"skip";if(f){if(f!=y)return e.Pass}else f=y}var w=c%2?s.charAt(c-1):i,_=c%2?i:s.charAt(c+1);r.operation(function(){if("skip"==f)r.execCommand("goCharRight");else if("skipThree"==f)for(var e=0;e<3;e++)r.execCommand("goCharRight");else if("surround"==f){for(var t=r.getSelections(),e=0;e<t.length;e++)t[e]=w+t[e]+_;r.replaceSelections(t,"around"),t=r.listSelections().slice();for(var e=0;e<t.length;e++)t[e]=a(t[e]);r.setSelections(t)}else"both"==f?(r.replaceSelection(w+_,null),r.triggerElectric(w+_),r.execCommand("goCharLeft")):"addFour"==f&&(r.replaceSelection(w+w+w+w,"before"),r.execCommand("goCharRight"))})}function l(e,t){var r=t.lastIndexOf(e);return r>-1&&r%2==1}function c(e,t){var r=e.getRange(d(t.line,t.ch-1),d(t.line,t.ch+1));return 2==r.length?r:null}function u(t,r,n){var i=t.getLine(r.line),o=t.getTokenAt(r);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,r.ch)+n+i.slice(r.ch),4);for(a.pos=a.start=o.start;;){var s=t.getMode().token(a,o.state);if(a.pos>=r.ch+1)return/\bstring2?\b/.test(s);a.start=a.pos}}var f={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},d=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),r&&(t.state.closeBrackets=r,t.addKeyMap(h))});for(var p=f.pairs+"`",h={Backspace:i,Enter:o},m=0;m<p.length;m++)h["'"+p.charAt(m)+"'"]=r(p.charAt(m))}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(r){r.state.failedTagMatch=!1,r.operation(function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var s="close"==o.at?o.open:o.close;s?r.state.tagOther=r.markText(s.from,s.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}})}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))}),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r=t.listSelections(),n=[],l=0;l<r.length;l++){if(!r[l].empty())return e.Pass;var c=r[l].head,u=t.getTokenAt(c),f=e.innerMode(t.getMode(),u.state),d=f.state;if("xml"!=f.mode.name||!d.tagName)return e.Pass;var p=t.getOption("autoCloseTags"),h="html"==f.mode.configuration,m="object"==typeof p&&p.dontCloseTags||h&&a,g="object"==typeof p&&p.indentTags||h&&s,v=d.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==d.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,d,!0))return e.Pass;var b=g&&i(g,y)>-1;n[l]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=r.length-1;l>=0;l--){var k=n[l];t.replaceRange(k.text,r[l].head,r[l].anchor,"+insert");var x=t.listSelections().slice(0);x[l]={head:k.newPos,anchor:k.newPos},t.setSelections(x),k.indent&&(t.indentLine(k.newPos.line,null,!0),t.indentLine(k.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":"</",s=0;s<n.length;s++){if(!n[s].empty())return e.Pass;var l=n[s].head,c=t.getTokenAt(l),u=e.innerMode(t.getMode(),c.state),f=u.state;if(r&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=l.ch-1))return e.Pass;var d;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)d=a+"script";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;d=a+"style"}else{if(!f.context||!f.context.tagName||o(t,f.context.tagName,l,f))return e.Pass;d=a+f.context.tagName}">"!=t.getLine(l.line).charAt(c.end)&&(d+=">"),i[s]=d}t.replaceSelections(i),n=t.listSelections();for(var s=0;s<n.length;s++)(s==n.length-1||n[s].head.line<n[s+1].head.line)&&t.indentLine(n[s].head.line)}function n(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),s=e.scanForClosingTag(t,n,null,a);if(!s||s.tag!=r)return!1;for(var l=i.context,c=o?1:0;l&&l.tagName==r;l=l.prev)++c;n=s.to;for(var u=1;u<c;u++){var f=e.scanForClosingTag(t,n,null,a);if(!f||f.tag!=r)return!1;n=f.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/,r=/^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/,n=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],s=0;s<o.length;s++){var l=o[s].head,c=i.getStateAfter(l.line),u=c.list!==!1,f=0!==c.quote,d=i.getLine(l.line),p=t.exec(d);if(!o[s].empty()||!u&&!f||!p)return void i.execCommand("newlineAndIndent");if(r.test(d))i.replaceRange("",{line:l.line,ch:0},{line:l.line,ch:l.ch+1}),a[s]="\n";else{var h=p[1],m=p[5],g=n.test(p[2])||p[2].indexOf(">")>=0?p[2]:parseInt(p[3],10)+1+p[4];m=m.replace("[x]","[ ]"),a[s]="\n"+h+g+m}}i.replaceSelections(a)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(i);return t==-1?0:t}function r(e,t,r){return/\bstring\b/.test(e.getTokenTypeAt(o(t.line,0)))&&!/^[\'\"`]/.test(r)}var n={},i=/[^\s\u00a0]/,o=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=n);for(var t=this,r=1/0,i=this.listSelections(),a=null,s=i.length-1;s>=0;s--){var l=i[s].from(),c=i[s].to();l.line>=r||(c.line>=r&&(c=o(r,0)),r=l.line,null==a?t.uncomment(l,c,e)?a="un":(t.lineComment(l,c,e),a="line"):"un"==a?t.uncomment(l,c,e):t.lineComment(l,c,e))}}),e.defineExtension("lineComment",function(e,a,s){s||(s=n);var l=this,c=l.getModeAt(e),u=l.getLine(e.line);if(null!=u&&!r(l,e,u)){var f=s.lineComment||c.lineComment;if(!f)return void((s.blockCommentStart||c.blockCommentStart)&&(s.fullLines=!0,l.blockComment(e,a,s)));var d=Math.min(0!=a.ch||a.line==e.line?a.line+1:a.line,l.lastLine()+1),p=null==s.padding?" ":s.padding,h=s.commentBlankLines||e.line==a.line;l.operation(function(){if(s.indent){for(var r=null,n=e.line;n<d;++n){var a=l.getLine(n),c=a.slice(0,t(a));(null==r||r.length>c.length)&&(r=c)}for(var n=e.line;n<d;++n){var a=l.getLine(n),u=r.length;(h||i.test(a))&&(a.slice(0,u)!=r&&(u=t(a)),l.replaceRange(r+f+p,o(n,0),o(n,u)))}}else for(var n=e.line;n<d;++n)(h||i.test(l.getLine(n)))&&l.replaceRange(f+p,o(n,0))})}}),e.defineExtension("blockComment",function(e,t,r){r||(r=n);var a=this,s=a.getModeAt(e),l=r.blockCommentStart||s.blockCommentStart,c=r.blockCommentEnd||s.blockCommentEnd;if(!l||!c)return void((r.lineComment||s.lineComment)&&0!=r.fullLines&&a.lineComment(e,t,r));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&i.test(a.getLine(u))&&--u;var f=null==r.padding?" ":r.padding;e.line>u||a.operation(function(){if(0!=r.fullLines){var n=i.test(a.getLine(u));a.replaceRange(f+c,o(u)),a.replaceRange(l+f,o(e.line,0));var d=r.blockCommentLead||s.blockCommentLead;if(null!=d)for(var p=e.line+1;p<=u;++p)(p!=u||n)&&a.replaceRange(d+f,o(p,0))}else a.replaceRange(c,t),a.replaceRange(l,e)})}),e.defineExtension("uncomment",function(e,t,r){r||(r=n);var a,s=this,l=s.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,s.lastLine()),u=Math.min(e.line,c),f=r.lineComment||l.lineComment,d=[],p=null==r.padding?" ":r.padding;e:if(f){for(var h=u;h<=c;++h){var m=s.getLine(h),g=m.indexOf(f);if(g>-1&&!/comment/.test(s.getTokenTypeAt(o(h,g+1)))&&(g=-1),g==-1&&(h!=c||h==u)&&i.test(m))break e;if(g>-1&&i.test(m.slice(0,g)))break e;d.push(m)}if(s.operation(function(){for(var e=u;e<=c;++e){var t=d[e-u],r=t.indexOf(f),n=r+f.length;r<0||(t.slice(n,n+p.length)==p&&(n+=p.length),a=!0,s.replaceRange("",o(e,r),o(e,n)))}}),a)return!0}var v=r.blockCommentStart||l.blockCommentStart,y=r.blockCommentEnd||l.blockCommentEnd;if(!v||!y)return!1;var b=r.blockCommentLead||l.blockCommentLead,k=s.getLine(u),x=c==u?k:s.getLine(c),w=k.indexOf(v),_=x.lastIndexOf(y);if(_==-1&&u!=c&&(x=s.getLine(--c),_=x.lastIndexOf(y)),w==-1||_==-1||!/comment/.test(s.getTokenTypeAt(o(u,w+1)))||!/comment/.test(s.getTokenTypeAt(o(c,_+1))))return!1;var C=k.lastIndexOf(v,e.ch),S=C==-1?-1:k.slice(0,e.ch).indexOf(y,C+v.length);if(C!=-1&&S!=-1&&S+y.length!=e.ch)return!1;S=x.indexOf(y,t.ch);var M=x.slice(t.ch).lastIndexOf(v,S-t.ch);return C=S==-1||M==-1?-1:t.ch+M,(S==-1||C==-1||C==t.ch)&&(s.operation(function(){s.replaceRange("",o(c,_-(p&&x.slice(_-p.length,_)==p?p.length:0)),o(c,_+y.length));var e=w+v.length;if(p&&k.slice(e,e+p.length)==p&&(e+=p.length),s.replaceRange("",o(u,w),o(u,e)),b)for(var t=u+1;t<=c;++t){var r=s.getLine(t),n=r.indexOf(b);if(n!=-1&&!i.test(r.slice(0,n))){var a=n+b.length;p&&r.slice(a,a+p.length)==p&&(a+=p.length),s.replaceRange("",o(t,n),o(t,a))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n,i=t.listSelections(),o=[],a=0;a<i.length;a++){var s=i[a].head,l=t.getTokenAt(s);if("comment"!=l.type)return e.Pass;var c=e.innerMode(t.getMode(),l.state).mode;if(n){if(n!=c)return e.Pass}else n=c;var u=null;if(n.blockCommentStart&&n.blockCommentContinue){var f,d=l.string.indexOf(n.blockCommentEnd),p=t.getRange(e.Pos(s.line,0),e.Pos(s.line,l.end));if(d!=-1&&d==l.string.length-n.blockCommentEnd.length&&s.ch>=d);else if(0==l.string.indexOf(n.blockCommentStart)){if(u=p.slice(0,l.start),!/^\s*$/.test(u)){u="";for(var h=0;h<l.start;++h)u+=" "}}else(f=p.indexOf(n.blockCommentContinue))!=-1&&f+n.blockCommentContinue.length>l.start&&/^\s*$/.test(p.slice(0,f))&&(u=p.slice(0,f));null!=u&&(u+=n.blockCommentContinue)}if(null==u&&n.lineComment&&r(t)){var m=t.getLine(s.line),f=m.indexOf(n.lineComment);f>-1&&(u=m.slice(0,f),/\S/.test(u)?u=null:u+=n.lineComment+m.slice(f+n.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[a]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+insert")})}function r(e){var t=e.getOption("continueComments");return!t||"object"!=typeof t||t.continueLineComment!==!1}for(var n=["clike","css","javascript"],i=0;i<n.length;++i)e.extendMode(n[i],{blockCommentContinue:" * "});e.defineOption("continueComments",null,function(r,n,i){if(i&&i!=e.Init&&r.removeKeyMap("continueComment"),n){var o="Enter";"string"==typeof n?o=n:"object"==typeof n&&n.key&&(o=n.key);var a={name:"continueComment"};a[o]=t,r.addKeyMap(a)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){for(var n=r.paragraphStart||e.getHelper(t,"paragraphStart"),i=t.line,o=e.firstLine();i>o;--i){var a=e.getLine(i);if(n&&n.test(a))break;if(!/\S/.test(a)){++i;break}}for(var s=r.paragraphEnd||e.getHelper(t,"paragraphEnd"),l=t.line+1,c=e.lastLine();l<=c;++l){var a=e.getLine(l);if(s&&s.test(a)){++l;break}if(!/\S/.test(a))break}return{from:i,to:l}}function r(e,t,r,n){for(var i=t;i<e.length&&" "==e.charAt(i);)i++;for(;i>0&&!r.test(e.slice(i-1,i+1));--i);for(var o=!0;;o=!1){var a=i;if(n)for(;" "==e.charAt(a-1);)--a;if(0!=a||!o)return{from:a,to:i};i=t}}function n(t,n,o,a){n=t.clipPos(n),o=t.clipPos(o);var s=a.column||80,l=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],f="",d=n.line,p=t.getRange(n,o,!1);if(!p.length)return null;for(var h=p[0].match(/^[ \t]*/)[0],m=0;m<p.length;++m){var g=p[m],v=f.length,y=0;f&&g&&!l.test(f.charAt(f.length-1)+g.charAt(0))&&(f+=" ",y=1);var b="";if(m&&(b=g.match(/^\s*/)[0],g=g.slice(b.length)),f+=g,m){var k=f.length>s&&h==b&&r(f,s,l,c);k&&k.from==v&&k.to==v+y?(f=h+g,++d):u.push({text:[y?" ":""],from:i(d,v),to:i(d+1,b.length)})}for(;f.length>s;){var x=r(f,s,l,c);u.push({text:["",h],from:i(d,x.from),to:i(d,x.to)}),f=h+f.slice(x.to),++d}}return u.length&&t.operation(function(){for(var r=0;r<u.length;++r){var n=u[r];(n.text||e.cmpPos(n.from,n.to))&&t.replaceRange(n.text,n.from,n.to)}}),u.length?{from:u[0].from,to:e.changeEnd(u[u.length-1])}:null}var i=e.Pos;e.defineExtension("wrapParagraph",function(e,r){r=r||{},e||(e=this.getCursor());var o=t(this,e,r);return n(this,i(o.from,0),i(o.to-1),r)}),e.commands.wrapLines=function(e){e.operation(function(){for(var r=e.listSelections(),o=e.lastLine()+1,a=r.length-1;a>=0;a--){var s,l=r[a];if(l.empty()){var c=t(e,l.head,{});s={from:i(c.from,0),to:i(c.to-1)}}else s={from:l.from(),to:l.to()};s.to.line>=o||(o=s.from.line,n(e,s.from,s.to,{}))}})},e.defineExtension("wrapRange",function(e,t,r){return n(this,e,t,r||{})}),e.defineExtension("wrapParagraphsInRange",function(e,r,o){o=o||{};for(var a=this,s=[],l=e.line;l<=r.line;){var c=t(a,i(l,0),o);s.push(c),l=c.to}var u=!1;return s.length&&a.operation(function(){for(var e=s.length-1;e>=0;--e)u=u||n(a,i(s[e].from,0),i(s[e].to-1),o)}),u})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function s(e){var r=l(t,i);if(!r||r.to.line-r.from.line<c)return null;for(var n=t.findMarksAt(r.from),o=0;o<n.length;++o)if(n[o].__isFold&&"fold"!==a){if(!e)return null;r.cleared=!0,n[o].clear()}return r}if(o&&o.call){var l=o;o=null}else var l=n(t,o,"rangeFinder");"number"==typeof i&&(i=e.Pos(i,0));var c=n(t,o,"minFoldSize"),u=s(!0);if(n(t,o,"scanUp"))for(;!u&&i.line>t.firstLine();)i=e.Pos(i.line-1,0),u=s(!1);if(u&&!u.cleared&&"unfold"!==a){var f=r(t,o);e.on(f,"mousedown",function(t){d.clear(),e.e_preventDefault(t)});var d=t.markText(u.from,u.to,{replacedWith:f,clearOnEnter:n(t,o,"clearOnEnter"),__isFold:!0});d.on("clear",function(r,n){e.signal(t,"unfold",t,r,n)}),e.signal(t,"fold",t,u.from,u.to)}}function r(e,t){var r=n(e,t,"widget");if("string"==typeof r){var i=document.createTextNode(r);r=document.createElement("span"),r.appendChild(i),r.className="CodeMirror-foldmarker"}return r}function n(e,t,r){if(t&&void 0!==t[r])return t[r];var n=e.options.foldOptions;return n&&void 0!==n[r]?n[r]:i[r]}e.newFoldFunction=function(e,r){return function(n,i){t(n,i,{rangeFinder:e,widget:r})}},e.defineExtension("foldCode",function(e,r,n){t(this,e,r,n)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),r=0;r<t.length;++r)if(t[r].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();r<=n;r++)t.foldCode(e.Pos(r,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();r<=n;r++)t.foldCode(e.Pos(r,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,r){for(var n=0;n<e.length;++n){var i=e[n](t,r);if(i)return i}}}),e.registerHelper("fold","auto",function(e,t){for(var r=e.getHelpers(t,"fold"),n=0;n<r.length;n++){var i=r[n](e,t);if(i)return i}});var i={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return n(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","brace",function(t,r){function n(n){for(var s=r.ch,l=0;;){var c=s<=0?-1:a.lastIndexOf(n,s-1);if(c!=-1){if(1==l&&c<r.ch)break;if(i=t.getTokenTypeAt(e.Pos(o,c+1)),!/^(comment|string)/.test(i))return c+1;s=c-1}else{if(1==l)break;l=1,s=a.length}}}var i,o=r.line,a=t.getLine(o),s="{",l="}",c=n("{");if(null==c&&(s="[",l="]",c=n("[")),null!=c){var u,f,d=1,p=t.lastLine();e:for(var h=o;h<=p;++h)for(var m=t.getLine(h),g=h==o?c:0;;){var v=m.indexOf(s,g),y=m.indexOf(l,g);if(v<0&&(v=m.length),y<0&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(h,g+1))==i)if(g==v)++d;else if(!--d){u=h,f=g;break e}++g}if(null!=u&&(o!=u||f!=c))return{from:e.Pos(o,c),to:e.Pos(u,f)}}}),e.registerHelper("fold","import",function(t,r){function n(r){if(r<t.firstLine()||r>t.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));if(/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"keyword"!=n.type||"import"!=n.string)return null;for(var i=r,o=Math.min(t.lastLine(),r+10);i<=o;++i){var a=t.getLine(i),s=a.indexOf(";");if(s!=-1)return{startCh:n.end,end:e.Pos(i,s)}}}var i,o=r.line,a=n(o);if(!a||n(o-1)||(i=n(o-2))&&i.end.line==o-1)return null;for(var s=a.end;;){var l=n(s.line+1);if(null==l)break;s=l.end}return{from:t.clipPos(e.Pos(o,a.startCh+1)),to:s}}),e.registerHelper("fold","include",function(t,r){function n(r){if(r<t.firstLine()||r>t.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));return/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"meta"==n.type&&"#include"==n.string.slice(0,8)?n.start+8:void 0}var i=r.line,o=n(i);if(null==o||null!=n(i-1))return null;for(var a=i;;){var s=n(a+1);if(null==s)break;++a}return{from:e.Pos(i,o+1),to:t.clipPos(e.Pos(a))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function r(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function n(e,t){for(var r=e.findMarks(f(t,0),f(t+1,0)),n=0;n<r.length;++n)if(r[n].__isFold&&r[n].find().from.line==t)return r[n]}function i(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function o(e,t,r){var o=e.state.foldGutter.options,a=t,s=e.foldOption(o,"minFoldSize"),l=e.foldOption(o,"rangeFinder");e.eachLine(t,r,function(t){var r=null;if(n(e,a))r=i(o.indicatorFolded);else{var c=f(a,0),u=l&&l(e,c);u&&u.to.line-u.from.line>=s&&(r=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,r),++a})}function a(e){var t=e.getViewport(),r=e.state.foldGutter;r&&(e.operation(function(){o(e,t.from,t.to)}),r.from=t.from,r.to=t.to)}function s(e,t,r){var i=e.state.foldGutter;if(i){var o=i.options;if(r==o.gutter){var a=n(e,t);a?a.clear():e.foldCode(f(t,0),o.rangeFinder)}}}function l(e){var t=e.state.foldGutter;if(t){var r=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},r.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var r=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var r=e.getViewport();t.from==t.to||r.from-t.to>20||t.from-r.to>20?a(e):e.operation(function(){r.from<t.from&&(o(e,r.from,t.from),t.from=r.from),r.to>t.to&&(o(e,t.to,r.to),t.to=r.to)})},r.updateViewportTimeSpan||400)}}function u(e,t){var r=e.state.foldGutter;if(r){var n=t.line;n>=r.from&&n<r.to&&o(e,n,n+1)}}e.defineOption("foldGutter",!1,function(n,i,o){o&&o!=e.Init&&(n.clearGutter(n.state.foldGutter.options.gutter),n.state.foldGutter=null,n.off("gutterClick",s),n.off("change",l),n.off("viewportChange",c),n.off("fold",u),n.off("unfold",u),n.off("swapDoc",l)),i&&(n.state.foldGutter=new t(r(i)),a(n),n.on("gutterClick",s),n.on("change",l),n.on("viewportChange",c),n.on("fold",u),n.on("unfold",u),n.on("swapDoc",l))});var f=e.Pos}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(t,r){function n(r){var n=t.getTokenTypeAt(e.Pos(r,0));return n&&/\bheader\b/.test(n)}function i(e,t,r){var i=t&&t.match(/^#+/);return i&&n(e)?i[0].length:(i=r&&r.match(/^[=\-]+\s*$/),i&&n(e+1)?"="==r[0]?1:2:o)}var o=100,a=t.getLine(r.line),s=t.getLine(r.line+1),l=i(r.line,a,s);if(l!==o){for(var c=t.lastLine(),u=r.line,f=t.getLine(u+2);u<c&&!(i(u+1,s,f)<=l);)++u,s=f,f=t.getLine(u+2);return{from:e.Pos(r.line,a.length),to:e.Pos(u,t.getLine(u).length)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(d(e.line,t));return r&&/\btag\b/.test(r)}function i(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function o(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(t==-1){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function s(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(t==-1){if(o(e))continue;return}if(n(e,t+1)){m.lastIndex=t,e.ch=t;var r=m.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function l(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(t==-1){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=l(e),o=e.line,s=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(c<0&&(!t||t==i[2]))return{tag:i[2],from:d(o,s),to:d(e.line,e.ch)}}else r.push(i[2])}}function f(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=s(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var l=r.length-1;l>=0;--l)if(r[l]==a[2]){r.length=l;break}if(l<0&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(i,o)}}}else s(e)}}var d=e.Pos,p="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",h=p+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+p+"]["+h+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=l(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var s=d(n.line,n.ch),c=u(n,o[2]);return c&&{from:s,to:c.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(o.text.indexOf(">")!=-1||o.text.indexOf("<")!=-1){var l=a(o),c=l&&d(o.line,o.ch),p=l&&s(o);if(l&&p&&!(t(o,n)>0)){var h={from:d(o.line,o.ch),to:c,tag:p[2]};return"selfClose"==l?{open:h,close:null,at:"open"}:p[1]?{open:f(o,p[2]),close:h,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:h,close:u(o,p[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=f(i);if(!o)break;var a=new r(e,t.line,t.ch,n),s=u(a,o.tag);if(s)return{open:o,close:s}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(l("atom","]]>")):null:e.match("--")?r(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(M=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"), -i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,M=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return M="equals",null;if("<"==r){t.tokenize=o,t.state=p,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=s(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(_.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function d(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!_.contextGrabbers.hasOwnProperty(r)||!_.contextGrabbers[r].hasOwnProperty(t))return;f(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,r){return"word"==e?(r.tagName=t.current(),L="tag",y):(L="error",h)}function m(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&_.implicitlyClosed.hasOwnProperty(r.context.tagName)&&f(r),r.context&&r.context.tagName==n||_.matchClosing===!1?(L="tag",g):(L="tag error",v)}return L="error",v}function g(e,t,r){return"endTag"!=e?(L="error",g):(f(r),p)}function v(e,t,r){return L="error",g(e,t,r)}function y(e,t,r){if("word"==e)return L="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||_.autoSelfClosers.hasOwnProperty(n)?d(r,n):(d(r,n),r.context=new u(r,n,i==r.indented)),p}return L="error",y}function b(e,t,r){return"equals"==e?k:(_.allowMissing||(L="error"),y(e,t,r))}function k(e,t,r){return"string"==e?x:"word"==e&&_.allowUnquoted?(L="string",y):(L="error",y(e,t,r))}function x(e,t,r){return"string"==e?x:y(e,t,r)}var w=n.indentUnit,_={},C=i.htmlMode?t:r;for(var S in C)_[S]=C[S];for(var S in i)_[S]=i[S];var M,L;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;M=null;var r=t.tokenize(e,t);return(r||M)&&"comment"!=r&&(L=null,t.state=t.state(M||r,e,t),L&&(r="error"==L?r+" error":L)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return _.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+w*(_.multilineTagIndentFactor||1);if(_.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var s=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(s&&s[1])for(;i;){if(i.tagName==s[2]){i=i.prev;break}if(!_.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(s)for(;i;){var l=_.contextGrabbers[i.tagName];if(!l||!l.hasOwnProperty(s[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+w:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:_.htmlMode?"html":"xml",helperType:_.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,r){function n(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}function i(e,t,r){return t.f=t.inline=r,r(e,t)}function o(e,t,r){return t.f=t.block=r,r(e,t)}function a(e){return!e||!/\S/.test(e.string)}function s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,w&&e.f==c&&(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function l(t,o){var s=t.sol(),l=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,l&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.indentation>0?o.list=null:o.list=!1);var f=null;if(o.indentationDiff>=4)return t.skipToEnd(),c||a(o.prevLine)?(o.indentation-=4,o.indentedCode=!0,_.code):null;if(t.eatSpace())return null;if((f=t.match(A))&&f[1].length<=6)return o.header=f[1].length,r.highlightFormatting&&(o.formatting="header"),o.f=o.inline,d(o);if(!(a(o.prevLine)||o.quote||l||c)&&(f=t.match(E)))return o.header="="==f[0].charAt(0)?1:2,r.highlightFormatting&&(o.formatting="header"),o.f=o.inline,d(o);if(t.eat(">"))return o.quote=s?1:o.quote+1,r.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),d(o);if("["===t.peek())return i(t,o,y);if(t.match(S,!0))return o.hr=!0,_.hr;if((a(o.prevLine)||l)&&(t.match(M,!1)||t.match(L,!1))){var p=null;for(t.match(M,!0)?p="ul":(t.match(L,!0),p="ol"),o.indentation=t.column()+t.current().length,o.list=!0;o.listStack&&t.column()<o.listStack[o.listStack.length-1];)o.listStack.pop();return o.listStack.push(o.indentation),r.taskLists&&t.match(T,!1)&&(o.taskList=!0),o.f=o.inline,r.highlightFormatting&&(o.formatting=["list","list-"+p]),d(o)}return r.fencedCodeBlocks&&(f=t.match(z,!0))?(o.fencedChars=f[1],o.localMode=n(f[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=u,r.highlightFormatting&&(o.formatting="code-block"),o.code=-1,d(o)):i(t,o,o.inline)}function c(t,r){var n=x.token(t,r.htmlState);if(!w){var i=e.innerMode(x,r.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||r.md_inside&&t.current().indexOf(">")>-1)&&(r.f=h,r.block=l,r.htmlState=null)}return n}function u(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=f,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),_.code)}function f(e,t){e.match(t.fencedChars),t.block=l,t.f=h,t.fencedChars=null,r.highlightFormatting&&(t.formatting="code-block"),t.code=1;var n=d(t);return t.code=0,n}function d(e){var t=[];if(e.formatting){t.push(_.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n<e.formatting.length;n++)t.push(_.formatting+"-"+e.formatting[n]),"header"===e.formatting[n]&&t.push(_.formatting+"-"+e.formatting[n]+"-"+e.header),"quote"===e.formatting[n]&&(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(_.formatting+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(_.linkHref,"url"):(e.strong&&t.push(_.strong),e.em&&t.push(_.em),e.strikethrough&&t.push(_.strikethrough),e.linkText&&t.push(_.linkText),e.code&&t.push(_.code),e.image&&t.push(_.image),e.imageAltText&&t.push(_.imageAltText,"link"),e.imageMarker&&t.push(_.imageMarker)),e.header&&t.push(_.header,_.header+"-"+e.header),e.quote&&(t.push(_.quote),!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(_.quote+"-"+e.quote):t.push(_.quote+"-"+r.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(_.list2):t.push(_.list3):t.push(_.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function p(e,t){if(e.match(O,!0))return d(t)}function h(t,n){var i=n.text(t,n);if("undefined"!=typeof i)return i;if(n.list)return n.list=null,d(n);if(n.taskList){var a="x"!==t.match(T,!0)[1];return a?n.taskOpen=!0:n.taskClosed=!0,r.highlightFormatting&&(n.formatting="task"),n.taskList=!1,d(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(n.formatting="header"),d(n);var s=t.sol(),l=t.next();if(n.linkTitle){n.linkTitle=!1;var u=l;"("===l&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(f),!0))return _.linkHref}if("`"===l){var p=n.formatting;r.highlightFormatting&&(n.formatting="code"),t.eatWhile("`");var h=t.current().length;if(0==n.code)return n.code=h,d(n);if(h==n.code){var v=d(n);return n.code=0,v}return n.formatting=p,d(n)}if(n.code)return d(n);if("\\"===l&&(t.next(),r.highlightFormatting)){var y=d(n),b=_.formatting+"-escape";return y?y+" "+b:b}if("!"===l&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return n.imageMarker=!0,n.image=!0,r.highlightFormatting&&(n.formatting="image"),d(n);if("["===l&&n.imageMarker)return n.imageMarker=!1,n.imageAltText=!0,r.highlightFormatting&&(n.formatting="image"),d(n);if("]"===l&&n.imageAltText){r.highlightFormatting&&(n.formatting="image");var y=d(n);return n.imageAltText=!1,n.image=!1,n.inline=n.f=g,y}if("["===l&&t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!n.image)return n.linkText=!0,r.highlightFormatting&&(n.formatting="link"),d(n);if("]"===l&&n.linkText&&t.match(/\(.*?\)| ?\[.*?\]/,!1)){r.highlightFormatting&&(n.formatting="link");var y=d(n);return n.linkText=!1,n.inline=n.f=g,y}if("<"===l&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link");var y=d(n);return y?y+=" ":y="",y+_.linkInline}if("<"===l&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link");var y=d(n);return y?y+=" ":y="",y+_.linkEmail}if("<"===l&&t.match(/^(!--|\w)/,!1)){var k=t.string.indexOf(">",t.pos);if(k!=-1){var w=t.string.substring(t.start,k);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(w)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(x),o(t,n,c)}if("<"===l&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var C=!1;if(!r.underscoresBreakWords&&"_"===l&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var M=t.string.charAt(S);"_"!==M&&M.match(/(\w)/,!1)&&(C=!0)}}if("*"===l||"_"===l&&!C)if(s&&" "===t.peek());else{if(n.strong===l&&t.eat(l)){r.highlightFormatting&&(n.formatting="strong");var v=d(n);return n.strong=!1,v}if(!n.strong&&t.eat(l))return n.strong=l,r.highlightFormatting&&(n.formatting="strong"),d(n);if(n.em===l){r.highlightFormatting&&(n.formatting="em");var v=d(n);return n.em=!1,v}if(!n.em)return n.em=l,r.highlightFormatting&&(n.formatting="em"),d(n)}else if(" "===l&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(n);t.backUp(1)}if(r.strikethrough)if("~"===l&&t.eatWhile(l)){if(n.strikethrough){r.highlightFormatting&&(n.formatting="strikethrough");var v=d(n);return n.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,r.highlightFormatting&&(n.formatting="strikethrough"),d(n)}else if(" "===l&&t.match(/^~~/,!0)){if(" "===t.peek())return d(n);t.backUp(2)}return" "===l&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),d(n)}function m(e,t){var n=e.next();if(">"===n){t.f=t.inline=h,r.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+_.linkInline}return e.match(/^[^>]+/,!0),_.linkInline}function g(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=v("("===n?")":"]",0),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function v(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=h,r.highlightFormatting&&(n.formatting="link-string");var o=d(n);return n.linkHref=!1,o}return t.match(I[e]),n.linkHref=!0,d(n)}}function y(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=b,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,h)}function b(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=k,r.highlightFormatting&&(t.formatting="link");var n=d(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),_.linkText}function k(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,_.linkHref+" url")}var x=e.getMode(t,"text/html"),w="null"==x.name;void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.underscoresBreakWords&&(r.underscoresBreakWords=!0),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1),void 0===r.tokenTypeOverrides&&(r.tokenTypeOverrides={});var _={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var C in _)_.hasOwnProperty(C)&&r.tokenTypeOverrides[C]&&(_[C]=r.tokenTypeOverrides[C]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,M=/^[*\-+]\s+/,L=/^[0-9]+([.)])\s+/,T=/^\[(x| )\](?=\s)/,A=r.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,E=/^ *(?:\={1,}|-{1,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~]+/,z=new RegExp("^("+(r.fencedCodeBlocks===!0?"~~~+|```+":r.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/},N={startState:function(){return{f:l,prevLine:null,thisLine:null,block:l,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(x,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedChars:t.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var r=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||r){if(s(t),!r)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentationDiff=Math.min(n-t.indentation,4),t.indentation=t.indentation+t.indentationDiff,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==c?{state:e.htmlState,mode:x}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:N}},blankLine:s,getType:d,fold:"markdown"};return N},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(r,n){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,r){if(r.combineTokens=null,r.codeBlock)return e.match(/^```+/)?(r.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(r.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),r.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return r.code?a===o&&(r.code=!1):(o=a,r.code=!0),null}if(r.code)return e.next(),null;if(e.eatSpace())return r.ateSpace=!0,null;if((e.sol()||r.ateSpace)&&(r.ateSpace=!1,n.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return r.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return r.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(r.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var l in n)s[l]=n[l];return s.name="markdown",e.overlayMode(e.getMode(r,s),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return be=e,ke=r,t}function a(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=s(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=l,l(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Te),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(Te.test(n))return e.eatWhile(Te),o("operator","operator",e.current());if(Me.test(n)){e.eatWhile(Me);var a=e.current(),u=Le.propertyIsEnumerable(a)&&Le[a];return u&&"."!=r.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function s(e){return function(t,r){var n,i=!1;if(_e&&"@"==t.peek()&&t.match(Ae))return r.tokenize=a,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=a),o("string","string")}}function l(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=a;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=a;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),s=Ee.indexOf(a);if(s>=0&&s<3){if(!n){++o;break}if(0==--n){"("==a&&(i=!0);break}}else if(s>=3&&s<6)++n;else if(Me.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function f(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function p(e,t,r,n,i){var o=e.cc;for(ze.state=e,ze.stream=i,ze.marked=null,ze.cc=o,ze.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Ce?_:w;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return ze.marked?ze.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)ze.cc.push(arguments[e])}function m(){return h.apply(null,arguments),!0}function g(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=ze.state;if(ze.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){ze.state.context={prev:ze.state.context,vars:ze.state.localVars},ze.state.localVars=Ie}function y(){ze.state.localVars=ze.state.context.vars,ze.state.context=ze.state.context.prev}function b(e,t){var r=function(){var r=ze.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new f(n,ze.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function k(){var e=ze.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?m():";"==e?h():m(t)}return t}function w(e,t){return"var"==e?m(b("vardef",t.length),X,x(";"),k):"keyword a"==e?m(b("form"),_,w,k):"keyword b"==e?m(b("form"),w,k):"{"==e?m(b("}"),$,k):";"==e?m():"if"==e?("else"==ze.state.lexical.info&&ze.state.cc[ze.state.cc.length-1]==k&&ze.state.cc.pop()(),m(b("form"),_,w,k,ee)):"function"==e?m(ae):"for"==e?m(b("form"),te,w,k):"variable"==e?m(b("stat"),R):"switch"==e?m(b("form"),_,b("}","switch"),x("{"),$,k,k):"case"==e?m(_,x(":")):"default"==e?m(x(":")):"catch"==e?m(b("form"),v,x("("),se,x(")"),w,k,y):"class"==e?m(b("form"),le,k):"export"==e?m(b("stat"),de,k):"import"==e?m(b("stat"),pe,k):"module"==e?m(b("form"),Z,b("}"),x("{"),$,k,k):"async"==e?m(w):h(b("stat"),_,x(";"),k)}function _(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(ze.state.fatArrowAt==ze.stream.start){var r=t?I:z;if("("==e)return m(v,b(")"),W(Z,")"),k,x("=>"),r,y);if("variable"==e)return h(v,Z,x("=>"),r,y)}var n=t?A:T;return Oe.hasOwnProperty(e)?m(n):"function"==e?m(ae,n):"keyword c"==e||"async"==e?m(t?L:M):"("==e?m(b(")"),M,x(")"),k,n):"operator"==e||"spread"==e?m(t?C:_):"["==e?m(b("]"),ve,k,n):"{"==e?H(D,"}",null,n):"quasi"==e?h(E,n):"new"==e?m(N(t)):m()}function M(e){return e.match(/[;\}\)\],]/)?h():h(_)}function L(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?m(_):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?_:C;return"=>"==e?m(v,r?I:z,y):"operator"==e?/\+\+|--/.test(t)?m(n):"?"==t?m(_,x(":"),i):m(i):"quasi"==e?h(E,n):";"!=e?"("==e?H(C,")","call",n):"."==e?m(j,n):"["==e?m(b("]"),M,x("]"),k,n):void 0:void 0}function E(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?m(E):m(_,O)}function O(e){if("}"==e)return ze.marked="string-2",ze.state.tokenize=c,m(E)}function z(e){return u(ze.stream,ze.state),h("{"==e?w:_)}function I(e){return u(ze.stream,ze.state),h("{"==e?w:C)}function N(e){return function(t){return"."==t?m(e?P:q):h(e?C:_)}}function q(e,t){if("target"==t)return ze.marked="keyword",m(T)}function P(e,t){if("target"==t)return ze.marked="keyword",m(A)}function R(e){return":"==e?m(k,w):h(T,x(";"),k)}function j(e){if("variable"==e)return ze.marked="property",m()}function D(e,t){return"async"==e?m(D):"variable"==e||"keyword"==ze.style?(ze.marked="property",m("get"==t||"set"==t?B:F)):"number"==e||"string"==e?(ze.marked=_e?"property":ze.style+" property",m(F)):"jsonld-keyword"==e?m(F):"modifier"==e?m(D):"["==e?m(_,x("]"),F):"spread"==e?m(_):void 0}function B(e){return"variable"!=e?h(F):(ze.marked="property",m(ae))}function F(e){return":"==e?m(C):"("==e?h(ae):void 0}function W(e,t){function r(n,i){if(","==n){var o=ze.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),m(function(r,n){return r==t||n==t?h():h(e)},r)}return n==t||i==t?m():m(x(t))}return function(n,i){return n==t||i==t?m():h(e,r)}}function H(e,t,r){for(var n=3;n<arguments.length;n++)ze.cc.push(arguments[n]);return m(b(t,r),W(e,t),k)}function $(e){return"}"==e?m():h(w,$)}function U(e){if(Se&&":"==e)return m(V)}function K(e,t){if("="==t)return m(C)}function V(e){if("variable"==e)return ze.marked="variable-3",m(G)}function G(e,t){return"<"==t?m(W(V,">"),G):"["==e?m(x("]"),G):void 0}function X(){return h(Z,U,Q,J)}function Z(e,t){return"modifier"==e?m(Z):"variable"==e?(g(t),m()):"spread"==e?m(Z):"["==e?H(Z,"]"):"{"==e?H(Y,"}"):void 0}function Y(e,t){return"variable"!=e||ze.stream.match(/^\s*:/,!1)?("variable"==e&&(ze.marked="property"),"spread"==e?m(Z):"}"==e?h():m(x(":"),Z,Q)):(g(t),m(Q))}function Q(e,t){if("="==t)return m(C)}function J(e){if(","==e)return m(X)}function ee(e,t){if("keyword b"==e&&"else"==t)return m(b("form","else"),w,k)}function te(e){if("("==e)return m(b(")"),re,x(")"),k)}function re(e){return"var"==e?m(X,x(";"),ie):";"==e?m(ie):"variable"==e?m(ne):h(_,x(";"),ie)}function ne(e,t){return"in"==t||"of"==t?(ze.marked="keyword",m(_)):m(T,ie)}function ie(e,t){return";"==e?m(oe):"in"==t||"of"==t?(ze.marked="keyword",m(_)):h(_,x(";"),oe)}function oe(e){")"!=e&&m(_)}function ae(e,t){return"*"==t?(ze.marked="keyword",m(ae)):"variable"==e?(g(t),m(ae)):"("==e?m(v,b(")"),W(se,")"),k,U,w,y):void 0}function se(e){return"spread"==e?m(se):h(Z,U,K)}function le(e,t){if("variable"==e)return g(t),m(ce)}function ce(e,t){return"extends"==t?m(_,ce):"{"==e?m(b("}"),ue,k):void 0}function ue(e,t){return"variable"==e||"keyword"==ze.style?"static"==t?(ze.marked="keyword",m(ue)):(ze.marked="property","get"==t||"set"==t?m(fe,ae,ue):m(ae,ue)):"*"==t?(ze.marked="keyword",m(ue)):";"==e?m(ue):"}"==e?m():void 0}function fe(e){return"variable"!=e?h():(ze.marked="property",m())}function de(e,t){return"*"==t?(ze.marked="keyword",m(ge,x(";"))):"default"==t?(ze.marked="keyword",m(_,x(";"))):h(w)}function pe(e){return"string"==e?m():h(he,ge)}function he(e,t){return"{"==e?H(he,"}"):("variable"==e&&g(t),"*"==t&&(ze.marked="keyword"),m(me))}function me(e,t){if("as"==t)return ze.marked="keyword",m(he)}function ge(e,t){if("from"==t)return ze.marked="keyword",m(_)}function ve(e){return"]"==e?m():h(W(C,"]"))}function ye(e,t){return"operator"==e.lastType||","==e.lastType||Te.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var be,ke,xe=r.indentUnit,we=n.statementIndent,_e=n.jsonld,Ce=n.json||_e,Se=n.typescript,Me=n.wordCharacters||/[\w$\xa1-\uffff]/,Le=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":e("new"),"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),"let":e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n,await:n,async:e("async")};if(Se){var s={type:"variable",style:"variable-3"},l={"interface":e("class"),"implements":n,namespace:n,module:e("module"),"enum":e("module"),"public":e("modifier"),"private":e("modifier"),"protected":e("modifier"),"abstract":e("modifier"),as:i,string:s,number:s,"boolean":s,any:s};for(var c in l)a[c]=l[c]}return a}(),Te=/[+\-*&%=<>!?|~^]/,Ae=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ee="([{}])",Oe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},ze={state:null,column:null,marked:null,cc:null},Ie={name:"this",next:{name:"arguments"}};return k.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new f((e||0)-xe,0,"block",(!1)),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==be?r:(t.lastType="operator"!=be||"++"!=ke&&"--"!=ke?be:"incdec",p(t,r,be,ke,e))},indent:function(t,r){if(t.tokenize==l)return e.Pass;if(t.tokenize!=a)return 0;var i=r&&r.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(r))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==k)o=o.prev;else if(c!=ee)break}"stat"==o.type&&"}"==i&&(o=o.prev),we&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,f=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+xe:"stat"==u?o.indented+(ye(t,r)?we||xe:0):"switch"!=o.info||f||0==n.doubleIndentSwitch?o.align?o.column+(f?0:1):o.indented+(f?0:xe):o.indented+(/^(?:case|default)\b/.test(r)?xe:2*xe)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ce?null:"/*",blockCommentEnd:Ce?null:"*/",lineComment:Ce?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ce?"json":"javascript",jsonldMode:_e,jsonMode:Ce,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=_&&t!=C||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return h=t,e}function i(e,t){var r=e.next();if(v[r]){var i=v[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/), -n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function s(e,t,r){this.type=e,this.indent=t,this.prev=r}function l(e,t,r,n){return e.context=new s(r,t.indentation()+(n===!1?0:g),e.context),r}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,r){return E[r.context.type](e,t,r)}function f(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function d(e){var t=e.current().toLowerCase();m=L.hasOwnProperty(t)?"atom":M.hasOwnProperty(t)?"keyword":"variable"}var p=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},k=r.mediaFeatures||{},x=r.mediaValueKeywords||{},w=r.propertyKeywords||{},_=r.nonStandardPropertyKeywords||{},C=r.fontProperties||{},S=r.counterDescriptors||{},M=r.colorKeywords||{},L=r.valueKeywords||{},T=r.allowNested,A=r.supportsAtComponent===!0,E={};return E.top=function(e,t,r){if("{"==e)return l(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return l(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return l(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return l(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(r,t,"at");if("hash"==e)m="builtin";else if("word"==e)m="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(r,t,"interpolation");if(":"==e)return"pseudo";if(T&&"("==e)return l(r,t,"parens")}return r.context.type},E.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return w.hasOwnProperty(n)?(m="property","maybeprop"):_.hasOwnProperty(n)?(m="string-2","maybeprop"):T?(m=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(m+=" error","maybeprop")}return"meta"==e?"block":T||"hash"!=e&&"qualifier"!=e?E.top(e,t,r):(m="error","block")},E.maybeprop=function(e,t,r){return":"==e?l(r,t,"prop"):u(e,t,r)},E.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&T)return l(r,t,"propBlock");if("}"==e||"{"==e)return f(e,t,r);if("("==e)return l(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return l(r,t,"interpolation")}else m+=" error";return"prop"},E.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(m="property","maybeprop"):r.context.type},E.parens=function(e,t,r){return"{"==e||"}"==e?f(e,t,r):")"==e?c(r):"("==e?l(r,t,"parens"):"interpolation"==e?l(r,t,"interpolation"):("word"==e&&d(t),"parens")},E.pseudo=function(e,t,r){return"word"==e?(m="variable-3",r.context.type):u(e,t,r)},E.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(m="tag",r.context.type):E.atBlock(e,t,r)},E.atBlock=function(e,t,r){if("("==e)return l(r,t,"atBlock_parens");if("}"==e||";"==e)return f(e,t,r);if("{"==e)return c(r)&&l(r,t,T?"block":"top");if("interpolation"==e)return l(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();m="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":k.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"keyword":w.hasOwnProperty(n)?"property":_.hasOwnProperty(n)?"string-2":L.hasOwnProperty(n)?"atom":M.hasOwnProperty(n)?"keyword":"error"}return r.context.type},E.atComponentBlock=function(e,t,r){return"}"==e?f(e,t,r):"{"==e?c(r)&&l(r,t,T?"block":"top",!1):("word"==e&&(m="error"),r.context.type)},E.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?f(e,t,r,2):E.atBlock(e,t,r)},E.restricted_atBlock_before=function(e,t,r){return"{"==e?l(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(m="variable","restricted_atBlock_before"):u(e,t,r)},E.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(m="@font-face"==r.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(e,t,r){return"word"==e?(m="variable","keyframes"):"{"==e?l(r,t,"top"):u(e,t,r)},E.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?f(e,t,r):("word"==e?m="tag":"hash"==e&&(m="builtin"),"at")},E.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?f(e,t,r):("word"==e?m="variable":"variable"!=e&&"("!=e&&")"!=e&&(m="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:p?"block":"top",stateArg:null,context:new s(p?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(h=r[1],r=r[0]),m=r,t.state=E[t.state](h,e,t),m},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=n||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-g),r=r.prev):(r=r.prev,i=r.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],i=t(n),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=t(s),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),f=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(f),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(p),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=t(x),_=n.concat(o).concat(s).concat(c).concat(f).concat(p).concat(b).concat(x);e.registerHelper("hintWords","css",_),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=r,r(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/)&&[null,"{"]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=r,r(e,t))}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function r(e){var t=l[e];return t?t:l[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(e,t){var n=e.match(r(t));return n?n[2]:""}function i(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}function a(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(!i[0]||i[1].test(n(t,i[0])))return i[2]}}var s={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},l={};e.defineMode("htmlmixed",function(r,n){function l(n,o){var s,f=c.token(n,o.htmlState),d=/\btag\b/.test(f);if(d&&!/[<>\s\/]/.test(n.current())&&(s=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(s))o.inTag=s+" ";else if(o.inTag&&d&&/>$/.test(n.current())){var p=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var h=">"==n.current()&&a(u[p[1]],p[2]),m=e.getMode(r,h),g=i(p[1],!0),v=i(p[1],!1);o.token=function(e,r){return e.match(g,!1)?(r.token=l,r.localState=r.localMode=null,null):t(e,v,r.localMode.token(e,r.localState))},o.localMode=m,o.localState=e.startState(m,c.indent(o.htmlState,""))}else o.inTag&&(o.inTag+=n.current(),n.eol()&&(o.inTag+=" "));return f}var c=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},f=n&&n.tags,d=n&&n.scriptTypes;if(o(s,u),f&&o(f,u),d)for(var p=d.length-1;p>=0;p--)u.script.unshift(["type",d[p].matches,d[p].mode]);return{startState:function(){var t=e.startState(c);return{token:l,inTag:null,localMode:null,localState:null,htmlState:t}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:r,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?c.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlembedded",function(t,r){return e.multiplexingMode(e.getMode(t,"htmlmixed"),{open:r.open||r.scriptStartRegex||"<%",close:r.close||r.scriptEndRegex||"%>",mode:e.getMode(t,r.scriptingModeSpec)})},"htmlmixed"),e.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),e.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),e.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),e.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function r(e,r,n,i){var o=e.indented;return e.context&&"statement"!=e.context.type&&"statement"!=n&&(o=e.context.indented),e.context=new t(o,r,n,i,null,e.context)}function n(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function i(e,t,r){return"variable"==t.prevToken||"variable-3"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function o(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function a(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}function l(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=l;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function c(e,t){return"variable-3"==t.prevToken&&"variable-3"}function u(e){return e.eatWhile(/[\w\.']/),"number"}function f(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],t.tokenize=h,h(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function d(e){var t=/(\w+)::(\w+)$/.exec(e);return t&&t[1]==t[2]}function p(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function h(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),n=e.match(new RegExp(".*?\\)"+r+'"'));return n?t.tokenize=null:e.skipToEnd(),"string"}function m(t,r){function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&i.push(t)}"string"==typeof t&&(t=[t]);var i=[];n(r.keywords),n(r.types),n(r.builtin),n(r.atoms),i.length&&(r.helperType=t[0],e.registerHelper("hintWords",t[0],i));for(var o=0;o<t.length;++o)e.defineMIME(t[o],r)}function g(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}function v(e){return function(t,r){for(var n,i=!1,o=!1;!t.eol();){if(!e&&!i&&t.match('"')){o=!0;break}if(e&&t.match('"""')){o=!0;break}n=t.next(),!i&&"$"==n&&t.match("{")&&t.skipTo("}"),i=!i&&"\\"==n&&!e}return!o&&e||(r.tokenize=null),"string"}}function y(e){return function(t,r){for(var n,i=!1,o=!1;!t.eol();){if(!i&&t.match('"')&&("single"==e||t.match('""'))){o=!0;break}if(!i&&t.match("``")){x=y(e),o=!0;break}n=t.next(),i="single"==e&&!i&&"\\"==n}return o&&(r.tokenize=null),"string"}}e.defineMode("clike",function(a,l){function c(e,t){var r=e.next();if(C[r]){var n=C[r](e,t);if(n!==!1)return n}if('"'==r||"'"==r)return t.tokenize=u(r),t.tokenize(e,t);if(A.test(r))return p=r,null;if(E.test(r)){if(e.backUp(1),e.match(O))return"number";e.next()}if("/"==r){if(e.eat("*"))return t.tokenize=f,f(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(z.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(z););return"operator"}if(e.eatWhile(/[\w\$_\xa1-\uffff]/),T)for(;e.match(T);)e.eatWhile(/[\w\$_\xa1-\uffff]/);var i=e.current();return s(y,i)?(s(x,i)&&(p="newstatement"),s(w,i)&&(h=!0),"keyword"):s(b,i)?"variable-3":s(k,i)?(s(x,i)&&(p="newstatement"),"builtin"):s(_,i)?"atom":"variable"}function u(e){return function(t,r){for(var n,i=!1,o=!1;null!=(n=t.next());){if(n==e&&!i){o=!0;break}i=!i&&"\\"==n}return(o||!i&&!S)&&(r.tokenize=null),"string"}}function f(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function d(e,t){l.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}var p,h,m=a.indentUnit,g=l.statementIndentUnit||m,v=l.dontAlignCalls,y=l.keywords||{},b=l.types||{},k=l.builtin||{},x=l.blockKeywords||{},w=l.defKeywords||{},_=l.atoms||{},C=l.hooks||{},S=l.multiLineStrings,M=l.indentStatements!==!1,L=l.indentSwitch!==!1,T=l.namespaceSeparator,A=l.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,E=l.numberStart||/[\d\.]/,O=l.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,z=l.isOperatorChar||/[+\-*&%=<>!?|\/]/,I=l.endStatement||/^[;:,]$/;return{startState:function(e){return{tokenize:null,context:new t((e||0)-m,0,"top",null,(!1)),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var a=t.context;if(e.sol()&&(null==a.align&&(a.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return d(e,t), -null;p=h=null;var s=(t.tokenize||c)(e,t);if("comment"==s||"meta"==s)return s;if(null==a.align&&(a.align=!0),I.test(p))for(;"statement"==t.context.type;)n(t);else if("{"==p)r(t,e.column(),"}");else if("["==p)r(t,e.column(),"]");else if("("==p)r(t,e.column(),")");else if("}"==p){for(;"statement"==a.type;)a=n(t);for("}"==a.type&&(a=n(t));"statement"==a.type;)a=n(t)}else p==a.type?n(t):M&&(("}"==a.type||"top"==a.type)&&";"!=p||"statement"==a.type&&"newstatement"==p)&&r(t,e.column(),"statement",e.current());if("variable"==s&&("def"==t.prevToken||l.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),C.token){var u=C.token(e,t,s);void 0!==u&&(s=u)}return"def"==s&&l.styleDefs===!1&&(s="variable"),t.startOfLine=!1,t.prevToken=h?"def":s||p,d(e,t),s},indent:function(t,r){if(t.tokenize!=c&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var n=t.context,i=r&&r.charAt(0);if("statement"==n.type&&"}"==i&&(n=n.prev),l.dontIndentStatements)for(;"statement"==n.type&&l.dontIndentStatements.test(n.info);)n=n.prev;if(C.indent){var o=C.indent(t,n,r);if("number"==typeof o)return o}var a=i==n.type,s=n.prev&&"switch"==n.prev.info;if(l.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=n.type&&"}"!=n.type;)n=n.prev;return n.indented}return"statement"==n.type?n.indented+("{"==i?0:g):!n.align||v&&")"==n.type?")"!=n.type||a?n.indented+(a?0:m)+(a||!s||/^(?:case|default)\b/.test(r)?0:m):n.indented+g:n.column+(a?0:1)},electricInput:L?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var b="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",k="int long char short double float unsigned signed void size_t ptrdiff_t";m(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(b),types:a(k+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:a("case do else for if switch while struct"),defKeywords:a("struct"),typeFirstDefinitions:!0,atoms:a("null true false"),hooks:{"#":l,"*":c},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(b+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:a(k+" bool wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),defKeywords:a("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:a("true false null"),dontIndentStatements:/^template$/,hooks:{"#":l,"*":c,u:f,U:f,L:f,R:f,0:u,1:u,2:u,3:u,4:u,5:u,6:u,7:u,8:u,9:u,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&d(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:a("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:a("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:a("catch class do else finally for if switch try while"),defKeywords:a("class interface package enum"),typeFirstDefinitions:!0,atoms:a("true false null"),endStatement:/^[;:]$/,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),m("text/x-csharp",{name:"clike",keywords:a("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:a("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),defKeywords:a("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),m("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:a("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:a("catch class do else finally for forSome if match switch try while"),defKeywords:a("class def object package trait type val var"),atoms:a("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=g,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,r){var n=r.context;return!("}"!=n.type||!n.align||!e.eat(">"))&&(r.context=new t(n.indented,n.column,n.type,n.info,null,n.prev),"operator")}},modeProps:{closeBrackets:{triples:'"'}}}),m("text/x-kotlin",{name:"clike",keywords:a("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:a("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,blockKeywords:a("catch class do else finally for if where try while enum"),defKeywords:a("class val var object package interface fun"),atoms:a("true false null this"),hooks:{'"':function(e,t){return t.tokenize=v(e.match('""')),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),m(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:a("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:a("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:a("for while do if else struct"),builtin:a("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:a("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":l},modeProps:{fold:["brace","include"]}}),m("text/x-nesc",{name:"clike",keywords:a(b+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:a(k),blockKeywords:a("case do else for if switch while struct"),atoms:a("null true false"),hooks:{"#":l},modeProps:{fold:["brace","include"]}}),m("text/x-objectivec",{name:"clike",keywords:a(b+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:a(k),atoms:a("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":l,indent:function(e,t,r){if("statement"==t.type&&/^@\w/.test(r))return t.indented}},modeProps:{fold:"brace"}}),m("text/x-squirrel",{name:"clike",keywords:a("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:a(k),blockKeywords:a("case catch class else for foreach if switch try while"),defKeywords:a("function local class"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"#":l},modeProps:{fold:["brace","include"]}});var x=null;m("text/x-ceylon",{name:"clike",keywords:a("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:a("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:a("class dynamic function interface module object package value"),builtin:a("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:a("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=y(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!x||!e.match("`"))&&(t.tokenize=x,x=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"variable-3"==r)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("clojure",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,r){this.indent=e,this.type=t,this.prev=r}function n(e,t,n){e.indentStack=new r(t,n,e.indentStack)}function i(e){e.indentStack=e.indentStack.prev}function o(e,t){return"0"===e&&t.eat(/x/i)?(t.eatWhile(w.hex),!0):("+"!=e&&"-"!=e||!w.digit.test(t.peek())||(t.eat(w.sign),e=t.next()),!!w.digit.test(e)&&(t.eat(e),t.eatWhile(w.digit),"."==t.peek()?(t.eat("."),t.eatWhile(w.digit)):"/"==t.peek()&&(t.eat("/"),t.eatWhile(w.digit)),t.eat(w.exponent)&&(t.eat(w.sign),t.eatWhile(w.digit)),!0))}function a(e){var t=e.next();t&&t.match(/[a-z]/)&&e.match(/[a-z]+/,!0)||"u"===t&&e.match(/[0-9a-z]{4}/i,!0)}var s="builtin",l="comment",c="string",u="string-2",f="atom",d="number",p="bracket",h="keyword",m="variable",g=e.indentUnit||2,v=e.indentUnit||2,y=t("true false nil"),b=t("defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),k=t("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cat cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement completing concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare dedupe default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while eduction empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth random-sample range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transduce transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? volatile! volatile? vreset! vswap! when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),x=t("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),w={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/,block_indent:/^(?:def|with)[^\/]+$|\/(?:def|with)/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),"string"!=t.mode&&e.eatSpace())return null;var r=null;switch(t.mode){case"string":for(var _,C=!1;null!=(_=e.next());){if('"'==_&&!C){t.mode=!1;break}C=!C&&"\\"==_}r=c;break;default:var S=e.next();if('"'==S)t.mode="string",r=c;else if("\\"==S)a(e),r=u;else if("'"!=S||w.digit_or_colon.test(e.peek()))if(";"==S)e.skipToEnd(),r=l;else if(o(S,e))r=d;else if("("==S||"["==S||"{"==S){var M,L="",T=e.column();if("("==S)for(;null!=(M=e.eat(w.keyword_char));)L+=M;L.length>0&&(x.propertyIsEnumerable(L)||w.block_indent.test(L))?n(t,T+g,S):(e.eatSpace(),e.eol()||";"==e.peek()?n(t,T+v,S):n(t,T+e.current().length,S)),e.backUp(e.current().length-1),r=p}else if(")"==S||"]"==S||"}"==S)r=p,null!=t.indentStack&&t.indentStack.type==(")"==S?"(":"]"==S?"[":"{")&&i(t);else{if(":"==S)return e.eatWhile(w.symbol),f;e.eatWhile(w.symbol),r=b&&b.propertyIsEnumerable(e.current())?h:k&&k.propertyIsEnumerable(e.current())?s:y&&y.propertyIsEnumerable(e.current())?f:m}else r=f}return r},indent:function(e){return null==e.indentStack?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),e.defineMIME("text/x-clojure","clojure"),e.defineMIME("text/x-clojurescript","clojure"),e.defineMIME("application/edn","clojure")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},r=0,n=e.length;r<n;++r)t[e[r]]=!0;return t}function r(e,t,r){return r.tokenize.push(e),e(t,r)}function n(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(l),"comment";if(e.eatSpace())return null;var n,i=e.next();if("`"==i||"'"==i||'"'==i)return r(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var f=0;e.current().length<u;){var d=e.next();if("("==d?f+=1:")"==d&&(f-=1),f<0)break}if(e.backUp(e.current().length-o),0==f)return r(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var h="string",m=!0;e.eat("s")?h="atom":e.eat(/[WQ]/)?h="string":e.eat(/[r]/)?h="string-2":e.eat(/[wxq]/)&&(h="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(p.propertyIsEnumerable(g)&&(g=p[g]),r(a(g,h,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(n=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return r(s(n[1]),e,t);if("0"==i)return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eatWhile(/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?r(a("'","atom",!1),e,t):e.eat('"')?r(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,r){if("}"==t.peek()){if(1==e)return r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r);r.tokenize[r.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(r.tokenize[r.tokenize.length-1]=i(e+1));return n(t,r)}}function o(){var e=!1;return function(t,r){return e?(r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r)):(e=!0,n(t,r))}}function a(e,t,r,n){return function(a,s){var l,c=!1;for("read-quoted-paused"===s.context.type&&(s.context=s.context.prev,a.eat("}"));null!=(l=a.next());){if(l==e&&(n||!c)){s.tokenize.pop();break}if(r&&"#"==l&&!c){if(a.eat("{")){"}"==e&&(s.context={prev:s.context,type:"read-quoted-paused"}),s.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){s.tokenize.push(o());break}}c=!c&&"\\"==l}return t}}function s(e){return function(t,r){return t.match(e)?r.tokenize.pop():t.skipToEnd(),"string"}}function l(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),f=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),d=t(["end","until"]),p={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){c=null,e.sol()&&(t.indented=e.indentation());var r,n=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==n){var o=e.current();n="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==n&&(i=o,f.propertyIsEnumerable(o)?r="indent":d.propertyIsEnumerable(o)?r="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented<t.indented&&(r="indent"):r="indent")}return(c||n&&"comment"!=n)&&(t.lastTok=i),"|"==c&&(t.varList=!t.varList),"indent"==r||/[\(\[\{]/.test(c)?t.context={prev:t.context,type:c||n,indented:t.indented}:("dedent"==r||/[\)\]\}]/.test(c))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==c||"operator"==n),n},indent:function(t,r){if(t.tokenize[t.tokenize.length-1]!=n)return 0;var i=r&&r.charAt(0),o=t.context,a=o.type==p[i]||"keyword"==o.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(r);return o.indented+(a?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricInput:/^\s*(?:end|rescue|\})$/,lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function r(e){return e.scopes[e.scopes.length-1]}var n=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],o=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];e.registerHelper("hintWords","python",i.concat(o)),e.defineMode("python",function(a,s){function l(e,t){if(e.sol()&&(t.indent=e.indentation()),e.sol()&&"py"==r(t).type){var n=r(t).offset;if(e.eatSpace()){var i=e.indentation();return i>n?f(t):i<n&&p(e,t)&&(t.errorToken=!0),null}var o=c(e,t);return n>0&&p(e,t)&&(o+=" "+m),o}return c(e,t)}function c(e,t){if(e.eatSpace())return null;var r=e.peek();if("#"==r)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^\d+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f]+/i)&&(o=!0),e.match(/^0b[01]+/i)&&(o=!0),e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(M)?(t.tokenize=u(e.current()),t.tokenize(e,t)):e.match(b)||e.match(y)?"punctuation":e.match(v)||e.match(C)?"operator":e.match(g)?"punctuation":"."==t.lastToken&&e.match(S)?"property":e.match(L)||e.match(n)?"keyword":e.match(T)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(S)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),m)}function u(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),r&&t.eol())return n}else{if(t.match(e))return i.tokenize=l,n;t.eat(/['"]/)}if(r){if(s.singleLineStringErrors)return m;i.tokenize=l}return n}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var r=1==e.length,n="string";return t.isString=!0,t}function f(e){for(;"py"!=r(e).type;)e.scopes.pop();e.scopes.push({offset:r(e).offset+a.indentUnit,type:"py",align:null})}function d(e,t,r){var n=e.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+k,type:r,align:n})}function p(e,t){for(var n=e.indentation();t.scopes.length>1&&r(t).offset>n;){if("py"!=r(t).type)return!0;t.scopes.pop()}return r(t).offset!=n}function h(e,t){e.sol()&&(t.beginningOfLine=!0);var n=t.tokenize(e,t),i=e.current();if(t.beginningOfLine&&"@"==i)return e.match(S,!1)?"meta":_?"operator":m;/\S/.test(i)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=i&&"return"!=i||(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=r(t).type||f(t);var o=1==i.length?"[({".indexOf(i):-1;if(o!=-1&&d(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),o!=-1){if(r(t).type!=i)return m;t.indent=t.scopes.pop().offset-k}return t.dedent>0&&e.eol()&&"py"==r(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}var m="error",g=s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,v=s.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,y=s.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,b=s.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/,k=s.hangingIndent||a.indentUnit,x=i,w=o;void 0!=s.extra_keywords&&(x=x.concat(s.extra_keywords)),void 0!=s.extra_builtins&&(w=w.concat(s.extra_builtins)); -var _=s.version&&3==parseInt(s.version,10);if(_){var C=s.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,S=s.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;x=x.concat(["nonlocal","False","True","None","async","await"]),w=w.concat(["ascii","bytes","exec","print"]);var M=new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))","i")}else{var C=s.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,S=s.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;x=x.concat(["exec","print"]),w=w.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);var M=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var L=t(x),T=t(w),A={startState:function(e){return{tokenize:l,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var r=t.errorToken;r&&(t.errorToken=!1);var n=h(e,t);return n&&"comment"!=n&&(t.lastToken="keyword"==n||"punctuation"==n?e.current():n),"punctuation"==n&&(n=null),e.eol()&&t.lambda&&(t.lambda=!1),r?n+" "+m:n},indent:function(t,n){if(t.tokenize!=l)return t.tokenize.isString?e.Pass:0;var i=r(t),o=i.type==n.charAt(0);return null!=i.align?i.align-(o?1:0):i.offset-(o?k:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return A}),e.defineMIME("text/x-python","python");var a=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:a("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var r=t.split(" "),n=0;n<r.length;n++)i[r[n]]=e}function t(e,t){if(e.eatSpace())return null;var a=e.sol(),s=e.next();if("\\"===s)return e.next(),null;if("'"===s||'"'===s||"`"===s)return t.tokens.unshift(r(s)),n(e,t);if("#"===s)return a&&e.eat("!")?(e.skipToEnd(),"meta"):(e.skipToEnd(),"comment");if("$"===s)return t.tokens.unshift(o),n(e,t);if("+"===s||"="===s)return"operator";if("-"===s)return e.eat("-"),e.eatWhile(/\w/),"attribute";if(/\d/.test(s)&&(e.eatWhile(/\d/),e.eol()||!/\w/.test(e.peek())))return"number";e.eatWhile(/[\w-]/);var l=e.current();return"="===e.peek()&&/\w+/.test(l)?"def":i.hasOwnProperty(l)?i[l]:null}function r(e){return function(t,r){for(var n,i=!1,a=!1;null!=(n=t.next());){if(n===e&&!a){i=!0;break}if("$"===n&&!a&&"'"!==e){a=!0,t.backUp(1),r.tokens.unshift(o);break}a=!a&&"\\"===n}return!i&&a||r.tokens.shift(),"`"===e||")"===e?"quote":"string"}}function n(e,r){return(r.tokens[0]||t)(e,r)}var i={};e("atom","true false"),e("keyword","if then do else elif while until for in esac fi fin fil done exit set unset export function"),e("builtin","ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep kill killall ln ls make mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo tee telnet top touch vi vim wall wc wget who write yes zsh");var o=function(e,t){t.tokens.length>1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=r(")"),n(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return n(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,i){return 0==e.length?n(t):function(o,a){for(var s=e[0],l=0;l<s.length;l++)if(o.match(s[l][0]))return a.tokenize=r(e.slice(1),t),s[l][1];return a.tokenize=n(t,i),"string"}}function n(e,t){return function(r,n){return i(r,n,e,t)}}function i(e,t,n,i){if(i!==!1&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(i!==!1&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=r([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,i)),e.match(/\-\>\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";for(var o=!1;!e.eol()&&(o||i===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",s="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,s].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var l={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(a),builtin:t(s),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){function n(t,r){var n=r.curMode==o;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),n)return n&&null==r.php.tokenize&&t.match("?>")?(r.curMode=i,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):o.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=o,r.php||(r.php=e.startState(o,i.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var a="string"}else if(r.pending&&t.pos<r.pending.end){t.pos=r.pending.end;var a=r.pending.style}else var a=i.token(t,r.curState);r.pending&&(r.pending=null);var s,l=t.current(),c=l.search(/<\?/);return c!=-1&&("string"==a&&(s=l.match(/[\'\"]$/))&&!/\?>/.test(l)?r.pending=s[0]:r.pending={end:t.pos,style:a},t.backUp(l.length-c)),a}var i=e.getMode(t,"text/html"),o=e.getMode(t,l);return{startState:function(){var t=e.startState(i),n=r.startOpen?e.startState(o):null;return{html:t,php:n,curMode:r.startOpen?o:i,curState:r.startOpen?n:t,pending:null}},copyState:function(t){var r,n=t.html,a=e.copyState(i,n),s=t.php,l=s&&e.copyState(o,s);return r=t.curMode==i?a:l,{html:a,php:l,curMode:t.curMode,curState:r,pending:t.pending}},token:n,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",l)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,r){function n(e,t){var r=e.next();if(h[r]){var n=h[r](e,t);if(n!==!1)return n}if(1==p.hexNumber&&("0"==r&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==r||"X"==r)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==r||"B"==r)&&e.match(/^'[01]+'/)||"0"==r&&e.match(/^b[01]+/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==r&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==r||'"'==r&&p.doubleQuote)return t.tokenize=i(r),t.tokenize(e,t);if((1==p.nCharCast&&("n"==r||"N"==r)||1==p.charsetCast&&"_"==r&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(r))return null;if(p.commentSlashSlash&&"/"==r&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==r||"-"==r&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==r&&e.eat("*"))return t.tokenize=o,t.tokenize(e,t);if("."!=r){if(d.test(r))return e.eatWhile(d),null;if("{"==r&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return m.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(a)?"atom":u.hasOwnProperty(a)?"builtin":f.hasOwnProperty(a)?"keyword":l.hasOwnProperty(a)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function i(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){r.tokenize=n;break}o=!o&&"\\"==i}return"string"}}function o(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=n;break}}return"comment"}function a(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}function s(e){e.indent=e.context.indent,e.context=e.context.prev}var l=r.client||{},c=r.atoms||{"false":!0,"true":!0,"null":!0},u=r.builtin||{},f=r.keywords||{},d=r.operatorChars||/^[*+\-%<>!=&|~^]/,p=r.support||{},h=r.hooks||{},m=r.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:n,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var n=e.current();return"("==n?a(e,t,")"):"["==n?a(e,t,"]"):t.context&&t.context.type==n&&s(t),r},indent:function(r,n){var i=r.context;if(!i)return e.Pass;var o=n.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function r(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function n(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function i(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}var o="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";e.defineMIME("text/x-sql",{name:"sql",keywords:i(o+"begin"),builtin:i("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:i("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":r}}),e.defineMIME("text/x-mysql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-mariadb",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:i("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:i("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"), -builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-pgsql",{name:"sql",client:i("source"),keywords:i(o+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:i("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),e.defineMIME("text/x-gql",{name:"sql",keywords:i("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:i("false true"),builtin:i("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})}()}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(e,t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var r=t.scope.offset;if(e.eatSpace()){var n=e.indentation();return n>r&&"coffee"==t.scope.type?"indent":n<r?"dedent":null}r>0&&s(e,t)}if(e.eatSpace())return null;var a=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===a)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var l=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(l=!0),e.match(/^-?\d+\.\d*/)&&(l=!0),e.match(/^-?\.\d+/)&&(l=!0),l)return"."==e.peek()&&e.backUp(1),"number";var m=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(m=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^-?0(?![\dx])/i)&&(m=!0),m)return"number"}if(e.match(y))return t.tokenize=i(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(b)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=i(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(u)||e.match(h)?"operator":e.match(f)?"punctuation":e.match(x)?"atom":e.match(p)||t.prop&&e.match(d)?"property":e.match(v)?"keyword":e.match(d)?"variable":(e.next(),c)}function i(e,r,i){return function(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),r&&o.eol())return i}else{if(o.match(e))return a.tokenize=n,i;o.eat(/['"\/]/)}return r&&(t.singleLineStringErrors?i=c:a.tokenize=n),i}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=n;break}e.eatWhile("#")}return"comment"}function a(t,r,n){n=n||"coffee";for(var i=0,o=!1,a=null,s=r.scope;s;s=s.prev)if("coffee"===s.type||"}"==s.type){i=s.offset+e.indentUnit;break}"coffee"!==n?(o=null,a=t.column()+t.current().length):r.scope.align&&(r.scope.align=!1),r.scope={offset:i,type:n,prev:r.scope,align:o,alignOffset:a}}function s(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var r=e.indentation(),n=!1,i=t.scope;i;i=i.prev)if(r===i.offset){n=!0;break}if(!n)return!0;for(;t.scope.prev&&t.scope.offset!==r;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function l(e,t){var r=t.tokenize(e,t),n=e.current();"return"===n&&(t.dedent=!0),(("->"===n||"=>"===n)&&e.eol()||"indent"===r)&&a(e,t);var i="[({".indexOf(n);if(i!==-1&&a(e,t,"])}".slice(i,i+1)),m.exec(n)&&a(e,t),"then"==n&&s(e,t),"dedent"===r&&s(e,t))return c;if(i="])}".indexOf(n),i!==-1){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==n&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),r}var c="error",u=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,f=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,d=/^[_A-Za-z$][_A-Za-z$0-9]*/,p=/^@[_A-Za-z$][_A-Za-z$0-9]*/,h=r(["and","or","not","is","isnt","in","instanceof","typeof"]),m=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],v=r(m.concat(g));m=r(m);var y=/^('{3}|\"{3}|['\"])/,b=/^(\/{3}|\/)/,k=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],x=r(k),w={startState:function(e){return{tokenize:n,scope:{offset:e||0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,t){var r=null===t.scope.align&&t.scope;r&&e.sol()&&(r.align=!1);var n=l(e,t);return n&&"comment"!=n&&(r&&(r.align=!0),t.prop="punctuation"==n&&"."==e.current()),n},indent:function(e,t){if(e.tokenize!=n)return 0;var r=e.scope,i=t&&"])}".indexOf(t.charAt(0))>-1;if(i)for(;"coffee"==r.type&&r.prev;)r=r.prev;var o=i&&r.type===t.charAt(0);return r.align?r.alignOffset-(o?1:0):(o?r.prev:r).offset},lineComment:"#",fold:"indent"};return w}),e.defineMIME("text/x-coffeescript","coffeescript"),e.defineMIME("text/coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,r){var n=e.peek(),i=r.escaped;if(r.escaped=!1,"#"==n&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(r.literal&&e.indentation()>r.keyCol)return e.skipToEnd(),"string";if(r.literal&&(r.literal=!1),e.sol()){if(r.keyCol=0,r.pair=!1,r.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==n?r.inlinePairs++:"}"==n?r.inlinePairs--:"["==n?r.inlineList++:r.inlineList--,"meta";if(r.inlineList>0&&!i&&","==n)return e.next(),"meta";if(r.inlinePairs>0&&!i&&","==n)return r.keyCol=0,r.pair=!1,r.pairStart=!1,e.next(),"meta";if(r.pairStart){if(e.match(/^\s*(\||\>)\s*/))return r.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==r.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(r.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!r.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(r.pair=!0,r.keyCol=e.indentation(),"atom"):r.pair&&e.match(/^:\s*/)?(r.pairStart=!0,"meta"):(r.pairStart=!1,r.escaped="\\"==n,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),e.defineMIME("text/x-yaml","yaml")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jade",function(t){function r(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=e.startState(Y),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function n(e,t){if(e.sol()&&(t.javaScriptLine=!1,t.javaScriptLineExcludesColon=!1),t.javaScriptLine){if(t.javaScriptLineExcludesColon&&":"===e.peek())return t.javaScriptLine=!1,void(t.javaScriptLineExcludesColon=!1);var r=Y.token(e,t.jsState);return e.eol()&&(t.javaScriptLine=!1),r||!0}}function i(e,t){if(t.javaScriptArguments){if(0===t.javaScriptArgumentsDepth&&"("!==e.peek())return void(t.javaScriptArguments=!1);if("("===e.peek()?t.javaScriptArgumentsDepth++:")"===e.peek()&&t.javaScriptArgumentsDepth--,0===t.javaScriptArgumentsDepth)return void(t.javaScriptArguments=!1);var r=Y.token(e,t.jsState);return r||!0}}function o(e){if(e.match(/^yield\b/))return"keyword"}function a(e){if(e.match(/^(?:doctype) *([^\n]+)?/))return V}function s(e,t){if(e.match("#{"))return t.isInterpolating=!0,t.interpolationNesting=0,"punctuation"}function l(e,t){if(t.isInterpolating){if("}"===e.peek()){if(t.interpolationNesting--,t.interpolationNesting<0)return e.next(),t.isInterpolating=!1,"punctuation"}else"{"===e.peek()&&t.interpolationNesting++;return Y.token(e,t.jsState)||!0}}function c(e,t){if(e.match(/^case\b/))return t.javaScriptLine=!0,K}function u(e,t){if(e.match(/^when\b/))return t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,K}function f(e){if(e.match(/^default\b/))return K}function d(e,t){if(e.match(/^extends?\b/))return t.restOfLine="string",K}function p(e,t){if(e.match(/^append\b/))return t.restOfLine="variable",K}function h(e,t){if(e.match(/^prepend\b/))return t.restOfLine="variable",K}function m(e,t){if(e.match(/^block\b *(?:(prepend|append)\b)?/))return t.restOfLine="variable",K}function g(e,t){if(e.match(/^include\b/))return t.restOfLine="string",K}function v(e,t){if(e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match("include"))return t.isIncludeFiltered=!0,K}function y(e,t){if(t.isIncludeFiltered){var r=L(e,t);return t.isIncludeFiltered=!1,t.restOfLine="string",r}}function b(e,t){if(e.match(/^mixin\b/))return t.javaScriptLine=!0,K}function k(e,t){return e.match(/^\+([-\w]+)/)?(e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),"variable"):e.match(/^\+#{/,!1)?(e.next(),t.mixinCallAfter=!0,s(e,t)):void 0}function x(e,t){if(t.mixinCallAfter)return t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0}function w(e,t){if(e.match(/^(if|unless|else if|else)\b/))return t.javaScriptLine=!0,K}function _(e,t){if(e.match(/^(- *)?(each|for)\b/))return t.isEach=!0,K}function C(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,K;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return"variable"}}}function S(e,t){if(e.match(/^while\b/))return t.javaScriptLine=!0,K}function M(e,t){var r;if(r=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))return t.lastTag=r[1].toLowerCase(),"script"===t.lastTag&&(t.scriptType="application/javascript"),"tag"}function L(r,n){if(r.match(/^:([\w\-]+)/)){var i;return t&&t.innerModes&&(i=t.innerModes(r.current().substring(1))),i||(i=r.current().substring(1)),"string"==typeof i&&(i=e.getMode(t,i)),B(r,n,i),"atom"}}function T(e,t){if(e.match(/^(!?=|-)/))return t.javaScriptLine=!0,"punctuation"}function A(e){if(e.match(/^#([\w-]+)/))return G}function E(e){if(e.match(/^\.([\w-]+)/))return X}function O(e,t){if("("==e.peek())return e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue="",t.attributeIsType=!1,"punctuation"}function z(t,r){if(r.isAttrs){if(Z[t.peek()]&&r.attrsNest.push(Z[t.peek()]),r.attrsNest[r.attrsNest.length-1]===t.peek())r.attrsNest.pop();else if(t.eat(")"))return r.isAttrs=!1,"punctuation";if(r.inAttributeName&&t.match(/^[^=,\)!]+/))return"="!==t.peek()&&"!"!==t.peek()||(r.inAttributeName=!1,r.jsState=e.startState(Y),"script"===r.lastTag&&"type"===t.current().trim().toLowerCase()?r.attributeIsType=!0:r.attributeIsType=!1),"attribute";var n=Y.token(t,r.jsState);if(r.attributeIsType&&"string"===n&&(r.scriptType=t.current().toString()),0===r.attrsNest.length&&("string"===n||"variable"===n||"keyword"===n))try{return Function("","var x "+r.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),r.inAttributeName=!0,r.attrValue="",t.backUp(t.current().length),z(t,r)}catch(i){}return r.attrValue+=t.current(),n||!0}}function I(e,t){if(e.match(/^&attributes\b/))return t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,"keyword"}function N(e){if(e.sol()&&e.eatSpace())return"indent"}function q(e,t){if(e.match(/^ *\/\/(-)?([^\n]*)/))return t.indentOf=e.indentation(),t.indentToken="comment","comment"}function P(e){if(e.match(/^: */))return"colon"}function R(e,t){return e.match(/^(?:\| ?| )([^\n]+)/)?"string":e.match(/^(<[^\n]*)/,!1)?(B(e,t,"htmlmixed"),t.innerModeForLine=!0,F(e,t,!0)):void 0}function j(e,t){if(e.eat(".")){var r=null;return"script"===t.lastTag&&t.scriptType.toLowerCase().indexOf("javascript")!=-1?r=t.scriptType.toLowerCase().replace(/"|'/g,""):"style"===t.lastTag&&(r="css"),B(e,t,r),"dot"}}function D(e){return e.next(),null}function B(r,n,i){i=e.mimeModes[i]||i,i=t.innerModes?t.innerModes(i)||i:i,i=e.mimeModes[i]||i,i=e.getMode(t,i),n.indentOf=r.indentation(),i&&"null"!==i.name?n.innerMode=i:n.indentToken="string"}function F(t,r,n){return t.indentation()>r.indentOf||r.innerModeForLine&&!t.sol()||n?r.innerMode?(r.innerState||(r.innerState=r.innerMode.startState?e.startState(r.innerMode,t.indentation()):{}),t.hideFirstChars(r.indentOf+2,function(){return r.innerMode.token(t,r.innerState)||!0})):(t.skipToEnd(),r.indentToken):void(t.sol()&&(r.indentOf=1/0,r.indentToken=null,r.innerMode=null,r.innerState=null))}function W(e,t){if(e.sol()&&(t.restOfLine=""),t.restOfLine){e.skipToEnd();var r=t.restOfLine;return t.restOfLine="",r}}function H(){return new r}function $(e){return e.copy()}function U(e,t){var r=F(e,t)||W(e,t)||l(e,t)||y(e,t)||C(e,t)||z(e,t)||n(e,t)||i(e,t)||x(e,t)||o(e,t)||a(e,t)||s(e,t)||c(e,t)||u(e,t)||f(e,t)||d(e,t)||p(e,t)||h(e,t)||m(e,t)||g(e,t)||v(e,t)||b(e,t)||k(e,t)||w(e,t)||_(e,t)||S(e,t)||M(e,t)||L(e,t)||T(e,t)||A(e,t)||E(e,t)||O(e,t)||I(e,t)||N(e,t)||R(e,t)||q(e,t)||P(e,t)||j(e,t)||D(e,t);return r===!0?null:r}var K="keyword",V="meta",G="builtin",X="qualifier",Z={"{":"}","(":")","[":"]"},Y=e.getMode(t,"javascript");return r.prototype.copy=function(){var t=new r;return t.javaScriptLine=this.javaScriptLine,t.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,t.javaScriptArguments=this.javaScriptArguments,t.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,t.isInterpolating=this.isInterpolating,t.interpolationNesting=this.interpolationNesting,t.jsState=e.copyState(Y,this.jsState),t.innerMode=this.innerMode,this.innerMode&&this.innerState&&(t.innerState=e.copyState(this.innerMode,this.innerState)),t.restOfLine=this.restOfLine,t.isIncludeFiltered=this.isIncludeFiltered,t.isEach=this.isEach,t.lastTag=this.lastTag,t.scriptType=this.scriptType,t.isAttrs=this.isAttrs,t.attrsNest=this.attrsNest.slice(),t.inAttributeName=this.inAttributeName,t.attributeIsType=this.attributeIsType,t.attrValue=this.attrValue,t.indentOf=this.indentOf,t.indentToken=this.indentToken,t.innerModeForLine=this.innerModeForLine,t},{startState:H,copyState:$,token:U}},"javascript","css","htmlmixed"),e.defineMIME("text/x-jade","jade")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("lua",function(e,t){function r(e){return new RegExp("^(?:"+e.join("|")+")","i")}function n(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function i(e){for(var t=0;e.eat("=");)++t;return e.eat("["),t}function o(e,t){var r=e.next();return"-"==r&&e.eat("-")?e.eat("[")&&e.eat("[")?(t.cur=a(i(e),"comment"))(e,t):(e.skipToEnd(),"comment"):'"'==r||"'"==r?(t.cur=s(r))(e,t):"["==r&&/[\[=]/.test(e.peek())?(t.cur=a(i(e),"string"))(e,t):/\d/.test(r)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(r)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function a(e,t){return function(r,n){for(var i,a=null;null!=(i=r.next());)if(null==a)"]"==i&&(a=0);else if("="==i)++a;else{if("]"==i&&a==e){n.cur=o;break}a=null}return t}}function s(e){return function(t,r){for(var n,i=!1;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.cur=o),"string"}}var l=e.indentUnit,c=n(t.specials||[]),u=n(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),f=n(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),d=n(["function","if","repeat","do","\\(","{"]),p=n(["end","until","\\)","}"]),h=r(["end","until","\\)","}","else","elseif"]);return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:o}},token:function(e,t){if(e.eatSpace())return null;var r=t.cur(e,t),n=e.current();return"variable"==r&&(f.test(n)?r="keyword":u.test(n)?r="builtin":c.test(n)&&(r="variable-2")),"comment"!=r&&"string"!=r&&(d.test(n)?++t.indentDepth:p.test(n)&&--t.indentDepth),r},indent:function(e,t){var r=h.test(t);return e.basecol+l*(e.indentDepth-(r?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),e.defineMIME("text/x-lua","lua")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("cmake",function(){function e(e,t){for(var r,n,i=!1;!e.eol()&&(r=e.next())!=t.pending;){if("$"===r&&"\\"!=n&&'"'==t.pending){i=!0;break}n=r}return i&&e.backUp(1),r==t.pending?t.continueString=!1:t.continueString=!0,"string"}function t(t,n){var i=t.next();return"$"===i?t.match(r)?"variable-2":"variable":n.continueString?(t.backUp(1),e(t,n)):t.match(/(\s+)?\w+\(/)||t.match(/(\s+)?\w+\ \(/)?(t.backUp(1),"def"):"#"==i?(t.skipToEnd(),"comment"):"'"==i||'"'==i?(n.pending=i,e(t,n)):"("==i||")"==i?"bracket":i.match(/[0-9]/)?"number":(t.eatWhile(/[\w-]/),null)}var r=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var e={};return e.inDefinition=!1,e.inInclude=!1,e.continueString=!1,e.pending=!1,e},token:function(e,r){return e.eatSpace()?null:t(e,r)}}}),e.defineMIME("text/x-cmake","cmake")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t){return s=t,e}function n(e,t){e.eatWhile(/[\w\$_]/);var n=e.current();if(l.propertyIsEnumerable(n))return"keyword";if(c.propertyIsEnumerable(n))return"variable-2";if(u.propertyIsEnumerable(n))return"string-2";var s=e.next();return"@"==s?(e.eatWhile(/[\w\\\-]/),r("meta",e.current())):"/"==s&&e.eat("*")?(t.tokenize=i,i(e,t)):"<"==s&&e.eat("!")?(t.tokenize=o,o(e,t)):"="!=s?"~"!=s&&"|"!=s||!e.eat("=")?'"'==s||"'"==s?(t.tokenize=a(s),t.tokenize(e,t)):"#"==s?(e.skipToEnd(),r("comment","comment")):"!"==s?(e.match(/^\s*\w*/),r("keyword","important")):/\d/.test(s)?(e.eatWhile(/[\w.%]/),r("number","unit")):/[,.+>*\/]/.test(s)?r(null,"select-op"):/[;{}:\[\]]/.test(s)?r(null,s):(e.eatWhile(/[\w\\\-]/),r("variable","variable")):r(null,"compare"):void r(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=n;break}o="*"==i}return r("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=n;break}o="-"==i?o+1:0}return r("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=n),r("string","string")}}var s,l=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),c=t("http mail events server types location upstream charset_map limit_except if geo map"),u=t("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),f=e.indentUnit; -return{startState:function(e){return{tokenize:n,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;s=null;var r=t.tokenize(e,t),n=t.stack[t.stack.length-1];return"hash"==s&&"rule"==n?r="atom":"variable"==r&&("rule"==n?r="number":n&&"@media{"!=n||(r="tag")),"rule"==n&&/^[\{\};]$/.test(s)&&t.stack.pop(),"{"==s?"@media"==n?t.stack[t.stack.length-1]="@media{":t.stack.push("{"):"}"==s?t.stack.pop():"@media"==s?t.stack.push("@media"):"{"==n&&"comment"!=s&&t.stack.push("rule"),r},indent:function(e,t){var r=e.stack.length;return/^\}/.test(t)&&(r-="rule"==e.stack[e.stack.length-1]?2:1),e.baseIndent+r*f},electricChars:"}"}}),e.defineMIME("text/x-nginx-conf","nginx")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.string.charAt(e.pos+(t||0))}function r(e,t){if(t){var r=e.pos-t;return e.string.substr(r>=0?r:0,t)}return e.string.substr(0,e.pos-1)}function n(e,t){var r=e.string.length,n=r-e.pos+1;return e.string.substr(e.pos,t&&t<r?t:n)}function i(e,t){var r,n=e.pos+t;n<=0?e.pos=0:n>=(r=e.string.length-1)?e.pos=r:e.pos=n}e.defineMode("perl",function(){function e(e,t,r,n,i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e,t){for(var o,s=!1,l=0;o=e.next();){if(o===r[l]&&!s)return void 0!==r[++l]?(t.chain=r[l],t.style=n,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,n;s=!s&&"\\"==o}return n},t.tokenize(e,t)}function o(e,t,r){return t.tokenize=function(e,t){return e.string==r&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var f=a.next();if('"'==f||"'"==f){if(r(a,3)=="<<"+f){var d=a.pos;a.eatWhile(/\w/);var p=a.current().substr(1);if(p&&a.eat(f))return o(a,u,p);a.pos=d}return e(a,u,[f],"string")}if("q"==f){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==f){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],l,c);if("("==h)return e(a,u,[")"],l,c);if("["==h)return e(a,u,["]"],l,c);if("{"==h)return e(a,u,["}"],l,c);if("<"==h)return e(a,u,[">"],l,c)}}if("s"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("y"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("t"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat("r"),h&&(h=a.eat(/[(\[{<\^'"!~\/]/))))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("`"==f)return e(a,u,[f],"variable-2");if("/"==f)return/~\s*$/.test(r(a))?e(a,u,[f],l,c):"operator";if("$"==f){var d=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=d}if(/[$@%]/.test(f)){var d=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(t(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var h=a.current();if(s[h])return"variable-2"}a.pos=d}if(/[$@%&]/.test(f)&&(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}"))){var h=a.current();return s[h]?"variable-2":"variable"}if("#"==f&&"$"!=t(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(f)){var d=a.pos;if(a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),s[a.current()])return"operator";a.pos=d}if("_"==f&&1==a.pos){if("_END__"==n(a,6))return e(a,u,["\0"],"comment");if("_DATA__"==n(a,7))return e(a,u,["\0"],"variable-2");if("_C__"==n(a,7))return e(a,u,["\0"],"string")}if(/\w/.test(f)){var d=a.pos;if("{"==t(a,-2)&&("}"==t(a,0)||a.eatWhile(/\w/)&&"}"==t(a,0)))return"string";a.pos=d}if(/[A-Z]/.test(f)){var m=t(a,-2),d=a.pos;if(a.eatWhile(/[A-Z_]/),!/[\da-z]/.test(t(a,0))){var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}a.pos=d}if(/[a-zA-Z_]/.test(f)){var m=t(a,-2);a.eatWhile(/\w/);var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}return null}var s={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},l="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:a,chain:null,style:null,tail:null}},token:function(e,t){return(t.tokenize||a)(e,t)},lineComment:"#"}}),e.registerHelper("wordChars","perl",/[\w$]/),e.defineMIME("text/x-perl","perl")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sass",function(e){function t(e){return new RegExp("^"+e.join("|"))}function r(e,t){var r=e.peek();return")"===r?(e.next(),t.tokenizer=l,"operator"):"("===r?(e.next(),e.eatSpace(),"operator"):"'"===r||'"'===r?(t.tokenizer=i(e.next()),"string"):(t.tokenizer=i(")",!1),"string")}function n(e,t){return function(r,n){return r.sol()&&r.indentation()<=e?(n.tokenizer=l,l(r,n)):(t&&r.skipTo("*/")?(r.next(),r.next(),n.tokenizer=l):r.skipToEnd(),"comment")}}function i(e,t){function r(n,i){var a=n.next(),s=n.peek(),c=n.string.charAt(n.pos-2),u="\\"!==a&&s===e||a===e&&"\\"!==c;return u?(a!==e&&t&&n.next(),i.tokenizer=l,"string"):"#"===a&&"{"===s?(i.tokenizer=o(r),n.next(),"operator"):"string"}return null==t&&(t=!0),r}function o(e){return function(t,r){return"}"===t.peek()?(t.next(),r.tokenizer=e,"operator"):l(t,r)}}function a(t){if(0==t.indentCount){t.indentCount++;var r=t.scopes[0].offset,n=r+e.indentUnit;t.scopes.unshift({offset:n})}}function s(e){1!=e.scopes.length&&e.scopes.shift()}function l(e,t){var c=e.peek();if(e.match("/*"))return t.tokenizer=n(e.indentation(),!0),t.tokenizer(e,t);if(e.match("//"))return t.tokenizer=n(e.indentation(),!1),t.tokenizer(e,t);if(e.match("#{"))return t.tokenizer=o(l),"operator";if('"'===c||"'"===c)return e.next(),t.tokenizer=i(c),"string";if(t.cursorHalf){if("#"===c&&(e.next(),e.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^-?[0-9\.]+/))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^(px|em|in)\b/))return e.peek()||(t.cursorHalf=0),"unit";if(e.match(f))return e.peek()||(t.cursorHalf=0),"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,e.peek()||(t.cursorHalf=0),"atom";if("$"===c)return e.next(),e.eatWhile(/[\w-]/),e.peek()||(t.cursorHalf=0),"variable-3";if("!"===c)return e.next(),e.peek()||(t.cursorHalf=0),e.match(/^[\w]+/)?"keyword":"operator";if(e.match(p))return e.peek()||(t.cursorHalf=0),"operator";if(e.eatWhile(/[\w-]/))return e.peek()||(t.cursorHalf=0),"attribute";if(!e.peek())return t.cursorHalf=0,null}else{if("."===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("#"===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("$"===c)return e.next(),e.eatWhile(/[\w-]/),"variable-2";if(e.match(/^-?[0-9\.]+/))return"number";if(e.match(/^(px|em|in)\b/))return"unit";if(e.match(f))return"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,"atom";if("="===c&&e.match(/^=[\w-]+/))return a(t),"meta";if("+"===c&&e.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&e.match(/@extend/)&&(e.match(/\s*[\w]/)||s(t)),e.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(t),"meta";if("@"===c)return e.next(),e.eatWhile(/[\w-]/),"meta";if(e.eatWhile(/[\w-]/))return e.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":e.match(/ *:/,!1)?(a(t),t.cursorHalf=1,"atom"):e.match(/ *,/,!1)?"atom":(a(t),"atom");if(":"===c)return e.match(h)?"keyword":(e.next(),t.cursorHalf=1,"operator")}return e.match(p)?"operator":(e.next(),null)}function c(t,r){t.sol()&&(r.indentCount=0);var n=r.tokenizer(t,r),i=t.current();if("@return"!==i&&"}"!==i||s(r),null!==n){for(var o=t.pos-i.length,a=o+e.indentUnit*r.indentCount,l=[],c=0;c<r.scopes.length;c++){var u=r.scopes[c];u.offset<=a&&l.push(u)}r.scopes=l}return n}var u=["true","false","null","auto"],f=new RegExp("^"+u.join("|")),d=["\\(","\\)","=",">","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],p=t(d),h=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:l,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(e,t){var r=c(e,t);return t.lastToken={style:r,content:e.current()},r},indent:function(e){return e.scopes[0].offset}}}),e.defineMIME("text/x-sass","sass")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("wordChars","r",/[\w.]/),e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),r={},n=0;n<t.length;++n)r[t[n]]=!0;return r}function r(e,t){a=null;var r=e.next();if("#"==r)return e.skipToEnd(),"comment";if("0"==r&&e.eat("x"))return e.eatWhile(/[\da-f]/i),"number";if("."==r&&e.eat(/\d/))return e.match(/\d*(?:e[+\-]?\d+)?/),"number";if(/\d/.test(r))return e.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/),"number";if("'"==r||'"'==r)return t.tokenize=n(r),"string";if("."==r&&e.match(/.[.\d]+/))return"keyword";if(/[\w\.]/.test(r)&&"_"!=r){e.eatWhile(/[\w\.]/);var i=e.current();return s.propertyIsEnumerable(i)?"atom":c.propertyIsEnumerable(i)?(u.propertyIsEnumerable(i)&&!e.match(/\s*if(\s+|$)/,!1)&&(a="block"),"keyword"):l.propertyIsEnumerable(i)?"builtin":"variable"}return"%"==r?(e.skipTo("%")&&e.next(),"variable-2"):"<"==r&&e.eat("-")?"arrow":"="==r&&t.ctx.argList?"arg-is":f.test(r)?"$"==r?"dollar":(e.eatWhile(f),"operator"):/[\(\){}\[\];]/.test(r)?(a=r,";"==r?"semi":null):null}function n(e){return function(t,n){if(t.eat("\\")){var i=t.next();return"x"==i?t.match(/^[a-f0-9]{2}/i):("u"==i||"U"==i)&&t.eat("{")&&t.skipTo("}")?t.next():"u"==i?t.match(/^[a-f0-9]{4}/i):"U"==i?t.match(/^[a-f0-9]{8}/i):/[0-7]/.test(i)&&t.match(/^[0-7]{1,2}/),"string-2"}for(var o;null!=(o=t.next());){if(o==e){n.tokenize=r;break}if("\\"==o){t.backUp(1);break}}return"string"}}function i(e,t,r){e.ctx={type:t,indent:e.indent,align:null,column:r.column(),prev:e.ctx}}function o(e){e.indent=e.ctx.indent,e.ctx=e.ctx.prev}var a,s=t("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"),l=t("list quote bquote eval return call parse deparse"),c=t("if else repeat while function for in next break"),u=t("if else repeat while function for"),f=/[+\-*\/^<>=!&|~$:]/;return{startState:function(){return{tokenize:r,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var r=t.tokenize(e,t);"comment"!=r&&null==t.ctx.align&&(t.ctx.align=!0);var n=t.ctx.type;return";"!=a&&"{"!=a&&"}"!=a||"block"!=n||o(t),"{"==a?i(t,"}",e):"("==a?(i(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==a?i(t,"]",e):"block"==a?i(t,"block",e):a==n&&o(t),t.afterIdent="variable"==r||"keyword"==r,r},indent:function(t,n){if(t.tokenize!=r)return 0;var i=n&&n.charAt(0),o=t.ctx,a=i==o.type;return"block"==o.type?o.indent+("{"==i?0:e.indentUnit):o.align?o.column+(a?0:1):o.indent+(a?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],e):e(CodeMirror)}(function(e){"use strict";var t=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],r="("+t.join("|")+")",n=new RegExp(r+"\\s*$","i"),i=new RegExp(r+"(\\s+)","i");e.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:n,token:"variable-2"},{regex:i,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}],meta:{lineComment:"#"}}),e.defineMIME("text/x-dockerfile","dockerfile")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line==t.line&&e.ch==t.ch}function r(e){N.push(e),N.length>50&&N.shift()}function n(e){return N.length?void(N[N.length-1]+=e):r(e)}function i(e){return N[N.length-(e?Math.min(e,1):1)]||""}function o(){return N.length>1&&N.pop(),i()}function a(e,i,o,a,s){null==s&&(s=e.getRange(i,o)),a&&q&&q.cm==e&&t(i,q.pos)&&e.isClean(q.gen)?n(s):r(s),e.replaceRange("",i,o,"+delete"),q=a?{cm:e,pos:i,gen:e.changeGeneration()}:null}function s(e,t,r){return e.findPosH(t,r,"char",!0)}function l(e,t,r){return e.findPosH(t,r,"word",!0)}function c(e,t,r){return e.findPosV(t,r,"line",e.doc.sel.goalColumn)}function u(e,t,r){return e.findPosV(t,r,"page",e.doc.sel.goalColumn)}function f(e,t,r){for(var n=t.line,i=e.getLine(n),o=/\S/.test(r<0?i.slice(0,t.ch):i.slice(t.ch)),a=e.firstLine(),s=e.lastLine();;){if(n+=r,n<a||n>s)return e.clipPos(I(n-r,r<0?0:null));i=e.getLine(n);var l=/\S/.test(i);if(l)o=!0;else if(o)return I(n,0)}}function d(e,t,r){for(var n=t.line,i=t.ch,o=e.getLine(t.line),a=!1;;){var s=o.charAt(i+(r<0?-1:0));if(s){if(a&&/[!?.]/.test(s))return I(n,i+(r>0?1:0));a||(a=/\w/.test(s)),i+=r}else{if(n==(r<0?e.firstLine():e.lastLine()))return I(n,i);if(o=e.getLine(n+r),!/\S/.test(o))return I(n,i);n+=r,i=r<0?o.length:0}}}function p(e,r,n){var i;if(e.findMatchingBracket&&(i=e.findMatchingBracket(r,!0))&&i.match&&(i.forward?1:-1)==n)return n>0?I(i.to.line,i.to.ch+1):i.to;for(var o=!0;;o=!1){var a=e.getTokenAt(r),s=I(r.line,n<0?a.start:a.end);if(!(o&&n>0&&a.end==r.ch)&&/\w/.test(a.string))return s;var l=e.findPosH(s,n,"char");if(t(s,l))return r;r=l}}function h(e,t){var r=e.state.emacsPrefix;return r?(w(e),"-"==r?-1:Number(r)):t?null:1}function m(e){var t="string"==typeof e?function(t){t.execCommand(e)}:e;return function(e){var r=h(e);t(e);for(var n=1;n<r;++n)t(e)}}function g(e,r,n,i){var o=h(e);o<0&&(i=-i,o=-o);for(var a=0;a<o;++a){var s=n(e,r,i);if(t(s,r))break;r=s}return r}function v(e,t){var r=function(r){r.extendSelection(g(r,r.getCursor(),e,t))};return r.motion=!0,r}function y(e,t,r){for(var n,i=e.listSelections(),o=i.length;o--;)n=i[o].head,a(e,n,g(e,n,t,r),!0)}function b(e){if(e.somethingSelected()){for(var t,r=e.listSelections(),n=r.length;n--;)t=r[n],a(e,t.anchor,t.head);return!0}}function k(e,t){return e.state.emacsPrefix?void("-"!=t&&(e.state.emacsPrefix+=t)):(e.state.emacsPrefix=t,e.on("keyHandled",x),void e.on("inputRead",_))}function x(e,t){e.state.emacsPrefixMap||P.hasOwnProperty(t)||w(e)}function w(e){e.state.emacsPrefix=null,e.off("keyHandled",x),e.off("inputRead",_)}function _(e,t){var r=h(e);if(r>1&&"+input"==t.origin){for(var n=t.text.join("\n"),i="",o=1;o<r;++o)i+=n;e.replaceSelection(i)}}function C(e){e.state.emacsPrefixMap=!0,e.addKeyMap(j),e.on("keyHandled",S),e.on("inputRead",S)}function S(e,t){("string"!=typeof t||!/^\d$/.test(t)&&"Ctrl-U"!=t)&&(e.removeKeyMap(j),e.state.emacsPrefixMap=!1,e.off("keyHandled",S),e.off("inputRead",S))}function M(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",function(){e.setExtending(!1)})}function L(e){e.setExtending(!1),e.setCursor(e.getCursor())}function T(e,t,r){e.openDialog?e.openDialog(t+': <input type="text" style="width: 10em"/>',r,{bottom:!0}):r(prompt(t,""))}function A(e,t){var r=e.getCursor(),n=e.findPosH(r,1,"word");e.replaceRange(t(e.getRange(r,n)),r,n),e.setCursor(n)}function E(e){for(var t=e.getCursor(),r=t.line,n=t.ch,i=[];r>=e.firstLine();){for(var o=e.getLine(r),a=null==n?o.length:n;a>0;){var n=o.charAt(--a);if(")"==n)i.push("(");else if("]"==n)i.push("[");else if("}"==n)i.push("{");else if(/[\(\{\[]/.test(n)&&(!i.length||i.pop()!=n))return e.extendSelection(I(r,a))}--r,n=null}}function O(e){e.execCommand("clearSearch"),L(e)}function z(e){j[e]=function(t){k(t,e)},R["Ctrl-"+e]=function(t){k(t,e)},P["Ctrl-"+e]=!0}for(var I=e.Pos,N=[],q=null,P={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0},R=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":function(e){a(e,e.getCursor("start"),e.getCursor("end"))},"Ctrl-K":m(function(e){var t=e.getCursor(),r=e.clipPos(I(t.line)),n=e.getRange(t,r);/\S/.test(n)||(n+="\n",r=I(t.line+1,0)),a(e,t,r,!0,n)}),"Alt-W":function(e){r(e.getSelection()),L(e)},"Ctrl-Y":function(e){var t=e.getCursor();e.replaceRange(i(h(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},"Alt-Y":function(e){e.replaceSelection(o(),"around","paste")},"Ctrl-Space":M,"Ctrl-Shift-2":M,"Ctrl-F":v(s,1),"Ctrl-B":v(s,-1),Right:v(s,1),Left:v(s,-1),"Ctrl-D":function(e){y(e,s,1)},Delete:function(e){b(e)||y(e,s,1)},"Ctrl-H":function(e){y(e,s,-1)},Backspace:function(e){b(e)||y(e,s,-1)},"Alt-F":v(l,1),"Alt-B":v(l,-1),"Alt-D":function(e){y(e,l,1)},"Alt-Backspace":function(e){y(e,l,-1)},"Ctrl-N":v(c,1),"Ctrl-P":v(c,-1),Down:v(c,1),Up:v(c,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":v(u,-1),"Ctrl-V":v(u,1),PageUp:v(u,-1),PageDown:v(u,1),"Ctrl-Up":v(f,-1),"Ctrl-Down":v(f,1),"Alt-A":v(d,-1),"Alt-E":v(d,1),"Alt-K":function(e){y(e,d,1)},"Ctrl-Alt-K":function(e){y(e,p,1)},"Ctrl-Alt-Backspace":function(e){y(e,p,-1)},"Ctrl-Alt-F":v(p,1),"Ctrl-Alt-B":v(p,-1),"Shift-Ctrl-Alt-2":function(e){var t=e.getCursor();e.setSelection(g(e,t,p,1),t)},"Ctrl-Alt-T":function(e){var t=p(e,e.getCursor(),-1),r=p(e,t,1),n=p(e,r,1),i=p(e,n,-1);e.replaceRange(e.getRange(i,n)+e.getRange(r,i)+e.getRange(t,r),t,n)},"Ctrl-Alt-U":m(E),"Alt-Space":function(e){for(var t=e.getCursor(),r=t.ch,n=t.ch,i=e.getLine(t.line);r&&/\s/.test(i.charAt(r-1));)--r;for(;n<i.length&&/\s/.test(i.charAt(n));)++n;e.replaceRange(" ",I(t.line,r),I(t.line,n))},"Ctrl-O":m(function(e){e.replaceSelection("\n","start")}),"Ctrl-T":m(function(e){e.execCommand("transposeChars")}),"Alt-C":m(function(e){A(e,function(e){var t=e.search(/\w/);return t==-1?e:e.slice(0,t)+e.charAt(t).toUpperCase()+e.slice(t+1).toLowerCase()})}),"Alt-U":m(function(e){A(e,function(e){return e.toUpperCase()})}),"Alt-L":m(function(e){A(e,function(e){return e.toLowerCase()})}),"Alt-;":"toggleComment","Ctrl-/":m("undo"),"Shift-Ctrl--":m("undo"),"Ctrl-Z":m("undo"),"Cmd-Z":m("undo"),"Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findNext","Ctrl-R":"findPrev","Ctrl-G":O,"Shift-Alt-5":"replace","Alt-/":"autocomplete","Ctrl-J":"newlineAndIndent",Enter:!1,Tab:"indentAuto","Alt-G G":function(e){var t=h(e,!0);return null!=t&&t>0?e.setCursor(t-1):void T(e,"Goto line",function(t){var r;t&&!isNaN(r=Number(t))&&r==(0|r)&&r>0&&e.setCursor(r-1)})},"Ctrl-X Tab":function(e){e.indentSelection(h(e,!0)||e.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":m("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(e){a(e,e.getCursor(),d(e,e.getCursor(),1),!0)},"Ctrl-X H":"selectAll","Ctrl-Q Tab":m("insertTab"),"Ctrl-U":C}),j={"Ctrl-G":w},D=0;D<10;++D)z(String(D));z("-")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r,n){if(n<0&&0==r.ch)return t.clipPos(d(r.line-1));var i=t.getLine(r.line);if(n>0&&r.ch>=i.length)return t.clipPos(d(r.line+1,0));for(var o,a="start",s=r.ch,l=n<0?0:i.length,c=0;s!=l;s+=n,c++){var u=i.charAt(n<0?s-1:s),f="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==f&&u.toUpperCase()==u&&(f="W"),"start"==a)"o"!=f&&(a="in",o=f);else if("in"==a&&o!=f){if("w"==o&&"W"==f&&n<0&&s--,"W"==o&&"w"==f&&n>0){o="w";continue}break}}return d(r.line,s)}function r(e,r){e.extendSelectionsBy(function(n){return e.display.shift||e.doc.extend||n.empty()?t(e.doc,n.head,r):r<0?n.from():n.to()})}function n(t,r){return t.isReadOnly()?e.Pass:(t.operation(function(){for(var e=t.listSelections().length,n=[],i=-1,o=0;o<e;o++){var a=t.listSelections()[o].head;if(!(a.line<=i)){var s=d(a.line+(r?0:1),0);t.replaceRange("\n",s,null,"+insertLine"),t.indentLine(s.line,null,!0),n.push({head:s,anchor:s}),i=a.line+1}}t.setSelections(n)}),void t.execCommand("indentAuto"))}function i(t,r){for(var n=r.ch,i=n,o=t.getLine(r.line);n&&e.isWordChar(o.charAt(n-1));)--n;for(;i<o.length&&e.isWordChar(o.charAt(i));)++i;return{from:d(r.line,n),to:d(r.line,i),word:o.slice(n,i)}}function o(e){var t=e.getCursor(),r=e.scanForBracket(t,-1);if(r)for(;;){var n=e.scanForBracket(t,1);if(!n)return;if(n.ch==v.charAt(v.indexOf(r.ch)+1))return e.setSelection(d(r.pos.line,r.pos.ch+1),n.pos,!1),!0;t=d(n.pos.line,n.pos.ch+1)}}function a(t,r){if(t.isReadOnly())return e.Pass;for(var n,i=t.listSelections(),o=[],a=0;a<i.length;a++){var s=i[a];if(!s.empty()){for(var l=s.from().line,c=s.to().line;a<i.length-1&&i[a+1].from().line==c;)c=s[++a].to().line;o.push(l,c)}}o.length?n=!0:o.push(t.firstLine(),t.lastLine()),t.operation(function(){for(var e=[],i=0;i<o.length;i+=2){var a=o[i],s=o[i+1],l=d(a,0),c=d(s),u=t.getRange(l,c,!1);r?u.sort():u.sort(function(e,t){var r=e.toUpperCase(),n=t.toUpperCase();return r!=n&&(e=r,t=n),e<t?-1:e==t?0:1}),t.replaceRange(u,l,c),n&&e.push({anchor:l,head:c})}n&&t.setSelections(e,0)})}function s(t,r){t.operation(function(){for(var n=t.listSelections(),o=[],a=[],s=0;s<n.length;s++){var l=n[s];l.empty()?(o.push(s),a.push("")):a.push(r(t.getRange(l.from(),l.to())))}t.replaceSelections(a,"around","case");for(var c,s=o.length-1;s>=0;s--){var l=n[o[s]];if(!(c&&e.cmpPos(l.head,c)>0)){var u=i(t,l.head);c=u.from,t.replaceRange(r(u.word),u.from,u.to)}}})}function l(t){var r=t.getCursor("from"),n=t.getCursor("to");if(0==e.cmpPos(r,n)){var o=i(t,r);if(!o.word)return;r=o.from,n=o.to}return{from:r,to:n,query:t.getRange(r,n),word:o}}function c(e,t){var r=l(e);if(r){var n=r.query,i=e.getSearchCursor(n,t?r.to:r.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(n,t?d(e.firstLine(),0):e.clipPos(d(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):r.word&&e.setSelection(r.from,r.to))}}var u=e.keyMap.sublime={fallthrough:"default"},f=e.commands,d=e.Pos,p=e.keyMap["default"]==e.keyMap.macDefault,h=p?"Cmd-":"Ctrl-",m=p?"Ctrl-":"Alt-";f[u[m+"Left"]="goSubwordLeft"]=function(e){r(e,-1)},f[u[m+"Right"]="goSubwordRight"]=function(e){r(e,1)},p&&(u["Cmd-Left"]="goLineStartSmart");var g=p?"Ctrl-Alt-":"Ctrl-";f[u[g+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var r=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=r&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},f[u[g+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var r=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=r&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},f[u["Shift-"+h+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)for(var i=t[n].from(),o=t[n].to(),a=i.line;a<=o.line;++a)o.line>i.line&&a==o.line&&0==o.ch||r.push({anchor:a==i.line?i:d(a,0),head:a==o.line?o:d(a)});e.setSelections(r,0)},u["Shift-Tab"]="indentLess",f[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},f[u[h+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n];r.push({anchor:d(i.from().line,0),head:d(i.to().line+1,0)})}e.setSelections(r)},u["Shift-Ctrl-K"]="deleteLine",f[u[h+"Enter"]="insertLineAfter"]=function(e){return n(e,!1)},f[u["Shift-"+h+"Enter"]="insertLineBefore"]=function(e){return n(e,!0)},f[u[h+"D"]="selectNextOccurrence"]=function(t){var r=t.getCursor("from"),n=t.getCursor("to"),o=t.state.sublimeFindFullWord==t.doc.sel;if(0==e.cmpPos(r,n)){var a=i(t,r);if(!a.word)return;t.setSelection(a.from,a.to),o=!0}else{var s=t.getRange(r,n),l=o?new RegExp("\\b"+s+"\\b"):s,c=t.getSearchCursor(l,n);c.findNext()?t.addSelection(c.from(),c.to()):(c=t.getSearchCursor(l,d(t.firstLine(),0)),c.findNext()&&t.addSelection(c.from(),c.to()))}o&&(t.state.sublimeFindFullWord=t.doc.sel)};var v="(){}[]";f[u["Shift-"+h+"Space"]="selectScope"]=function(e){o(e)||e.execCommand("selectAll")},f[u["Shift-"+h+"M"]="selectBetweenBrackets"]=function(t){if(!o(t))return e.Pass},f[u[h+"M"]="goToBracket"]=function(t){t.extendSelectionsBy(function(r){var n=t.scanForBracket(r.head,1);if(n&&0!=e.cmpPos(n.pos,r.head))return n.pos;var i=t.scanForBracket(r.head,-1);return i&&d(i.pos.line,i.pos.ch+1)||r.head})};var y=p?"Cmd-Ctrl-":"Shift-Ctrl-";f[u[y+"Up"]="swapLineUp"]=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),n=[],i=t.firstLine()-1,o=[],a=0;a<r.length;a++){var s=r[a],l=s.from().line-1,c=s.to().line;o.push({anchor:d(s.anchor.line-1,s.anchor.ch),head:d(s.head.line-1,s.head.ch)}),0!=s.to().ch||s.empty()||--c,l>i?n.push(l,c):n.length&&(n[n.length-1]=c),i=c}t.operation(function(){for(var e=0;e<n.length;e+=2){var r=n[e],i=n[e+1],a=t.getLine(r);t.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),i>t.lastLine()?t.replaceRange("\n"+a,d(t.lastLine()),null,"+swapLine"):t.replaceRange(a+"\n",d(i,0),null,"+swapLine")}t.setSelections(o),t.scrollIntoView()})},f[u[y+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),n=[],i=t.lastLine()+1,o=r.length-1;o>=0;o--){ -var a=r[o],s=a.to().line+1,l=a.from().line;0!=a.to().ch||a.empty()||s--,s<i?n.push(s,l):n.length&&(n[n.length-1]=l),i=l}t.operation(function(){for(var e=n.length-2;e>=0;e-=2){var r=n[e],i=n[e+1],o=t.getLine(r);r==t.lastLine()?t.replaceRange("",d(r-1),d(r),"+swapLine"):t.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),t.replaceRange(o+"\n",d(i,0),null,"+swapLine")}t.scrollIntoView()})},f[u[h+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},f[u[h+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){for(var i=t[n],o=i.from(),a=o.line,s=i.to().line;n<t.length-1&&t[n+1].from().line==s;)s=t[++n].to().line;r.push({start:a,end:s,anchor:!i.empty()&&o})}e.operation(function(){for(var t=0,n=[],i=0;i<r.length;i++){for(var o,a=r[i],s=a.anchor&&d(a.anchor.line-t,a.anchor.ch),l=a.start;l<=a.end;l++){var c=l-t;l==a.end&&(o=d(c,e.getLine(c).length+1)),c<e.lastLine()&&(e.replaceRange(" ",d(c),d(c+1,/^\s*/.exec(e.getLine(c+1))[0].length)),++t)}n.push({anchor:s||o,head:o})}e.setSelections(n,0)})},f[u["Shift-"+h+"D"]="duplicateLine"]=function(e){e.operation(function(){for(var t=e.listSelections().length,r=0;r<t;r++){var n=e.listSelections()[r];n.empty()?e.replaceRange(e.getLine(n.head.line)+"\n",d(n.head.line,0)):e.replaceRange(e.getRange(n.from(),n.to()),n.from())}e.scrollIntoView()})},u[h+"T"]="transposeChars",f[u.F9="sortLines"]=function(e){a(e,!0)},f[u[h+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},f[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var r=t.shift(),n=r.find();if(n)return t.push(r),e.setSelection(n.from,n.to)}},f[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var r=t[t.length-1].find();if(r)return e.setSelection(r.from,r.to);t.pop()}},f[u[h+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),r=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),n=0;n<t.length;n++){for(var i=t[n].from(),o=t[n].to(),a=e.findMarks(i,o),s=0;s<a.length;s++)if(a[s].sublimeBookmark){a[s].clear();for(var l=0;l<r.length;l++)r[l]==a[s]&&r.splice(l--,1);break}s==a.length&&r.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},f[u["Shift-"+h+"F2"]="clearBookmarks"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(var r=0;r<t.length;r++)t[r].clear();t.length=0},f[u["Alt-F2"]="selectBookmarks"]=function(e){var t=e.state.sublimeBookmarks,r=[];if(t)for(var n=0;n<t.length;n++){var i=t[n].find();i?r.push({anchor:i.from,head:i.to}):t.splice(n--,0)}r.length&&e.setSelections(r,0)},u["Alt-Q"]="wrapLines";var b=h+"K ";u[b+h+"Backspace"]="delLineLeft",f[u.Backspace="smartBackspace"]=function(t){return t.somethingSelected()?e.Pass:void t.operation(function(){for(var r=t.listSelections(),n=t.getOption("indentUnit"),i=r.length-1;i>=0;i--){var o=r[i].head,a=t.getRange({line:o.line,ch:0},o),s=e.countColumn(a,null,t.getOption("tabSize")),l=t.findPosH(o,-1,"char",!1);if(a&&!/\S/.test(a)&&s%n==0){var c=new d(o.line,e.findColumn(a,s-n,n));c.ch!=o.ch&&(l=c)}t.replaceRange("",l,o,"+delete")}})},f[u[b+h+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange("",t[r].anchor,d(t[r].to().line),"+delete");e.scrollIntoView()})},f[u[b+h+"U"]="upcaseAtCursor"]=function(e){s(e,function(e){return e.toUpperCase()})},f[u[b+h+"L"]="downcaseAtCursor"]=function(e){s(e,function(e){return e.toLowerCase()})},f[u[b+h+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},f[u[b+h+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},f[u[b+h+"W"]="deleteToSublimeMark"]=function(t){var r=t.state.sublimeMark&&t.state.sublimeMark.find();if(r){var n=t.getCursor(),i=r;if(e.cmpPos(n,i)>0){var o=i;i=n,n=o}t.state.sublimeKilled=t.getRange(n,i),t.replaceRange("",n,i)}},f[u[b+h+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},f[u[b+h+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[b+h+"G"]="clearBookmarks",f[u[b+h+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)};var k=p?"Ctrl-Shift-":"Ctrl-Alt-";f[u[k+"Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=0;r<t.length;r++){var n=t[r];n.head.line>e.firstLine()&&e.addSelection(d(n.head.line-1,n.head.ch))}})},f[u[k+"Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=0;r<t.length;r++){var n=t[r];n.head.line<e.lastLine()&&e.addSelection(d(n.head.line+1,n.head.ch))}})},f[u[h+"F3"]="findUnder"]=function(e){c(e,!0)},f[u["Shift-"+h+"F3"]="findUnderPrevious"]=function(e){c(e,!1)},f[u["Alt-F3"]="findAllUnder"]=function(e){var t=l(e);if(t){for(var r=e.getSearchCursor(t.query),n=[],i=-1;r.findNext();)n.push({anchor:r.from(),head:r.to()}),r.from().line<=t.from.line&&r.from().ch<=t.from.ch&&i++;e.setSelections(n,i)}},u["Shift-"+h+"["]="fold",u["Shift-"+h+"]"]="unfold",u[b+h+"0"]=u[b+h+"j"]="unfoldAll",u[h+"I"]="findIncremental",u["Shift-"+h+"I"]="findIncrementalReverse",u[h+"H"]="replace",u.F3="findNext",u["Shift-F3"]="findPrev",e.normalizeKeyMap(u)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";var t=[{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:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"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:"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:"<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:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"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:"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:"moveToEol",motionArgs:{inclusive:!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-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{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:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},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:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",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:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],r=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],n=e.Pos,i=function(){function i(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",et),_(t),e.on(t.getInputField(),"paste",u(t))}function o(t){t.setOption("disableInput",!1),t.off("cursorActivity",et),e.off(t.getInputField(),"paste",u(t)),t.state.vim=null}function a(t,r){this==e.keyMap.vim&&e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==s||o(t,!1)}function s(t,r){this==e.keyMap.vim&&e.addClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==s||i(t)}function l(t,r){if(r){if(this[t])return this[t];var n=c(t);if(!n)return!1;var i=e.Vim.findKey(r,n);return"function"==typeof i&&e.signal(r,"vim-keypress",n),i}}function c(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),r=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==r.length)return!1;for(var n=!1,i=0;i<t.length;i++){var o=t[i];o in st?t[i]=st[o]:n=!0,o in lt&&(t[i]=lt[o])}return!!n&&(g(r)&&(t[t.length-1]=r.toLowerCase()),"<"+t.join("-")+">")}function u(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(R(e.getCursor(),0,1)),Mt.enterInsertMode(e,{},t))}),t.onPasteFn}function f(e,t){for(var r=[],n=e;n<e+t;n++)r.push(String.fromCharCode(n));return r}function d(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function p(e){return/^[a-z]$/.test(e)}function h(e){return"()[]{}".indexOf(e)!=-1}function m(e){return ct.test(e)}function g(e){return/^[A-Z]$/.test(e)}function v(e){return/^\s*$/.test(e)}function y(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}function b(e,t,r,n,i){if(void 0===t&&!i)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),vt[e]={type:r,defaultValue:t,callback:i},n)for(var o=0;o<n.length;o++)vt[n[o]]=vt[e];t&&k(e,t)}function k(e,t,r,n){var i=vt[e];n=n||{};var o=n.scope;if(!i)throw Error("Unknown option: "+e);if("boolean"==i.type){if(t&&t!==!0)throw Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}i.callback?("local"!==o&&i.callback(t,void 0),"global"!==o&&r&&i.callback(t,r)):("local"!==o&&(i.value="boolean"==i.type?!!t:t),"global"!==o&&r&&(r.state.vim.options[e]={value:t}))}function x(e,t,r){var n=vt[e];r=r||{};var i=r.scope;if(!n)throw Error("Unknown option: "+e);{if(!n.callback){var o="global"!==i&&t&&t.state.vim.options[e];return(o||"local"!==i&&n||{}).value}var o=t&&n.callback(void 0,t);if("global"!==i&&void 0!==o)return o;if("local"!==i)return n.callback()}}function w(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=bt()}function _(e){return e.state.vim||(e.state.vim={inputState:new S,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function C(){kt={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:yt(),macroModeState:new w,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new A({}),searchHistoryController:new E({}),exCommandHistoryController:new E({})};for(var e in vt){var t=vt[e];t.value=t.defaultValue}}function S(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function M(t,r){t.state.vim.inputState=new S,e.signal(t,"vim-command-done",r)}function L(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}function T(e,t){var r=kt.registerController.registers[e];if(!e||1!=e.length)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,gt.push(e)}function A(e){this.registers=e,this.unnamedRegister=e['"']=new L,e["."]=new L,e[":"]=new L,e["/"]=new L}function E(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}function O(e,t){Ct[e]=t}function z(e,t){for(var r=[],n=0;n<t;n++)r.push(e);return r}function I(e,t){St[e]=t}function N(e,t){Mt[e]=t}function q(e,t,r){var i=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),o=X(e,i)-1;o=r?o+1:o;var a=Math.min(Math.max(0,t.ch),o);return n(i,a)}function P(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function R(e,t,r){return"object"==typeof t&&(r=t.ch,t=t.line),n(e.line+t,e.ch+r)}function j(e,t){return{line:t.line-e.line,ch:t.line-e.line}}function D(e,t,r,n){for(var i,o=[],a=[],s=0;s<t.length;s++){var l=t[s];"insert"==r&&"insert"!=l.context||l.context&&l.context!=r||n.operator&&"action"==l.type||!(i=B(e,l.keys))||("partial"==i&&o.push(l),"full"==i&&a.push(l))}return{partial:o.length&&o,full:a.length&&a}}function B(e,t){if("<character>"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),i=t.slice(0,r);return n==i&&e.length>r?"full":0==i.indexOf(n)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function F(e){var t=/^.*(<[\w\-]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"<CR>":r="\n";break;case"<Space>":r=" "}return r}function W(e,t,r){return function(){for(var n=0;n<r;n++)t(e)}}function H(e){return n(e.line,e.ch)}function $(e,t){return e.ch==t.ch&&e.line==t.line}function U(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function K(e,t){return arguments.length>2&&(t=K.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?e:t}function V(e,t){return arguments.length>2&&(t=V.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?t:e}function G(e,t,r){var n=U(e,t),i=U(t,r);return n&&i}function X(e,t){return e.getLine(t).length}function Z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Q(e,t,r){var i=X(e,t),o=new Array(r-i+1).join(" ");e.setCursor(n(t,i)),e.replaceRange(o,e.getCursor())}function J(e,t){var r=[],i=e.listSelections(),o=H(e.clipPos(t)),a=!$(t,o),s=e.getCursor("head"),l=te(i,s),c=$(i[l].head,i[l].anchor),u=i.length-1,f=u-l>l?u:0,d=i[f].anchor,p=Math.min(d.line,o.line),h=Math.max(d.line,o.line),m=d.ch,g=o.ch,v=i[f].head.ch-m,y=g-m;v>0&&y<=0?(m++,a||g--):v<0&&y>=0?(m--,c||g++):v<0&&y==-1&&(m--,g++);for(var b=p;b<=h;b++){var k={anchor:new n(b,m),head:new n(b,g)};r.push(k)}return l=o.line==h?r.length-1:0,e.setSelections(r),t.ch=g,d.ch=m,d}function ee(e,t,r){for(var n=[],i=0;i<r;i++){var o=R(t,i,0);n.push({anchor:o,head:o})}e.setSelections(n,0)}function te(e,t,r){for(var n=0;n<e.length;n++){var i="head"!=r&&$(e[n].anchor,t),o="anchor"!=r&&$(e[n].head,t);if(i||o)return n}return-1}function re(e,t){var r=t.lastSelection,i=function(){var t=e.listSelections(),r=t[0],n=t[t.length-1],i=U(r.anchor,r.head)?r.anchor:r.head,o=U(n.anchor,n.head)?n.head:n.anchor;return[i,o]},o=function(){var t=e.getCursor(),i=e.getCursor(),o=r.visualBlock;if(o){var a=o.width,s=o.height;i=n(t.line+s,t.ch+a);for(var l=[],c=t.line;c<i.line;c++){var u=n(c,t.ch),f=n(c,i.ch),d={anchor:u,head:f};l.push(d)}e.setSelections(l)}else{var p=r.anchorMark.find(),h=r.headMark.find(),m=h.line-p.line,g=h.ch-p.ch;i={line:i.line+m,ch:m?i.ch:g+i.ch},r.visualLine&&(t=n(t.line,0),i=n(i.line,X(e,i.line))),e.setSelection(t,i)}return[t,i]};return t.visualMode?i():o()}function ne(e,t){var r=t.sel.anchor,n=t.sel.head;t.lastPastedText&&(n=e.posFromIndex(e.indexFromPos(r)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(r),headMark:e.setBookmark(n),anchor:H(r),head:H(n),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ie(e,t,r){var i,o=e.state.vim.sel,a=o.head,s=o.anchor;return U(r,t)&&(i=r,r=t,t=i),U(a,s)?(a=K(t,a),s=V(s,r)):(s=K(t,s),a=V(a,r),a=R(a,0,-1),a.ch==-1&&a.line!=e.firstLine()&&(a=n(a.line-1,X(e,a.line-1)))),[s,a]}function oe(e,t,r){var n=e.state.vim;t=t||n.sel;var r=r||n.visualLine?"line":n.visualBlock?"block":"char",i=ae(e,t,r);e.setSelections(i.ranges,i.primary),tt(e)}function ae(e,t,r,i){var o=H(t.head),a=H(t.anchor);if("char"==r){var s=i||U(t.head,t.anchor)?0:1,l=U(t.head,t.anchor)?1:0;return o=R(t.head,0,s),a=R(t.anchor,0,l),{ranges:[{anchor:a,head:o}],primary:0}}if("line"==r){if(U(t.head,t.anchor))o.ch=0,a.ch=X(e,a.line);else{a.ch=0;var c=e.lastLine();o.line>c&&(o.line=c),o.ch=X(e,o.line)}return{ranges:[{anchor:a,head:o}],primary:0}}if("block"==r){for(var u=Math.min(a.line,o.line),f=Math.min(a.ch,o.ch),d=Math.max(a.line,o.line),p=Math.max(a.ch,o.ch)+1,h=d-u+1,m=o.line==u?0:h-1,g=[],v=0;v<h;v++)g.push({anchor:n(u+v,f),head:n(u+v,p)});return{ranges:g,primary:m}}}function se(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=K(t,e.getCursor("anchor"))),t}function le(t,r){var n=t.state.vim;r!==!1&&t.setCursor(q(t,n.sel.head)),ne(t,n),n.visualMode=!1,n.visualLine=!1,n.visualBlock=!1,e.signal(t,"vim-mode-change",{mode:"normal"}),n.fakeCursor&&n.fakeCursor.clear()}function ce(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var i=n.split("\n");i.pop();for(var o,o=i.pop();i.length>0&&o&&v(o);o=i.pop())r.line--,r.ch=0;o?(r.line--,r.ch=X(e,r.line)):r.ch=0}}function ue(e,t,r){t.ch=0,r.ch=0,r.line++}function fe(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function de(e,t,r,i,o){for(var a=se(e),s=e.getLine(a.line),l=a.ch,c=o?ut[0]:ft[0];!c(s.charAt(l));)if(l++,l>=s.length)return null;i?c=ft[0]:(c=ut[0],c(s.charAt(l))||(c=ut[1]));for(var u=l,f=l;c(s.charAt(u))&&u<s.length;)u++;for(;c(s.charAt(f))&&f>=0;)f--;if(f++,t){for(var d=u;/\s/.test(s.charAt(u))&&u<s.length;)u++;if(d==u){for(var p=f;/\s/.test(s.charAt(f-1))&&f>0;)f--;f||(f=p)}}return{start:n(a.line,f),end:n(a.line,u)}}function pe(e,t,r){$(t,r)||kt.jumpList.add(e,t,r)}function he(e,t){kt.lastCharacterSearch.increment=e,kt.lastCharacterSearch.forward=t.forward,kt.lastCharacterSearch.selectedCharacter=t.selectedCharacter}function me(e,t,r,i){var o=H(e.getCursor()),a=r?1:-1,s=r?e.lineCount():-1,l=o.ch,c=o.line,u=e.getLine(c),f={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:i,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[i],forward:r,depth:0,curMoveThrough:!1},d=Lt[i];if(!d)return o;var p=Tt[d].init,h=Tt[d].isComplete;for(p&&p(f);c!==s&&t;){if(f.index+=a,f.nextCh=f.lineText.charAt(f.index),!f.nextCh){if(c+=a,f.lineText=e.getLine(c)||"",a>0)f.index=0;else{var m=f.lineText.length;f.index=m>0?m-1:0}f.nextCh=f.lineText.charAt(f.index)}h(f)&&(o.line=c,o.ch=f.index,t--)}return f.nextCh||f.curMoveThrough?n(c,f.index):o}function ge(e,t,r,n,i){var o=t.line,a=t.ch,s=e.getLine(o),l=r?1:-1,c=n?ft:ut;if(i&&""==s){if(o+=l,s=e.getLine(o),!d(e,o))return null;a=r?0:s.length}for(;;){if(i&&""==s)return{from:0,to:0,line:o};for(var u=l>0?s.length:-1,f=u,p=u;a!=u;){for(var h=!1,m=0;m<c.length&&!h;++m)if(c[m](s.charAt(a))){for(f=a;a!=u&&c[m](s.charAt(a));)a+=l;if(p=a,h=f!=p,f==t.ch&&o==t.line&&p==f+l)continue;return{from:Math.min(f,p+1),to:Math.max(f,p),line:o}}h||(a+=l)}if(o+=l,!d(e,o))return null;s=e.getLine(o),a=l>0?0:s.length}}function ve(e,t,r,i,o,a){var s=H(t),l=[];(i&&!o||!i&&o)&&r++;for(var c=!(i&&o),u=0;u<r;u++){var f=ge(e,t,i,a,c);if(!f){var d=X(e,e.lastLine());l.push(i?{line:e.lastLine(),from:d,to:d}:{line:0,from:0,to:0});break}l.push(f),t=n(f.line,i?f.to-1:f.from)}var p=l.length!=r,h=l[0],m=l.pop();return i&&!o?(p||h.from==s.ch&&h.line==s.line||(m=l.pop()),n(m.line,m.from)):i&&o?n(m.line,m.to-1):!i&&o?(p||h.to==s.ch&&h.line==s.line||(m=l.pop()),n(m.line,m.to)):n(m.line,m.from)}function ye(e,t,r,i){for(var o,a=e.getCursor(),s=a.ch,l=0;l<t;l++){var c=e.getLine(a.line);if(o=xe(s,c,i,r,!0),o==-1)return null;s=o}return n(e.getCursor().line,o)}function be(e,t){var r=e.getCursor().line;return q(e,n(r,t-1))}function ke(e,t,r,n){y(r,mt)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function xe(e,t,r,n,i){var o;return n?(o=t.indexOf(r,e+1),o==-1||i||(o-=1)):(o=t.lastIndexOf(r,e-1),o==-1||i||(o+=1)),o}function we(e,t,r,i,o){function a(t){return!e.getLine(t)}function s(e,t,r){return r?a(e)!=a(e+t):!a(e)&&a(e+t)}var l,c,u=t.line,f=e.firstLine(),d=e.lastLine(),p=u;if(i){for(;f<=p&&p<=d&&r>0;)s(p,i)&&r--,p+=i;return new n(p,0)}var h=e.state.vim;if(h.visualLine&&s(u,1,!0)){var m=h.sel.anchor;s(m.line,-1,!0)&&(o&&m.line==u||(u+=1))}var g=a(u);for(p=u;p<=d&&r;p++)s(p,1,!0)&&(o&&a(p)==g||r--);for(c=new n(p,0),p>d&&!g?g=!0:o=!1,p=u;p>f&&(o&&a(p)!=g&&p!=u||!s(p,-1,!0));p--);return l=new n(p,0),{start:l,end:c}}function _e(e,t,r,i){var o,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[r],u=e.getLine(s.line).charAt(s.ch),f=u===c?1:0;if(o=e.scanForBracket(n(s.line,s.ch+f),-1,null,{bracketRegex:l}),a=e.scanForBracket(n(s.line,s.ch+f),1,null,{bracketRegex:l}),!o||!a)return{start:s,end:s};if(o=o.pos,a=a.pos,o.line==a.line&&o.ch>a.ch||o.line>a.line){var d=o;o=a,a=d}return i?a.ch+=1:o.ch+=1,{start:o,end:a}}function Ce(e,t,r,i){var o,a,s,l,c=H(t),u=e.getLine(c.line),f=u.split(""),d=f.indexOf(r);if(c.ch<d?c.ch=d:d<c.ch&&f[c.ch]==r&&(a=c.ch,--c.ch),f[c.ch]!=r||a)for(s=c.ch;s>-1&&!o;s--)f[s]==r&&(o=s+1);else o=c.ch+1;if(o&&!a)for(s=o,l=f.length;s<l&&!a;s++)f[s]==r&&(a=s);return o&&a?(i&&(--o,++a),{start:n(c.line,o),end:n(c.line,a)}):{start:c,end:c}}function Se(){}function Me(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Se)}function Le(e,t,r,n,i){e.openDialog?e.openDialog(t,n,{bottom:!0,value:i.value,onKeyDown:i.onKeyDown,onKeyUp:i.onKeyUp,selectValueOnOpen:!1}):n(prompt(r,""))}function Te(e){var t=Ae(e)||[];if(!t.length)return[];var r=[];if(0===t[0]){for(var n=0;n<t.length;n++)"number"==typeof t[n]&&r.push(e.substring(t[n]+1,t[n+1])); -return r}}function Ae(e){for(var t=!1,r=[],n=0;n<e.length;n++){var i=e.charAt(n);t||"/"!=i||r.push(n),t=!t&&"\\"==i}return r}function Ee(e){for(var t="|(){",r="}",n=!1,i=[],o=-1;o<e.length;o++){var a=e.charAt(o)||"",s=e.charAt(o+1)||"",l=s&&t.indexOf(s)!=-1;n?("\\"===a&&l||i.push(a),n=!1):"\\"===a?(n=!0,s&&r.indexOf(s)!=-1&&(l=!0),l&&"\\"!==s||i.push(a)):(i.push(a),l&&"\\"!==s&&i.push("\\"))}return i.join("")}function Oe(e){for(var t=!1,r=[],n=-1;n<e.length;n++){var i=e.charAt(n)||"",o=e.charAt(n+1)||"";At[i+o]?(r.push(At[i+o]),n++):t?(r.push(i),t=!1):"\\"===i?(t=!0,m(o)||"$"===o?r.push("$"):"/"!==o&&"\\"!==o&&r.push("\\")):("$"===i&&r.push("$"),r.push(i),"/"===o&&r.push("\\"))}return r.join("")}function ze(t){for(var r=new e.StringStream(t),n=[];!r.eol();){for(;r.peek()&&"\\"!=r.peek();)n.push(r.next());var i=!1;for(var o in Et)if(r.match(o,!0)){i=!0,n.push(Et[o]);break}i||n.push(r.next())}return n.join("")}function Ie(e,t,r){var n=kt.registerController.getRegister("/");if(n.setText(e),e instanceof RegExp)return e;var i,o,a=Ae(e);if(a.length){i=e.substring(0,a[0]);var s=e.substring(a[0]);o=s.indexOf("i")!=-1}else i=e;if(!i)return null;x("pcre")||(i=Ee(i)),r&&(t=/^[^A-Z]*$/.test(i));var l=new RegExp(i,t||o?"i":void 0);return l}function Ne(e,t){e.openNotification?e.openNotification('<span style="color: red">'+t+"</span>",{bottom:!0,duration:5e3}):alert(t)}function qe(e,t){var r='<span style="font-family: monospace; white-space: pre">'+(e||"")+'<input type="text"></span>';return t&&(r+=' <span style="color: #888">'+t+"</span>"),r}function Pe(e,t){var r=(t.prefix||"")+" "+(t.desc||""),n=qe(t.prefix,t.desc);Le(e,n,r,t.onClose,t)}function Re(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n<r.length;n++){var i=r[n];if(e[i]!==t[i])return!1}return!0}return!1}function je(e,t,r,n){if(t){var i=Me(e),o=Ie(t,!!r,!!n);if(o)return Be(e,o),Re(o,i.getQuery())?o:(i.setQuery(o),o)}}function De(e){if("^"==e.source.charAt(0))var t=!0;return{token:function(r){if(t&&!r.sol())return void r.skipToEnd();var n=r.match(e,!1);if(n)return 0==n[0].length?(r.next(),"searching"):r.sol()||(r.backUp(1),e.exec(r.next()+n[0]))?(r.match(e),"searching"):(r.next(),null);for(;!r.eol()&&(r.next(),!r.match(e,!1)););},query:e}}function Be(e,t){var r=Me(e),n=r.getOverlay();n&&t==n.query||(n&&e.removeOverlay(n),n=De(t),e.addOverlay(n),e.showMatchesOnScrollbar&&(r.getScrollbarAnnotate()&&r.getScrollbarAnnotate().clear(),r.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),r.setOverlay(n))}function Fe(e,t,r,i){return void 0===i&&(i=1),e.operation(function(){for(var o=e.getCursor(),a=e.getSearchCursor(r,o),s=0;s<i;s++){var l=a.find(t);if(0==s&&l&&$(a.from(),o)&&(l=a.find(t)),!l&&(a=e.getSearchCursor(r,t?n(e.lastLine()):n(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function We(e){var t=Me(e);e.removeOverlay(Me(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function He(e,t,r){return"number"!=typeof e&&(e=e.line),t instanceof Array?y(e,t):r?e>=t&&e<=r:e==t}function $e(e){var t=e.getScrollInfo(),r=6,n=10,i=e.coordsChar({left:0,top:r+t.top},"local"),o=t.clientHeight-n+t.top,a=e.coordsChar({left:0,top:o},"local");return{top:i.line,bottom:a.line}}function Ue(t,r,n,i,o,a,s,l,c){function u(){t.operation(function(){for(;!m;)f(),d();p()})}function f(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function d(){for(;a.findNext()&&He(a.from(),i,o);)if(n||!g||a.from().line!=g.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),g=a.from(),void(m=!1);m=!0}function p(e){if(e&&e(),t.focus(),g){t.setCursor(g);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=g.ch}c&&c()}function h(r,n,i){e.e_stop(r);var o=e.keyName(r);switch(o){case"Y":f(),d();break;case"N":d();break;case"A":var a=c;c=void 0,t.operation(u),c=a;break;case"L":f();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":p(i)}return m&&p(i),!0}t.state.vim.exMode=!0;var m=!1,g=a.from();return d(),m?void Ne(t,"No matches for "+s.source):r?void Pe(t,{prefix:"replace with <strong>"+l+"</strong> (y/n/a/q/l)",onKeyDown:h}):(u(),void(c&&c()))}function Ke(t){var r=t.state.vim,n=kt.macroModeState,i=kt.registerController.getRegister("."),o=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!o){for(var l=a.inVisualBlock?r.lastSelection.visualBlock.height:1,c=a.changes,s=[],u=0;u<c.length;)s.push(c[u]),c[u]instanceof nt?u++:u+=l;a.changes=s,t.off("change",Je),e.off(t.getInputField(),"keydown",it)}!o&&r.insertModeRepeat>1&&(ot(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),i.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&Ye(n)}function Ve(e){t.unshift(e)}function Ge(e,t,r,n,i){var o={keys:e,type:t};o[t]=r,o[t+"Args"]=n;for(var a in i)o[a]=i[a];Ve(o)}function Xe(t,r,n,i){var o=kt.registerController.getRegister(i);if(":"==i)return o.keyBuffer[0]&&Nt.processCommand(t,o.keyBuffer[0]),void(n.isPlaying=!1);var a=o.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=o.searchQueries.slice(0);for(var l=0;l<a.length;l++)for(var c,u,f=a[l];f;)if(c=/<\w+-.+?>|<\w+>|./.exec(f),u=c[0],f=f.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var d=o.insertModeChanges[s++].changes;kt.macroModeState.lastInsertModeChanges.changes=d,at(t,d,1),Ke(t)}n.isPlaying=!1}function Ze(e,t){if(!e.isPlaying){var r=e.latestRegister,n=kt.registerController.getRegister(r);n&&n.pushText(t)}}function Ye(e){if(!e.isPlaying){var t=e.latestRegister,r=kt.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function Qe(e,t){if(!e.isPlaying){var r=e.latestRegister,n=kt.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}function Je(e,t){var r=kt.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var i=t.text.join("\n");n.changes.push(i)}t=t.next}}function et(e){var t=e.state.vim;if(t.insertMode){var r=kt.macroModeState;if(r.isPlaying)return;var n=r.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.changes=[]}else e.curOp.isVimOp||rt(e,t);t.visualMode&&tt(e)}function tt(e){var t=e.state.vim,r=q(e,H(t.sel.head)),n=R(r,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(r,n,{className:"cm-animate-fat-cursor"})}function rt(t,r){var n=t.getCursor("anchor"),i=t.getCursor("head");if(r.visualMode&&!t.somethingSelected()?le(t,!1):r.visualMode||r.insertMode||!t.somethingSelected()||(r.visualMode=!0,r.visualLine=!1,e.signal(t,"vim-mode-change",{mode:"visual"})),r.visualMode){var o=U(i,n)?0:-1,a=U(i,n)?-1:0;i=R(i,0,o),n=R(n,0,a),r.sel={anchor:n,head:i},ke(t,r,"<",K(i,n)),ke(t,r,">",V(i,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}function nt(e){this.keyName=e}function it(t){function r(){return i.changes.push(new nt(o)),!0}var n=kt.macroModeState,i=n.lastInsertModeChanges,o=e.keyName(t);o&&(o.indexOf("Delete")==-1&&o.indexOf("Backspace")==-1||e.lookupKey(o,"vim-insert",r))}function ot(e,t,r,n){function i(){s?_t.processAction(e,t,t.lastEditActionCommand):_t.evalInput(e,t)}function o(r){if(a.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=a.lastInsertModeChanges;at(e,n.changes,r)}}var a=kt.macroModeState;a.isPlaying=!0;var s=!!t.lastEditActionCommand,l=t.inputState;if(t.inputState=t.lastEditInputState,s&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c<r;c++)i(),o(1);else n||i(),o(r);t.inputState=l,t.insertMode&&!n&&Ke(e),a.isPlaying=!1}function at(t,r,n){function i(r){return"string"==typeof r?e.commands[r](t):r(t),!0}var o=t.getCursor("head"),a=kt.macroModeState.lastInsertModeChanges.inVisualBlock;if(a){var s=t.state.vim,l=s.lastSelection,c=j(l.anchor,l.head);ee(t,o,c.line+1),n=t.listSelections().length,t.setCursor(o)}for(var u=0;u<n;u++){a&&t.setCursor(R(o,u,0));for(var f=0;f<r.length;f++){var d=r[f];if(d instanceof nt)e.lookupKey(d.keyName,"vim-insert",i);else{var p=t.getCursor();t.replaceRange(d,p,p)}}}a&&t.setCursor(R(o,0,1))}e.defineOption("vimMode",!1,function(t,r,n){r&&"vim"!=t.getOption("keyMap")?t.setOption("keyMap","vim"):!r&&n!=e.Init&&/^vim/.test(t.getOption("keyMap"))&&t.setOption("keyMap","default")});var st={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},lt={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},ct=/[\d]/,ut=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],ft=[function(e){return/\S/.test(e)}],dt=f(65,26),pt=f(97,26),ht=f(48,10),mt=[].concat(dt,pt,ht,["<",">"]),gt=[].concat(dt,pt,ht,["-",'"',".",":","/"]),vt={};b("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e){var r=t.getOption("mode");return"null"==r?"":r}var r=""==e?"null":e;t.setOption("mode",r)}});var yt=function(){function e(e,t,s){function l(t){var i=++n%r,o=a[i];o&&o.clear(),a[i]=e.setBookmark(t)}var c=n%r,u=a[c];if(u){var f=u.find();f&&!$(f,t)&&l(t)}else l(t);l(s),i=n,o=n-r+1,o<0&&(o=0)}function t(e,t){n+=t,n>i?n=i:n<o&&(n=o);var s=a[(r+n)%r];if(s&&!s.find()){var l,c=t>0?1:-1,u=e.getCursor();do if(n+=c,s=a[(r+n)%r],s&&(l=s.find())&&!$(u,l))break;while(n<i&&n>o)}return s}var r=100,n=-1,i=0,o=0,a=new Array(r);return{cachedCursor:void 0,add:e,move:t}},bt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var e=kt.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=kt.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var kt,xt,wt={buildKeyMap:function(){},getRegisterController:function(){return kt.registerController},resetVimGlobalState_:C,getVimGlobalState_:function(){return kt},maybeInitVimState_:_,suppressErrorLogging:!1,InsertModeKey:nt,map:function(e,t,r){Nt.map(e,t,r)},unmap:function(e,t){Nt.unmap(e,t)},setOption:k,getOption:x,defineOption:b,defineEx:function(e,t,r){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;It[e]=r,Nt.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if("function"==typeof n)return n()},findKey:function(r,n,i){function o(){var e=kt.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),M(r),!0;"mapping"!=i&&Ze(e,n)}}function a(){if("<Esc>"==n)return M(r),f.visualMode?le(r):f.insertMode&&Ke(r),!0}function s(t){for(var i;t;)i=/<\w+-.+?>|<\w+>|./.exec(t),n=i[0],t=t.substring(i.index+n.length),e.Vim.handleKey(r,n,"mapping")}function l(){if(a())return!0;for(var e=f.inputState.keyBuffer=f.inputState.keyBuffer+n,i=1==n.length,o=_t.matchCommand(e,t,f.inputState,"insert");e.length>1&&"full"!=o.type;){var e=f.inputState.keyBuffer=e.slice(1),s=_t.matchCommand(e,t,f.inputState,"insert");"none"!=s.type&&(o=s)}if("none"==o.type)return M(r),!1;if("partial"==o.type)return xt&&window.clearTimeout(xt),xt=window.setTimeout(function(){f.insertMode&&f.inputState.keyBuffer&&M(r)},x("insertModeEscKeysTimeout")),!i;if(xt&&window.clearTimeout(xt),i){var l=r.getCursor();r.replaceRange("",R(l,0,-(e.length-1)),l,"+input")}return M(r),o.command}function c(){if(o()||a())return!0;var e=f.inputState.keyBuffer=f.inputState.keyBuffer+n;if(/^[1-9]\d*$/.test(e))return!0;var i=/^(\d*)(.*)$/.exec(e);if(!i)return M(r),!1;var s=f.visualMode?"visual":"normal",l=_t.matchCommand(i[2]||i[1],t,f.inputState,s);if("none"==l.type)return M(r),!1;if("partial"==l.type)return!0;f.inputState.keyBuffer="";var i=/^(\d*)(.*)$/.exec(e);return i[1]&&"0"!=i[1]&&f.inputState.pushRepeatDigit(i[1]),l.command}var u,f=_(r);return u=f.insertMode?l():c(),u===!1?void 0:u===!0?function(){}:function(){return r.operation(function(){r.curOp.isVimOp=!0;try{"keyToKey"==u.type?s(u.toKeys):_t.processCommand(r,f,u)}catch(t){throw r.state.vim=void 0,_(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Nt.processCommand(e,t)},defineMotion:O,defineAction:N,defineOperator:I,mapCommand:Ge,_mapCommand:Ve,defineRegister:T,exitVisualMode:le,exitInsertMode:Ke};S.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},S.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},L.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(bt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},A.prototype={pushText:function(e,t,r,n,i){n&&"\n"==r.charAt(0)&&(r=r.slice(1)+"\n"),n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new L(r,n,i);break;case"delete":case"change":r.indexOf("\n")==-1?this.registers["-"]=new L(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new L(r,n))}return void this.unnamedRegister.setText(r,n,i)}var a=g(e);a?o.pushText(r,n):o.setText(r,n,i),this.unnamedRegister.setText(o.toString(),n)},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new L),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&y(e,gt)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},E.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var i=this.iterator+n;t?i>=0:i<r.length;i+=n)for(var o=r[i],a=0;a<=o.length;a++)if(this.initialPrefix==o.substring(0,a))return this.iterator=i,o;return i>=r.length?(this.iterator=r.length,this.initialPrefix):i<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var _t={matchCommand:function(e,t,r,n){var i=D(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o,a=0;a<i.full.length;a++){var s=i.full[a];o||(o=s)}return"<character>"==o.keys.slice(-11)&&(r.selectedCharacter=F(e)),{type:"full",command:o}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=P(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);M(e)}n.operator=r.operator,n.operatorArgs=P(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,i=P(r.operatorMotionArgs);i&&n&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,i=n.getRepeat(),o=!!i,a=P(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=n.registerName,M(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),Mt[r.action](e,a,t)},processSearch:function(t,r,n){function i(e,i,o){kt.searchHistoryController.pushInput(e),kt.searchHistoryController.reset();try{je(t,e,i,o)}catch(a){return Ne(t,"Invalid regex: "+e),void M(t)}_t.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}function o(e){t.scrollTo(d.left,d.top),i(e,!0,!0);var r=kt.macroModeState;r.isRecording&&Qe(r,e)}function a(r,n,i){var o,a=e.keyName(r);"Up"==a||"Down"==a?(o="Up"==a,n=kt.searchHistoryController.nextMatch(n,o)||"",i(n)):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.searchHistoryController.reset();var s;try{s=je(t,n,!0,!0)}catch(r){}s?t.scrollIntoView(Fe(t,!l,s),30):(We(t),t.scrollTo(d.left,d.top))}function s(r,n,i){var o=e.keyName(r);"Esc"==o||"Ctrl-C"==o||"Ctrl-["==o||"Backspace"==o&&""==n?(kt.searchHistoryController.pushInput(n),kt.searchHistoryController.reset(),je(t,f),We(t),t.scrollTo(d.left,d.top),e.e_stop(r),M(t),i(),t.focus()):"Ctrl-U"==o&&(e.e_stop(r),i(""))}if(t.getSearchCursor){var l=n.searchArgs.forward,c=n.searchArgs.wholeWordOnly;Me(t).setReversed(!l);var u=l?"/":"?",f=Me(t).getQuery(),d=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var p=kt.macroModeState;if(p.isPlaying){var h=p.replaySearchQueries.shift();i(h,!0,!1)}else Pe(t,{onClose:o,prefix:u,desc:Ot,onKeyUp:a,onKeyDown:s});break;case"wordUnderCursor":var m=de(t,!1,!0,!1,!0),g=!0;if(m||(m=de(t,!1,!0,!1,!1),g=!1),!m)return;var h=t.getLine(m.start.line).substring(m.start.ch,m.end.ch);h=g&&c?"\\b"+h+"\\b":Y(h),kt.jumpList.cachedCursor=t.getCursor(),t.setCursor(m.start),i(h,!0,!1)}}},processEx:function(t,r,n){function i(e){kt.exCommandHistoryController.pushInput(e),kt.exCommandHistoryController.reset(),Nt.processCommand(t,e)}function o(r,n,i){var o,a=e.keyName(r);("Esc"==a||"Ctrl-C"==a||"Ctrl-["==a||"Backspace"==a&&""==n)&&(kt.exCommandHistoryController.pushInput(n),kt.exCommandHistoryController.reset(),e.e_stop(r),M(t),i(),t.focus()),"Up"==a||"Down"==a?(o="Up"==a,n=kt.exCommandHistoryController.nextMatch(n,o)||"",i(n)):"Ctrl-U"==a?(e.e_stop(r),i("")):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.exCommandHistoryController.reset()}"keyToEx"==n.type?Nt.processCommand(t,n.exArgs.input):r.visualMode?Pe(t,{onClose:i,prefix:":",value:"'<,'>",onKeyDown:o}):Pe(t,{onClose:i,prefix:":",onKeyDown:o})},evalInput:function(e,t){var r,i,o,a=t.inputState,s=a.motion,l=a.motionArgs||{},c=a.operator,u=a.operatorArgs||{},f=a.registerName,d=t.sel,p=H(t.visualMode?q(e,d.head):e.getCursor("head")),h=H(t.visualMode?q(e,d.anchor):e.getCursor("anchor")),m=H(p),g=H(h);if(c&&this.recordLastEdit(t,a),o=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat(),o>0&&l.explicitRepeat?l.repeatIsExplicit=!0:(l.noRepeat||!l.explicitRepeat&&0===o)&&(o=1,l.repeatIsExplicit=!1),a.selectedCharacter&&(l.selectedCharacter=u.selectedCharacter=a.selectedCharacter),l.repeat=o,M(e),s){var v=Ct[s](e,p,l,t);if(t.lastMotion=Ct[s],!v)return;if(l.toJumplist){var y=kt.jumpList,b=y.cachedCursor;b?(pe(e,b,v),delete y.cachedCursor):pe(e,p,v)}v instanceof Array?(i=v[0],r=v[1]):r=v,r||(r=H(p)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=q(e,r,t.visualBlock)),i&&(i=q(e,i,!0)),i=i||g,d.anchor=i,d.head=r,oe(e),ke(e,t,"<",U(i,r)?i:r),ke(e,t,">",U(i,r)?r:i)):c||(r=q(e,r),e.setCursor(r.line,r.ch))}if(c){if(u.lastSel){i=g;var k=u.lastSel,x=Math.abs(k.head.line-k.anchor.line),w=Math.abs(k.head.ch-k.anchor.ch);r=k.visualLine?n(g.line+x,g.ch):k.visualBlock?n(g.line+x,g.ch+w):k.head.line==k.anchor.line?n(g.line,g.ch+w):n(g.line+x,g.ch),t.visualMode=!0,t.visualLine=k.visualLine,t.visualBlock=k.visualBlock,d=t.sel={anchor:i,head:r},oe(e)}else t.visualMode&&(u.lastSel={anchor:H(d.anchor),head:H(d.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var _,C,S,L,T;if(t.visualMode){if(_=K(d.head,d.anchor),C=V(d.head,d.anchor),S=t.visualLine||u.linewise,L=t.visualBlock?"block":S?"line":"char",T=ae(e,{anchor:_,head:C},L),S){var A=T.ranges;if("block"==L)for(var E=0;E<A.length;E++)A[E].head.ch=X(e,A[E].head.line);else"line"==L&&(A[0].head=n(A[0].head.line+1,0))}}else{if(_=H(i||g),C=H(r||m),U(C,_)){var O=_;_=C,C=O}S=l.linewise||u.linewise,S?ue(e,_,C):l.forward&&ce(e,_,C),L="char";var z=!l.inclusive||S;T=ae(e,{anchor:_,head:C},L,z)}e.setSelections(T.ranges,T.primary),t.lastMotion=null,u.repeat=o,u.registerName=f,u.linewise=S;var I=St[c](e,u,T.ranges,g,r);t.visualMode&&le(e,null!=I),I&&e.setCursor(I)}},recordLastEdit:function(e,t,r){var n=kt.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1)}},Ct={moveToTopLine:function(e,t,r){var i=$e(e).top+r.repeat-1;return n(i,fe(e.getLine(i)))},moveToMiddleLine:function(e){var t=$e(e),r=Math.floor(.5*(t.top+t.bottom));return n(r,fe(e.getLine(r)))},moveToBottomLine:function(e,t,r){var i=$e(e).bottom-r.repeat+1;return n(i,fe(e.getLine(i)))},expandToLine:function(e,t,r){var i=t;return n(i.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=Me(e),i=n.getQuery();if(i){var o=!r.forward;return o=n.isReversed()?!o:o,Be(e,i),Fe(e,o,i,r.repeat)}},goToMark:function(e,t,r,n){var i=n.marks[r.selectedCharacter];if(i){var o=i.find();return r.linewise?{line:o.line,ch:fe(e.getLine(o.line))}:o}return null},moveToOtherHighlightedEnd:function(e,t,r,i){if(i.visualBlock&&r.sameLine){var o=i.sel;return[q(e,n(o.anchor.line,o.head.ch)),q(e,n(o.head.line,o.anchor.ch))]}return[i.sel.head,i.sel.anchor]},jumpToMark:function(e,t,r,i){for(var o=t,a=0;a<r.repeat;a++){var s=o;for(var l in i.marks)if(p(l)){var c=i.marks[l].find(),u=r.forward?U(c,s):U(s,c);if(!(u||r.linewise&&c.line==s.line)){var f=$(s,o),d=r.forward?G(s,c,o):G(o,c,s);(f||d)&&(o=c)}}}return r.linewise&&(o=n(o.line,fe(e.getLine(o.line)))),o},moveByCharacters:function(e,t,r){var i=t,o=r.repeat,a=r.forward?i.ch+o:i.ch-o;return n(i.line,a)},moveByLines:function(e,t,r,i){var o=t,a=o.ch;switch(i.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:a=i.lastHPos;break;default:i.lastHPos=a}var s=r.repeat+(r.repeatOffset||0),l=r.forward?o.line+s:o.line-s,c=e.firstLine(),u=e.lastLine();return l<c&&o.line==c?this.moveToStartOfLine(e,t,r,i):l>u&&o.line==u?this.moveToEol(e,t,r,i):(r.toFirstChar&&(a=fe(e.getLine(l)),i.lastHPos=a),i.lastHSPos=e.charCoords(n(l,a),"div").left,n(l,a))},moveByDisplayLines:function(e,t,r,i){var o=t;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 a=r.repeat,s=e.findPosV(o,r.forward?a:-a,"line",i.lastHSPos);if(s.hitSide)if(r.forward)var l=e.charCoords(s,"div"),c={top:l.top+8,left:i.lastHSPos},s=e.coordsChar(c,"div");else{var u=e.charCoords(n(e.firstLine(),0),"div");u.left=i.lastHSPos,s=e.coordsChar(u,"div")}return i.lastHPos=s.ch,s},moveByPage:function(e,t,r){var n=t,i=r.repeat;return e.findPosV(n,r.forward?i:-i,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return we(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var i=e.getScrollInfo(),o=null,a=r.repeat;a||(a=i.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");r.repeat=a;var o=Ct.moveByDisplayLines(e,t,r,n);if(!o)return null;var l=e.charCoords(o,"local");return e.scrollTo(null,i.top+l.top-s.top),o},moveByWords:function(e,t,r){return ve(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,i=ye(e,n,r.forward,r.selectedCharacter),o=r.forward?-1:1;return he(o,r),i?(i.ch+=o,i):null},moveToCharacter:function(e,t,r){var n=r.repeat;return he(0,r),ye(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return me(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var i=r.repeat;return n.lastHPos=i-1,n.lastHSPos=e.charCoords(t,"div").left,be(e,i)},moveToEol:function(e,t,r,i){var o=t;i.lastHPos=1/0;var a=n(o.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,i.lastHSPos=e.charCoords(s,"div").left,a},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return n(r.line,fe(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){var r,i=t,o=i.line,a=i.ch,s=e.getLine(o);do if(r=s.charAt(a++),r&&h(r)){var l=e.getTokenTypeAt(n(o,a));if("string"!==l&&"comment"!==l)break}while(r);if(r){var c=e.findMatchingBracket(n(o,a));return c.to}return i},moveToStartOfLine:function(e,t){return n(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var i=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(i=r.repeat-e.getOption("firstLineNumber")),n(i,fe(e.getLine(i)))},textObjectManipulation:function(e,t,r,n){var i={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},o={"'":!0,'"':!0},a=r.selectedCharacter;"b"==a?a="(":"B"==a&&(a="{");var s,l=!r.textObjectInner;if(i[a])s=_e(e,t,a,l);else if(o[a])s=Ce(e,t,a,l);else if("W"===a)s=de(e,l,!0,!0);else if("w"===a)s=de(e,l,!0,!1);else{if("p"!==a)return null;if(s=we(e,t,r.repeat,0,l),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var c=n.inputState.operatorArgs;c&&(c.linewise=!0),s.end.line--}}return e.state.vim.visualMode?ie(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,r){var n=kt.lastCharacterSearch,i=r.repeat,o=r.forward===n.forward,a=(n.increment?1:0)*(o?-1:1);e.moveH(-a,"char"),r.inclusive=!!o;var s=ye(e,i,o,n.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}},St={change:function(t,r,i){var o,a,s=t.state.vim;if(kt.macroModeState.lastInsertModeChanges.inVisualBlock=s.visualBlock,s.visualMode){a=t.getSelection();var l=z("",i.length);t.replaceSelections(l),o=K(i[0].head,i[0].anchor)}else{var c=i[0].anchor,u=i[0].head;a=t.getRange(c,u);var f=s.lastEditInputState||{};if("moveByWords"==f.motion&&!v(a)){var d=/\s+$/.exec(a);d&&f.motionArgs&&f.motionArgs.forward&&(u=R(u,0,-d[0].length),a=a.slice(0,-d[0].length))}var p=new n(c.line-1,Number.MAX_VALUE),h=t.firstLine()==t.lastLine();u.line>t.lastLine()&&r.linewise&&!h?t.replaceRange("",p,u):t.replaceRange("",c,u),r.linewise&&(h||(t.setCursor(p),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),o=c}kt.registerController.pushText(r.registerName,"change",a,r.linewise,i.length>1),Mt.enterInsertMode(t,{head:o},t.state.vim)},"delete":function(e,t,r){var i,o,a=e.state.vim;if(a.visualBlock){o=e.getSelection();var s=z("",r.length);e.replaceSelections(s),i=r[0].anchor}else{var l=r[0].anchor,c=r[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=n(l.line-1,X(e,l.line-1))),o=e.getRange(l,c),e.replaceRange("",l,c),i=l,t.linewise&&(i=Ct.moveToFirstNonWhiteSpaceCharacter(e,l))}return kt.registerController.pushText(t.registerName,"delete",o,t.linewise,a.visualBlock),q(e,i)},indent:function(e,t,r){var n=e.state.vim,i=r[0].anchor.line,o=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&o--;for(var s=i;s<=o;s++)for(var l=0;l<a;l++)e.indentLine(s,t.indentRight);return Ct.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,i){for(var o=e.getSelections(),a=[],s=t.toLower,l=0;l<o.length;l++){var c=o[l],u="";if(s===!0)u=c.toLowerCase();else if(s===!1)u=c.toUpperCase();else for(var f=0;f<c.length;f++){var d=c.charAt(f);u+=g(d)?d.toLowerCase():d.toUpperCase()}a.push(u)}return e.replaceSelections(a),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&r[0].anchor.line+1==r[0].head.line?Ct.moveToFirstNonWhiteSpaceCharacter(e,n):t.linewise?n:K(r[0].anchor,r[0].head)},yank:function(e,t,r,n){var i=e.state.vim,o=e.getSelection(),a=i.visualMode?K(i.sel.anchor,i.sel.head,r[0].head,r[0].anchor):n;return kt.registerController.pushText(t.registerName,"yank",o,t.linewise,i.visualBlock),a}},Mt={jumpListWalk:function(e,t,r){if(!r.visualMode){var n=t.repeat,i=t.forward,o=kt.jumpList,a=o.move(e,i?n:-n),s=a?a.find():void 0;s=s?s:e.getCursor(),e.setCursor(s)}},scroll:function(e,t,r){if(!r.visualMode){var n=t.repeat||1,i=e.defaultTextHeight(),o=e.getScrollInfo().top,a=i*n,s=t.forward?o+a:o-a,l=H(e.getCursor()),c=e.charCoords(l,"local");if(t.forward)s>c.top?(l.line+=(s-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,s);else{var u=s+e.getScrollInfo().clientHeight;u<c.bottom?(l.line-=(c.bottom-u)/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,s)}}},scrollToCursor:function(e,t){var r=e.getCursor().line,i=e.charCoords(n(r,0),"local"),o=e.getScrollInfo().clientHeight,a=i.top,s=i.bottom-a;switch(t.position){case"center":a=a-o/2+s;break;case"bottom":a=a-o+s}e.scrollTo(null,a)},replayMacro:function(e,t,r){var n=t.selectedCharacter,i=t.repeat,o=kt.macroModeState;for("@"==n&&(n=o.latestRegister);i--;)Xe(e,r,o,n)},enterMacroRecordMode:function(e,t){var r=kt.macroModeState,n=t.selectedCharacter;r.enterMacroRecordMode(e,n)},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(t,r,i){if(!t.getOption("readOnly")){i.insertMode=!0,i.insertModeRepeat=r&&r.repeat||1;var o=r?r.insertAt:null,a=i.sel,s=r.head||t.getCursor("head"),l=t.listSelections().length;if("eol"==o)s=n(s.line,X(t,s.line));else if("charAfter"==o)s=R(s,0,1);else if("firstNonBlank"==o)s=Ct.moveToFirstNonWhiteSpaceCharacter(t,s);else if("startOfSelectedArea"==o)i.visualBlock?(s=n(Math.min(a.head.line,a.anchor.line),Math.min(a.head.ch,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line<a.anchor.line?a.head:n(a.anchor.line,0);else if("endOfSelectedArea"==o)i.visualBlock?(s=n(Math.min(a.head.line,a.anchor.line),Math.max(a.head.ch+1,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line>=a.anchor.line?R(a.head,0,1):n(a.anchor.line,0);else if("inplace"==o&&i.visualMode)return;t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),kt.macroModeState.isPlaying||(t.on("change",Je),e.on(t.getInputField(),"keydown",it)),i.visualMode&&le(t),ee(t,s,l)}},toggleVisualMode:function(t,r,i){var o,a=r.repeat,s=t.getCursor();i.visualMode?i.visualLine^r.linewise||i.visualBlock^r.blockwise?(i.visualLine=!!r.linewise,i.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t)):le(t):(i.visualMode=!0,i.visualLine=!!r.linewise,i.visualBlock=!!r.blockwise,o=q(t,n(s.line,s.ch+a-1),!0),i.sel={anchor:s,head:o},e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t),ke(t,i,"<",K(s,o)),ke(t,i,">",V(s,o)))},reselectLastSelection:function(t,r,n){var i=n.lastSelection;if(n.visualMode&&ne(t,n),i){var o=i.anchorMark.find(),a=i.headMark.find();if(!o||!a)return;n.sel={anchor:o,head:a},n.visualMode=!0,n.visualLine=i.visualLine,n.visualBlock=i.visualBlock,oe(t),ke(t,n,"<",K(o,a)),ke(t,n,">",V(o,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var i,o;if(r.visualMode){if(i=e.getCursor("anchor"), -o=e.getCursor("head"),U(o,i)){var a=o;o=i,i=a}o.ch=X(e,o.line)-1}else{var s=Math.max(t.repeat,2);i=e.getCursor(),o=q(e,n(i.line+s-1,1/0))}for(var l=0,c=i.line;c<o.line;c++){l=X(e,i.line);var a=n(i.line+1,X(e,i.line+1)),u=e.getRange(i,a);u=u.replace(/\n\s*/g," "),e.replaceRange(u,i,a)}var f=n(i.line,l);r.visualMode&&le(e,!1),e.setCursor(f)},newLineAndEnterInsertMode:function(t,r,i){i.insertMode=!0;var o=H(t.getCursor());if(o.line!==t.firstLine()||r.after){o.line=r.after?o.line:o.line-1,o.ch=X(t,o.line),t.setCursor(o);var a=e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent;a(t)}else t.replaceRange("\n",n(t.firstLine(),0)),t.setCursor(t.firstLine(),0);this.enterInsertMode(t,{repeat:r.repeat},i)},paste:function(e,t,r){var i=H(e.getCursor()),o=kt.registerController.getRegister(t.registerName),a=o.toString();if(a){if(t.matchIndent){var s=e.getOption("tabSize"),l=function(e){var t=e.split("\t").length-1,r=e.split(" ").length-1;return t*s+1*r},c=e.getLine(e.getCursor().line),u=l(c.match(/^\s*/)[0]),f=a.replace(/\n$/,""),d=a!==f,p=l(a.match(/^\s*/)[0]),a=f.replace(/^\s*/gm,function(t){var r=u+(l(t)-p);if(r<0)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/s);return Array(n+1).join("\t")}return Array(r+1).join(" ")});a+=d?"\n":""}if(t.repeat>1)var a=Array(t.repeat+1).join(a);var h=o.linewise,m=o.blockwise;if(h)r.visualMode?a=r.visualLine?a.slice(0,-1):"\n"+a.slice(0,a.length-1)+"\n":t.after?(a="\n"+a.slice(0,a.length-1),i.ch=X(e,i.line)):i.ch=0;else{if(m){a=a.split("\n");for(var g=0;g<a.length;g++)a[g]=""==a[g]?" ":a[g]}i.ch+=t.after?1:0}var v,y;if(r.visualMode){r.lastPastedText=a;var b,k=re(e,r),x=k[0],w=k[1],_=e.getSelection(),C=e.listSelections(),S=new Array(C.length).join("1").split("1");r.lastSelection&&(b=r.lastSelection.headMark.find()),kt.registerController.unnamedRegister.setText(_),m?(e.replaceSelections(S),w=n(x.line+a.length-1,x.ch),e.setCursor(x),J(e,w),e.replaceSelections(a),v=x):r.visualBlock?(e.replaceSelections(S),e.setCursor(x),e.replaceRange(a,x,x),v=x):(e.replaceRange(a,x,w),v=e.posFromIndex(e.indexFromPos(x)+a.length-1)),b&&(r.lastSelection.headMark=e.setBookmark(b)),h&&(v.ch=0)}else if(m){e.setCursor(i);for(var g=0;g<a.length;g++){var M=i.line+g;M>e.lastLine()&&e.replaceRange("\n",n(M,0));var L=X(e,M);L<i.ch&&Q(e,M,i.ch)}e.setCursor(i),J(e,n(i.line+a.length-1,i.ch)),e.replaceSelections(a),v=i}else e.replaceRange(a,i),h&&t.after?v=n(i.line+1,fe(e.getLine(i.line+1))):h&&!t.after?v=n(i.line,fe(e.getLine(i.line))):!h&&t.after?(y=e.indexFromPos(i),v=e.posFromIndex(y+a.length-1)):(y=e.indexFromPos(i),v=e.posFromIndex(y+a.length));r.visualMode&&le(e,!1),e.setCursor(v)}},undo:function(t,r){t.operation(function(){W(t,e.commands.undo,r.repeat)(),t.setCursor(t.getCursor("anchor"))})},redo:function(t,r){W(t,e.commands.redo,r.repeat)()},setRegister:function(e,t,r){r.inputState.registerName=t.selectedCharacter},setMark:function(e,t,r){var n=t.selectedCharacter;ke(e,r,n,e.getCursor())},replace:function(t,r,i){var o,a,s=r.selectedCharacter,l=t.getCursor(),c=t.listSelections();if(i.visualMode)l=t.getCursor("start"),a=t.getCursor("end");else{var u=t.getLine(l.line);o=l.ch+r.repeat,o>u.length&&(o=u.length),a=n(l.line,o)}if("\n"==s)i.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var f=t.getRange(l,a);if(f=f.replace(/[^\n]/g,s),i.visualBlock){var d=new Array(t.getOption("tabSize")+1).join(" ");f=t.getSelection(),f=f.replace(/\t/g,d).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(f)}else t.replaceRange(f,l,a);i.visualMode?(l=U(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),le(t,!1)):t.setCursor(R(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,i,o,a,s,l=e.getCursor(),c=e.getLine(l.line),u=/-?\d+/g;null!==(r=u.exec(c))&&(s=r[0],i=r.index,o=i+s.length,!(l.ch<o)););if((t.backtrack||!(o<=l.ch))&&s){var f=t.increase?1:-1,d=parseInt(s)+f*t.repeat,p=n(l.line,i),h=n(l.line,o);a=d.toString(),e.replaceRange(a,p,h),e.setCursor(n(l.line,i+a.length-1))}},repeatLastEdit:function(e,t,r){var n=r.lastEditInputState;if(n){var i=t.repeat;i&&t.repeatIsExplicit?r.lastEditInputState.repeatOverride=i:i=r.lastEditInputState.repeatOverride||i,ot(e,r,i,!1)}},exitInsertMode:Ke},Lt={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Tt={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}}};b("pcre",!0,"boolean"),Se.prototype={getQuery:function(){return kt.query},setQuery:function(e){kt.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return kt.isReversed},setReversed:function(e){kt.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var At={"\\n":"\n","\\r":"\r","\\t":"\t"},Et={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},Ot="(Javascript regexp)",zt=function(){this.buildCommandMap_()};zt.prototype={processCommand:function(e,t,r){var n=this;e.operation(function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)})},_processCommand:function(t,r,n){var i=t.state.vim,o=kt.registerController.getRegister(":"),a=o.toString();i.visualMode&&le(t);var s=new e.StringStream(r);o.setText(r);var l=n||{};l.input=r;try{this.parseInput_(t,s,l)}catch(c){throw Ne(t,c),c}var u,f;if(l.commandName){if(u=this.matchCommand_(l.commandName)){if(f=u.name,u.excludeFromCommandHistory&&o.setText(a),this.parseCommandArgs_(s,l,u),"exToKey"==u.type){for(var d=0;d<u.toKeys.length;d++)e.Vim.handleKey(t,u.toKeys[d],"mapping");return}if("exToEx"==u.type)return void this.processCommand(t,u.toInput)}}else void 0!==l.line&&(f="move");if(!f)return void Ne(t,'Not an editor command ":'+r+'"');try{It[f](t,l),u&&u.possiblyAsync||!l.callback||l.callback()}catch(c){throw Ne(t,c),c}},parseInput_:function(e,t,r){t.eatWhile(":"),t.eat("%")?(r.line=e.firstLine(),r.lineEnd=e.lastLine()):(r.line=this.parseLineSpec_(e,t),void 0!==r.line&&t.eat(",")&&(r.lineEnd=this.parseLineSpec_(e,t)));var n=t.match(/^(\w+)/);return n?r.commandName=n[1]:r.commandName=t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return e.getCursor().line;case"$":return e.lastLine();case"'":var n=e.state.vim.marks[t.next()];if(n&&n.find())return n.find().line;throw new Error("Mark not set");default:return void t.backUp(1)}},parseCommandArgs_:function(e,t,r){if(!e.eol()){t.argString=e.match(/.*/)[0];var n=r.argDelimiter||/\s+/,i=Z(t.argString).split(n);i.length&&i[0]&&(t.args=i)}},matchCommand_:function(e){for(var t=e.length;t>0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e<r.length;e++){var t=r[e],n=t.shortName||t.name;this.commandMap_[n]=t}},map:function(e,r,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var i=e.substring(1);":"!=r&&":"==r.charAt(0)?this.commandMap_[i]={name:i,type:"exToEx",toInput:r.substring(1),user:!0}:this.commandMap_[i]={name:i,type:"exToKey",toKeys:r,user:!0}}else if(":"!=r&&":"==r.charAt(0)){var o={keys:e,type:"keyToEx",exArgs:{input:r.substring(1)},user:!0};n&&(o.context=n),t.unshift(o)}else{var o={keys:e,type:"keyToKey",toKeys:r,user:!0};n&&(o.context=n),t.unshift(o)}},unmap:function(e,r){if(":"!=e&&":"==e.charAt(0)){if(r)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return void delete this.commandMap_[n]}else for(var i=e,o=0;o<t.length;o++)if(i==t[o].keys&&t[o].context===r&&t[o].user)return void t.splice(o,1);throw Error("No such mapping.")}};var It={colorscheme:function(e,t){return!t.args||t.args.length<1?void Ne(e,e.getOption("theme")):void e.setOption("theme",t.args[0])},map:function(e,t,r){var n=t.args;return!n||n.length<2?void(e&&Ne(e,"Invalid mapping: "+t.input)):void Nt.map(n[0],n[1],r)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,r){var n=t.args;return!n||n.length<1?void(e&&Ne(e,"No such mapping: "+t.input)):void Nt.unmap(n[0],r)},move:function(e,t){_t.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var r=t.args,n=t.setCfg||{};if(!r||r.length<1)return void(e&&Ne(e,"Invalid mapping: "+t.input));var i=r[0].split("="),o=i[0],a=i[1],s=!1;if("?"==o.charAt(o.length-1)){if(a)throw Error("Trailing characters: "+t.argString);o=o.substring(0,o.length-1),s=!0}void 0===a&&"no"==o.substring(0,2)&&(o=o.substring(2),a=!1);var l=vt[o]&&"boolean"==vt[o].type;if(l&&void 0==a&&(a=!0),!l&&void 0===a||s){var c=x(o,e,n);c===!0||c===!1?Ne(e," "+(c?"":"no")+o):Ne(e," "+o+"="+c)}else k(o,a,e,n)},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var r=t.args,n=kt.registerController.registers,i="----------Registers----------<br><br>";if(r){var o;r=r.join("");for(var a=0;a<r.length;a++)if(o=r.charAt(a),kt.registerController.isValidRegister(o)){var s=n[o]||new L;i+='"'+o+" "+s.toString()+"<br>"}}else for(var o in n){var l=n[o].toString();l.length&&(i+='"'+o+" "+l+"<br>")}Ne(e,i)},sort:function(t,r){function i(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(a=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/[a-z]+/);if(n){n=n[0],s=n.indexOf("i")!=-1,l=n.indexOf("u")!=-1;var i=n.indexOf("d")!=-1&&1,o=n.indexOf("x")!=-1&&1,u=n.indexOf("o")!=-1&&1;if(i+o+u>1)return"Invalid arguments";c=i&&"decimal"||o&&"hex"||u&&"octal"}if(t.match(/\/.*\//))return"patterns not supported"}}function o(e,t){if(a){var r;r=e,e=t,t=r}s&&(e=e.toLowerCase(),t=t.toLowerCase());var n=c&&g.exec(e),i=c&&g.exec(t);return n?(n=parseInt((n[1]+n[2]).toLowerCase(),v),i=parseInt((i[1]+i[2]).toLowerCase(),v),n-i):e<t?-1:1}var a,s,l,c,u=i();if(u)return void Ne(t,u+": "+r.argString);var f=r.line||t.firstLine(),d=r.lineEnd||r.line||t.lastLine();if(f!=d){var p=n(f,0),h=n(d,X(t,d)),m=t.getRange(p,h).split("\n"),g="decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,v="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,y=[],b=[];if(c)for(var k=0;k<m.length;k++)g.exec(m[k])?y.push(m[k]):b.push(m[k]);else b=m;if(y.sort(o),b.sort(o),m=a?y.concat(b):b.concat(y),l){var x,w=m;m=[];for(var k=0;k<w.length;k++)w[k]!=x&&m.push(w[k]),x=w[k]}t.replaceRange(m.join("\n"),p,h)}},global:function(e,t){var r=t.argString;if(!r)return void Ne(e,"Regular Expression missing from global");var n,i=void 0!==t.line?t.line:e.firstLine(),o=t.lineEnd||t.line||e.lastLine(),a=Te(r),s=r;if(a.length&&(s=a[0],n=a.slice(1,a.length).join("/")),s)try{je(e,s,!0,!0)}catch(l){return void Ne(e,"Invalid regex: "+s)}for(var c=Me(e).getQuery(),u=[],f="",d=i;d<=o;d++){var p=c.test(e.getLine(d));p&&(u.push(d+1),f+=e.getLine(d)+"<br>")}if(!n)return void Ne(e,f);var h=0,m=function(){if(h<u.length){var t=u[h]+n;Nt.processCommand(e,t,{callback:m})}h++};m()},substitute:function(e,t){if(!e.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var r,i,o,a,s=t.argString,l=s?Te(s):[],c="",u=!1,f=!1;if(l.length)r=l[0],c=l[1],void 0!==c&&(c=x("pcre")?ze(c):Oe(c),kt.lastSubstituteReplacePart=c),i=l[2]?l[2].split(" "):[];else if(s&&s.length)return void Ne(e,"Substitutions should be of the form :s/pattern/replace/");if(i&&(o=i[0],a=parseInt(i[1]),o&&(o.indexOf("c")!=-1&&(u=!0,o.replace("c","")),o.indexOf("g")!=-1&&(f=!0,o.replace("g","")),r=r+"/"+o)),r)try{je(e,r,!0,!0)}catch(d){return void Ne(e,"Invalid regex: "+r)}if(c=c||kt.lastSubstituteReplacePart,void 0===c)return void Ne(e,"No previous substitute regular expression");var p=Me(e),h=p.getQuery(),m=void 0!==t.line?t.line:e.getCursor().line,g=t.lineEnd||m;m==e.firstLine()&&g==e.lastLine()&&(g=1/0),a&&(m=g,g=m+a-1);var v=q(e,n(m,0)),y=e.getSearchCursor(h,v);Ue(e,u,f,m,g,y,h,c,t.callback)},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){We(e)},yank:function(e){var t=H(e.getCursor()),r=t.line,n=e.getLine(r);kt.registerController.pushText("0","yank",n,!0,!0)},delmarks:function(t,r){if(!r.argString||!Z(r.argString))return void Ne(t,"Argument required");for(var n=t.state.vim,i=new e.StringStream(Z(r.argString));!i.eol();){i.eatSpace();var o=i.pos;if(!i.match(/[a-zA-Z]/,!1))return void Ne(t,"Invalid argument: "+r.argString.substring(o));var a=i.next();if(i.match("-",!0)){if(!i.match(/[a-zA-Z]/,!1))return void Ne(t,"Invalid argument: "+r.argString.substring(o));var s=a,l=i.next();if(!(p(s)&&p(l)||g(s)&&g(l)))return void Ne(t,"Invalid argument: "+s+"-");var c=s.charCodeAt(0),u=l.charCodeAt(0);if(c>=u)return void Ne(t,"Invalid argument: "+r.argString.substring(o));for(var f=0;f<=u-c;f++){var d=String.fromCharCode(c+f);delete n.marks[d]}}else delete n.marks[a]}}},Nt=new zt;return e.keyMap.vim={attach:s,detach:a,call:l},b("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={fallthrough:["default"],attach:s,detach:a,call:l},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:s,detach:a,call:l},C(),wt};e.Vim=i()});
\ No newline at end of file +!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(n,r){if(!(this instanceof e))return new e(n,r);this.options=r=r?Di(r):{},Di(na,r,!1),p(r);var i=r.value;"string"==typeof i&&(i=new Ma(i,r.mode,null,r.lineSeparator)),this.doc=i;var o=new e.inputStyles[r.inputStyle](this),a=this.display=new t(n,i,o);a.wrapper.CodeMirror=this,c(this),s(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!zo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Oi,keySeq:null,specialChars:null};var l=this;xo&&wo<11&&setTimeout(function(){l.display.input.reset(!0)},20),$t(this),Yi(),wt(this),this.curOp.forceUpdate=!0,Qr(this,i),r.autofocus&&!zo||l.hasFocus()?setTimeout(Wi(bn,this),20):kn(this);for(var u in ra)ra.hasOwnProperty(u)&&ra[u](this,r[u],ia);w(this),r.finishInit&&r.finishInit(this);for(var f=0;f<la.length;++f)la[f](this);Ct(this),_o&&r.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,n){var r=this;this.input=n,r.scrollbarFiller=$i("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=$i("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=$i("div",null,"CodeMirror-code"),r.selectionDiv=$i("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=$i("div",null,"CodeMirror-cursors"),r.measure=$i("div",null,"CodeMirror-measure"),r.lineMeasure=$i("div",null,"CodeMirror-measure"),r.lineSpace=$i("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=$i("div",[$i("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=$i("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=$i("div",null,null,"position: absolute; height: "+Ra+"px; width: 1px;"),r.gutters=$i("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=$i("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=$i("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),xo&&wo<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),_o||yo&&zo||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,We(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(es(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ja(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Rt(e),ct(e),setTimeout(function(){y(e)},100)}function o(e){var t=kt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/xt(e.display)-3);return function(i){if(Cr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function a(e){var t=e.doc,n=o(e);t.iter(function(e){var t=n(e);t!=e.height&&ni(e,t)})}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ct(e)}function l(e){c(e),Rt(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,n=e.options.gutters;Ui(t);for(var r=0;r<n.length;++r){var i=n[r],o=t.appendChild($i("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function f(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=vr(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=yr(r);){var i=t.find(0,!0);n-=r.text.length-i.from.ch,r=i.to.line,n+=r.text.length-i.to.ch}return n}function d(e){var t=e.display,n=e.doc;t.maxLine=Jr(n,n.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=f(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function p(e){var t=qi(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ue(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=$i("div",[$i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=$i("div",[$i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Oa(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,xo&&wo<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ja(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Oa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?sn(t,e):an(t,e)},t),t.display.scrollbars.addClass&&es(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&z(e),b(e,h(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function k(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-$e(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ii(t,r),a=ii(t,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;s<o?(o=s,a=ii(t,oi(Jr(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ii(t,oi(Jr(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&n[a].gutter&&(n[a].gutter.style.left=o);var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function w(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=_(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild($i("div",[$i("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",u(e),!0}return!1}function _(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function C(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function S(e,t,n){var r=e.display;this.viewport=t,this.visible=k(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ge(e),this.force=n,this.dims=I(e),this.events=[]}function M(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ve(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ve(e)+"px",t.scrollbarsClipped=!0)}function L(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Dt(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Ht(e))return!1;w(e)&&(Dt(e),t.dims=I(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Do&&(o=wr(e.doc,o),a=_r(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ft(e,o,a),n.viewOffset=oi(Jr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=Ht(e);if(!s&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Vi();return l>4&&(n.lineDiv.style.display="none"),N(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&Vi()!=c&&c.offsetHeight&&c.focus(),Ui(n.cursorDiv),Ui(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,We(e,400)),n.updateLineNumbers=null,!0}function T(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Ge(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ue(e.display)-Xe(e),n.top)}),t.visible=k(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&L(e,t);r=!1){z(e);var i=h(e);qe(e),y(e,i),E(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var n=new S(e,t);if(L(e,n)){z(e),T(e,n);var r=h(e);qe(e),y(e,r),E(e,r),n.finish()}}function E(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ve(e)+"px"}function z(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i,o=t.view[r];if(!o.hidden){if(xo&&wo<8){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(i<2&&(i=kt(t)),(l>.001||l<-.001)&&(ni(o.line,i),O(o.line),o.rest))for(var c=0;c<o.rest.length;c++)O(o.rest[c])}}}function O(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function I(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:C(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function N(e,t,n){function r(t){var n=t.nextSibling;return _o&&Oo&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,s=a.firstChild,l=i.view,c=i.viewFrom,u=0;u<l.length;u++){var f=l[u];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;s!=f.node;)s=r(s);var d=o&&null!=t&&t<=c&&f.lineNumber;f.changes&&(qi(f.changes,"gutter")>-1&&(d=!1),q(e,f,c,n)),d&&(Ui(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(_(e.options,c)))),s=f.node.nextSibling}else{var p=H(e,f,c,n);a.insertBefore(p,s)}c+=f.size}for(;s;)s=r(s)}function q(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?D(e,t):"gutter"==o?B(e,t,n,r):"class"==o?W(t):"widget"==o&&F(e,t,r)}t.changes=null}function P(e){return e.node==e.text&&(e.node=$i("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),xo&&wo<8&&(e.node.style.zIndex=2)),e.node}function R(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=P(e);e.background=n.insertBefore($i("div",null,t),n.firstChild)}}function j(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Wr(e,t)}function D(e,t){var n=t.text.className,r=j(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,W(t)):n&&(t.text.className=n)}function W(e){R(e),e.line.wrapClass?P(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function B(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=P(t);t.gutterBackground=$i("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=P(t),a=t.gutter=$i("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild($i("div",_(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.options.gutters.length;++s){var l=e.options.gutters[s],c=o.hasOwnProperty(l)&&o[l];c&&a.appendChild($i("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function F(e,t,n){t.alignable&&(t.alignable=null);for(var r,i=t.node.firstChild;i;i=r){var r=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}U(e,t,n)}function H(e,t,n,r){var i=j(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),W(t),B(e,t,n,r),U(e,t,r),t.node}function U(e,t,n){if(K(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)K(e,t.rest[r],t,n,!1)}function K(e,t,n,r,i){if(t.widgets)for(var o=P(n),a=0,s=t.widgets;a<s.length;++a){var l=s[a],c=$i("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),V(l,c,n,r),e.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),Mi(l,"redraw")}}function V(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function G(e){return Wo(e.line,e.ch)}function X(e,t){return Bo(e,t)<0?t:e}function Z(e,t){return Bo(e,t)<0?e:t}function Y(e){e.state.focused||(e.display.input.focus(),bn(e))}function Q(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var a=e.state.pasteIncoming||"paste"==i,s=o.splitLines(t),l=null;if(a&&r.ranges.length>1)if(Fo&&Fo.text.join("\n")==t){if(r.ranges.length%Fo.text.length==0){l=[];for(var c=0;c<Fo.text.length;c++)l.push(o.splitLines(Fo.text[c]))}}else s.length==r.ranges.length&&(l=Pi(s,function(e){return[e]}));for(var c=r.ranges.length-1;c>=0;c--){var u=r.ranges[c],f=u.from(),d=u.to();u.empty()&&(n&&n>0?f=Wo(f.line,f.ch-n):e.state.overwrite&&!a?d=Wo(d.line,Math.min(Jr(o,d.line).text.length,d.ch+Ni(s).length)):Fo&&Fo.lineWise&&Fo.text.join("\n")==t&&(f=d=Wo(f.line,0)));var p=e.curOp.updateInput,h={from:f,to:d,text:l?l[c%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Tn(e.doc,h),Mi(e,"inputRead",e,h)}t&&!a&&ee(e,t),Wn(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var n=e.clipboardData&&e.clipboardData.getData("text/plain");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||zt(t,function(){Q(t,n,0,null,"paste")}),!0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){a=Fn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Jr(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fn(e,i.head.line,"smart"));a&&Mi(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:Wo(i,0),head:Wo(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function ne(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Oi,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ie(){var e=$i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=$i("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return _o?e.style.width="1000px":e.setAttribute("wrap","off"),Eo&&(e.style.border="1px solid black"),ne(e),t}function oe(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Oi,this.gracePeriod=!1}function ae(e,t){var n=et(e,t.line);if(!n||n.hidden)return null;var r=Jr(e.doc,t.line),i=Ye(n,r,t.line),o=ai(r),a="left";if(o){var s=fo(o,t.ch);a=s%2?"right":"left"}var l=rt(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function se(e,t){return t&&(e.bad=!0),e}function le(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return se(e.clipPos(Wo(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return ce(o,t,n)}}function ce(e,t,n){function r(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?c.map:u[i],a=0;a<o.length;a+=3){var s=o[a+2];if(s==t||s==n){var l=ri(i<0?e.line:e.rest[i]),f=o[a]+r;return(r<0||s!=t)&&(f=o[a+(r?1:0)]),Wo(l,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Za(i,t))return se(Wo(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?Ni(e.rest):e.line;return se(Wo(ri(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,n&&(n=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var c=e.measure,u=c.maps,f=r(s,l,n);if(f)return se(f,o);for(var d=l.nextSibling,p=s?s.nodeValue.length-n:0;d;d=d.nextSibling){if(f=r(d,d.firstChild,0))return se(Wo(f.line,f.ch-p),o);p+=d.textContent.length}for(var h=l.previousSibling,p=n;h;h=h.previousSibling){if(f=r(h,h.firstChild,-1))return se(Wo(f.line,f.ch+p),o);p+=d.textContent.length}}function ue(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(s+=n);var u,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(Wo(r,0),Wo(i+1,0),o(+f));return void(d.length&&(u=d[0].find())&&(s+=ei(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p<t.childNodes.length;p++)a(t.childNodes[p]);/^(pre|div|p)$/i.test(t.nodeName)&&(l=!0)}else if(3==t.nodeType){var h=t.nodeValue;if(!h)return;l&&(s+=c,l=!1),s+=h}}for(var s="",l=!1,c=e.doc.lineSeparator();a(t),t!=n;)t=t.nextSibling;return s}function fe(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function pe(e,t){var n=e[t];e.sort(function(e,t){return Bo(e.from(),t.from())}),t=qi(e,n);for(var r=1;r<e.length;r++){var i=e[r],o=e[r-1];if(Bo(o.to(),i.from())>=0){var a=Z(o.from(),i.from()),s=X(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new de(l?s:a,l?a:s))}}return new fe(e,t)}function he(e,t){return new fe([new de(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Wo(e.first,0);var n=e.first+e.size-1;return t.line>n?Wo(n,Jr(e,n).text.length):ve(t,Jr(e,t.line).text.length)}function ve(e,t){var n=e.ch;return null==n||n>t?Wo(e.line,t):n<0?Wo(e.line,0):e}function ye(e,t){return t>=e.first&&t<e.first+e.size}function be(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ge(e,t[r]);return n}function ke(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=Bo(n,i)<0;o!=Bo(r,i)<0?(i=n,n=r):o!=Bo(n,r)<0&&(n=r)}return new de(i,n)}return new de(r||n,n)}function xe(e,t,n,r){Le(e,new fe([ke(e,e.sel.primary(),t,n)],0),r)}function we(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=ke(e,e.sel.ranges[i],t[i],null);var o=pe(r,e.sel.primIndex);Le(e,o,n)}function _e(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Le(e,pe(i,e.sel.primIndex),r)}function Ce(e,t,n,r){Le(e,he(t,n),r)}function Se(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new de(ge(e,t[n].anchor),ge(e,t[n].head))},origin:n&&n.origin};return qa(e,"beforeSelectionChange",e,r),e.cm&&qa(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?pe(r.ranges,r.ranges.length-1):t}function Me(e,t,n){var r=e.history.done,i=Ni(r);i&&i.ranges?(r[r.length-1]=t,Te(e,t,n)):Le(e,t,n)}function Le(e,t,n){Te(e,t,n),pi(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Te(e,t,n){(Ei(e,"beforeSelectionChange")||e.cm&&Ei(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,n));var r=n&&n.bias||(Bo(t.primary().head,e.sel.primary().head)<0?-1:1);Ae(e,ze(e,t,r,!0)),n&&n.scroll===!1||!e.cm||Wn(e.cm)}function Ae(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ai(e.cm)),Mi(e,"cursorActivity",e))}function Ee(e){Ae(e,ze(e,e.sel,null,!1),Da)}function ze(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],l=Ie(e,a.anchor,s&&s.anchor,n,r),c=Ie(e,a.head,s&&s.head,n,r);(i||l!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(l,c))}return i?pe(i,t.primIndex):t}function Oe(e,t,n,r,i){var o=Jr(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker;if((null==s.from||(l.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(l.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(qa(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var c,u=l.find(r<0?1:-1);if((r<0?l.inclusiveRight:l.inclusiveLeft)&&(u=Ne(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=Bo(u,n))&&(r<0?c<0:c>0))return Oe(e,u,t,r,i)}var f=l.find(r<0?-1:1);return(r<0?l.inclusiveLeft:l.inclusiveRight)&&(f=Ne(e,f,r,f.line==t.line?o:null)),f?Oe(e,f,t,r,i):null}}return t}function Ie(e,t,n,r,i){var o=r||1,a=Oe(e,t,n,o,i)||!i&&Oe(e,t,n,o,!0)||Oe(e,t,n,-o,i)||!i&&Oe(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,Wo(e.first,0))}function Ne(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?ge(e,Wo(t.line-1)):null:n>0&&t.ch==(r||Jr(e,t.line)).text.length?t.line<e.first+e.size-1?Wo(t.line+1,0):null:new Wo(t.line,t.ch+n)}function qe(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Pe(e,t){for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t!==!1||a!=n.sel.primIndex){var s=n.sel.ranges[a],l=s.empty();(l||e.options.showCursorWhenSelecting)&&Re(e,s.head,i),l||je(e,s,o)}return r}function Re(e,t,n){var r=mt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild($i("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild($i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}$(".other-cursor").each(function(t,n){var r=parseInt($(n).attr("data-line")),i=parseInt($(n).attr("data-ch")),o=parseFloat($(n).attr("data-offset-left")),a=parseFloat($(n).attr("data-offset-top")),s=e.charCoords({line:r,ch:i},"windows");$(n)[0].style.left=s.left+o+"px",$(n)[0].style.top=s.top+a+"px"})}function je(e,t,n){function r(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),s.appendChild($i("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?u-e:n)+"px; height: "+(r-t)+"px"))}function i(t,n,i){function o(n,r){return ht(e,Wo(t,n),"div",f,r)}var s,l,f=Jr(a,t),d=f.text.length;return no(ai(f),n||0,null==i?d:i,function(e,t,a){var f,p,h,m=o(e,"left");if(e==t)f=m,p=h=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}p=m.left,h=f.right}null==n&&0==e&&(p=c),f.top-m.top>3&&(r(p,m.top,null,m.bottom),p=c,m.bottom<f.top&&r(p,m.bottom,null,f.top)),null==i&&t==d&&(h=u),(!s||m.top<s.top||m.top==s.top&&m.left<s.left)&&(s=m),(!l||f.bottom>l.bottom||f.bottom==l.bottom&&f.right>l.right)&&(l=f),p<c+1&&(p=c),r(p,f.top,h-p,f.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ke(e.display),c=l.left,u=Math.max(o.sizerWidth,Ge(e)-o.sizer.offsetLeft)-l.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var p=Jr(a,f.line),h=Jr(a,d.line),m=kr(p)==kr(h),g=i(f.line,f.ch,m?p.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top<v.top-2?(r(g.right,g.top,null,g.bottom),r(c,v.top,v.left,v.bottom)):r(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&r(c,g.bottom,null,v.top)}n.appendChild(s)}function De(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function We(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Wi(Be,e))}function Be(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ua(t.mode,He(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=Pr(e,o,s?ua(t.mode,r):r,!0);o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!f&&d<a.length;++d)f=a[d]!=o.styles[d];f&&i.push(t.frontier),o.stateAfter=s?r:ua(t.mode,r)}else o.text.length<=e.options.maxHighlightLength&&jr(e,o.text,r),o.stateAfter=t.frontier%5==0?ua(t.mode,r):null;if(++t.frontier,+new Date>n)return We(e,e.options.workDelay),!0}),i.length&&zt(e,function(){for(var t=0;t<i.length;t++)jt(e,i[t],"text")})}}function Fe(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>a;--s){if(s<=o.first)return o.first;var l=Jr(o,s-1);if(l.stateAfter&&(!n||s<=o.frontier))return s;var c=Fa(l.text,null,e.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function He(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=Fe(e,t,n),a=o>r.first&&Jr(r,o-1).stateAfter;return a=a?ua(r.mode,a):fa(r.mode),r.iter(o,t,function(n){jr(e,n.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;n.stateAfter=s?ua(r.mode,a):null,++o}),n&&(r.frontier=o),a}function $e(e){return e.lineSpace.offsetTop}function Ue(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ke(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ki(e.measure,$i("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Ve(e){return Ra-e.display.nativeBarWidth}function Ge(e){return e.display.scroller.clientWidth-Ve(e)-e.display.barWidth}function Xe(e){return e.display.scroller.clientHeight-Ve(e)-e.display.barHeight}function Ze(e,t,n){var r=e.options.lineWrapping,i=r&&Ge(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],c=a[s+1];Math.abs(l.bottom-c.bottom)>2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ye(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var r=0;r<e.rest.length;r++)if(ri(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Qe(e,t){t=kr(t);var n=ri(t),r=e.display.externalMeasured=new qt(e.doc,t,n);r.lineN=n;var i=r.built=Wr(e,r);return r.text=i.pre,Ki(e.display.lineMeasure,i.pre),r}function Je(e,t,n,r){return nt(e,tt(e,t),n,r)}function et(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Wt(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function tt(e,t){var n=ri(t),r=et(e,n);r&&!r.text?r=null:r&&r.changes&&(q(e,r,n,I(e)),e.curOp.forceUpdate=!0),r||(r=Qe(e,t));var i=Ye(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function nt(e,t,n,r,i){t.before&&(n=-1);var o,a=n+(r||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ze(e,t.view,t.rect),t.hasHeights=!0), +o=ot(e,t,n,r),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,n){for(var r,i,o,a,s=0;s<e.length;s+=3){var l=e[s],c=e[s+1];if(t<l?(i=0,o=1,a="left"):t<c?(i=t-l,o=i+1):(s==e.length-3||t==c&&e[s+3]>t)&&(o=c-l,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[s+2],l==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)r=e[(s-=3)+2],a="left";if("right"==n&&i==c-l)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)r=e[(s+=3)+2],a="right";break}}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:c}}function it(e,t){var n=Ko;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var r=e.length-1;r>=0&&(n=e[r]).left==n.right;r--);return n}function ot(e,t,n,r){var i,o=rt(t.map,n,r),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;s&&Hi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&Hi(t.line.text.charAt(o.coverStart+l));)++l;if(i=xo&&wo<9&&0==s&&l==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():it(Ka(a,s,l).getClientRects(),r),i.left||i.right||0==s)break;l=s,s-=1,c="right"}xo&&wo<11&&(i=at(e.display.measure,i))}else{s>0&&(c=r="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(xo&&wo<9&&!s&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+xt(e.display),top:d.top,bottom:d.bottom}:Ko}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);var v=u?g[u-1]:0,y=g[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=p,b.rbottom=h),b}function at(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!to(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function st(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lt(e){e.display.externalMeasure=null,Ui(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)st(e.display.view[t])}function ct(e){lt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ut(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ft(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dt(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Lr(t.widgets[i]);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=oi(t);if("local"==r?a+=$e(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var s=e.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:ft());var l=s.left+("window"==r?0:ut());n.left+=l,n.right+=l}return n.top+=a,n.bottom+=a,n}function pt(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=ut(),i-=ft();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function ht(e,t,n,r,i){return r||(r=Jr(e.doc,t.line)),dt(e,r,Je(e,r,t.ch,i),n)}function mt(e,t,n,r,i,o){function a(t,a){var s=nt(e,i,t,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,dt(e,r,s,n)}function s(e,t){var n=l[t],r=n.level%2;return e==ro(n)&&t&&n.level<l[t-1].level?(n=l[--t],e=io(n)-(n.level%2?0:1),r=!0):e==io(n)&&t<l.length-1&&n.level<l[t+1].level&&(n=l[++t],e=ro(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||Jr(e.doc,t.line),i||(i=tt(e,r));var l=ai(r),c=t.ch;if(!l)return a(c);var u=fo(l,c),f=s(c,u);return null!=ls&&(f.other=s(c,ls)),f}function gt(e,t){var n=0,t=ge(e.doc,t);e.options.lineWrapping||(n=xt(e.display)*t.ch);var r=Jr(e.doc,t.line),i=oi(r)+$e(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function vt(e,t,n,r){var i=Wo(e,t);return i.xRel=r,n&&(i.outside=!0),i}function yt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return vt(r.first,0,!0,-1);var i=ii(r,n),o=r.first+r.size-1;if(i>o)return vt(r.first+r.size-1,Jr(r,o).text.length,!0,1);t<0&&(t=0);for(var a=Jr(r,i);;){var s=bt(e,a,i,t,n),l=yr(a),c=l&&l.find(0,!0);if(!l||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=ri(a=c.to.line)}}function bt(e,t,n,r,i){function o(r){var i=mt(e,Wo(n,r),"line",t,c);return s=!0,a>i.bottom?i.left-l:a<i.top?i.left+l:(s=!1,i.left)}var a=i-oi(t),s=!1,l=2*e.display.wrapper.clientWidth,c=tt(e,t),u=ai(t),f=t.text.length,d=oo(t),p=ao(t),h=o(d),m=s,g=o(p),v=s;if(r>g)return vt(n,p,v,1);for(;;){if(u?p==d||p==ho(t,d,1):p-d<=1){var y=r<h||r-h<=g-r?d:p,b=y==d?m:v,k=r-(y==d?h:g);if(v&&!u&&!/\s/.test(t.text.charAt(y))&&k>0&&y<t.text.length&&c.view.measure.heights.length>1){var x=nt(e,c,y,"right");a<=x.bottom&&a>=x.top&&Math.abs(r-x.right)<k&&(b=!1,y++,k=r-x.right)}for(;Hi(t.text.charAt(y));)++y;var w=vt(n,y,b,k<-1?-1:k>1?1:0);return w}var _=Math.ceil(f/2),C=d+_;if(u){C=d;for(var S=0;S<_;++S)C=ho(t,C,1)}var M=o(C);M>r?(p=C,g=M,(v=s)&&(g+=1e3),f=_):(d=C,h=M,m=s,f-=_)}}function kt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ho){Ho=$i("pre");for(var t=0;t<49;++t)Ho.appendChild(document.createTextNode("x")),Ho.appendChild($i("br"));Ho.appendChild(document.createTextNode("x"))}Ki(e.measure,Ho);var n=Ho.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Ui(e.measure),n||1}function xt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=$i("span","xxxxxxxxxx"),n=$i("pre",[t]);Ki(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function wt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Go},Vo?Vo.ops.push(e.curOp):e.curOp.ownsGroup=Vo={ops:[e.curOp],delayedCallbacks:[]}}function _t(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ct(e){var t=e.curOp,n=t.ownsGroup;if(n)try{_t(n)}finally{Vo=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;St(n)}}function St(e){for(var t=e.ops,n=0;n<t.length;n++)Mt(t[n]);for(var n=0;n<t.length;n++)Lt(t[n]);for(var n=0;n<t.length;n++)Tt(t[n]);for(var n=0;n<t.length;n++)At(t[n]);for(var n=0;n<t.length;n++)Et(t[n])}function Mt(e){var t=e.cm,n=t.display;M(t),e.updateMaxLine&&d(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Lt(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Tt(e){var t=e.cm,n=t.display;e.updatedDisplay&&z(t),e.barMeasure=h(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Je(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection(e.focus))}function At(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&sn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==Vi()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&E(t,e.barMeasure),e.selectionChanged&&De(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Y(e.cm)}function Et(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&T(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null==e.scrollTop||n.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(r.scrollTop=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop)),n.scrollbars.setScrollTop(r.scrollTop),n.scroller.scrollTop=r.scrollTop),null==e.scrollLeft||n.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(r.scrollLeft=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,e.scrollLeft)),n.scrollbars.setScrollLeft(r.scrollLeft),n.scroller.scrollLeft=r.scrollLeft,x(t)),e.scrollToPos){var i=Pn(t,ge(r,e.scrollToPos.from),ge(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&qn(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||qa(o[s],"hide");if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&qa(a[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&qa(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function zt(e,t){if(e.curOp)return t();wt(e);try{return t()}finally{Ct(e)}}function Ot(e,t){return function(){if(e.curOp)return t.apply(e,arguments);wt(e);try{return t.apply(e,arguments)}finally{Ct(e)}}}function It(e){return function(){if(this.curOp)return e.apply(this,arguments);wt(this);try{return e.apply(this,arguments)}finally{Ct(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);wt(t);try{return e.apply(this,arguments)}finally{Ct(t)}}}function qt(e,t,n){this.line=t,this.rest=xr(t),this.size=this.rest?ri(Ni(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Cr(e,t)}function Pt(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new qt(e.doc,Jr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function Rt(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Do&&wr(e.doc,t)<i.viewTo&&Dt(e);else if(n<=i.viewFrom)Do&&_r(e.doc,n+r)>i.viewFrom?Dt(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Dt(e);else if(t<=i.viewFrom){var o=Bt(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Dt(e)}else if(n>=i.viewTo){var o=Bt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Dt(e)}else{var a=Bt(e,t,t,-1),s=Bt(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):Dt(e)}var l=i.externalMeasured;l&&(n<l.lineN?l.lineN+=r:t<l.lineN+l.size&&(i.externalMeasured=null))}function jt(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Wt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);qi(a,n)==-1&&a.push(n)}}}function Dt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Wt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Bt(e,t,n,r){var i,o=Wt(e,t),a=e.display.view;if(!Do||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=0,l=e.display.viewFrom;s<o;s++)l+=a[s].size;if(l!=t){if(r>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;wr(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Ft(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Pt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Pt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Wt(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Pt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Wt(e,n)))),r.viewTo=n}function Ht(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function $t(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function n(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function r(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}var i=e.display;Oa(i.scroller,"mousedown",Ot(e,Xt)),xo&&wo<11?Oa(i.scroller,"dblclick",Ot(e,function(t){if(!Ti(e,t)){var n=Gt(e,t);if(n&&!en(e,t)&&!Vt(e.display,t)){Aa(t);var r=e.findWordAt(n);xe(e.doc,r.anchor,r.head)}}})):Oa(i.scroller,"dblclick",function(t){Ti(e,t)||Aa(t)}),Ro||Oa(i.scroller,"contextmenu",function(t){xn(e,t)});var o,a={end:0};Oa(i.scroller,"touchstart",function(t){if(!Ti(e,t)&&!n(t)){clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Oa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Oa(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Vt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new de(s,s):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(s):new de(Wo(s.line,0),ge(e.doc,Wo(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Aa(n)}t()}),Oa(i.scroller,"touchcancel",t),Oa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(an(e,i.scroller.scrollTop),sn(e,i.scroller.scrollLeft,!0),qa(e,"scroll",e))}),Oa(i.scroller,"mousewheel",function(t){ln(e,t)}),Oa(i.scroller,"DOMMouseScroll",function(t){ln(e,t)}),Oa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ti(e,t)||za(t)},over:function(t){Ti(e,t)||(rn(e,t),za(t))},start:function(t){nn(e,t)},drop:Ot(e,tn),leave:function(t){Ti(e,t)||on(e)}};var s=i.input.getField();Oa(s,"keyup",function(t){gn.call(e,t)}),Oa(s,"keydown",Ot(e,hn)),Oa(s,"keypress",Ot(e,vn)),Oa(s,"focus",Wi(bn,e)),Oa(s,"blur",Wi(kn,e))}function Ut(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?Oa:Na;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Kt(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Vt(e,t){for(var n=_i(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Gt(e,t,n,r){var i=e.display;if(!n&&"true"==_i(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,c=yt(e,o,a);if(r&&1==c.xRel&&(l=Jr(e.doc,c.line).text).length==c.ch){var u=Fa(l,l.length,e.options.tabSize)-l.length;c=Wo(c.line,Math.max(0,Math.round((o-Ke(e.display).left)/xt(e.display))-u))}return c}function Xt(e){var t=this,n=t.display;if(!(Ti(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.shift=e.shiftKey,Vt(n,e))return void(_o||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!en(t,e)){var r=Gt(t,e);switch(window.focus(),Ci(e)){case 1:t.state.selectingText?t.state.selectingText(e):r?Zt(t,e,r):_i(e)==n.scroller&&Aa(e);break;case 2:_o&&(t.state.lastMiddleDown=+new Date),r&&xe(t.doc,r),setTimeout(function(){n.input.focus()},20),Aa(e);break;case 3:Ro?xn(t,e):yn(t)}}}}function Zt(e,t,n){xo?setTimeout(Wi(Y,e),0):e.curOp.focus=Vi();var r,i=+new Date;Uo&&Uo.time>i-400&&0==Bo(Uo.pos,n)?r="triple":$o&&$o.time>i-400&&0==Bo($o.pos,n)?(r="double",Uo={time:i,pos:n}):(r="single",$o={time:i,pos:n});var o,a=e.doc.sel,s=Oo?t.metaKey:t.ctrlKey;e.options.dragDrop&&ns&&!e.isReadOnly()&&"single"==r&&(o=a.contains(n))>-1&&(Bo((o=a.ranges[o]).from(),n)<0||n.xRel>0)&&(Bo(o.to(),n)>0||n.xRel<0)?Yt(e,t,n,s):Qt(e,t,n,r,s)}function Yt(e,t,n,r){var i=e.display,o=+new Date,a=Ot(e,function(s){_o&&(i.scroller.draggable=!1),e.state.draggingText=!1,Na(document,"mouseup",a),Na(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Aa(s),!r&&+new Date-200<o&&xe(e.doc,n),_o||xo&&9==wo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});_o&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=Oo?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),Oa(document,"mouseup",a),Oa(i.scroller,"drop",a)}function Qt(e,t,n,r,i){function o(t){if(0!=Bo(g,t))if(g=t,"rect"==r){for(var i=[],o=e.options.tabSize,a=Fa(Jr(c,n.line).text,n.ch,o),s=Fa(Jr(c,t.line).text,t.ch,o),l=Math.min(a,s),p=Math.max(a,s),h=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));h<=m;h++){var v=Jr(c,h).text,y=Ha(v,l,o);l==p?i.push(new de(Wo(h,y),Wo(h,y))):v.length>y&&i.push(new de(Wo(h,y),Wo(h,Ha(v,p,o))))}i.length||i.push(new de(n,n)),Le(c,pe(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,k=b.anchor,x=t;if("single"!=r){if("double"==r)var w=e.findWordAt(t);else var w=new de(Wo(t.line,0),ge(c,Wo(t.line+1,0)));Bo(w.anchor,k)>0?(x=w.head,k=Z(b.from(),w.anchor)):(x=w.anchor,k=X(b.to(),w.head))}var i=d.ranges.slice(0);i[f]=new de(ge(c,k),x),Le(c,pe(i,f),Wa)}}function a(t){var n=++y,i=Gt(e,t,!0,"rect"==r);if(i)if(0!=Bo(i,g)){e.curOp.focus=Vi(),o(i);var s=k(l,c);(i.line>=s.to||i.line<s.from)&&setTimeout(Ot(e,function(){y==n&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Ot(e,function(){y==n&&(l.scroller.scrollTop+=u,a(t))}),50)}}function s(t){e.state.selectingText=!1,y=1/0,Aa(t),l.input.focus(),Na(document,"mousemove",b),Na(document,"mouseup",x),c.history.lastSelOrigin=null}var l=e.display,c=e.doc;Aa(t);var u,f,d=c.sel,p=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(n),u=f>-1?p[f]:new de(n,n)):(u=c.sel.primary(),f=c.sel.primIndex),Io?t.shiftKey&&t.metaKey:t.altKey)r="rect",i||(u=new de(n,n)),n=Gt(e,t,!0,!0),f=-1;else if("double"==r){var h=e.findWordAt(n);u=e.display.shift||c.extend?ke(c,u,h.anchor,h.head):h}else if("triple"==r){var m=new de(Wo(n.line,0),ge(c,Wo(n.line+1,0)));u=e.display.shift||c.extend?ke(c,u,m.anchor,m.head):m}else u=ke(c,u,n);i?f==-1?(f=p.length,Le(c,pe(p.concat([u]),f),{scroll:!1,origin:"*mouse"})):p.length>1&&p[f].empty()&&"single"==r&&!t.shiftKey?(Le(c,pe(p.slice(0,f).concat(p.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),d=c.sel):_e(c,f,u,Wa):(f=0,Le(c,new fe([u],0),Wa),d=c.sel);var g=n,v=l.wrapper.getBoundingClientRect(),y=0,b=Ot(e,function(e){Ci(e)?a(e):s(e)}),x=Ot(e,s);e.state.selectingText=x,Oa(document,"mousemove",b),Oa(document,"mouseup",x)}function Jt(e,t,n,r){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Aa(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ei(e,n))return wi(t);o-=s.top-a.viewOffset;for(var l=0;l<e.options.gutters.length;++l){var c=a.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=i){var u=ii(e.doc,o),f=e.options.gutters[l];return qa(e,n,e,u,f,t),wi(t)}}}function en(e,t){return Jt(e,t,"gutterClick",!0)}function tn(e){var t=this;if(on(t),!Ti(t,e)&&!Vt(t.display,e)){Aa(e),xo&&(Xo=+new Date);var n=Gt(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,s=function(e,r){if(!t.options.allowDropFileTypes||qi(t.options.allowDropFileTypes,e.type)!=-1){var s=new FileReader;s.onload=Ot(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++a==i){n=ge(t.doc,n);var l={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Tn(t.doc,l),Me(t.doc,he(n,ta(l)))}}),s.readAsText(e)}},l=0;l<i;++l)s(r[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!t.state.draggingText.copy)var c=t.listSelections();if(Te(t.doc,he(n,n)),c)for(var l=0;l<c.length;++l)Nn(t.doc,"",c[l].anchor,c[l].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function nn(e,t){if(xo&&(!e.state.draggingText||+new Date-Xo<100))return void za(t);if(!Ti(e,t)&&!Vt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Lo)){var n=$i("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Mo&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),Mo&&n.parentNode.removeChild(n)}}function rn(e,t){var n=Gt(e,t);if(n){var r=document.createDocumentFragment();Re(e,n,r),e.display.dragCursor||(e.display.dragCursor=$i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ki(e.display.dragCursor,r)}}function on(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function an(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,yo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),yo&&A(e),We(e,100))}function sn(e,t,n){(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ln(e,t){var n=Qo(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&Oo&&_o)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var f=0;f<u.length;f++)if(u[f].node==c){e.display.currentWheelTarget=c;break e}if(r&&!yo&&!Mo&&null!=Yo)return i&&l&&an(e,Math.max(0,Math.min(a.scrollTop+i*Yo,a.scrollHeight-a.clientHeight))),sn(e,Math.max(0,Math.min(a.scrollLeft+r*Yo,a.scrollWidth-a.clientWidth))),(!i||i&&l)&&Aa(t),void(o.wheelStartX=null);if(i&&null!=Yo){var d=i*Yo,p=e.doc.scrollTop,h=p+o.wrapper.clientHeight;d<0?p=Math.max(0,p+d-50):h=Math.min(e.doc.height,h+d+50),A(e,{top:p,bottom:h})}Zo<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Yo=(Yo*Zo+n)/(Zo+1),++Zo)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function cn(e,t,n){if("string"==typeof t&&(t=da[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=ja}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function un(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=ha(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&ha(t,e.options.extraKeys,n,e)||ha(t,e.options.keyMap,n,e)}function fn(e,t,n,r){var i=e.state.keySeq;if(i){if(ma(t))return"handled";Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=un(e,t,r);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Mi(e,"keyHandled",e,t,n),"handled"!=o&&"multi"!=o||(Aa(n),De(e)),i&&!o&&/\'$/.test(t)?(Aa(n),!0):!!o}function dn(e,t){var n=ga(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?fn(e,"Shift-"+n,t,function(t){return cn(e,t,!0)})||fn(e,n,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return cn(e,t)}):fn(e,n,t,function(t){return cn(e,t)}))}function pn(e,t,n){return fn(e,"'"+n+"'",t,function(t){return cn(e,t,!0)})}function hn(e){var t=this;if(t.curOp.focus=Vi(),!Ti(t,e)){xo&&wo<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=dn(t,e);Mo&&(ea=r?n:null,!r&&88==n&&!os&&(Oo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||mn(t)}}function mn(e){function t(e){18!=e.keyCode&&e.altKey||(Ja(n,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t))}var n=e.display.lineDiv;es(n,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t)}function gn(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ti(this,e)}function vn(e){var t=this;if(!(Vt(t.display,e)||Ti(t,e)||e.ctrlKey&&!e.altKey||Oo&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(Mo&&n==ea)return ea=null,void Aa(e);if(!Mo||e.which&&!(e.which<10)||!dn(t,e)){var i=String.fromCharCode(null==r?n:r);pn(t,e,i)||t.display.input.onKeyPress(e)}}}function yn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,kn(e))},100)}function bn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(qa(e,"focus",e),e.state.focused=!0,es(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),_o&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),De(e))}function kn(e){e.state.delayingBlurEvent||(e.state.focused&&(qa(e,"blur",e),e.state.focused=!1,Ja(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function xn(e,t){Vt(e.display,t)||wn(e,t)||Ti(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function wn(e,t){return!!Ei(e,"gutterContextMenu")&&Jt(e,t,"gutterContextMenu",!1)}function _n(e,t){if(Bo(e,t.from)<0)return e;if(Bo(e,t.to)<=0)return ta(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ta(t).ch-t.to.ch),Wo(n,r)}function Cn(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new de(_n(i.anchor,t),_n(i.head,t)))}return pe(n,e.sel.primIndex)}function Sn(e,t,n){return e.line==t.line?Wo(n.line,e.ch-t.ch+n.ch):Wo(n.line+(e.line-t.line),e.ch)}function Mn(e,t,n){for(var r=[],i=Wo(e.first,0),o=i,a=0;a<t.length;a++){var s=t[a],l=Sn(s.from,i,o),c=Sn(ta(s),i,o);if(i=s.to,o=c,"around"==n){var u=e.sel.ranges[a],f=Bo(u.head,u.anchor)<0;r[a]=new de(f?c:l,f?l:c)}else r[a]=new de(l,l)}return new fe(r,e.sel.primIndex)}function Ln(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(r.update=function(t,n,r,i){t&&(this.from=ge(e,t)),n&&(this.to=ge(e,n)),r&&(this.text=r),void 0!==i&&(this.origin=i)}),qa(e,"beforeChange",e,r),e.cm&&qa(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Tn(e,t,n){if(e.cm){if(!e.cm.curOp)return Ot(e.cm,Tn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ei(e,"beforeChange")||e.cm&&Ei(e.cm,"beforeChange"))||(t=Ln(e,t,!0))){var r=jo&&!n&&ur(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)An(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else An(e,t)}}function An(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Bo(t.from,t.to)){var n=Cn(e,t);fi(e,t,n,e.cm?e.cm.curOp.id:NaN),On(e,t,n,sr(e,t));var r=[];Yr(e,function(e,n){n||qi(r,e.history)!=-1||(xi(e.history,t),r.push(e.history)),On(e,t,null,sr(e,t))})}}function En(e,t,n){if(!e.cm||!e.cm.state.suppressEdits||n){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l<a.length&&(r=a[l],n?!r.ranges||r.equals(e.sel):r.ranges);l++);if(l!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;r=a.pop(),r.ranges;){if(hi(r,s),n&&!r.equals(e.sel))return void Le(e,r,{clearRedo:!1});o=r}var c=[];hi(o,s),s.push({changes:c,generation:i.generation}),i.generation=r.generation||++i.maxGeneration;for(var u=Ei(e,"beforeChange")||e.cm&&Ei(e.cm,"beforeChange"),l=r.changes.length-1;l>=0;--l){var f=r.changes[l];if(f.origin=t,u&&!Ln(e,f,!1))return void(a.length=0);c.push(li(e,f));var d=l?Cn(e,f):Ni(a);On(e,f,d,cr(e,f)),!l&&e.cm&&e.cm.scrollIntoView({from:f.from,to:ta(f)});var p=[];Yr(e,function(e,t){t||qi(p,e.history)!=-1||(xi(e.history,f),p.push(e.history)),On(e,f,null,cr(e,f))})}}}}function zn(e,t){if(0!=t&&(e.first+=t,e.sel=new fe(Pi(e.sel.ranges,function(e){return new de(Wo(e.anchor.line+t,e.anchor.ch),Wo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Rt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)jt(e.cm,r,"gutter")}}function On(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ot(e.cm,On)(e,t,n,r);if(t.to.line<e.first)return void zn(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);zn(e,i),t={from:Wo(e.first,0),to:Wo(t.to.line+i,t.to.ch),text:[Ni(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Wo(o,Jr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ei(e,t.from,t.to),n||(n=Cn(e,t)),e.cm?In(e.cm,t,r):Gr(e,t,r),Te(e,n,Da)}}function In(e,t,n){var r=e.doc,i=e.display,a=t.from,s=t.to,l=!1,c=a.line;e.options.lineWrapping||(c=ri(kr(Jr(r,a.line))),r.iter(c,s.line+1,function(e){if(e==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ai(e),Gr(r,t,n,o(e)),e.options.lineWrapping||(r.iter(c,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),We(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?Rt(e):a.line!=s.line||1!=t.text.length||Vr(e.doc,t)?Rt(e,a.line,s.line+1,u):jt(e,a.line,"text");var d=Ei(e,"changes"),p=Ei(e,"change");if(p||d){var h={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};p&&Mi(e,"change",e,h),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Nn(e,t,n,r,i){if(r||(r=n),Bo(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Tn(e,{from:n,to:r,text:t,origin:i})}function qn(e,t){if(!Ti(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Ao){var o=$i("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Pn(e,t,n,r){null==r&&(r=0);for(var i=0;i<5;i++){var o=!1,a=mt(e,t),s=n&&n!=t?mt(e,n):a,l=jn(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-r,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(an(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(sn(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Rn(e,t,n,r,i){var o=jn(e,t,n,r,i);null!=o.scrollTop&&an(e,o.scrollTop),null!=o.scrollLeft&&sn(e,o.scrollLeft)}function jn(e,t,n,r,i){var o=e.display,a=kt(e.display);n<0&&(n=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Xe(e),c={};i-n>l&&(i=n+l);var u=e.doc.height+Ue(o),f=n<a,d=i>u-a;if(n<s)c.scrollTop=f?0:n;else if(i>s+l){var p=Math.min(n,(d?u:i)-l);p!=s&&(c.scrollTop=p); +}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),t<10?c.scrollLeft=0:t<h?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+h-3&&(c.scrollLeft=r+(g?0:10)-m),c}function Dn(e,t,n){null==t&&null==n||Bn(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Wn(e){Bn(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?Wo(t.line,t.ch-1):t,r=Wo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function Bn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=gt(e,t.from),r=gt(e,t.to),i=jn(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=He(e,t):n="prev");var a=e.options.tabSize,s=Jr(o,t),l=Fa(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&(c=o.mode.indent(i,s.text.slice(u.length),s.text),c==ja||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Fa(Jr(o,t-1).text,null,a):0:"add"==n?c=l+e.options.indentUnit:"subtract"==n?c=l-e.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)d+=a,f+="\t";if(d<c&&(f+=Ii(c-d)),f!=u)return Nn(o,f,Wo(t,0),Wo(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var h=o.sel.ranges[p];if(h.head.line==t&&h.head.ch<u.length){var d=Wo(t,u.length);_e(o,p,new de(d,d));break}}}function Hn(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Jr(e,me(e,t)):i=ri(t),null==i?null:(r(o,i)&&e.cm&&jt(e.cm,i,n),o)}function $n(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&Bo(o.from,Ni(r).to)<=0;){var a=r.pop();if(Bo(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}zt(e,function(){for(var t=r.length-1;t>=0;t--)Nn(e.doc,"",r[t].from,r[t].to,"+delete");Wn(e)})}function Un(e,t,n,r,i){function o(){var t=s+n;return!(t<e.first||t>=e.first+e.size)&&(s=t,u=Jr(e,t))}function a(e){var t=(i?ho:mo)(u,l,n,!0);if(null==t){if(e||!o())return!1;l=i?(n<0?ao:oo)(u):n<0?u.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,c=n,u=Jr(e,s);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var f=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(n<0)||a(!h);h=!1){var m=u.text.charAt(l)||"\n",g=Bi(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||h||g||(g="s"),f&&f!=g){n<0&&(n=1,a());break}if(g&&(f=g),n>0&&!a(!h))break}var v=Ie(e,Wo(s,l),t,c,!0);return Bo(t,v)||(v.hitSide=!0),v}function Kn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(s-(n<0?1.5:.5)*kt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var l=yt(e,a,i);if(!l.outside)break;if(n<0?i<=0:i>=o.height){l.hitSide=!0;break}i+=5*n}return l}function Vn(t,n,r,i){e.defaults[t]=n,r&&(ra[t]=i?function(e,t,n){n!=ia&&r(e,t,n)}:r)}function Gn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Xn(e){return"string"==typeof e?pa[e]:e}function Zn(e,t,n,r,i){if(r&&r.shared)return Yn(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ot(e.cm,Zn)(e,t,n,r,i);var o=new ba(e,i),a=Bo(t,n);if(r&&Di(r,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=$i("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(br(e,t.line,t,n,o)||t.line!=n.line&&br(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&fi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var s,l=t.line,c=e.cm;if(e.iter(l,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&kr(e)==c.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&ni(e,0),ir(e,new tr(o,l==t.line?t.ch:null,l==n.line?n.ch:null)),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(t){Cr(e,t)&&ni(t,0)}),o.clearOnEnter&&Oa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(jo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ya,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Rt(c,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=n.line;u++)jt(c,u,"text");o.atomic&&Ee(c.doc),Mi(c,"markerAdded",c,o)}return o}function Yn(e,t,n,r,i){r=Di(r),r.shared=!1;var o=[Zn(e,t,n,r,i)],a=o[0],s=r.widgetNode;return Yr(e,function(e){s&&(r.widgetNode=s.cloneNode(!0)),o.push(Zn(e,ge(e,t),ge(e,n),r,i));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;a=Ni(o)}),new ka(o,a)}function Qn(e){return e.findMarks(Wo(e.first,0),e.clipPos(Wo(e.lastLine())),function(e){return e.parent})}function Jn(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(Bo(o,a)){var s=Zn(e,o,a,r.primary,r.primary.type);r.markers.push(s),s.parent=r}}}function er(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];Yr(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];qi(r,o.doc)==-1&&(o.parent=null,n.markers.splice(i--,1))}}}function tr(e,t,n){this.marker=e,this.from=t,this.to=n}function nr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function rr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ir(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function or(e,t,n){if(e)for(var r,i=0;i<e.length;++i){var o=e[i],a=o.marker,s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new tr(a,o.from,l?null:o.to))}}return r}function ar(e,t,n){if(e)for(var r,i=0;i<e.length;++i){var o=e[i],a=o.marker,s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new tr(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}function sr(e,t){if(t.full)return null;var n=ye(e,t.from.line)&&Jr(e,t.from.line).markedSpans,r=ye(e,t.to.line)&&Jr(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==Bo(t.from,t.to),s=or(n,i,a),l=ar(r,o,a),c=1==t.text.length,u=Ni(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null==d.to){var p=nr(l,d.marker);p?c&&(d.to=null==p.to?null:p.to+u):d.to=i}}if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null!=d.to&&(d.to+=u),null==d.from){var p=nr(s,d.marker);p||(d.from=u,c&&(s||(s=[])).push(d))}else d.from+=u,c&&(s||(s=[])).push(d)}s&&(s=lr(s)),l&&l!=s&&(l=lr(l));var h=[s];if(!c){var m,g=t.text.length-2;if(g>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(m||(m=[])).push(new tr(s[f].marker,null,null));for(var f=0;f<g;++f)h.push(m);h.push(l)}return h}function lr(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function cr(e,t){var n=vi(e,t),r=sr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue e;o.push(l)}else a&&(n[i]=a)}return n}function ur(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&qi(r,n)!=-1||(r||(r=[])).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var c=i[l];if(!(Bo(c.to,s.from)<0||Bo(c.from,s.to)>0)){var u=[l,1],f=Bo(c.from,s.from),d=Bo(c.to,s.to);(f<0||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),l+=u.length-1}}return i}function fr(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function dr(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function pr(e){return e.inclusiveLeft?-1:0}function hr(e){return e.inclusiveRight?1:0}function mr(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=Bo(r.from,i.from)||pr(e)-pr(t);if(o)return-o;var a=Bo(r.to,i.to)||hr(e)-hr(t);return a?a:t.id-e.id}function gr(e,t){var n,r=Do&&e.markedSpans;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||mr(n,i.marker)<0)&&(n=i.marker);return n}function vr(e){return gr(e,!0)}function yr(e){return gr(e,!1)}function br(e,t,n,r,i){var o=Jr(e,t),a=Do&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var c=l.marker.find(0),u=Bo(c.from,n)||pr(l.marker)-pr(i),f=Bo(c.to,r)||hr(l.marker)-hr(i);if(!(u>=0&&f<=0||u<=0&&f>=0)&&(u<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?Bo(c.to,n)>=0:Bo(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?Bo(c.from,r)<=0:Bo(c.from,r)<0)))return!0}}}function kr(e){for(var t;t=vr(e);)e=t.find(-1,!0).line;return e}function xr(e){for(var t,n;t=yr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function wr(e,t){var n=Jr(e,t),r=kr(n);return n==r?t:ri(r)}function _r(e,t){if(t>e.lastLine())return t;var n,r=Jr(e,t);if(!Cr(e,r))return t;for(;n=yr(r);)r=n.find(1,!0).line;return ri(r)+1}function Cr(e,t){var n=Do&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i)if(r=n[i],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&Sr(e,t,r))return!0}}function Sr(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return Sr(e,r.line,nr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Sr(e,t,i))return!0}function Mr(e,t,n){oi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dn(e,null,n)}function Lr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Za(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),Ki(t.display.measure,$i("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Tr(e,t,n,r){var i=new xa(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Hn(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Cr(e,t)){var r=oi(t)<e.scrollTop;ni(t,t.height+Lr(i)),r&&Dn(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Ar(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),fr(e),dr(e,n);var i=r?r(e):1;i!=e.height&&ni(e,i)}function Er(e){e.parent=null,fr(e)}function zr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Or(t,n){if(t.blankLine)return t.blankLine(n);if(t.innerMode){var r=e.innerMode(t,n);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Ir(t,n,r,i){for(var o=0;o<10;o++){i&&(i[0]=e.innerMode(t,r).mode);var a=t.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Nr(e,t,n,r){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?ua(a.mode,u):u}}var o,a=e.doc,s=a.mode;t=ge(a,t);var l,c=Jr(a,t.line),u=He(e,t.line,n),f=new va(c.text,e.options.tabSize);for(r&&(l=[]);(r||f.pos<t.ch)&&!f.eol();)f.start=f.pos,o=Ir(s,f,u),r&&l.push(i(!0));return r?l:i()}function qr(e,t,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var l,c=0,u=null,f=new va(t,e.options.tabSize),d=e.options.addModeClass&&[null];for(""==t&&zr(Or(n,r),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,a&&jr(e,t,r,f.pos),f.pos=t.length,l=null):l=zr(Ir(n,f,r,d),o),d){var p=d[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){for(;c<f.start;)c=Math.min(f.start,c+5e4),i(c,u);u=l}f.start=f.pos}for(;c<f.pos;){var h=Math.min(f.pos,c+5e4);i(h,u),c=h}}function Pr(e,t,n,r){var i=[e.state.modeGen],o={};qr(e,t.text,e.doc.mode,n,function(e,t){i.push(e,t)},o,r);for(var a=0;a<e.state.overlays.length;++a){var s=e.state.overlays[a],l=1,c=0;qr(e,t.text,s.mode,!0,function(e,t){for(var n=l;c<e;){var r=i[l];r>e&&i.splice(l,1,e,i[l+1],r),l+=2,c=Math.min(e,r)}if(t)if(s.opaque)i.splice(n,l-n,e,"cm-overlay "+t),l=n+2;else for(;n<l;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Rr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=He(e,ri(t)),i=Pr(e,t,t.text.length>e.options.maxHighlightLength?ua(e.doc.mode,r):r);t.stateAfter=r,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function jr(e,t,n,r){var i=e.doc.mode,o=new va(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Or(i,n);!o.eol();)Ir(i,o,n),o.start=o.pos}function Dr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ca:_a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Wr(e,t){var n=$i("span",null,null,_o?"padding-right: .1px":null),r={pre:$i("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(xo||_o)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=Fr,eo(e.display.measure)&&(o=ai(a))&&(r.addToken=$r(r.addToken,o)),r.map=[];var s=t!=e.display.externalMeasured&&ri(a);Kr(a,r,Rr(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=Xi(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=Xi(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ji(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(_o){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return qa(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Xi(r.pre.className,r.textClass||"")),r}function Br(e){var t=$i("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Fr(e,t,n,r,i,o,a){if(t){var s=e.splitSpaces?Hr(t,e.trailingSpace):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),f=0;;){l.lastIndex=f;var d=l.exec(t),p=d?d.index-f:t.length-f;if(p){var h=document.createTextNode(s.slice(f,f+p));xo&&wo<9?u.appendChild($i("span",[h])):u.appendChild(h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!d)break;if(f+=p+1,"\t"==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild($i("span",Ii(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text","\t"),e.col+=g}else if("\r"==d[0]||"\n"==d[0]){var h=u.appendChild($i("span","\r"==d[0]?"␍":"","cm-invalidchar"));h.setAttribute("cm-text",d[0]),e.col+=1}else{var h=e.cm.options.specialCharPlaceholder(d[0]);h.setAttribute("cm-text",d[0]),xo&&wo<9?u.appendChild($i("span",[h])):u.appendChild(h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,u),xo&&wo<9&&(c=!0),e.pos+=t.length}if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=$i("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Hr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}function $r(e,t){return function(n,r,i,o,a,s,l){i=i?i+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+r.length;;){for(var f=0;f<t.length;f++){var d=t[f];if(d.to>c&&d.from<=c)break}if(d.to>=u)return e(n,r,i,o,a,s,l);e(n,r.slice(0,d.to-c),i,o,null,s,l),o=null,r=r.slice(d.to-c),c=d.to}}}function Ur(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Kr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,c,u,f,d,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=c=u=f=s="",d=null,v=1/0;for(var y,b=[],k=0;k<r.length;++k){var x=r[k],w=x.marker;"bookmark"==w.type&&x.from==h&&w.widgetNode?b.push(w):x.from<=h&&(null==x.to||x.to>h||w.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&v>x.to&&(v=x.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==h&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(y||(y=[])).push(w.endStyle,x.to),w.title&&!f&&(f=w.title),w.collapsed&&(!d||mr(d.marker,w)<0)&&(d=x)):x.from>h&&v>x.from&&(v=x.from)}if(y)for(var k=0;k<y.length;k+=2)y[k+1]==v&&(c+=" "+y[k]);if(!d||d.from==h)for(var k=0;k<b.length;++k)Ur(t,0,b[k]);if(d&&(d.from||0)==h){if(Ur(t,(null==d.to?p+1:d.to)-h,d.marker,null==d.from),null==d.to)return;d.to==h&&(d=!1)}}if(h>=p)break;for(var _=Math.min(p,v);;){if(g){var C=h+g.length;if(!d){var S=C>_?g.slice(0,_-h):g;t.addToken(t,S,a?a+l:l,u,h+S.length==v?c:"",f,s)}if(C>=_){g=g.slice(_-h),h=_;break}h=C,u=""}g=i.slice(o,o=n[m++]),a=Dr(n[m++],t.cm.options)}}else for(var m=1;m<n.length;m+=2)t.addToken(t,i.slice(o,o=n[m]),Dr(n[m+1],t.cm.options))}function Vr(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ni(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Gr(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){Ar(e,n,i,r),Mi(e,"change",e,t)}function a(e,t){for(var n=e,o=[];n<t;++n)o.push(new wa(c[n],i(n),r));return o}var s=t.from,l=t.to,c=t.text,u=Jr(e,s.line),f=Jr(e,l.line),d=Ni(c),p=i(c.length-1),h=l.line-s.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Vr(e,t)){var m=a(0,c.length-1);o(f,f.text,p),h&&e.remove(s.line,h),m.length&&e.insert(s.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,s.ch)+d+u.text.slice(l.ch),p);else{var m=a(1,c.length-1);m.push(new wa(d+u.text.slice(l.ch),p,r)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(l.ch),i(0)),e.remove(s.line+1,h);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(f,d+f.text.slice(l.ch),p);var m=a(1,c.length-1);h>1&&e.remove(s.line+1,h-1),e.insert(s.line+1,m)}Mi(e,"change",e,t)}function Xr(e){this.lines=e,this.parent=null;for(var t=0,n=0;t<e.length;++t)e[t].parent=this,n+=e[t].height;this.height=n}function Zr(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}function Yr(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var s=e.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;n&&!l||(t(s.doc,l),r(s.doc,e,l))}}}r(e,null,!0)}function Qr(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),n(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,Rt(e)}function Jr(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function ei(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function ti(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ni(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ri(e){if(null==e.parent)return null;for(var t=e.parent,n=qi(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ii(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;r<e.lines.length;++r){var a=e.lines[r],s=a.height;if(t<s)break;t-=s}return n+r}function oi(e){e=kr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var r=0;r<o.children.length;++r){var a=o.children[r];if(a==n)break;t+=a.height}return t}function ai(e){var t=e.order;return null==t&&(t=e.order=cs(e.text)),t}function si(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function li(e,t){var n={from:G(t.from),to:ta(t),text:ei(e,t.from,t.to)};return mi(e,n,t.from.line,t.to.line+1),Yr(e,function(e){mi(e,n,t.from.line,t.to.line+1)},!0),n}function ci(e){for(;e.length;){var t=Ni(e);if(!t.ranges)break;e.pop()}}function ui(e,t){return t?(ci(e.done),Ni(e.done)):e.done.length&&!Ni(e.done).ranges?Ni(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ni(e.done)):void 0}function fi(e,t,n,r){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ui(i,i.lastOp==r))){var s=Ni(o.changes);0==Bo(t.from,t.to)&&0==Bo(t.from,s.to)?s.to=ta(t):o.changes.push(li(e,t))}else{var l=Ni(i.done);for(l&&l.ranges||hi(e.sel,i.done),o={changes:[li(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,s||qa(e,"historyAdded")}}function di(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function pi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||di(e,o,Ni(i.done),t))?i.done[i.done.length-1]=t:hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ci(i.undone)}function hi(e,t){var n=Ni(t);n&&n.ranges&&n.equals(e)||t.push(e)}function mi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function gi(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function vi(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(gi(n[r]));return i}function yi(e,t,n){for(var r=0,i=[];r<e.length;++r){var o=e[r];if(o.ranges)i.push(n?fe.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];i.push({changes:s});for(var l=0;l<a.length;++l){var c,u=a[l];if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&qi(t,Number(c[1]))>-1&&(Ni(s)[f]=u[f],delete u[f])}}}return i}function bi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ki(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)bi(o.ranges[s].anchor,t,n,r),bi(o.ranges[s].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var l=o.changes[s];if(n<l.from.line)l.from=Wo(l.from.line+r,l.from.ch),l.to=Wo(l.to.line+r,l.to.ch);else if(t<=l.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function xi(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ki(e.done,n,r,i),ki(e.undone,n,r,i)}function wi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function _i(e){return e.target||e.srcElement}function Ci(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Oo&&e.ctrlKey&&1==t&&(t=3),t}function Si(e,t,n){var r=e._handlers&&e._handlers[t];return n?r&&r.length>0?r.slice():Ia:r||Ia}function Mi(e,t){function n(e){return function(){e.apply(null,o)}}var r=Si(e,t,!1);if(r.length){var i,o=Array.prototype.slice.call(arguments,2);Vo?i=Vo.delayedCallbacks:Pa?i=Pa:(i=Pa=[],setTimeout(Li,0));for(var a=0;a<r.length;++a)i.push(n(r[a]))}}function Li(){var e=Pa;Pa=null;for(var t=0;t<e.length;++t)e[t]()}function Ti(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),qa(e,n||t.type,e,t),wi(t)||t.codemirrorIgnore}function Ai(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)qi(n,t[r])==-1&&n.push(t[r])}function Ei(e,t){return Si(e,t).length>0}function zi(e){e.prototype.on=function(e,t){Oa(this,e,t)},e.prototype.off=function(e,t){Na(this,e,t)}}function Oi(){this.id=null}function Ii(e){for(;$a.length<=e;)$a.push(Ni($a)+" ");return $a[e]}function Ni(e){return e[e.length-1]}function qi(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function Pi(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ri(){}function ji(e,t){var n;return Object.create?n=Object.create(e):(Ri.prototype=e,n=new Ri),t&&Di(t,n),n}function Di(e,t,n){t||(t={});for(var r in e)!e.hasOwnProperty(r)||n===!1&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function Wi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Bi(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Ga(e))||t.test(e):Ga(e)}function Fi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Hi(e){return e.charCodeAt(0)>=768&&Xa.test(e)}function $i(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function Ui(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ki(e,t){return Ui(e).appendChild(t)}function Vi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Gi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Xi(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Gi(n[r]).test(t)&&(t+=" "+n[r]);return t}function Zi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}function Yi(){ts||(Qi(),ts=!0)}function Qi(){var e;Oa(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Zi(Kt)},100))}),Oa(window,"blur",function(){Zi(kn)})}function Ji(e){if(null==Ya){var t=$i("span","");Ki(e,$i("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ya=t.offsetWidth<=1&&t.offsetHeight>2&&!(xo&&wo<8))}var n=Ya?$i("span",""):$i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function eo(e){if(null!=Qa)return Qa;var t=Ki(e,document.createTextNode("AخA")),n=Ka(t,0,1).getBoundingClientRect(),r=Ka(t,1,2).getBoundingClientRect();return Ui(e),!(!n||n.left==n.right)&&(Qa=r.right-n.right<3)}function to(e){if(null!=as)return as;var t=Ki(e,$i("span","x")),n=t.getBoundingClientRect(),r=Ka(t,0,1).getBoundingClientRect();return as=Math.abs(n.left-r.left)>1}function no(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function ro(e){return e.level%2?e.to:e.from}function io(e){return e.level%2?e.from:e.to}function oo(e){var t=ai(e);return t?ro(t[0]):0}function ao(e){var t=ai(e);return t?io(Ni(t)):e.text.length}function so(e,t){var n=Jr(e.doc,t),r=kr(n);r!=n&&(t=ri(r));var i=ai(r),o=i?i[0].level%2?ao(r):oo(r):0;return Wo(t,o)}function lo(e,t){for(var n,r=Jr(e.doc,t);n=yr(r);)r=n.find(1,!0).line,t=null;var i=ai(r),o=i?i[0].level%2?oo(r):ao(r):r.text.length;return Wo(null==t?ri(r):t,o)}function co(e,t){var n=so(e,t.line),r=Jr(e.doc,n.line),i=ai(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return Wo(n.line,a?0:o)}return n}function uo(e,t,n){var r=e[0].level;return t==r||n!=r&&t<n}function fo(e,t){ls=null;for(var n,r=0;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return r;if(i.from==t||i.to==t){if(null!=n)return uo(e,i.level,e[n].level)?(i.from!=i.to&&(ls=n),r):(i.from!=i.to&&(ls=r),n);n=r}}return n}function po(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Hi(e.text.charAt(t)));return t}function ho(e,t,n,r){var i=ai(e);if(!i)return mo(e,t,n,r);for(var o=fo(i,t),a=i[o],s=po(e,t,a.level%2?-n:n,r);;){if(s>a.from&&s<a.to)return s;if(s==a.from||s==a.to)return fo(i,s)==o?s:(a=i[o+=n],n>0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;s=n>0==a.level%2?po(e,a.to,-1,r):po(e,a.from,1,r)}}function mo(e,t,n,r){var i=t+n;if(r)for(;i>0&&Hi(e.text.charAt(i));)i+=n;return i<0||i>e.text.length?null:i}var go=navigator.userAgent,vo=navigator.platform,yo=/gecko\/\d/i.test(go),bo=/MSIE \d/.test(go),ko=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(go),xo=bo||ko,wo=xo&&(bo?document.documentMode||6:ko[1]),_o=/WebKit\//.test(go),Co=_o&&/Qt\/\d+\.\d+/.test(go),So=/Chrome\//.test(go),Mo=/Opera\//.test(go),Lo=/Apple Computer/.test(navigator.vendor),To=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(go),Ao=/PhantomJS/.test(go),Eo=/AppleWebKit/.test(go)&&/Mobile\/\w+/.test(go),zo=Eo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(go),Oo=Eo||/Mac/.test(vo),Io=/\bCrOS\b/.test(go),No=/win/i.test(vo),qo=Mo&&go.match(/Version\/(\d*\.\d*)/);qo&&(qo=Number(qo[1])),qo&&qo>=15&&(Mo=!1,_o=!0);var Po=Oo&&(Co||Mo&&(null==qo||qo<12.11)),Ro=yo||xo&&wo>=9,jo=!1,Do=!1;m.prototype=Di({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){ +this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Oo&&!To?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Oi,this.disableVert=new Oi},enableZeroWidthBar:function(e,t){function n(){var r=e.getBoundingClientRect(),i=document.elementFromPoint(r.left+1,r.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Di({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},S.prototype.signal=function(e,t){Ei(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e<this.events.length;e++)qa.apply(null,this.events[e])};var Wo=e.Pos=function(e,t){return this instanceof Wo?(this.line=e,void(this.ch=t)):new Wo(e,t)},Bo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Fo=null;re.prototype=Di({init:function(e){function t(e){if(!Ti(r,e)){if(r.somethingSelected())Fo={lineWise:!1,text:r.getSelections()},n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=Fo.text.join("\n"),Ua(o));else{if(!r.options.lineWiseCopyCut)return;var t=te(r);Fo={lineWise:!0,text:t.text},"cut"==e.type?r.setSelections(t.ranges,null,Da):(n.prevInput="",o.value=t.text.join("\n"),Ua(o))}"cut"==e.type&&(r.state.cutIncoming=!0)}}var n=this,r=this.cm,i=this.wrapper=ie(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),Eo&&(o.style.width="0px"),Oa(o,"input",function(){xo&&wo>=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Oa(o,"paste",function(e){Ti(r,e)||J(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Oa(o,"cut",t),Oa(o,"copy",t),Oa(e.scroller,"paste",function(t){Vt(e,t)||Ti(r,t)||(r.state.pasteIncoming=!0,n.focus())}),Oa(e.lineSpace,"selectstart",function(t){Vt(e,t)||Aa(t)}),Oa(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oa(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=Pe(e);if(e.options.moveInputWithCursor){var i=mt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;Ki(n.cursorDiv,e.cursors),Ki(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=os&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.composing||(this.textarea.value=a),r.state.focused&&Ua(this.textarea),xo&&wo>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),xo&&wo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!zo||Vi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||is(t)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(xo&&wo>=9&&this.hasSelection===r||Oo&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);o<a&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var s=this;return zt(e,function(){Q(e,r.slice(o),n.length-o,null,s.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=r,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){xo&&wo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=f,a.style.cssText=u,xo&&wo<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!xo||xo&&wo<9)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==r.prevInput?Ot(i,da.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,s=Gt(i,e),l=o.scroller.scrollTop;if(s&&!Mo){var c=i.options.resetSelectionOnContextMenu;c&&i.doc.sel.contains(s)==-1&&Ot(i,Le)(i.doc,he(s),Da);var u=a.style.cssText,f=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var d=r.wrapper.getBoundingClientRect();if(a.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px; z-index: 1000; background: "+(xo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",_o)var p=window.scrollY;if(o.input.focus(),_o&&window.scrollTo(null,p),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),xo&&wo>=9&&t(),Ro){za(e);var h=function(){Na(window,"mouseup",h),setTimeout(n,20)};Oa(window,"mouseup",h)}else setTimeout(n,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Ri,needsContentAttribute:!1},re.prototype),oe.prototype=Di({init:function(e){function t(e){if(!Ti(r,e)){if(r.somethingSelected())Fo={lineWise:!1,text:r.getSelections()},"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=te(r);Fo={lineWise:!0,text:t.text},"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Da),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Eo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.text.join("\n"));else{var n=ie(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Fo.text.join("\n");var o=document.activeElement;Ua(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}}var n=this,r=n.cm,i=n.div=e.lineDiv;ne(i),Oa(i,"paste",function(e){Ti(r,e)||J(e,r)}),Oa(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(n.composing.sel=he(Wo(i.head.line,a),Wo(i.head.line,a+t.length)))}}),Oa(i,"compositionupdate",function(e){n.composing.data=e.data}),Oa(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t),n.composing==t&&(n.composing=null)},50))}),Oa(i,"touchstart",function(){n.forceCompositionEnd()}),Oa(i,"input",function(){n.composing||!r.isReadOnly()&&n.pollContent()||zt(n.cm,function(){Rt(r)})}),Oa(i,"copy",t),Oa(i,"cut",t)},prepareSelection:function(){var e=Pe(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=le(this.cm,e.anchorNode,e.anchorOffset),r=le(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=Bo(Z(n,r),t.from())||0!=Bo(X(n,r),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ka(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(!yo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),s&&null==e.anchorNode?e.addRange(s):yo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ki(this.cm.display.cursorDiv,e.cursors),Ki(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Za(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():zt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=le(t,e.anchorNode,e.anchorOffset),r=le(t,e.focusNode,e.focusOffset);n&&r&&zt(t,function(){Le(t.doc,he(n,r),Da),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=Wt(e,r.line)))var a=ri(t.view[0].line),s=t.view[0].node;else var a=ri(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=Wt(e,i.line);if(l==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ri(t.view[l+1].line)-1,u=t.view[l+1].node.previousSibling;for(var f=e.doc.splitLines(ue(e,s,u,a,c)),d=ei(e.doc,Wo(a,0),Wo(c,Jr(e.doc,c).text.length));f.length>1&&d.length>1;)if(Ni(f)==Ni(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var p=0,h=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);p<v&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Ni(f),b=Ni(d),k=Math.min(y.length-(1==f.length?p:0),b.length-(1==d.length?p:0));h<k&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;f[f.length-1]=y.slice(0,y.length-h),f[0]=f[0].slice(p);var x=Wo(a,p),w=Wo(c,d.length?Ni(d).length-h:0);return f.length>1||f[0]||Bo(x,w)?(Nn(e.doc,f,x,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Ot(this.cm,Rt)(this.cm):e.data&&e.data!=e.startData&&Ot(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Ot(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Ri,resetPosition:Ri,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:re,contenteditable:oe},fe.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(0!=Bo(n.anchor,r.anchor)||0!=Bo(n.head,r.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new de(G(this.ranges[t].anchor),G(this.ranges[t].head));return new fe(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Bo(t,r.from())>=0&&Bo(e,r.to())<=0)return n}return-1}},de.prototype={from:function(){return Z(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ho,$o,Uo,Ko={left:0,right:0,top:0,bottom:0},Vo=null,Go=0,Xo=0,Zo=0,Yo=null;xo?Yo=-.53:yo?Yo=15:So?Yo=-.7:Lo&&(Yo=-1/3);var Qo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=Qo(e);return t.x*=Yo,t.y*=Yo,t};var Jo=new Oi,ea=null,ta=e.changeEnd=function(e){return e.text?Wo(e.from.line+e.text.length-1,Ni(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,ra.hasOwnProperty(e)&&Ot(this,ra[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Xn(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:It(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:t,opaque:n&&n.opaque}),this.state.modeGen++,Rt(this)}),removeOverlay:It(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void Rt(this)}}),indentLine:It(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ye(this.doc,e)&&Fn(this,e,t,n)}),indentSelection:It(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(Fn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Wn(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l<n;++l)Fn(this,l,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&_e(this.doc,r,new de(o,c[r].to()),Da)}}}),getTokenAt:function(e,t){return Nr(this,e,t)},getLineTokens:function(e,t){return Nr(this,Wo(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,n=Rr(this,Jr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var s=t?t.indexOf("cm-overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!ca.hasOwnProperty(t))return n;var r=ca[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=r[i[t][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var o=0;o<r._global.length;o++){var s=r._global[o];s.pred(i,this)&&qi(n,s.val)==-1&&n.push(s.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=me(n,null==e?n.first+n.size-1:e),He(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?ge(this.doc,e):e?r.from():r.to(),mt(this,n,t||"page")},charCoords:function(e,t){return ht(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=pt(this,e,t||"page"),yt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=pt(this,{top:e,left:0},t||"page").top,ii(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n,r=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,r=!0),n=Jr(this.doc,e)}else n=e;return dt(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-oi(n):0)},defaultTextHeight:function(){return kt(this.display)},defaultCharWidth:function(){return xt(this.display)},setGutterMarker:It(function(e,t,n){return Hn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Fi(r)&&(e.gutterMarkers=null),!0})}),clearGutter:It(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,jt(t,r,"gutter"),Fi(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Jr(this.doc,e),!e)return null}else{var t=ri(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=mt(this,ge(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&Rn(this,s,a,s+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:It(hn),triggerOnKeyPress:It(vn),triggerOnKeyUp:gn,execCommand:function(e){if(da.hasOwnProperty(e))return da[e].call(null,this)},triggerElectric:It(function(e){ee(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);o<t&&(a=Un(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:It(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Un(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},Ba)}),deleteH:It(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):$n(this,function(n){var i=Un(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=0,s=ge(this.doc,e);a<t;++a){var l=mt(this,s,"div");if(null==o?o=l.left:l.left=o,s=Kn(this,l,i,n),s.hitSide)break}return s},moveV:It(function(e,t){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(a){if(o)return e<0?a.from():a.to();var s=mt(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=Kn(n,s,e,t);return"page"==t&&a==r.sel.primary()&&Dn(n,null,ht(n,l,"div").top-s.top),l},Ba),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,n=Jr(t,e.line).text,r=e.ch,i=e.ch;if(n){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==n.length)&&r?--r:++i;for(var a=n.charAt(r),s=Bi(a,o)?function(e){return Bi(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Bi(e)};r>0&&s(n.charAt(r-1));)--r;for(;i<n.length&&s(n.charAt(i));)++i}return new de(Wo(e.line,r),Wo(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?es(this.display.cursorDiv,"CodeMirror-overwrite"):Ja(this.display.cursorDiv,"CodeMirror-overwrite"),qa(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Vi()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:It(function(e,t){null==e&&null==t||Bn(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ve(this)-this.display.barHeight,width:e.scrollWidth-Ve(this)-this.display.barWidth,clientHeight:Xe(this),clientWidth:Ge(this)}},scrollIntoView:It(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:Wo(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Bn(this),this.curOp.scrollToPos=e;else{var n=jn(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:It(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var r=this;null!=e&&(r.display.wrapper.style.width=n(e)),null!=t&&(r.display.wrapper.style.height=n(t)),r.options.lineWrapping&<(this);var i=r.display.viewFrom;r.doc.iter(i,r.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){jt(r,i,"widget");break}++i}),r.curOp.forceUpdate=!0,qa(r,"refresh",this)}),operation:function(e){return zt(this,e)},refresh:It(function(){var e=this.display.cachedTextHeight;Rt(this),this.curOp.forceUpdate=!0,ct(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-kt(this.display))>.5)&&a(this),qa(this,"refresh",this)}),swapDoc:It(function(e){var t=this.doc;return t.cm=null,Qr(this,e),ct(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Mi(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},zi(e);var na=e.defaults={},ra=e.optionHandlers={},ia=e.Init={toString:function(){return"CodeMirror.Init"}};Vn("value","",function(e,t){e.setValue(t)},!0),Vn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),Vn("indentUnit",2,n,!0),Vn("indentWithTabs",!1),Vn("smartIndent",!0),Vn("tabSize",4,function(e){r(e),ct(e),Rt(e)},!0),Vn("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,n.push(Wo(r,o))}r++});for(var i=n.length-1;i>=0;i--)Nn(e.doc,t,n[i],Wo(n[i].line,n[i].ch+t.length))}}),Vn("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test("\t")?"":"|\t"),"g"),r!=e.Init&&t.refresh()}),Vn("specialCharPlaceholder",Br,function(e){e.refresh()},!0),Vn("electricChars",!0),Vn("inputStyle",zo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Vn("rtlMoveVisually",!No),Vn("wholeLineUpdateBefore",!0),Vn("theme","default",function(e){s(e),l(e)},!0),Vn("keyMap","default",function(t,n,r){var i=Xn(n),o=r!=e.Init&&Xn(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Vn("extraKeys",null),Vn("lineWrapping",!1,i,!0),Vn("gutters",[],function(e){p(e.options),l(e)},!0),Vn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Vn("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Vn("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Vn("lineNumbers",!1,function(e){p(e.options),l(e)},!0),Vn("firstLineNumber",1,l,!0),Vn("lineNumberFormatter",function(e){return e},l,!0),Vn("showCursorWhenSelecting",!1,qe,!0),Vn("resetSelectionOnContextMenu",!0),Vn("lineWiseCopyCut",!0),Vn("readOnly",!1,function(e,t){"nocursor"==t?(kn(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Vn("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Vn("dragDrop",!0,Ut),Vn("allowDropFileTypes",null),Vn("cursorBlinkRate",530),Vn("cursorScrollMargin",0),Vn("cursorHeight",1,qe,!0),Vn("singleCursorHeightPerLine",!0,qe,!0),Vn("workTime",100),Vn("workDelay",100),Vn("flattenSpans",!0,r,!0),Vn("addModeClass",!1,r,!0),Vn("pollInterval",100),Vn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Vn("historyEventDelay",1250),Vn("viewportMargin",10,function(e){e.refresh()},!0),Vn("maxHighlightLength",1e4,r,!0),Vn("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Vn("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Vn("autofocus",null);var oa=e.modes={},aa=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),oa[t]=n},e.defineMIME=function(e,t){aa[e]=t},e.resolveMode=function(t){if("string"==typeof t&&aa.hasOwnProperty(t))t=aa[t];else if(t&&"string"==typeof t.name&&aa.hasOwnProperty(t.name)){var n=aa[t.name];"string"==typeof n&&(n={name:n}),t=ji(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=oa[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(sa.hasOwnProperty(n.name)){var o=sa[n.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var sa=e.modeExtensions={};e.extendMode=function(e,t){var n=sa.hasOwnProperty(e)?sa[e]:sa[e]={};Di(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){Ma.prototype[e]=t},e.defineOption=Vn;var la=[];e.defineInitHook=function(e){la.push(e)};var ca=e.helpers={};e.registerHelper=function(t,n,r){ca.hasOwnProperty(t)||(ca[t]=e[t]={_global:[]}),ca[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),ca[t]._global.push({pred:r,val:i})};var ua=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},fa=e.startState=function(e,t,n){return!e.startState||e.startState(t,n)};e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var da=e.commands={selectAll:function(e){e.setSelection(Wo(e.firstLine(),0),Wo(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){$n(e,function(t){if(t.empty()){var n=Jr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Wo(t.head.line+1,0)}:{from:t.head,to:Wo(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){$n(e,function(t){return{from:Wo(t.from().line,0),to:ge(e.doc,Wo(t.to().line+1,0))}})},delLineLeft:function(e){$n(e,function(e){return{from:Wo(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){$n(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){$n(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(Wo(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Wo(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return so(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return co(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return lo(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ba)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Ba)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?co(e,t.head):r},Ba)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=Fa(e.getLine(o.line),o.ch,r);t.push(Ii(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){zt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r].head,o=Jr(e.doc,i.line).text; +if(o)if(i.ch==o.length&&(i=new Wo(i.line,i.ch-1)),i.ch>0)i=new Wo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Wo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Jr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Wo(i.line-1,a.length-1),Wo(i.line,1),"+transpose")}n.push(new de(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){zt(e,function(){for(var t=e.listSelections().length,n=0;n<t;n++){var r=e.listSelections()[n];e.replaceRange(e.doc.lineSeparator(),r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0)}Wn(e)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},pa=e.keyMap={};pa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},pa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},pa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},pa["default"]=Oo?pa.macDefault:pa.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Pi(n.split(" "),Gn),o=0;o<i.length;o++){var a,s;o==i.length-1?(s=i.join(" "),a=r):(s=i.slice(0,o+1).join(" "),a="...");var l=t[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else t[s]=a}delete e[n]}for(var c in t)e[c]=t[c];return e};var ha=e.lookupKey=function(e,t,n,r){t=Xn(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return ha(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=ha(e,t.fallthrough[o],n,r);if(a)return a}}},ma=e.isModifierKey=function(e){var t="string"==typeof e?e:ss[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},ga=e.keyName=function(e,t){if(Mo&&34==e.keyCode&&e["char"])return!1;var n=ss[e.keyCode],r=n;return null!=r&&!e.altGraphKey&&(e.altKey&&"Alt"!=n&&(r="Alt-"+r),(Po?e.metaKey:e.ctrlKey)&&"Ctrl"!=n&&(r="Ctrl-"+r),(Po?e.ctrlKey:e.metaKey)&&"Cmd"!=n&&(r="Cmd-"+r),!t&&e.shiftKey&&"Shift"!=n&&(r="Shift-"+r),r)};e.fromTextArea=function(t,n){function r(){t.value=c.getValue()}if(n=n?Di(n):{},n.value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var i=Vi();n.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Oa(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var s=o.submit=function(){r(),o.submit=a,o.submit(),o.submit=s}}catch(l){}}n.finishInit=function(e){e.save=r,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,r(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Na(t.form,"submit",r),"function"==typeof t.form.submit&&(t.form.submit=a))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return c};var va=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};va.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n)return++this.pos,t},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Fa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Fa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Fa(this.string,null,this.tabSize)-(this.lineStart?Fa(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ya=0,ba=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ya};zi(ba),ba.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&wt(e),Ei(this,"clear")){var n=this.find();n&&Mi(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=nr(a.markedSpans,this);e&&!this.collapsed?jt(e,ri(a),"text"):e&&(null!=s.to&&(i=ri(a)),null!=s.from&&(r=ri(a))),a.markedSpans=rr(a.markedSpans,s),null==s.from&&this.collapsed&&!Cr(this.doc,a)&&e&&ni(a,kt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=kr(this.lines[o]),c=f(l);c>e.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Rt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ee(e.doc)),e&&Mi(e,"markerCleared",e,this),t&&Ct(e),this.parent&&this.parent.clear()}},ba.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var o=this.lines[i],a=nr(o.markedSpans,this);if(null!=a.from&&(n=Wo(t?o:ri(o),a.from),e==-1))return n;if(null!=a.to&&(r=Wo(t?o:ri(o),a.to),1==e))return r}return n&&{from:n,to:r}},ba.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;e&&n&&zt(n,function(){var r=e.line,i=ri(e.line),o=et(n,i);if(o&&(st(o),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Cr(t.doc,r)&&null!=t.height){var a=t.height;t.height=null;var s=Lr(t)-a;s&&ni(r,r.height+s)}})},ba.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&qi(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ba.prototype.detachLine=function(e){if(this.lines.splice(qi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ya=0,ka=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};zi(ka),ka.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Mi(this,"clear")}},ka.prototype.find=function(e,t){return this.primary.find(e,t)};var xa=e.LineWidget=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};zi(xa),xa.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=ri(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=Lr(this);ni(n,Math.max(0,n.height-o)),e&&zt(e,function(){Mr(e,n,-o),jt(e,r,"widget")})}},xa.prototype.changed=function(){var e=this.height,t=this.doc.cm,n=this.line;this.height=null;var r=Lr(this)-e;r&&(ni(n,n.height+r),t&&zt(t,function(){t.curOp.forceUpdate=!0,Mr(t,n,r)}))};var wa=e.Line=function(e,t,n){this.text=e,dr(this,t),this.height=n?n(this):1};zi(wa),wa.prototype.lineNo=function(){return ri(this)};var _a={},Ca={};Xr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Er(i),Mi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},Zr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Xr))){var s=[];this.collapse(s),this.children=[new Xr(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,s=a;s<i.lines.length;){var l=new Xr(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Zr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=qi(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Zr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Sa=0,Ma=e.Doc=function(e,t,n,r){if(!(this instanceof Ma))return new Ma(e,t,n,r);null==n&&(n=0),Zr.call(this,[new Xr([new wa("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var i=Wo(n,0);this.sel=he(i),this.history=new si(null),this.id=++Sa,this.modeOption=t,this.lineSep=r,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Gr(this,{from:i,to:i,text:e}),Le(this,he(i),Da)};Ma.prototype=ji(Zr.prototype,{constructor:Ma,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ti(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Nt(function(e){var t=Wo(this.first,0),n=this.first+this.size-1;Tn(this,{from:t,to:Wo(n,Jr(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),Le(this,he(t))}),replaceRange:function(e,t,n,r){t=ge(this,t),n=n?ge(this,n):t,Nn(this,e,t,n,r)},getRange:function(e,t,n){var r=ei(this,ge(this,e),ge(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ye(this,e))return Jr(this,e)},getLineNumber:function(e){return ri(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Jr(this,e)),kr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||e===!1?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nt(function(e,t,n){Ce(this,ge(this,"number"==typeof e?Wo(e,t||0):e),null,n)}),setSelection:Nt(function(e,t,n){Ce(this,ge(this,e),ge(this,t||e),n)}),extendSelection:Nt(function(e,t,n){xe(this,ge(this,e),t&&ge(this,t),n)}),extendSelections:Nt(function(e,t){we(this,be(this,e),t)}),extendSelectionsBy:Nt(function(e,t){var n=Pi(this.sel.ranges,e);we(this,be(this,n),t)}),setSelections:Nt(function(e,t,n){if(e.length){for(var r=0,i=[];r<e.length;r++)i[r]=new de(ge(this,e[r].anchor),ge(this,e[r].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Le(this,pe(i,t),n)}}),addSelection:Nt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new de(ge(this,e),ge(this,t||e))),Le(this,pe(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=ei(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=ei(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Nt(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var s=t&&"end"!=t&&Mn(this,r,t),o=r.length-1;o>=0;o--)Tn(this,r[o]);s?Me(this,s):this.cm&&Wn(this.cm)}),undo:Nt(function(){En(this,"undo")}),redo:Nt(function(){En(this,"redo")}),undoSelection:Nt(function(){En(this,"undo",!0)}),redoSelection:Nt(function(){En(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new si(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:yi(this.history.done),undone:yi(this.history.undone)}},setHistory:function(e){var t=this.history=new si(this.history.maxGeneration);t.done=yi(e.done.slice(0),null,!0),t.undone=yi(e.undone.slice(0),null,!0)},addLineClass:Nt(function(e,t,n){return Hn(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(Gi(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:Nt(function(e,t,n){return Hn(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(Gi(n));if(!o)return!1;var a=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Nt(function(e,t,n){return Tr(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Zn(this,ge(this,e),ge(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Zn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],n=Jr(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ge(this,e),t=ge(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];null!=l.to&&i==e.line&&e.ch>=l.to||null==l.from&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+r;return o>e?(t=e,!0):(e-=o,void++n)}),ge(this,Wo(n,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Ma(ti(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Ma(ti(this,t,n),e.mode||this.modeOption,t,this.lineSep);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Jn(r,Qn(this)),r},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var n=0;n<this.linked.length;++n){var r=this.linked[n];if(r.doc==t){this.linked.splice(n,1),t.unlinkDoc(this),er(Qn(this));break}}if(t.history==this.history){var i=[t.id];Yr(t,function(e){i.push(e.id)},!0),t.history=new si(null),t.history.done=yi(this.history.done,i),t.history.undone=yi(this.history.undone,i)}},iterLinkedDocs:function(e){Yr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):rs(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Ma.prototype.eachLine=Ma.prototype.iter;var La="iter insert remove copy getEditor constructor".split(" ");for(var Ta in Ma.prototype)Ma.prototype.hasOwnProperty(Ta)&&qi(La,Ta)<0&&(e.prototype[Ta]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ma.prototype[Ta]));zi(Ma);var Aa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Ea=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},za=e.e_stop=function(e){Aa(e),Ea(e)},Oa=e.on=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}},Ia=[],Na=e.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else for(var r=Si(e,t,!1),i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}},qa=e.signal=function(e,t){var n=Si(e,t,!0);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)},Pa=null,Ra=30,ja=e.Pass={toString:function(){return"CodeMirror.Pass"}},Da={scroll:!1},Wa={origin:"*mouse"},Ba={origin:"+move"};Oi.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Fa=e.countColumn=function(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,a=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}},Ha=e.findColumn=function(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);o==-1&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}},$a=[""],Ua=function(e){e.select()};Eo?Ua=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:xo&&(Ua=function(e){try{e.select()}catch(t){}});var Ka,Va=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ga=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Va.test(e))},Xa=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ka=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Za=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};xo&&wo<11&&(Vi=function(){try{return document.activeElement}catch(e){return document.body}});var Ya,Qa,Ja=e.rmClass=function(e,t){var n=e.className,r=Gi(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},es=e.addClass=function(e,t){var n=e.className;Gi(t).test(n)||(e.className+=(n?" ":"")+t)},ts=!1,ns=function(){if(xo&&wo<9)return!1;var e=$i("div");return"draggable"in e||"dragDrop"in e}(),rs=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},is=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},os=function(){var e=$i("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),as=null,ss=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;e<10;e++)ss[e+48]=ss[e+96]=String(e);for(var e=65;e<=90;e++)ss[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)ss[e+111]=ss[e+63235]="F"+e}();var ls,cs=function(){function e(e){return e<=247?n.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1773?r.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,f=[],d=0;d<u;++d)f.push(r=e(n.charCodeAt(d)));for(var d=0,p=c;d<u;++d){var r=f[d];"m"==r?f[d]=p:p=r}for(var d=0,h=c;d<u;++d){var r=f[d];"1"==r&&"r"==h?f[d]="n":a.test(r)&&(h=r,"r"==r&&(f[d]="R"))}for(var d=1,p=f[0];d<u-1;++d){var r=f[d];"+"==r&&"1"==p&&"1"==f[d+1]?f[d]="1":","!=r||p!=f[d+1]||"1"!=p&&"n"!=p||(f[d]=p),p=r}for(var d=0;d<u;++d){var r=f[d];if(","==r)f[d]="N";else if("%"==r){for(var m=d+1;m<u&&"%"==f[m];++m);for(var g=d&&"!"==f[d-1]||m<u&&"1"==f[m]?"1":"N",v=d;v<m;++v)f[v]=g;d=m-1}}for(var d=0,h=c;d<u;++d){var r=f[d];"L"==h&&"1"==r?f[d]="L":a.test(r)&&(h=r)}for(var d=0;d<u;++d)if(o.test(f[d])){for(var m=d+1;m<u&&o.test(f[m]);++m);for(var y="L"==(d?f[d-1]:c),b="L"==(m<u?f[m]:c),g=y||b?"L":"R",v=d;v<m;++v)f[v]=g;d=m-1}for(var k,x=[],d=0;d<u;)if(s.test(f[d])){var w=d;for(++d;d<u&&s.test(f[d]);++d);x.push(new t(0,w,d))}else{var _=d,C=x.length;for(++d;d<u&&"L"!=f[d];++d);for(var v=_;v<d;)if(l.test(f[v])){_<v&&x.splice(C,0,new t(1,_,v));var S=v;for(++v;v<d&&l.test(f[v]);++v);x.splice(C,0,new t(2,S,v)),_=v}else++v;_<d&&x.splice(C,0,new t(1,_,d))}return 1==x[0].level&&(k=n.match(/^\s+/))&&(x[0].from=k[0].length,x.unshift(new t(0,0,k[0].length))),1==Ni(x).level&&(k=n.match(/\s+$/))&&(Ni(x).to-=k[0].length,x.push(new t(0,u-k[0].length,u))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Ni(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.17.1",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=n.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||r&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,n){return t.indent(e.base,n)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),n.blankLine&&n.blankLine(e.overlay)}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function n(e,t){if(!e)return/(?:)/;var n="";return e instanceof RegExp?(e.ignoreCase&&(n="i"),e=e.source):e=String(e),new RegExp((t===!1?"":"^")+"(?:"+e+")",n)}function r(e){if(!e)return null;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g," "));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function o(e,t){return function(n,r){if(r.pending){var i=r.pending.shift();return 0==r.pending.length&&(r.pending=null),n.pos+=i.text.length,i.token}if(r.local){if(r.local.end&&n.match(r.local.end)){var o=r.local.endToken||null;return r.local=r.localState=null,o}var a,o=r.local.mode.token(n,r.localState);return r.local.endScan&&(a=r.local.endScan.exec(n.current()))&&(n.pos=n.start+a.index),o}for(var l=e[r.state],c=0;c<l.length;c++){var u=l[c],f=(!u.data.sol||n.sol())&&n.match(u.regex);if(f){if(u.data.next?r.state=u.data.next:u.data.push?((r.stack||(r.stack=[])).push(r.state),r.state=u.data.push):u.data.pop&&r.stack&&r.stack.length&&(r.state=r.stack.pop()),u.data.mode&&s(t,r,u.data.mode,u.token),u.data.indent&&r.indent.push(n.indentation()+t.indentUnit),u.data.dedent&&r.indent.pop(),f.length>2){r.pending=[];for(var d=2;d<f.length;d++)f[d]&&r.pending.push({text:f[d],token:u.token[d-1]});return n.backUp(f[0].length-(f[1]?f[1].length:0)),u.token[0]}return u.token&&u.token.join?u.token[0]:u.token}}return n.next(),null}}function a(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var r in e)if(e.hasOwnProperty(r)){if(!t.hasOwnProperty(r)||!a(e[r],t[r]))return!1;n++}for(var r in t)t.hasOwnProperty(r)&&n--;return 0==n}function s(t,r,i,o){var s;if(i.persistent)for(var l=r.persistentStates;l&&!s;l=l.next)(i.spec?a(i.spec,l.spec):i.mode==l.mode)&&(s=l);var c=s?s.mode:i.mode||e.getMode(t,i.spec),u=s?s.state:e.startState(c);i.persistent&&!s&&(r.persistentStates={mode:c,spec:i.spec,state:u, +next:r.persistentStates}),r.localState=u,r.local={mode:c,end:i.end&&n(i.end),endScan:i.end&&i.forceEnd!==!1&&n(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function l(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}function c(t,n){return function(r,i,o){if(r.local&&r.local.mode.indent)return r.local.mode.indent(r.localState,i,o);if(null==r.indent||r.local||n.dontIndentStates&&l(r.state,n.dontIndentStates)>-1)return e.Pass;var a=r.indent.length-1,s=t[r.state];e:for(;;){for(var c=0;c<s.length;c++){var u=s[c];if(u.data.dedent&&u.data.dedentIfLineStart!==!1){var f=u.regex.exec(i);if(f&&f[0]){a--,(u.next||u.push)&&(s=t[u.next||u.push]),i=i.slice(f[0].length);continue e}}}break}return a<0?0:r.indent[a]}}e.defineSimpleMode=function(t,n){e.defineMode(t,function(t){return e.simpleMode(t,n)})},e.simpleMode=function(n,r){t(r,"start");var a={},s=r.meta||{},l=!1;for(var u in r)if(u!=s&&r.hasOwnProperty(u))for(var f=a[u]=[],d=r[u],p=0;p<d.length;p++){var h=d[p];f.push(new i(h,r)),(h.indent||h.dedent)&&(l=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:l?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var r=t.persistentStates;r;r=r.next)n.persistentStates={mode:r.mode,spec:r.spec,state:r.state==t.localState?n.localState:e.copyState(r.mode,r.state),next:n.persistentStates};return n},token:o(a,n),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:c(a,s)};if(s)for(var g in s)s.hasOwnProperty(g)&&(m[g]=s[g]);return m}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.multiplexingMode=function(t){function n(e,t,n,r){if("string"==typeof t){var i=e.indexOf(t,n);return r&&i>-1?i+t.length:i}var o=t.exec(n?e.slice(n):e);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,s=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var l=a.close?n(s,a.close,i.pos,a.parseDelimiters):-1;if(l==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";l>-1&&(i.string=s.slice(0,l));var c=a.mode.token(i,o.inner);return l>-1&&(i.string=s),l==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,s=i.string,f=0;f<r.length;++f){var d=r[f],l=n(s,d.open,i.pos);if(l==i.pos)return d.parseDelimiters||i.match(d.open),o.innerActive=d,o.inner=e.startState(d.mode,t.indent?t.indent(o.outer,""):0),d.delimStyle&&d.delimStyle+" "+d.delimStyle+"-open";l!=-1&&l<u&&(u=l)}u!=1/0&&(i.string=s.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=s),p},indent:function(n,r){var i=n.innerActive?n.innerActive.mode:t;return i.indent?i.indent(n.innerActive?n.inner:n.outer,r):e.Pass},blankLine:function(n){var i=n.innerActive?n.innerActive.mode:t;if(i.blankLine&&i.blankLine(n.innerActive?n.inner:n.outer),n.innerActive)"\n"===n.innerActive.close&&(n.innerActive=n.inner=null);else for(var o=0;o<r.length;++o){var a=r[o];"\n"===a.open&&(n.innerActive=a,n.inner=e.startState(a.mode,i.indent?i.indent(n.outer,""):0))}},electricChars:t.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:t}}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a),e.removeLineClass(e.state.activeLines[t],"gutter",s)}function n(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function r(e,r){for(var i=[],l=0;l<r.length;l++){var c=r[l];if(c.empty()){var u=e.getLineHandleVisualStart(c.head.line);i[i.length-1]!=u&&i.push(u)}}n(e.state.activeLines,i)||e.operation(function(){t(e);for(var n=0;n<i.length;n++)e.addLineClass(i[n],"wrap",o),e.addLineClass(i[n],"background",a),e.addLineClass(i[n],"gutter",s);e.state.activeLines=i})}function i(e,t){r(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background",s="CodeMirror-activeline-gutter";e.defineOption("styleActiveLine",!1,function(n,o,a){var s=a&&a!=e.Init;o&&!s?(n.state.activeLines=[],r(n,n.listSelections()),n.on("beforeSelectionChange",i)):!o&&s&&(n.off("beforeSelectionChange",i),t(n),delete n.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,i,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),i=i?e.clipPos(i):r(0,0),this.pos={from:i,to:i},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,i){if(n){t.lastIndex=0;for(var o,a,s=e.getLine(i.line).slice(0,i.ch),l=0;;){t.lastIndex=l;var c=t.exec(s);if(!c)break;if(o=c,a=o.index,l=o.index+(o[0].length||1),l==s.length)break}var u=o&&o[0].length||0;u||(0==a&&0==s.length?o=void 0:a!=e.getLine(i.line).length&&u++)}else{t.lastIndex=i.ch;var s=e.getLine(i.line),o=t.exec(s),u=o&&o[0].length||0,a=o&&o.index;a+u==s.length||u||(u=1)}if(o&&u)return{from:r(i.line,a),to:r(i.line,a+u),match:o}};else{var a=t;o&&(t=t.toLowerCase());var s=o?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)t.length?this.matches=function(i,o){if(i){var l=e.getLine(o.line).slice(0,o.ch),c=s(l),u=c.lastIndexOf(t);if(u>-1)return u=n(l,c,u),{from:r(o.line,u),to:r(o.line,u+a.length)}}else{var l=e.getLine(o.line).slice(o.ch),c=s(l),u=c.indexOf(t);if(u>-1)return u=n(l,c,u)+o.ch,{from:r(o.line,u),to:r(o.line,u+a.length)}}}:this.matches=function(){};else{var c=a.split("\n");this.matches=function(t,n){var i=l.length-1;if(t){if(n.line-(l.length-1)<e.firstLine())return;if(s(e.getLine(n.line).slice(0,c[i].length))!=l[l.length-1])return;for(var o=r(n.line,c[i].length),a=n.line-1,u=i-1;u>=1;--u,--a)if(l[u]!=s(e.getLine(a)))return;var f=e.getLine(a),d=f.length-c[0].length;if(s(f.slice(d))!=l[0])return;return{from:r(a,d),to:o}}if(!(n.line+(l.length-1)>e.lastLine())){var f=e.getLine(n.line),d=f.length-c[0].length;if(s(f.slice(d))==l[0]){for(var p=r(n.line,d),a=n.line+1,u=1;u<i;++u,++a)if(l[u]!=s(e.getLine(a)))return;if(s(e.getLine(a).slice(0,c[i].length))==l[i])return{from:p,to:r(a,c[i].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var r=Math.min(n,e.length);;){var i=e.slice(0,r).toLowerCase().length;if(i<n)++r;else{if(!(i>n))return r;--r}}}var r=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=r(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=r(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=r(i.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,n){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,n),this.pos.to=r(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),e.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)}),e.defineExtension("selectMatches",function(t,n){for(var r=[],i=this.getSearchCursor(t,this.getCursor("from"),n);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length||1,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function r(e){return e.state.search||(e.state.search=new n)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,n){return e.getSearchCursor(t,n,i(t))}function a(e,t,n,r,i){e.openDialog(t,r,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){h(e)},onKeyDown:i})}function s(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function l(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function c(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],t[2].indexOf("i")==-1?"":"i")}catch(n){}else e=c(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function f(e,n,r){n.queryText=r,n.query=u(r),e.removeOverlay(n.overlay,i(n.query)),n.overlay=t(n.query,i(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,i(n.query)))}function d(t,n,i,o){var l=r(t);if(l.query)return p(t,n);var c=t.getSelection()||l.lastQuery;if(i&&t.openDialog){var u=null,d=function(n,r){e.e_stop(r),n&&(n!=l.queryText&&(f(t,l,n),l.posFrom=l.posTo=t.getCursor()),u&&(u.style.opacity=1),p(t,r.shiftKey,function(e,n){var r;n.line<3&&document.querySelector&&(r=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>t.cursorCoords(n,"window").top&&((u=r).style.opacity=.4)}))};a(t,v,c,d,function(n,i){var o=e.keyMap[t.getOption("keyMap")][e.keyName(n)];"findNext"==o||"findPrev"==o?(e.e_stop(n),f(t,r(t),i),t.execCommand(o)):"find"!=o&&"findPersistent"!=o||(e.e_stop(n),d(i,n))}),o&&(f(t,l,c),p(t,n))}else s(t,v,"Search for:",c,function(e){e&&!l.query&&t.operation(function(){f(t,l,e),l.posFrom=l.posTo=t.getCursor(),p(t,n)})})}function p(t,n,i){t.operation(function(){var a=r(t),s=o(t,a.query,n?a.posFrom:a.posTo);(s.find(n)||(s=o(t,a.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),s.find(n)))&&(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))})}function h(e){e.operation(function(){var t=r(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function m(e,t,n){e.operation(function(){for(var r=o(e,t);r.findNext();)if("string"!=typeof t){var i=e.getRange(r.from(),r.to()).match(t);r.replace(n.replace(/\$(\d)/g,function(e,t){return i[t]}))}else r.replace(n)})}function g(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||r(e).lastQuery,i=t?"Replace all:":"Replace:";s(e,i+y,i,n,function(n){n&&(n=u(n),s(e,b,"Replace with:","",function(r){if(r=c(r),t)m(e,n,r);else{h(e);var i=o(e,n,e.getCursor("from")),a=function(){var t,c=i.from();!(t=i.findNext())&&(i=o(e,n),!(t=i.findNext())||c&&i.from().line==c.line&&i.from().ch==c.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,k,"Replace?",[function(){s(t)},a,function(){m(e,n,r)}]))},s=function(e){i.replace("string"==typeof n?r:r.replace(/\$(\d)/g,function(t,n){return e[n]})),a()};a()}}))})}}var v='Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',y=' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',b='With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',k="Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>";e.commands.find=function(e){h(e),d(e)},e.commands.findPersistent=function(e){h(e),d(e,!1,!0)},e.commands.findPersistentNext=function(e){d(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){d(e,!0,!0,!0)},e.commands.findNext=d,e.commands.findPrev=function(e){d(e,!0)},e.commands.clearSearch=h,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function n(e,t){var n=Number(t);return/^[-+]/.test(t)?e.getCursor().line+n:n-1}var r='Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>';e.commands.jumpToLine=function(e){var i=e.getCursor();t(e,r,"Jump to line:",i.line+1+":"+i.ch,function(t){if(t){var r;if(r=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(n(e,r[1]),Number(r[2]));else if(r=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(r[1])/100);/^[-+]/.test(r[1])&&(o=i.line+o+1),e.setCursor(o-1,i.ch)}else(r=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(n(e,r[1]),i.ch)}})},e.keyMap["default"]["Alt-G"]="jumpToLine"}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r){this.cm=e,this.options=r;var i={listenForChanges:!1};for(var o in r)i[o]=r[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=n,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function n(e,t,n){return e<=t?e:Math.max(t,e+n)}e.defineExtension("showMatchesOnScrollbar",function(e,n,r){return"string"==typeof r&&(r={className:r}),r||(r={}),new t(this,e,n,r)});var r=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t<this.matches.length;t++){var n=this.matches[t];if(n.from.line>=this.gap.to)break;n.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||r;i.findNext();){var n={from:i.from(),to:i.to()};if(n.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,n),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var r=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(n(this.gap.from,r,o),t.from.line),this.gap.to=Math.max(n(this.gap.to,r,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;a<this.matches.length;a++){var s=this.matches[a],l=n(s.from.line,r,o);l!=s.from.line&&(s.from=e.Pos(l,s.from.ch));var c=n(s.to.line,r,o);c!=s.to.line&&(s.to=e.Pos(c,s.to.ch))}clearTimeout(this.update);var u=this;this.update=setTimeout(function(){u.updateAfterChange()},250)},t.prototype.updateAfterChange=function(){this.findMatches(),this.annotation.update(this.matches)},t.prototype.clear=function(){this.cm.off("change",this.changeHandler),this.annotation.clear()}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options={};for(var t in c)this.options[t]=(e&&e.hasOwnProperty(t)?e:c)[t];this.overlay=this.timeout=null,this.matchesonscroll=null}function n(e){var t=e.state.matchHighlighter;clearTimeout(t.timeout),t.timeout=setTimeout(function(){o(e)},t.options.delay)}function r(e,t,n,r){var i=e.state.matchHighlighter;if(e.addOverlay(i.overlay=l(t,n,r)),i.options.annotateScrollbar&&e.showMatchesOnScrollbar){var o=n?new RegExp("\\b"+t+"\\b"):t;i.matchesonscroll=e.showMatchesOnScrollbar(o,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function i(e){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null,t.matchesonscroll&&(t.matchesonscroll.clear(),t.matchesonscroll=null))}function o(e){e.operation(function(){var t=e.state.matchHighlighter;if(i(e),!e.somethingSelected()&&t.options.showToken){for(var n=t.options.showToken===!0?/[\w$]/:t.options.showToken,o=e.getCursor(),s=e.getLine(o.line),l=o.ch,c=l;l&&n.test(s.charAt(l-1));)--l;for(;c<s.length&&n.test(s.charAt(c));)++c;return void(l<c&&r(e,s.slice(l,c),n,t.options.style))}var u=e.getCursor("from"),f=e.getCursor("to");if(u.line==f.line&&(!t.options.wordsOnly||a(e,u,f))){var d=e.getRange(u,f);t.options.trim&&(d=d.replace(/^\s+|\s+$/g,"")),d.length>=t.options.minChars&&r(e,d,!1,t.options.style)}})}function a(e,t,n){var r=e.getRange(t,n);if(null!==r.match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(n.ch<e.getLine(t.line).length){var i={line:n.line,ch:n.ch+1},o=e.getRange(n,i);if(null===o.match(/\W/))return!1}return!0}return!1}function s(e,t){return!(e.start&&t.test(e.string.charAt(e.start-1))||e.pos!=e.string.length&&t.test(e.string.charAt(e.pos)))}function l(e,t,n){return{token:function(r){return!r.match(e)||t&&!s(r,t)?(r.next(),void(r.skipTo(e.charAt(0))||r.skipToEnd())):n}}}var c={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};e.defineOption("highlightSelectionMatches",!1,function(r,a,s){s&&s!=e.Init&&(i(r),clearTimeout(r.state.matchHighlighter.timeout),r.state.matchHighlighter=null,r.off("cursorActivity",n)),a&&(r.state.matchHighlighter=new t(a),o(r),r.on("cursorActivity",n))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n,r){function i(t){var n=e.wheelEventPixels(t)["horizontal"==o.orientation?"x":"y"],r=o.pos;o.moveTo(o.pos+n),o.pos!=r&&e.e_preventDefault(t)}this.orientation=n,this.scroll=r,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=t+"-"+n,this.inner=this.node.appendChild(document.createElement("div"));var o=this;e.on(this.inner,"mousedown",function(t){function n(){e.off(document,"mousemove",r),e.off(document,"mouseup",n)}function r(e){return 1!=e.which?n():void o.moveTo(s+(e[i]-a)*(o.total/o.size))}if(1==t.which){e.e_preventDefault(t);var i="horizontal"==o.orientation?"pageX":"pageY",a=t[i],s=o.pos;e.on(document,"mousemove",r),e.on(document,"mouseup",n)}}),e.on(this.node,"click",function(t){e.e_preventDefault(t);var n,r=o.inner.getBoundingClientRect();n="horizontal"==o.orientation?t.clientX<r.left?-1:t.clientX>r.right?1:0:t.clientY<r.top?-1:t.clientY>r.bottom?1:0,o.moveTo(o.pos+n*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function n(e,n,r){this.addClass=e,this.horiz=new t(e,"horizontal",r),n(this.horiz.node),this.vert=new t(e,"vertical",r),n(this.vert.node),this.width=null}t.prototype.setPos=function(e,t){return e<0&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),!(!t&&e==this.pos)&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},t.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};var r=10;t.prototype.update=function(e,t,n){var i=this.screen!=t||this.total!=e||this.size!=n;i&&(this.screen=t,this.total=e,this.size=n);var o=this.screen*(this.size/this.total);o<r&&(this.size-=r-o,o=r),this.inner.style["horizontal"==this.orientation?"width":"height"]=o+"px",this.setPos(this.pos,i)},n.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var n=this.width||0,r=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=r?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(r?n:0)),this.vert.node.style.bottom=r?n+"px":"0"),r&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?n:0)-e.barLeft),this.horiz.node.style.right=i?n+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?n:0,bottom:r?n:0}},n.prototype.setScrollTop=function(e){this.vert.setPos(e)},n.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function n(e){clearTimeout(r.doRedraw),r.doRedraw=setTimeout(function(){r.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var r=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(r.doUpdate),r.doUpdate=setTimeout(function(){r.computeScale()&&n(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){n(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.getScrollerElement().scrollHeight;if(t!=this.hScale)return this.hScale=t,!0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(l!=e.line&&(l=e.line,c=n.getLineHandle(l)),a&&c.height>s)return n.charCoords(e,"local")[t?"top":"bottom"];var r=n.heightAtLine(c,"local");return r+(t?0:c.height)}e!==!1&&this.computeScale();var n=this.cm,r=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=n.getOption("lineWrapping"),s=a&&1.5*n.defaultTextHeight(),l=null,c=null;if(n.display.barWidth)for(var u,f=0;f<o.length;f++){for(var d=o[f],p=u||t(d.from,!0)*r,h=t(d.to,!1)*r;f<o.length-1&&(u=t(o[f+1].from,!0)*r,!(u>h+.9));)d=o[++f],h=t(d.to,!1)*r;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(1.5*n.display.barWidth,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className,d.id&&g.setAttribute("annotation-id",d.id)}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,r){this.cm=e,this.node=t,this.options=n,this.height=r,this.cleared=!1}function n(e){var t=e.getWrapperElement(),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r=parseInt(n.height),i=e.state.panels={setHeight:t.style.height,heightLeft:r,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(i.wrapper,t);var o=e.hasFocus();i.wrapper.appendChild(t),o&&e.focus(),e._setSize=e.setSize,null!=r&&(e.setSize=function(t,n){if(null==n)return this._setSize(t,n);if(i.setHeight=n,"number"!=typeof n){var o=/^(\d+\.?\d*)px$/.exec(n);o?n=Number(o[1]):(i.wrapper.style.height=n,n=i.wrapper.offsetHeight,i.wrapper.style.height="")}e._setSize(t,i.heightLeft+=n-r),r=n})}function r(e){var t=e.state.panels;e.state.panels=null;var n=e.getWrapperElement();t.wrapper.parentNode.replaceChild(n,t.wrapper),n.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}e.defineExtension("addPanel",function(e,r){r=r||{},this.state.panels||n(this);var i=this.state.panels,o=i.wrapper,a=this.getWrapperElement();r.after instanceof t&&!r.after.cleared?o.insertBefore(e,r.before.node.nextSibling):r.before instanceof t&&!r.before.cleared?o.insertBefore(e,r.before.node):r.replace instanceof t&&!r.replace.cleared?(o.insertBefore(e,r.replace.node),r.replace.clear()):"bottom"==r.position?o.appendChild(e):"before-bottom"==r.position?o.insertBefore(e,a.nextSibling):"after-top"==r.position?o.insertBefore(e,a):o.insertBefore(e,o.firstChild);var s=r&&r.height||e.offsetHeight;return this._setSize(null,i.heightLeft-=s),i.panels++,new t(this,e,r,s)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),e.wrapper.removeChild(this.node),0==--e.panels&&r(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,n=this.cm.state.panels;this.cm._setSize(null,n.height+=t-this.height),this.height=t}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.className="CodeMirror-placeholder";var r=e.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r)),n.appendChild(r),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){o(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=o(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(n,o,a){var s=a&&a!=e.Init;if(o&&!s)n.on("blur",r),n.on("change",i),n.on("swapDoc",i),i(n);else if(!o&&s){n.off("blur",r),n.off("change",i),n.off("swapDoc",i),t(n);var l=n.getWrapperElement();l.className=l.className.replace(" CodeMirror-empty","")}o&&!n.hasFocus()&&r(n)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function n(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var n=e.state.fullScreenRestore;t.style.width=n.width,t.style.height=n.height,window.scrollTo(n.scrollLeft,n.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(r,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(r):n(r))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r){function i(){t.display.wrapper.offsetHeight?(n(t,r),t.display.lastWrapHeight!=t.display.wrapper.clientHeight&&t.refresh()):r.timeout=setTimeout(i,r.delay)}r.timeout=setTimeout(i,r.delay),r.hurry=function(){clearTimeout(r.timeout),r.timeout=setTimeout(i,50)},e.on(window,"mouseup",r.hurry),e.on(window,"keyup",r.hurry)}function n(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,function(e,r){e.state.autoRefresh&&(n(e,e.state.autoRefresh),e.state.autoRefresh=null),r&&0==e.display.wrapper.offsetHeight&&t(e,e.state.autoRefresh={delay:r.delay||250})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n){var r,i=e.getWrapperElement();return r=i.appendChild(document.createElement("div")),n?r.className="CodeMirror-dialog CodeMirror-dialog-bottom":r.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(r,i,o){function a(e){if("string"==typeof e)f.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),u.focus(),o.onClose&&o.onClose(l)}}o||(o={}),n(this,null);var s,l=t(this,r,o.bottom),c=!1,u=this,f=l.getElementsByTagName("input")[0];return f?(f.focus(),o.value&&(f.value=o.value,o.selectValueOnOpen!==!1&&f.select()),o.onInput&&e.on(f,"input",function(e){o.onInput(e,f.value,a)}),o.onKeyUp&&e.on(f,"keyup",function(e){o.onKeyUp(e,f.value,a)}),e.on(f,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,f.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(f.blur(),e.e_stop(t),a()),13==t.keyCode&&i(f.value,t))}),o.closeOnBlur!==!1&&e.on(f,"blur",a)):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(r,i,o){function a(){c||(c=!0,s.parentNode.removeChild(s),u.focus())}n(this,null);var s=t(this,r,o&&o.bottom),l=s.getElementsByTagName("button"),c=!1,u=this,f=1;l[0].focus();for(var d=0;d<l.length;++d){var p=l[d];!function(t){e.on(p,"click",function(n){e.e_preventDefault(n),a(),t&&t(u)})}(i[d]),e.on(p,"blur",function(){--f,setTimeout(function(){f<=0&&a()},200)}),e.on(p,"focus",function(){++f})}}),e.defineExtension("openNotification",function(r,i){function o(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}n(this,o);var a,s=t(this,r,i&&i.bottom),l=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t), +o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,i){var o=e.getLineHandle(t.line),l=t.ch-1,c=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(l==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,l+1)),d=n(e,a(t.line,l+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,l),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:u>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=f;d+=n){var p=e.getLine(d);if(p){var h=n>0?0:p.length-1,m=n>0?p.length:-1;if(!(p.length>o))for(d==t.line&&(h=t.ch-(n<0?1:0));h!=m;h+=n){var g=p.charAt(h);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(d,h+1))==r)){var v=s[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(d,h),ch:g};c.pop()}}}}}return d-n!=(n>0?e.lastLine():e.firstLine())&&null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=e.listSelections(),c=0;c<l.length;c++){var u=l[c].empty()&&t(e,l[c].head,!1,r);if(u&&e.getLine(u.from.line).length<=i){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=i&&s.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:f}))}}if(s.length){o&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!n)return d;setTimeout(d,800)}}function i(e){e.operation(function(){l&&(l(),l=null),l=r(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.off("cursorActivity",i),l&&(l(),l=null)),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return t(this,e,n,r)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:f[t]}function n(e){return function(t){return s(t,e)}}function r(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function i(n){var i=r(n);if(!i||n.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=n.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(n,a[s].head);if(!l||o.indexOf(l)%2!=0)return e.Pass}for(var s=a.length-1;s>=0;s--){var u=a[s].head;n.replaceRange("",d(u.line,u.ch-1),d(u.line,u.ch+1),"+delete")}}function o(n){var i=r(n),o=i&&t(i,"explode");if(!o||n.getOption("disableInput"))return e.Pass;for(var a=n.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(n,a[s].head);if(!l||o.indexOf(l)%2!=0)return e.Pass}n.operation(function(){n.replaceSelection("\n\n",null),n.execCommand("goCharLeft"),a=n.listSelections();for(var e=0;e<a.length;e++){var t=a[e].head.line;n.indentLine(t,null,!0),n.indentLine(t+1,null,!0)}})}function a(t){var n=e.cmpPos(t.anchor,t.head)>0;return{anchor:new d(t.anchor.line,t.anchor.ch+(n?-1:1)),head:new d(t.head.line,t.head.ch+(n?1:-1))}}function s(n,i){var o=r(n);if(!o||n.getOption("disableInput"))return e.Pass;var s=t(o,"pairs"),c=s.indexOf(i);if(c==-1)return e.Pass;for(var f,p=t(o,"triples"),h=s.charAt(c+1)==i,m=n.listSelections(),g=c%2==0,v=0;v<m.length;v++){var y,b=m[v],k=b.head,x=n.getRange(k,d(k.line,k.ch+1));if(g&&!b.empty())y="surround";else if(!h&&g||x!=i)if(h&&k.ch>1&&p.indexOf(i)>=0&&n.getRange(d(k.line,k.ch-2),k)==i+i&&(k.ch<=2||n.getRange(d(k.line,k.ch-3),d(k.line,k.ch-2))!=i))y="addFour";else if(h){if(e.isWordChar(x)||!u(n,k,i))return e.Pass;y="both"}else{if(!g||n.getLine(k.line).length!=k.ch&&!l(x,s)&&!/\s/.test(x))return e.Pass;y="both"}else y=p.indexOf(i)>=0&&n.getRange(k,d(k.line,k.ch+3))==i+i+i?"skipThree":"skip";if(f){if(f!=y)return e.Pass}else f=y}var w=c%2?s.charAt(c-1):i,_=c%2?i:s.charAt(c+1);n.operation(function(){if("skip"==f)n.execCommand("goCharRight");else if("skipThree"==f)for(var e=0;e<3;e++)n.execCommand("goCharRight");else if("surround"==f){for(var t=n.getSelections(),e=0;e<t.length;e++)t[e]=w+t[e]+_;n.replaceSelections(t,"around"),t=n.listSelections().slice();for(var e=0;e<t.length;e++)t[e]=a(t[e]);n.setSelections(t)}else"both"==f?(n.replaceSelection(w+_,null),n.triggerElectric(w+_),n.execCommand("goCharLeft")):"addFour"==f&&(n.replaceSelection(w+w+w+w,"before"),n.execCommand("goCharRight"))})}function l(e,t){var n=t.lastIndexOf(e);return n>-1&&n%2==1}function c(e,t){var n=e.getRange(d(t.line,t.ch-1),d(t.line,t.ch+1));return 2==n.length?n:null}function u(t,n,r){var i=t.getLine(n.line),o=t.getTokenAt(n);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(a.pos=a.start=o.start;;){var s=t.getMode().token(a,o.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(s);a.start=a.pos}}var f={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},d=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(h))});for(var p=f.pairs+"`",h={Backspace:i,Enter:o},m=0;m<p.length;m++)h["'"+p.charAt(m)+"'"]=n(p.charAt(m))}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function n(n){n.state.failedTagMatch=!1,n.operation(function(){if(t(n),!n.somethingSelected()){var r=n.getCursor(),i=n.getViewport();i.from=Math.min(i.from,r.line),i.to=Math.max(r.line+1,i.to);var o=e.findMatchingTag(n,r,i);if(o){if(n.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(n.state.tagHit=n.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var s="close"==o.at?o.open:o.close;s?n.state.tagOther=n.markText(s.from,s.to,{className:"CodeMirror-matchingtag"}):n.state.failedTagMatch=!0}}})}function r(e){e.state.failedTagMatch&&n(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",n),i.off("viewportChange",r),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",n),i.on("viewportChange",r),n(i))}),e.commands.toMatchingTag=function(t){var n=e.findMatchingTag(t,t.getCursor());if(n){var r="close"==n.at?n.open:n.close;r&&t.extendSelection(r.to,r.from)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n=t.listSelections(),r=[],l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var c=n[l].head,u=t.getTokenAt(c),f=e.innerMode(t.getMode(),u.state),d=f.state;if("xml"!=f.mode.name||!d.tagName)return e.Pass;var p=t.getOption("autoCloseTags"),h="html"==f.mode.configuration,m="object"==typeof p&&p.dontCloseTags||h&&a,g="object"==typeof p&&p.indentTags||h&&s,v=d.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==d.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,d,!0))return e.Pass;var b=g&&i(g,y)>-1;r[l]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=n.length-1;l>=0;l--){var k=r[l];t.replaceRange(k.text,n[l].head,n[l].anchor,"+insert");var x=t.listSelections().slice(0);x[l]={head:k.newPos,anchor:k.newPos},t.setSelections(x),k.indent&&(t.indentLine(k.newPos.line,null,!0),t.indentLine(k.newPos.line+1,null,!0))}}function n(t,n){for(var r=t.listSelections(),i=[],a=n?"/":"</",s=0;s<r.length;s++){if(!r[s].empty())return e.Pass;var l=r[s].head,c=t.getTokenAt(l),u=e.innerMode(t.getMode(),c.state),f=u.state;if(n&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=l.ch-1))return e.Pass;var d;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)d=a+"script";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;d=a+"style"}else{if(!f.context||!f.context.tagName||o(t,f.context.tagName,l,f))return e.Pass;d=a+f.context.tagName}">"!=t.getLine(l.line).charAt(c.end)&&(d+=">"),i[s]=d}t.replaceSelections(i),r=t.listSelections();for(var s=0;s<r.length;s++)(s==r.length-1||r[s].head.line<r[s+1].head.line)&&t.indentLine(r[s].head.line)}function r(t){return t.getOption("disableInput")?e.Pass:n(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function o(t,n,r,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,r.line+500),s=e.scanForClosingTag(t,r,null,a);if(!s||s.tag!=n)return!1;for(var l=i.context,c=o?1:0;l&&l.tagName==n;l=l.prev)++c;r=s.to;for(var u=1;u<c;u++){var f=e.scanForClosingTag(t,r,null,a);if(!f||f.tag!=n)return!1;r=f.to}return!0}e.defineOption("autoCloseTags",!1,function(n,i,o){if(o!=e.Init&&o&&n.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return r(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),n.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/,n=/^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],s=0;s<o.length;s++){var l=o[s].head,c=i.getStateAfter(l.line),u=c.list!==!1,f=0!==c.quote,d=i.getLine(l.line),p=t.exec(d);if(!o[s].empty()||!u&&!f||!p)return void i.execCommand("newlineAndIndent");if(n.test(d))i.replaceRange("",{line:l.line,ch:0},{line:l.line,ch:l.ch+1}),a[s]="\n";else{var h=p[1],m=p[5],g=r.test(p[2])||p[2].indexOf(">")>=0?p[2]:parseInt(p[3],10)+1+p[4];m=m.replace("[x]","[ ]"),a[s]="\n"+h+g+m}}i.replaceSelections(a)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(i);return t==-1?0:t}function n(e,t,n){return/\bstring\b/.test(e.getTokenTypeAt(o(t.line,0)))&&!/^[\'\"`]/.test(n)}var r={},i=/[^\s\u00a0]/,o=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=r);for(var t=this,n=1/0,i=this.listSelections(),a=null,s=i.length-1;s>=0;s--){var l=i[s].from(),c=i[s].to();l.line>=n||(c.line>=n&&(c=o(n,0)),n=l.line,null==a?t.uncomment(l,c,e)?a="un":(t.lineComment(l,c,e),a="line"):"un"==a?t.uncomment(l,c,e):t.lineComment(l,c,e))}}),e.defineExtension("lineComment",function(e,a,s){s||(s=r);var l=this,c=l.getModeAt(e),u=l.getLine(e.line);if(null!=u&&!n(l,e,u)){var f=s.lineComment||c.lineComment;if(!f)return void((s.blockCommentStart||c.blockCommentStart)&&(s.fullLines=!0,l.blockComment(e,a,s)));var d=Math.min(0!=a.ch||a.line==e.line?a.line+1:a.line,l.lastLine()+1),p=null==s.padding?" ":s.padding,h=s.commentBlankLines||e.line==a.line;l.operation(function(){if(s.indent){for(var n=null,r=e.line;r<d;++r){var a=l.getLine(r),c=a.slice(0,t(a));(null==n||n.length>c.length)&&(n=c)}for(var r=e.line;r<d;++r){var a=l.getLine(r),u=n.length;(h||i.test(a))&&(a.slice(0,u)!=n&&(u=t(a)),l.replaceRange(n+f+p,o(r,0),o(r,u)))}}else for(var r=e.line;r<d;++r)(h||i.test(l.getLine(r)))&&l.replaceRange(f+p,o(r,0))})}}),e.defineExtension("blockComment",function(e,t,n){n||(n=r);var a=this,s=a.getModeAt(e),l=n.blockCommentStart||s.blockCommentStart,c=n.blockCommentEnd||s.blockCommentEnd;if(!l||!c)return void((n.lineComment||s.lineComment)&&0!=n.fullLines&&a.lineComment(e,t,n));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&i.test(a.getLine(u))&&--u;var f=null==n.padding?" ":n.padding;e.line>u||a.operation(function(){if(0!=n.fullLines){var r=i.test(a.getLine(u));a.replaceRange(f+c,o(u)),a.replaceRange(l+f,o(e.line,0));var d=n.blockCommentLead||s.blockCommentLead;if(null!=d)for(var p=e.line+1;p<=u;++p)(p!=u||r)&&a.replaceRange(d+f,o(p,0))}else a.replaceRange(c,t),a.replaceRange(l,e)})}),e.defineExtension("uncomment",function(e,t,n){n||(n=r);var a,s=this,l=s.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,s.lastLine()),u=Math.min(e.line,c),f=n.lineComment||l.lineComment,d=[],p=null==n.padding?" ":n.padding;e:if(f){for(var h=u;h<=c;++h){var m=s.getLine(h),g=m.indexOf(f);if(g>-1&&!/comment/.test(s.getTokenTypeAt(o(h,g+1)))&&(g=-1),g==-1&&(h!=c||h==u)&&i.test(m))break e;if(g>-1&&i.test(m.slice(0,g)))break e;d.push(m)}if(s.operation(function(){for(var e=u;e<=c;++e){var t=d[e-u],n=t.indexOf(f),r=n+f.length;n<0||(t.slice(r,r+p.length)==p&&(r+=p.length),a=!0,s.replaceRange("",o(e,n),o(e,r)))}}),a)return!0}var v=n.blockCommentStart||l.blockCommentStart,y=n.blockCommentEnd||l.blockCommentEnd;if(!v||!y)return!1;var b=n.blockCommentLead||l.blockCommentLead,k=s.getLine(u),x=c==u?k:s.getLine(c),w=k.indexOf(v),_=x.lastIndexOf(y);if(_==-1&&u!=c&&(x=s.getLine(--c),_=x.lastIndexOf(y)),w==-1||_==-1||!/comment/.test(s.getTokenTypeAt(o(u,w+1)))||!/comment/.test(s.getTokenTypeAt(o(c,_+1))))return!1;var C=k.lastIndexOf(v,e.ch),S=C==-1?-1:k.slice(0,e.ch).indexOf(y,C+v.length);if(C!=-1&&S!=-1&&S+y.length!=e.ch)return!1;S=x.indexOf(y,t.ch);var M=x.slice(t.ch).lastIndexOf(v,S-t.ch);return C=S==-1||M==-1?-1:t.ch+M,(S==-1||C==-1||C==t.ch)&&(s.operation(function(){s.replaceRange("",o(c,_-(p&&x.slice(_-p.length,_)==p?p.length:0)),o(c,_+y.length));var e=w+v.length;if(p&&k.slice(e,e+p.length)==p&&(e+=p.length),s.replaceRange("",o(u,w),o(u,e)),b)for(var t=u+1;t<=c;++t){var n=s.getLine(t),r=n.indexOf(b);if(r!=-1&&!i.test(n.slice(0,r))){var a=r+b.length;p&&n.slice(a,a+p.length)==p&&(a+=p.length),s.replaceRange("",o(t,r),o(t,a))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r,i=t.listSelections(),o=[],a=0;a<i.length;a++){var s=i[a].head,l=t.getTokenAt(s);if("comment"!=l.type)return e.Pass;var c=e.innerMode(t.getMode(),l.state).mode;if(r){if(r!=c)return e.Pass}else r=c;var u=null;if(r.blockCommentStart&&r.blockCommentContinue){var f,d=l.string.indexOf(r.blockCommentEnd),p=t.getRange(e.Pos(s.line,0),e.Pos(s.line,l.end));if(d!=-1&&d==l.string.length-r.blockCommentEnd.length&&s.ch>=d);else if(0==l.string.indexOf(r.blockCommentStart)){if(u=p.slice(0,l.start),!/^\s*$/.test(u)){u="";for(var h=0;h<l.start;++h)u+=" "}}else(f=p.indexOf(r.blockCommentContinue))!=-1&&f+r.blockCommentContinue.length>l.start&&/^\s*$/.test(p.slice(0,f))&&(u=p.slice(0,f));null!=u&&(u+=r.blockCommentContinue)}if(null==u&&r.lineComment&&n(t)){var m=t.getLine(s.line),f=m.indexOf(r.lineComment);f>-1&&(u=m.slice(0,f),/\S/.test(u)?u=null:u+=r.lineComment+m.slice(f+r.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[a]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+insert")})}function n(e){var t=e.getOption("continueComments");return!t||"object"!=typeof t||t.continueLineComment!==!1}for(var r=["clike","css","javascript"],i=0;i<r.length;++i)e.extendMode(r[i],{blockCommentContinue:" * "});e.defineOption("continueComments",null,function(n,r,i){if(i&&i!=e.Init&&n.removeKeyMap("continueComment"),r){var o="Enter";"string"==typeof r?o=r:"object"==typeof r&&r.key&&(o=r.key);var a={name:"continueComment"};a[o]=t,n.addKeyMap(a)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){for(var r=n.paragraphStart||e.getHelper(t,"paragraphStart"),i=t.line,o=e.firstLine();i>o;--i){var a=e.getLine(i);if(r&&r.test(a))break;if(!/\S/.test(a)){++i;break}}for(var s=n.paragraphEnd||e.getHelper(t,"paragraphEnd"),l=t.line+1,c=e.lastLine();l<=c;++l){var a=e.getLine(l);if(s&&s.test(a)){++l;break}if(!/\S/.test(a))break}return{from:i,to:l}}function n(e,t,n,r){for(var i=t;i<e.length&&" "==e.charAt(i);)i++;for(;i>0&&!n.test(e.slice(i-1,i+1));--i);for(var o=!0;;o=!1){var a=i;if(r)for(;" "==e.charAt(a-1);)--a;if(0!=a||!o)return{from:a,to:i};i=t}}function r(t,r,o,a){r=t.clipPos(r),o=t.clipPos(o);var s=a.column||80,l=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],f="",d=r.line,p=t.getRange(r,o,!1);if(!p.length)return null;for(var h=p[0].match(/^[ \t]*/)[0],m=0;m<p.length;++m){var g=p[m],v=f.length,y=0;f&&g&&!l.test(f.charAt(f.length-1)+g.charAt(0))&&(f+=" ",y=1);var b="";if(m&&(b=g.match(/^\s*/)[0],g=g.slice(b.length)),f+=g,m){var k=f.length>s&&h==b&&n(f,s,l,c);k&&k.from==v&&k.to==v+y?(f=h+g,++d):u.push({text:[y?" ":""],from:i(d,v),to:i(d+1,b.length)})}for(;f.length>s;){var x=n(f,s,l,c);u.push({text:["",h],from:i(d,x.from),to:i(d,x.to)}),f=h+f.slice(x.to),++d}}return u.length&&t.operation(function(){for(var n=0;n<u.length;++n){var r=u[n];(r.text||e.cmpPos(r.from,r.to))&&t.replaceRange(r.text,r.from,r.to)}}),u.length?{from:u[0].from,to:e.changeEnd(u[u.length-1])}:null}var i=e.Pos;e.defineExtension("wrapParagraph",function(e,n){n=n||{},e||(e=this.getCursor());var o=t(this,e,n);return r(this,i(o.from,0),i(o.to-1),n)}),e.commands.wrapLines=function(e){e.operation(function(){for(var n=e.listSelections(),o=e.lastLine()+1,a=n.length-1;a>=0;a--){var s,l=n[a];if(l.empty()){var c=t(e,l.head,{});s={from:i(c.from,0),to:i(c.to-1)}}else s={from:l.from(),to:l.to()};s.to.line>=o||(o=s.from.line,r(e,s.from,s.to,{}))}})},e.defineExtension("wrapRange",function(e,t,n){return r(this,e,t,n||{})}),e.defineExtension("wrapParagraphsInRange",function(e,n,o){o=o||{};for(var a=this,s=[],l=e.line;l<=n.line;){var c=t(a,i(l,0),o);s.push(c),l=c.to}var u=!1;return s.length&&a.operation(function(){for(var e=s.length-1;e>=0;--e)u=u||r(a,i(s[e].from,0),i(s[e].to-1),o)}),u})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function s(e){var n=l(t,i);if(!n||n.to.line-n.from.line<c)return null;for(var r=t.findMarksAt(n.from),o=0;o<r.length;++o)if(r[o].__isFold&&"fold"!==a){if(!e)return null;n.cleared=!0,r[o].clear()}return n}if(o&&o.call){var l=o;o=null}else var l=r(t,o,"rangeFinder");"number"==typeof i&&(i=e.Pos(i,0));var c=r(t,o,"minFoldSize"),u=s(!0);if(r(t,o,"scanUp"))for(;!u&&i.line>t.firstLine();)i=e.Pos(i.line-1,0),u=s(!1);if(u&&!u.cleared&&"unfold"!==a){var f=n(t,o);e.on(f,"mousedown",function(t){d.clear(),e.e_preventDefault(t)});var d=t.markText(u.from,u.to,{replacedWith:f,clearOnEnter:r(t,o,"clearOnEnter"),__isFold:!0});d.on("clear",function(n,r){e.signal(t,"unfold",t,n,r)}),e.signal(t,"fold",t,u.from,u.to)}}function n(e,t){var n=r(e,t,"widget");if("string"==typeof n){var i=document.createTextNode(n);n=document.createElement("span"),n.appendChild(i),n.className="CodeMirror-foldmarker"}return n}function r(e,t,n){if(t&&void 0!==t[n])return t[n];var r=e.options.foldOptions;return r&&void 0!==r[n]?r[n]:i[n]}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,r){t(this,e,n,r)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n<t.length;++n)if(t[n].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();n<=r;n++)t.foldCode(e.Pos(n,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();n<=r;n++)t.foldCode(e.Pos(n,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var r=0;r<e.length;++r){var i=e[r](t,n);if(i)return i}}}),e.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),r=0;r<n.length;r++){var i=n[r](e,t);if(i)return i}});var i={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return r(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","brace",function(t,n){function r(r){for(var s=n.ch,l=0;;){var c=s<=0?-1:a.lastIndexOf(r,s-1);if(c!=-1){if(1==l&&c<n.ch)break;if(i=t.getTokenTypeAt(e.Pos(o,c+1)),!/^(comment|string)/.test(i))return c+1;s=c-1}else{if(1==l)break;l=1,s=a.length}}}var i,o=n.line,a=t.getLine(o),s="{",l="}",c=r("{");if(null==c&&(s="[",l="]",c=r("[")),null!=c){var u,f,d=1,p=t.lastLine();e:for(var h=o;h<=p;++h)for(var m=t.getLine(h),g=h==o?c:0;;){var v=m.indexOf(s,g),y=m.indexOf(l,g);if(v<0&&(v=m.length),y<0&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(h,g+1))==i)if(g==v)++d;else if(!--d){u=h,f=g;break e}++g}if(null!=u&&(o!=u||f!=c))return{from:e.Pos(o,c),to:e.Pos(u,f)}}}),e.registerHelper("fold","import",function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(t.lastLine(),n+10);i<=o;++i){var a=t.getLine(i),s=a.indexOf(";");if(s!=-1)return{startCh:r.end,end:e.Pos(i,s)}}}var i,o=n.line,a=r(o);if(!a||r(o-1)||(i=r(o-2))&&i.end.line==o-1)return null;for(var s=a.end;;){var l=r(s.line+1);if(null==l)break;s=l.end}return{from:t.clipPos(e.Pos(o,a.startCh+1)),to:s}}),e.registerHelper("fold","include",function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));return/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var i=n.line,o=r(i);if(null==o||null!=r(i-1))return null;for(var a=i;;){var s=r(a+1);if(null==s)break;++a}return{from:e.Pos(i,o+1),to:t.clipPos(e.Pos(a))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function n(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function r(e,t){for(var n=e.findMarks(f(t,0),f(t+1,0)),r=0;r<n.length;++r)if(n[r].__isFold&&n[r].find().from.line==t)return n[r]}function i(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function o(e,t,n){var o=e.state.foldGutter.options,a=t,s=e.foldOption(o,"minFoldSize"),l=e.foldOption(o,"rangeFinder");e.eachLine(t,n,function(t){var n=null;if(r(e,a))n=i(o.indicatorFolded);else{var c=f(a,0),u=l&&l(e,c);u&&u.to.line-u.from.line>=s&&(n=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,n),++a})}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){o(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function s(e,t,n){var i=e.state.foldGutter;if(i){var o=i.options;if(n==o.gutter){var a=r(e,t);a?a.clear():e.foldCode(f(t,0),o.rangeFinder)}}}function l(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},n.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?a(e):e.operation(function(){n.from<t.from&&(o(e,n.from,t.from),t.from=n.from),n.to>t.to&&(o(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function u(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&r<n.to&&o(e,r,r+1)}}e.defineOption("foldGutter",!1,function(r,i,o){o&&o!=e.Init&&(r.clearGutter(r.state.foldGutter.options.gutter),r.state.foldGutter=null,r.off("gutterClick",s),r.off("change",l),r.off("viewportChange",c),r.off("fold",u),r.off("unfold",u),r.off("swapDoc",l)),i&&(r.state.foldGutter=new t(n(i)),a(r),r.on("gutterClick",s),r.on("change",l),r.on("viewportChange",c),r.on("fold",u),r.on("unfold",u),r.on("swapDoc",l))});var f=e.Pos}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(t,n){function r(n){var r=t.getTokenTypeAt(e.Pos(n,0));return r&&/\bheader\b/.test(r)}function i(e,t,n){var i=t&&t.match(/^#+/);return i&&r(e)?i[0].length:(i=n&&n.match(/^[=\-]+\s*$/),i&&r(e+1)?"="==n[0]?1:2:o)}var o=100,a=t.getLine(n.line),s=t.getLine(n.line+1),l=i(n.line,a,s);if(l!==o){for(var c=t.lastLine(),u=n.line,f=t.getLine(u+2);u<c&&!(i(u+1,s,f)<=l);)++u,s=f,f=t.getLine(u+2);return{from:e.Pos(n.line,a.length),to:e.Pos(u,t.getLine(u).length)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function n(e,t,n,r){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=r?r.from:e.firstLine(),this.max=r?r.to-1:e.lastLine()}function r(e,t){var n=e.cm.getTokenTypeAt(d(e.line,t));return n&&/\btag\b/.test(n)}function i(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function o(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(t==-1){if(i(e))continue;return}{if(r(e,t+1)){var n=e.text.lastIndexOf("/",t),o=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function s(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(t==-1){if(o(e))continue;return}if(r(e,t+1)){m.lastIndex=t,e.ch=t;var n=m.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function l(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(i(e))continue;return}{if(r(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(t==-1){if(o(e))continue;return}{if(r(e,t+1)){var n=e.text.lastIndexOf("/",t),i=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var n=[];;){var r,i=l(e),o=e.line,s=e.ch-(i?i[0].length:0);if(!i||!(r=a(e)))return;if("selfClose"!=r)if(i[1]){for(var c=n.length-1;c>=0;--c)if(n[c]==i[2]){n.length=c;break}if(c<0&&(!t||t==i[2]))return{tag:i[2],from:d(o,s),to:d(e.line,e.ch)}}else n.push(i[2])}}function f(e,t){for(var n=[];;){var r=c(e);if(!r)return;if("selfClose"!=r){var i=e.line,o=e.ch,a=s(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var l=n.length-1;l>=0;--l)if(n[l]==a[2]){n.length=l;break}if(l<0&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(i,o)}}}else s(e)}}var d=e.Pos,p="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",h=p+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+p+"]["+h+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var r=new n(e,t.line,0);;){var i,o=l(r);if(!o||r.line!=t.line||!(i=a(r)))return;if(!o[1]&&"selfClose"!=i){var s=d(r.line,r.ch),c=u(r,o[2]);return c&&{from:s,to:c.from}}}}),e.findMatchingTag=function(e,r,i){var o=new n(e,r.line,r.ch,i);if(o.text.indexOf(">")!=-1||o.text.indexOf("<")!=-1){var l=a(o),c=l&&d(o.line,o.ch),p=l&&s(o);if(l&&p&&!(t(o,r)>0)){var h={from:d(o.line,o.ch),to:c,tag:p[2]};return"selfClose"==l?{open:h,close:null,at:"open"}:p[1]?{open:f(o,p[2]),close:h,at:"close"}:(o=new n(e,c.line,c.ch,i),{open:h,close:u(o,p[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,r){for(var i=new n(e,t.line,t.ch,r);;){var o=f(i);if(!o)break;var a=new n(e,t.line,t.ch,r),s=u(a,o.tag);if(s)return{open:o,close:s}}},e.scanForClosingTag=function(e,t,r,i){var o=new n(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,r)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(r,i){function o(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if("<"==r)return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(l("atom","]]>")):null:e.match("--")?n(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(M=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==r){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"), +i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=o,M=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return M="equals",null;if("<"==n){t.tokenize=o,t.state=p,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=s(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=o;break}n.next()}return e}}function c(e){return function(t,n){for(var r;null!=(r=t.next());){if("<"==r)return n.tokenize=c(e+1),n.tokenize(t,n);if(">"==r){if(1==e){n.tokenize=o;break}return n.tokenize=c(e-1),n.tokenize(t,n)}}return"meta"}}function u(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(_.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function d(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!_.contextGrabbers.hasOwnProperty(n)||!_.contextGrabbers[n].hasOwnProperty(t))return;f(e)}}function p(e,t,n){return"openTag"==e?(n.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,n){return"word"==e?(n.tagName=t.current(),L="tag",y):(L="error",h)}function m(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&_.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==r||_.matchClosing===!1?(L="tag",g):(L="tag error",v)}return L="error",v}function g(e,t,n){return"endTag"!=e?(L="error",g):(f(n),p)}function v(e,t,n){return L="error",g(e,t,n)}function y(e,t,n){if("word"==e)return L="attribute",b;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||_.autoSelfClosers.hasOwnProperty(r)?d(n,r):(d(n,r),n.context=new u(n,r,i==n.indented)),p}return L="error",y}function b(e,t,n){return"equals"==e?k:(_.allowMissing||(L="error"),y(e,t,n))}function k(e,t,n){return"string"==e?x:"word"==e&&_.allowUnquoted?(L="string",y):(L="error",y(e,t,n))}function x(e,t,n){return"string"==e?x:y(e,t,n)}var w=r.indentUnit,_={},C=i.htmlMode?t:n;for(var S in C)_[S]=C[S];for(var S in i)_[S]=i[S];var M,L;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;M=null;var n=t.tokenize(e,t);return(n||M)&&"comment"!=n&&(L=null,t.state=t.state(M||n,e,t),L&&(n="error"==L?n+" error":L)),n},indent:function(t,n,r){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return _.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+w*(_.multilineTagIndentFactor||1);if(_.alignCDATA&&/<!\[CDATA\[/.test(n))return 0;var s=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(s&&s[1])for(;i;){if(i.tagName==s[2]){i=i.prev;break}if(!_.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(s)for(;i;){var l=_.contextGrabbers[i.tagName];if(!l||!l.hasOwnProperty(s[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+w:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:_.htmlMode?"html":"xml",helperType:_.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,n){function r(n){if(e.findModeByName){var r=e.findModeByName(n);r&&(n=r.mime||r.mimes[0])}var i=e.getMode(t,n);return"null"==i.name?null:i}function i(e,t,n){return t.f=t.inline=n,n(e,t)}function o(e,t,n){return t.f=t.block=n,n(e,t)}function a(e){return!e||!/\S/.test(e.string)}function s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,w&&e.f==c&&(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function l(t,o){var s=t.sol(),l=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,l&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.indentation>0?o.list=null:o.list=!1);var f=null;if(o.indentationDiff>=4)return t.skipToEnd(),c||a(o.prevLine)?(o.indentation-=4,o.indentedCode=!0,_.code):null;if(t.eatSpace())return null;if((f=t.match(A))&&f[1].length<=6)return o.header=f[1].length,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,d(o);if(!(a(o.prevLine)||o.quote||l||c)&&(f=t.match(E)))return o.header="="==f[0].charAt(0)?1:2,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,d(o);if(t.eat(">"))return o.quote=s?1:o.quote+1,n.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),d(o);if("["===t.peek())return i(t,o,y);if(t.match(S,!0))return o.hr=!0,_.hr;if((a(o.prevLine)||l)&&(t.match(M,!1)||t.match(L,!1))){var p=null;for(t.match(M,!0)?p="ul":(t.match(L,!0),p="ol"),o.indentation=t.column()+t.current().length,o.list=!0;o.listStack&&t.column()<o.listStack[o.listStack.length-1];)o.listStack.pop();return o.listStack.push(o.indentation),n.taskLists&&t.match(T,!1)&&(o.taskList=!0),o.f=o.inline,n.highlightFormatting&&(o.formatting=["list","list-"+p]),d(o)}return n.fencedCodeBlocks&&(f=t.match(O,!0))?(o.fencedChars=f[1],o.localMode=r(f[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=u,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,d(o)):i(t,o,o.inline)}function c(t,n){var r=x.token(t,n.htmlState);if(!w){var i=e.innerMode(x,n.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||n.md_inside&&t.current().indexOf(">")>-1)&&(n.f=h,n.block=l,n.htmlState=null)}return r}function u(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=f,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),_.code)}function f(e,t){e.match(t.fencedChars),t.block=l,t.f=h,t.fencedChars=null,n.highlightFormatting&&(t.formatting="code-block"),t.code=1;var r=d(t);return t.code=0,r}function d(e){var t=[];if(e.formatting){t.push(_.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(_.formatting+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(_.formatting+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(_.formatting+"-"+e.formatting[r]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(_.linkHref,"url"):(e.strong&&t.push(_.strong),e.em&&t.push(_.em),e.strikethrough&&t.push(_.strikethrough),e.linkText&&t.push(_.linkText),e.code&&t.push(_.code),e.image&&t.push(_.image),e.imageAltText&&t.push(_.imageAltText,"link"),e.imageMarker&&t.push(_.imageMarker)),e.header&&t.push(_.header,_.header+"-"+e.header),e.quote&&(t.push(_.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(_.quote+"-"+e.quote):t.push(_.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(_.list2):t.push(_.list3):t.push(_.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function p(e,t){if(e.match(z,!0))return d(t)}function h(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,d(r);if(r.taskList){var a="x"!==t.match(T,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,d(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),d(r);var s=t.sol(),l=t.next();if(r.linkTitle){r.linkTitle=!1;var u=l;"("===l&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(f),!0))return _.linkHref}if("`"===l){var p=r.formatting;n.highlightFormatting&&(r.formatting="code"),t.eatWhile("`");var h=t.current().length;if(0==r.code)return r.code=h,d(r);if(h==r.code){var v=d(r);return r.code=0,v}return r.formatting=p,d(r)}if(r.code)return d(r);if("\\"===l&&(t.next(),n.highlightFormatting)){var y=d(r),b=_.formatting+"-escape";return y?y+" "+b:b}if("!"===l&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return r.imageMarker=!0,r.image=!0,n.highlightFormatting&&(r.formatting="image"),d(r);if("["===l&&r.imageMarker)return r.imageMarker=!1,r.imageAltText=!0,n.highlightFormatting&&(r.formatting="image"),d(r);if("]"===l&&r.imageAltText){n.highlightFormatting&&(r.formatting="image");var y=d(r);return r.imageAltText=!1,r.image=!1,r.inline=r.f=g,y}if("["===l&&t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!r.image)return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),d(r);if("]"===l&&r.linkText&&t.match(/\(.*?\)| ?\[.*?\]/,!1)){n.highlightFormatting&&(r.formatting="link");var y=d(r);return r.linkText=!1,r.inline=r.f=g,y}if("<"===l&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=m,n.highlightFormatting&&(r.formatting="link");var y=d(r);return y?y+=" ":y="",y+_.linkInline}if("<"===l&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=m,n.highlightFormatting&&(r.formatting="link");var y=d(r);return y?y+=" ":y="",y+_.linkEmail}if("<"===l&&t.match(/^(!--|\w)/,!1)){var k=t.string.indexOf(">",t.pos);if(k!=-1){var w=t.string.substring(t.start,k);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(w)&&(r.md_inside=!0)}return t.backUp(1),r.htmlState=e.startState(x),o(t,r,c)}if("<"===l&&t.match(/^\/\w*?>/))return r.md_inside=!1,"tag";var C=!1;if(!n.underscoresBreakWords&&"_"===l&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var M=t.string.charAt(S);"_"!==M&&M.match(/(\w)/,!1)&&(C=!0)}}if("*"===l||"_"===l&&!C)if(s&&" "===t.peek());else{if(r.strong===l&&t.eat(l)){n.highlightFormatting&&(r.formatting="strong");var v=d(r);return r.strong=!1,v}if(!r.strong&&t.eat(l))return r.strong=l,n.highlightFormatting&&(r.formatting="strong"),d(r);if(r.em===l){n.highlightFormatting&&(r.formatting="em");var v=d(r);return r.em=!1,v}if(!r.em)return r.em=l,n.highlightFormatting&&(r.formatting="em"),d(r)}else if(" "===l&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(r);t.backUp(1)}if(n.strikethrough)if("~"===l&&t.eatWhile(l)){if(r.strikethrough){n.highlightFormatting&&(r.formatting="strikethrough");var v=d(r);return r.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return r.strikethrough=!0,n.highlightFormatting&&(r.formatting="strikethrough"),d(r)}else if(" "===l&&t.match(/^~~/,!0)){if(" "===t.peek())return d(r);t.backUp(2)}return" "===l&&(t.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),d(r)}function m(e,t){var r=e.next();if(">"===r){t.f=t.inline=h,n.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+_.linkInline}return e.match(/^[^>]+/,!0),_.linkInline}function g(e,t){if(e.eatSpace())return null;var r=e.next();return"("===r||"["===r?(t.f=t.inline=v("("===r?")":"]",0),n.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function v(e){return function(t,r){var i=t.next();if(i===e){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link-string");var o=d(r);return r.linkHref=!1,o}return t.match(I[e]),r.linkHref=!0,d(r)}}function y(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=b,e.next(),n.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,h)}function b(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=k,n.highlightFormatting&&(t.formatting="link");var r=d(t);return t.linkText=!1,r}return e.match(/^([^\]\\]|\\.)+/,!0),_.linkText}function k(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,_.linkHref+" url")}var x=e.getMode(t,"text/html"),w="null"==x.name;void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.underscoresBreakWords&&(n.underscoresBreakWords=!0),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1),void 0===n.tokenTypeOverrides&&(n.tokenTypeOverrides={});var _={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var C in _)_.hasOwnProperty(C)&&n.tokenTypeOverrides[C]&&(_[C]=n.tokenTypeOverrides[C]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,M=/^[*\-+]\s+/,L=/^[0-9]+([.)])\s+/,T=/^\[(x| )\](?=\s)/,A=n.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,E=/^ *(?:\={1,}|-{1,})\s*$/,z=/^[^#!\[\]*_\\<>` "'(~]+/,O=new RegExp("^("+(n.fencedCodeBlocks===!0?"~~~+|```+":n.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/},N={startState:function(){return{f:l,prevLine:null,thisLine:null,block:l,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(x,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedChars:t.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var n=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||n){if(s(t),!n)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var r=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentationDiff=Math.min(r-t.indentation,4),t.indentation=t.indentation+t.indentationDiff,r>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==c?{state:e.htmlState,mode:x}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:N}},blankLine:s,getType:d,fold:"markdown"};return N},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(n,r){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,n){if(n.combineTokens=null,n.codeBlock)return e.match(/^```+/)?(n.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(n.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),n.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return n.code?a===o&&(n.code=!1):(o=a,n.code=!0),null}if(n.code)return e.next(),null;if(e.eatSpace())return n.ateSpace=!0,null;if((e.sol()||n.ateSpace)&&(n.ateSpace=!1,r.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return n.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return n.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(n.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var l in r)s[l]=r[l];return s.name="markdown",e.overlayMode(e.getMode(n,s),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}e.defineMode("javascript",function(n,r){function i(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}function o(e,t,n){return be=e,ke=n,t}function a(e,n){var r=e.next();if('"'==r||"'"==r)return n.tokenize=s(r),n.tokenize(e,n);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==r&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return o(r);if("="==r&&e.eat(">"))return o("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==r&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==r&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==r)return e.eat("*")?(n.tokenize=l,l(e,n)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,n,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Te),o("operator","operator",e.current()));if("`"==r)return n.tokenize=c,c(e,n);if("#"==r)return e.skipToEnd(),o("error","error");if(Te.test(r))return e.eatWhile(Te),o("operator","operator",e.current());if(Me.test(r)){e.eatWhile(Me);var a=e.current(),u=Le.propertyIsEnumerable(a)&&Le[a];return u&&"."!=n.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function s(e){return function(t,n){var r,i=!1;if(_e&&"@"==t.peek()&&t.match(Ae))return n.tokenize=a,o("jsonld-keyword","meta");for(;null!=(r=t.next())&&(r!=e||i);)i=!i&&"\\"==r;return i||(n.tokenize=a),o("string","string")}}function l(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=a;break}r="*"==n}return o("comment","comment")}function c(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=a;break}r=!r&&"\\"==n}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){for(var r=0,i=!1,o=n-1;o>=0;--o){var a=e.string.charAt(o),s=Ee.indexOf(a);if(s>=0&&s<3){if(!r){++o;break}if(0==--r){"("==a&&(i=!0);break}}else if(s>=3&&s<6)++r;else if(Me.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!r){++o;break}}}i&&!r&&(t.fatArrowAt=o)}}function f(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function d(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function p(e,t,n,r,i){var o=e.cc;for(Oe.state=e,Oe.stream=i,Oe.marked=null,Oe.cc=o,Oe.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Ce?_:w;if(a(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Oe.marked?Oe.marked:"variable"==n&&d(e,r)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Oe.cc.push(arguments[e])}function m(){return h.apply(null,arguments),!0}function g(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var n=Oe.state;if(Oe.marked="def",n.context){if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function v(){Oe.state.context={prev:Oe.state.context,vars:Oe.state.localVars},Oe.state.localVars=Ie}function y(){Oe.state.localVars=Oe.state.context.vars,Oe.state.context=Oe.state.context.prev}function b(e,t){var n=function(){var n=Oe.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new f(r,Oe.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function k(){var e=Oe.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(n){return n==e?m():";"==e?h():m(t)}return t}function w(e,t){return"var"==e?m(b("vardef",t.length),X,x(";"),k):"keyword a"==e?m(b("form"),_,w,k):"keyword b"==e?m(b("form"),w,k):"{"==e?m(b("}"),$,k):";"==e?m():"if"==e?("else"==Oe.state.lexical.info&&Oe.state.cc[Oe.state.cc.length-1]==k&&Oe.state.cc.pop()(),m(b("form"),_,w,k,ee)):"function"==e?m(ae):"for"==e?m(b("form"),te,w,k):"variable"==e?m(b("stat"),R):"switch"==e?m(b("form"),_,b("}","switch"),x("{"),$,k,k):"case"==e?m(_,x(":")):"default"==e?m(x(":")):"catch"==e?m(b("form"),v,x("("),se,x(")"),w,k,y):"class"==e?m(b("form"),le,k):"export"==e?m(b("stat"),de,k):"import"==e?m(b("stat"),pe,k):"module"==e?m(b("form"),Z,b("}"),x("{"),$,k,k):"async"==e?m(w):h(b("stat"),_,x(";"),k)}function _(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(Oe.state.fatArrowAt==Oe.stream.start){var n=t?I:O;if("("==e)return m(v,b(")"),F(Z,")"),k,x("=>"),n,y);if("variable"==e)return h(v,Z,x("=>"),n,y)}var r=t?A:T;return ze.hasOwnProperty(e)?m(r):"function"==e?m(ae,r):"keyword c"==e||"async"==e?m(t?L:M):"("==e?m(b(")"),M,x(")"),k,r):"operator"==e||"spread"==e?m(t?C:_):"["==e?m(b("]"),ve,k,r):"{"==e?H(D,"}",null,r):"quasi"==e?h(E,r):"new"==e?m(N(t)):m()}function M(e){return e.match(/[;\}\)\],]/)?h():h(_)}function L(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?m(_):A(e,t,!1)}function A(e,t,n){var r=0==n?T:A,i=0==n?_:C;return"=>"==e?m(v,n?I:O,y):"operator"==e?/\+\+|--/.test(t)?m(r):"?"==t?m(_,x(":"),i):m(i):"quasi"==e?h(E,r):";"!=e?"("==e?H(C,")","call",r):"."==e?m(j,r):"["==e?m(b("]"),M,x("]"),k,r):void 0:void 0}function E(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?m(E):m(_,z)}function z(e){if("}"==e)return Oe.marked="string-2",Oe.state.tokenize=c,m(E)}function O(e){return u(Oe.stream,Oe.state),h("{"==e?w:_)}function I(e){return u(Oe.stream,Oe.state),h("{"==e?w:C)}function N(e){return function(t){return"."==t?m(e?P:q):h(e?C:_)}}function q(e,t){if("target"==t)return Oe.marked="keyword",m(T)}function P(e,t){if("target"==t)return Oe.marked="keyword",m(A)}function R(e){return":"==e?m(k,w):h(T,x(";"),k)}function j(e){if("variable"==e)return Oe.marked="property",m()}function D(e,t){return"async"==e?m(D):"variable"==e||"keyword"==Oe.style?(Oe.marked="property",m("get"==t||"set"==t?W:B)):"number"==e||"string"==e?(Oe.marked=_e?"property":Oe.style+" property",m(B)):"jsonld-keyword"==e?m(B):"modifier"==e?m(D):"["==e?m(_,x("]"),B):"spread"==e?m(_):void 0}function W(e){return"variable"!=e?h(B):(Oe.marked="property",m(ae))}function B(e){return":"==e?m(C):"("==e?h(ae):void 0}function F(e,t){function n(r,i){if(","==r){var o=Oe.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),m(function(n,r){return n==t||r==t?h():h(e)},n)}return r==t||i==t?m():m(x(t))}return function(r,i){return r==t||i==t?m():h(e,n)}}function H(e,t,n){for(var r=3;r<arguments.length;r++)Oe.cc.push(arguments[r]);return m(b(t,n),F(e,t),k)}function $(e){return"}"==e?m():h(w,$)}function U(e){if(Se&&":"==e)return m(V)}function K(e,t){if("="==t)return m(C)}function V(e){if("variable"==e)return Oe.marked="variable-3",m(G)}function G(e,t){return"<"==t?m(F(V,">"),G):"["==e?m(x("]"),G):void 0}function X(){return h(Z,U,Q,J)}function Z(e,t){return"modifier"==e?m(Z):"variable"==e?(g(t),m()):"spread"==e?m(Z):"["==e?H(Z,"]"):"{"==e?H(Y,"}"):void 0}function Y(e,t){return"variable"!=e||Oe.stream.match(/^\s*:/,!1)?("variable"==e&&(Oe.marked="property"),"spread"==e?m(Z):"}"==e?h():m(x(":"),Z,Q)):(g(t),m(Q))}function Q(e,t){if("="==t)return m(C)}function J(e){if(","==e)return m(X)}function ee(e,t){if("keyword b"==e&&"else"==t)return m(b("form","else"),w,k)}function te(e){if("("==e)return m(b(")"),ne,x(")"),k)}function ne(e){return"var"==e?m(X,x(";"),ie):";"==e?m(ie):"variable"==e?m(re):h(_,x(";"),ie)}function re(e,t){return"in"==t||"of"==t?(Oe.marked="keyword",m(_)):m(T,ie)}function ie(e,t){return";"==e?m(oe):"in"==t||"of"==t?(Oe.marked="keyword",m(_)):h(_,x(";"),oe)}function oe(e){")"!=e&&m(_)}function ae(e,t){return"*"==t?(Oe.marked="keyword",m(ae)):"variable"==e?(g(t),m(ae)):"("==e?m(v,b(")"),F(se,")"),k,U,w,y):void 0}function se(e){return"spread"==e?m(se):h(Z,U,K)}function le(e,t){if("variable"==e)return g(t),m(ce)}function ce(e,t){return"extends"==t?m(_,ce):"{"==e?m(b("}"),ue,k):void 0}function ue(e,t){return"variable"==e||"keyword"==Oe.style?"static"==t?(Oe.marked="keyword",m(ue)):(Oe.marked="property","get"==t||"set"==t?m(fe,ae,ue):m(ae,ue)):"*"==t?(Oe.marked="keyword",m(ue)):";"==e?m(ue):"}"==e?m():void 0}function fe(e){return"variable"!=e?h():(Oe.marked="property",m())}function de(e,t){return"*"==t?(Oe.marked="keyword",m(ge,x(";"))):"default"==t?(Oe.marked="keyword",m(_,x(";"))):h(w)}function pe(e){return"string"==e?m():h(he,ge)}function he(e,t){return"{"==e?H(he,"}"):("variable"==e&&g(t),"*"==t&&(Oe.marked="keyword"),m(me))}function me(e,t){if("as"==t)return Oe.marked="keyword",m(he)}function ge(e,t){if("from"==t)return Oe.marked="keyword",m(_)}function ve(e){return"]"==e?m():h(F(C,"]"))}function ye(e,t){return"operator"==e.lastType||","==e.lastType||Te.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var be,ke,xe=n.indentUnit,we=r.statementIndent,_e=r.jsonld,Ce=r.json||_e,Se=r.typescript,Me=r.wordCharacters||/[\w$\xa1-\uffff]/,Le=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":e("new"),"delete":r,"throw":r,"debugger":r,"var":e("var"),"const":e("var"),"let":e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),"class":e("class"),"super":e("atom"),"yield":r,"export":e("export"),"import":e("import"),"extends":r,await:r,async:e("async")};if(Se){var s={type:"variable",style:"variable-3"},l={"interface":e("class"),"implements":r,namespace:r,module:e("module"),"enum":e("module"),"public":e("modifier"),"private":e("modifier"),"protected":e("modifier"),"abstract":e("modifier"),as:i,string:s,number:s,"boolean":s,any:s};for(var c in l)a[c]=l[c]}return a}(),Te=/[+\-*&%=<>!?|~^]/,Ae=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ee="([{}])",ze={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Oe={state:null,column:null,marked:null,cc:null},Ie={name:"this",next:{name:"arguments"}};return k.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new f((e||0)-xe,0,"block",(!1)),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:e||0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==be?n:(t.lastType="operator"!=be||"++"!=ke&&"--"!=ke?be:"incdec",p(t,n,be,ke,e))},indent:function(t,n){if(t.tokenize==l)return e.Pass;if(t.tokenize!=a)return 0;var i=n&&n.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(n))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==k)o=o.prev;else if(c!=ee)break}"stat"==o.type&&"}"==i&&(o=o.prev),we&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,f=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+xe:"stat"==u?o.indented+(ye(t,n)?we||xe:0):"switch"!=o.info||f||0==r.doubleIndentSwitch?o.align?o.column+(f?0:1):o.indented+(f?0:xe):o.indented+(/^(?:case|default)\b/.test(n)?xe:2*xe)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ce?null:"/*",blockCommentEnd:Ce?null:"*/",lineComment:Ce?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ce?"json":"javascript",jsonldMode:_e,jsonMode:Ce,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=_&&t!=C||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=!0;return t}function n(e,t){for(var n,r=!1;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}e.defineMode("css",function(t,n){function r(e,t){return h=t,e}function i(e,t){var n=e.next();if(v[n]){var i=v[n](e,t);if(i!==!1)return i}return"@"==n?(e.eatWhile(/[\w\\\-]/),r("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?r(null,"compare"):'"'==n||"'"==n?(t.tokenize=o(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),r("atom","hash")):"!"==n?(e.match(/^\s*\w*/),r("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/), +r("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?r(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?r("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?r(null,n):"u"==n&&e.match(/rl(-prefix)?\(/)||"d"==n&&e.match("omain(")||"r"==n&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,r("property","word")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),r("property","word")):r(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),r("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?r("variable-2","variable-definition"):r("variable-2","variable")):e.match(/^\w+-/)?r("meta","meta"):void 0}function o(e){return function(t,n){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(n.tokenize=null),r("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),r(null,"(")}function s(e,t,n){this.type=e,this.indent=t,this.prev=n}function l(e,t,n,r){return e.context=new s(n,t.indentation()+(r===!1?0:g),e.context),n}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,n){return E[n.context.type](e,t,n)}function f(e,t,n,r){for(var i=r||1;i>0;i--)n.context=n.context.prev;return u(e,t,n)}function d(e){var t=e.current().toLowerCase();m=L.hasOwnProperty(t)?"atom":M.hasOwnProperty(t)?"keyword":"variable"}var p=n.inline;n.propertyKeywords||(n=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=n.tokenHooks,y=n.documentTypes||{},b=n.mediaTypes||{},k=n.mediaFeatures||{},x=n.mediaValueKeywords||{},w=n.propertyKeywords||{},_=n.nonStandardPropertyKeywords||{},C=n.fontProperties||{},S=n.counterDescriptors||{},M=n.colorKeywords||{},L=n.valueKeywords||{},T=n.allowNested,A=n.supportsAtComponent===!0,E={};return E.top=function(e,t,n){if("{"==e)return l(n,t,"block");if("}"==e&&n.context.prev)return c(n);if(A&&/@component/.test(e))return l(n,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return l(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return l(n,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return n.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(n,t,"at");if("hash"==e)m="builtin";else if("word"==e)m="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(n,t,"interpolation");if(":"==e)return"pseudo";if(T&&"("==e)return l(n,t,"parens")}return n.context.type},E.block=function(e,t,n){if("word"==e){var r=t.current().toLowerCase();return w.hasOwnProperty(r)?(m="property","maybeprop"):_.hasOwnProperty(r)?(m="string-2","maybeprop"):T?(m=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(m+=" error","maybeprop")}return"meta"==e?"block":T||"hash"!=e&&"qualifier"!=e?E.top(e,t,n):(m="error","block")},E.maybeprop=function(e,t,n){return":"==e?l(n,t,"prop"):u(e,t,n)},E.prop=function(e,t,n){if(";"==e)return c(n);if("{"==e&&T)return l(n,t,"propBlock");if("}"==e||"{"==e)return f(e,t,n);if("("==e)return l(n,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return l(n,t,"interpolation")}else m+=" error";return"prop"},E.propBlock=function(e,t,n){return"}"==e?c(n):"word"==e?(m="property","maybeprop"):n.context.type},E.parens=function(e,t,n){return"{"==e||"}"==e?f(e,t,n):")"==e?c(n):"("==e?l(n,t,"parens"):"interpolation"==e?l(n,t,"interpolation"):("word"==e&&d(t),"parens")},E.pseudo=function(e,t,n){return"word"==e?(m="variable-3",n.context.type):u(e,t,n)},E.documentTypes=function(e,t,n){return"word"==e&&y.hasOwnProperty(t.current())?(m="tag",n.context.type):E.atBlock(e,t,n)},E.atBlock=function(e,t,n){if("("==e)return l(n,t,"atBlock_parens");if("}"==e||";"==e)return f(e,t,n);if("{"==e)return c(n)&&l(n,t,T?"block":"top");if("interpolation"==e)return l(n,t,"interpolation");if("word"==e){var r=t.current().toLowerCase();m="only"==r||"not"==r||"and"==r||"or"==r?"keyword":b.hasOwnProperty(r)?"attribute":k.hasOwnProperty(r)?"property":x.hasOwnProperty(r)?"keyword":w.hasOwnProperty(r)?"property":_.hasOwnProperty(r)?"string-2":L.hasOwnProperty(r)?"atom":M.hasOwnProperty(r)?"keyword":"error"}return n.context.type},E.atComponentBlock=function(e,t,n){return"}"==e?f(e,t,n):"{"==e?c(n)&&l(n,t,T?"block":"top",!1):("word"==e&&(m="error"),n.context.type)},E.atBlock_parens=function(e,t,n){return")"==e?c(n):"{"==e||"}"==e?f(e,t,n,2):E.atBlock(e,t,n)},E.restricted_atBlock_before=function(e,t,n){return"{"==e?l(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(m="variable","restricted_atBlock_before"):u(e,t,n)},E.restricted_atBlock=function(e,t,n){return"}"==e?(n.stateArg=null,c(n)):"word"==e?(m="@font-face"==n.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(e,t,n){return"word"==e?(m="variable","keyframes"):"{"==e?l(n,t,"top"):u(e,t,n)},E.at=function(e,t,n){return";"==e?c(n):"{"==e||"}"==e?f(e,t,n):("word"==e?m="tag":"hash"==e&&(m="builtin"),"at")},E.interpolation=function(e,t,n){return"}"==e?c(n):"{"==e||";"==e?f(e,t,n):("word"==e?m="variable":"variable"!=e&&"("!=e&&")"!=e&&(m="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:p?"block":"top",stateArg:null,context:new s(p?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||i)(e,t);return n&&"object"==typeof n&&(h=n[1],n=n[0]),m=n,t.state=E[t.state](h,e,t),m},indent:function(e,t){var n=e.context,r=t&&t.charAt(0),i=n.indent;return"prop"!=n.type||"}"!=r&&")"!=r||(n=n.prev),n.prev&&("}"!=r||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=r||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=r||"at"!=n.type&&"atBlock"!=n.type)||(i=Math.max(0,n.indent-g),n=n.prev):(n=n.prev,i=n.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var r=["domain","regexp","url","url-prefix"],i=t(r),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=t(s),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),f=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(f),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(p),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=t(x),_=r.concat(o).concat(s).concat(c).concat(f).concat(p).concat(b).concat(x);e.registerHelper("hintWords","css",_),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=n,n(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=n,n(e,t)):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/)&&[null,"{"]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=n,n(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=n,n(e,t))}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){var r=e.current(),i=r.search(t);return i>-1?e.backUp(r.length-i):r.match(/<\/?$/)&&(e.backUp(r.length),e.match(t,!1)||e.match(r)),n}function n(e){var t=l[e];return t?t:l[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function r(e,t){var r=e.match(n(t));return r?r[2]:""}function i(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var n in e)for(var r=t[n]||(t[n]=[]),i=e[n],o=i.length-1;o>=0;o--)r.unshift(i[o])}function a(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(!i[0]||i[1].test(r(t,i[0])))return i[2]}}var s={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},l={};e.defineMode("htmlmixed",function(n,r){function l(r,o){var s,f=c.token(r,o.htmlState),d=/\btag\b/.test(f);if(d&&!/[<>\s\/]/.test(r.current())&&(s=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(s))o.inTag=s+" ";else if(o.inTag&&d&&/>$/.test(r.current())){var p=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var h=">"==r.current()&&a(u[p[1]],p[2]),m=e.getMode(n,h),g=i(p[1],!0),v=i(p[1],!1);o.token=function(e,n){return e.match(g,!1)?(n.token=l,n.localState=n.localMode=null,null):t(e,v,n.localMode.token(e,n.localState))},o.localMode=m,o.localState=e.startState(m,c.indent(o.htmlState,""))}else o.inTag&&(o.inTag+=r.current(),r.eol()&&(o.inTag+=" "));return f}var c=e.getMode(n,{name:"xml",htmlMode:!0,multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),u={},f=r&&r.tags,d=r&&r.scriptTypes;if(o(s,u),f&&o(f,u),d)for(var p=d.length-1;p>=0;p--)u.script.unshift(["type",d[p].matches,d[p].mode]);return{startState:function(){var t=e.startState(c);return{token:l,inTag:null,localMode:null,localState:null,htmlState:t}},copyState:function(t){var n;return t.localState&&(n=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:n,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,n){return!t.localMode||/^\s*<\//.test(n)?c.indent(t.htmlState,n):t.localMode.indent?t.localMode.indent(t.localState,n):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlembedded",function(t,n){return e.multiplexingMode(e.getMode(t,"htmlmixed"),{open:n.open||n.scriptStartRegex||"<%",close:n.close||n.scriptEndRegex||"%>",mode:e.getMode(t,n.scriptingModeSpec)})},"htmlmixed"),e.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),e.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),e.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),e.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=i,this.prev=o}function n(e,n,r,i){var o=e.indented;return e.context&&"statement"!=e.context.type&&"statement"!=r&&(o=e.context.indented),e.context=new t(o,n,r,i,null,e.context)}function r(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function i(e,t,n){return"variable"==t.prevToken||"variable-3"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function o(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function a(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function s(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}function l(e,t){if(!t.startOfLine)return!1;for(var n,r=null;n=e.peek();){if("\\"==n&&e.match(/^.$/)){r=l;break}if("/"==n&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=r,"meta"}function c(e,t){return"variable-3"==t.prevToken&&"variable-3"}function u(e){return e.eatWhile(/[\w\.']/),"number"}function f(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var n=e.match(/"([^\s\\()]{0,16})\(/);return!!n&&(t.cpp11RawStringDelim=n[1],t.tokenize=h,h(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function d(e){var t=/(\w+)::(\w+)$/.exec(e);return t&&t[1]==t[2]}function p(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function h(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),r=e.match(new RegExp(".*?\\)"+n+'"'));return r?t.tokenize=null:e.skipToEnd(),"string"}function m(t,n){function r(e){if(e)for(var t in e)e.hasOwnProperty(t)&&i.push(t)}"string"==typeof t&&(t=[t]);var i=[];r(n.keywords),r(n.types),r(n.builtin),r(n.atoms),i.length&&(n.helperType=t[0],e.registerHelper("hintWords",t[0],i));for(var o=0;o<t.length;++o)e.defineMIME(t[o],n)}function g(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}function v(e){return function(t,n){for(var r,i=!1,o=!1;!t.eol();){if(!e&&!i&&t.match('"')){o=!0;break}if(e&&t.match('"""')){o=!0;break}r=t.next(),!i&&"$"==r&&t.match("{")&&t.skipTo("}"),i=!i&&"\\"==r&&!e}return!o&&e||(n.tokenize=null),"string"}}function y(e){return function(t,n){for(var r,i=!1,o=!1;!t.eol();){if(!i&&t.match('"')&&("single"==e||t.match('""'))){o=!0;break}if(!i&&t.match("``")){x=y(e),o=!0;break}r=t.next(),i="single"==e&&!i&&"\\"==r}return o&&(n.tokenize=null),"string"}}e.defineMode("clike",function(a,l){function c(e,t){var n=e.next();if(C[n]){var r=C[n](e,t);if(r!==!1)return r}if('"'==n||"'"==n)return t.tokenize=u(n),t.tokenize(e,t);if(A.test(n))return p=n,null;if(E.test(n)){if(e.backUp(1),e.match(z))return"number";e.next()}if("/"==n){if(e.eat("*"))return t.tokenize=f,f(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(O.test(n)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(O););return"operator"}if(e.eatWhile(/[\w\$_\xa1-\uffff]/),T)for(;e.match(T);)e.eatWhile(/[\w\$_\xa1-\uffff]/);var i=e.current();return s(y,i)?(s(x,i)&&(p="newstatement"),s(w,i)&&(h=!0),"keyword"):s(b,i)?"variable-3":s(k,i)?(s(x,i)&&(p="newstatement"),"builtin"):s(_,i)?"atom":"variable"}function u(e){return function(t,n){for(var r,i=!1,o=!1;null!=(r=t.next());){if(r==e&&!i){o=!0;break}i=!i&&"\\"==r}return(o||!i&&!S)&&(n.tokenize=null),"string"}}function f(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function d(e,t){l.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}var p,h,m=a.indentUnit,g=l.statementIndentUnit||m,v=l.dontAlignCalls,y=l.keywords||{},b=l.types||{},k=l.builtin||{},x=l.blockKeywords||{},w=l.defKeywords||{},_=l.atoms||{},C=l.hooks||{},S=l.multiLineStrings,M=l.indentStatements!==!1,L=l.indentSwitch!==!1,T=l.namespaceSeparator,A=l.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,E=l.numberStart||/[\d\.]/,z=l.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,O=l.isOperatorChar||/[+\-*&%=<>!?|\/]/,I=l.endStatement||/^[;:,]$/;return{startState:function(e){return{tokenize:null,context:new t((e||0)-m,0,"top",null,(!1)),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var a=t.context;if(e.sol()&&(null==a.align&&(a.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return d(e,t), +null;p=h=null;var s=(t.tokenize||c)(e,t);if("comment"==s||"meta"==s)return s;if(null==a.align&&(a.align=!0),I.test(p))for(;"statement"==t.context.type;)r(t);else if("{"==p)n(t,e.column(),"}");else if("["==p)n(t,e.column(),"]");else if("("==p)n(t,e.column(),")");else if("}"==p){for(;"statement"==a.type;)a=r(t);for("}"==a.type&&(a=r(t));"statement"==a.type;)a=r(t)}else p==a.type?r(t):M&&(("}"==a.type||"top"==a.type)&&";"!=p||"statement"==a.type&&"newstatement"==p)&&n(t,e.column(),"statement",e.current());if("variable"==s&&("def"==t.prevToken||l.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),C.token){var u=C.token(e,t,s);void 0!==u&&(s=u)}return"def"==s&&l.styleDefs===!1&&(s="variable"),t.startOfLine=!1,t.prevToken=h?"def":s||p,d(e,t),s},indent:function(t,n){if(t.tokenize!=c&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var r=t.context,i=n&&n.charAt(0);if("statement"==r.type&&"}"==i&&(r=r.prev),l.dontIndentStatements)for(;"statement"==r.type&&l.dontIndentStatements.test(r.info);)r=r.prev;if(C.indent){var o=C.indent(t,r,n);if("number"==typeof o)return o}var a=i==r.type,s=r.prev&&"switch"==r.prev.info;if(l.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==i?0:g):!r.align||v&&")"==r.type?")"!=r.type||a?r.indented+(a?0:m)+(a||!s||/^(?:case|default)\b/.test(n)?0:m):r.indented+g:r.column+(a?0:1)},electricInput:L?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var b="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",k="int long char short double float unsigned signed void size_t ptrdiff_t";m(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(b),types:a(k+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:a("case do else for if switch while struct"),defKeywords:a("struct"),typeFirstDefinitions:!0,atoms:a("null true false"),hooks:{"#":l,"*":c},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(b+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:a(k+" bool wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),defKeywords:a("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:a("true false null"),dontIndentStatements:/^template$/,hooks:{"#":l,"*":c,u:f,U:f,L:f,R:f,0:u,1:u,2:u,3:u,4:u,5:u,6:u,7:u,8:u,9:u,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&d(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:a("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:a("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:a("catch class do else finally for if switch try while"),defKeywords:a("class interface package enum"),typeFirstDefinitions:!0,atoms:a("true false null"),endStatement:/^[;:]$/,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),m("text/x-csharp",{name:"clike",keywords:a("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:a("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),defKeywords:a("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),m("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:a("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:a("catch class do else finally for forSome if match switch try while"),defKeywords:a("class def object package trait type val var"),atoms:a("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=g,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,n){var r=n.context;return!("}"!=r.type||!r.align||!e.eat(">"))&&(n.context=new t(r.indented,r.column,r.type,r.info,null,r.prev),"operator")}},modeProps:{closeBrackets:{triples:'"'}}}),m("text/x-kotlin",{name:"clike",keywords:a("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:a("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,blockKeywords:a("catch class do else finally for if where try while enum"),defKeywords:a("class val var object package interface fun"),atoms:a("true false null this"),hooks:{'"':function(e,t){return t.tokenize=v(e.match('""')),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),m(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:a("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:a("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:a("for while do if else struct"),builtin:a("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:a("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":l},modeProps:{fold:["brace","include"]}}),m("text/x-nesc",{name:"clike",keywords:a(b+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:a(k),blockKeywords:a("case do else for if switch while struct"),atoms:a("null true false"),hooks:{"#":l},modeProps:{fold:["brace","include"]}}),m("text/x-objectivec",{name:"clike",keywords:a(b+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:a(k),atoms:a("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":l,indent:function(e,t,n){if("statement"==t.type&&/^@\w/.test(n))return t.indented}},modeProps:{fold:"brace"}}),m("text/x-squirrel",{name:"clike",keywords:a("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:a(k),blockKeywords:a("case catch class else for foreach if switch try while"),defKeywords:a("function local class"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"#":l},modeProps:{fold:["brace","include"]}});var x=null;m("text/x-ceylon",{name:"clike",keywords:a("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:a("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:a("class dynamic function interface module object package value"),builtin:a("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:a("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=y(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!x||!e.match("`"))&&(t.tokenize=x,x=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,n){if(("variable"==n||"variable-3"==n)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("clojure",function(e){function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t,n){this.indent=e,this.type=t,this.prev=n}function r(e,t,r){e.indentStack=new n(t,r,e.indentStack)}function i(e){e.indentStack=e.indentStack.prev}function o(e,t){return"0"===e&&t.eat(/x/i)?(t.eatWhile(w.hex),!0):("+"!=e&&"-"!=e||!w.digit.test(t.peek())||(t.eat(w.sign),e=t.next()),!!w.digit.test(e)&&(t.eat(e),t.eatWhile(w.digit),"."==t.peek()?(t.eat("."),t.eatWhile(w.digit)):"/"==t.peek()&&(t.eat("/"),t.eatWhile(w.digit)),t.eat(w.exponent)&&(t.eat(w.sign),t.eatWhile(w.digit)),!0))}function a(e){var t=e.next();t&&t.match(/[a-z]/)&&e.match(/[a-z]+/,!0)||"u"===t&&e.match(/[0-9a-z]{4}/i,!0)}var s="builtin",l="comment",c="string",u="string-2",f="atom",d="number",p="bracket",h="keyword",m="variable",g=e.indentUnit||2,v=e.indentUnit||2,y=t("true false nil"),b=t("defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),k=t("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cat cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement completing concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare dedupe default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while eduction empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth random-sample range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transduce transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? volatile! volatile? vreset! vswap! when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),x=t("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),w={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/,block_indent:/^(?:def|with)[^\/]+$|\/(?:def|with)/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),"string"!=t.mode&&e.eatSpace())return null;var n=null;switch(t.mode){case"string":for(var _,C=!1;null!=(_=e.next());){if('"'==_&&!C){t.mode=!1;break}C=!C&&"\\"==_}n=c;break;default:var S=e.next();if('"'==S)t.mode="string",n=c;else if("\\"==S)a(e),n=u;else if("'"!=S||w.digit_or_colon.test(e.peek()))if(";"==S)e.skipToEnd(),n=l;else if(o(S,e))n=d;else if("("==S||"["==S||"{"==S){var M,L="",T=e.column();if("("==S)for(;null!=(M=e.eat(w.keyword_char));)L+=M;L.length>0&&(x.propertyIsEnumerable(L)||w.block_indent.test(L))?r(t,T+g,S):(e.eatSpace(),e.eol()||";"==e.peek()?r(t,T+v,S):r(t,T+e.current().length,S)),e.backUp(e.current().length-1),n=p}else if(")"==S||"]"==S||"}"==S)n=p,null!=t.indentStack&&t.indentStack.type==(")"==S?"(":"]"==S?"[":"{")&&i(t);else{if(":"==S)return e.eatWhile(w.symbol),f;e.eatWhile(w.symbol),n=b&&b.propertyIsEnumerable(e.current())?h:k&&k.propertyIsEnumerable(e.current())?s:y&&y.propertyIsEnumerable(e.current())?f:m}else n=f}return n},indent:function(e){return null==e.indentStack?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),e.defineMIME("text/x-clojure","clojure"),e.defineMIME("text/x-clojurescript","clojure"),e.defineMIME("application/edn","clojure")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},n=0,r=e.length;n<r;++n)t[e[n]]=!0;return t}function n(e,t,n){return n.tokenize.push(e),e(t,n)}function r(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(l),"comment";if(e.eatSpace())return null;var r,i=e.next();if("`"==i||"'"==i||'"'==i)return n(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var f=0;e.current().length<u;){var d=e.next();if("("==d?f+=1:")"==d&&(f-=1),f<0)break}if(e.backUp(e.current().length-o),0==f)return n(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var h="string",m=!0;e.eat("s")?h="atom":e.eat(/[WQ]/)?h="string":e.eat(/[r]/)?h="string-2":e.eat(/[wxq]/)&&(h="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(p.propertyIsEnumerable(g)&&(g=p[g]),n(a(g,h,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return n(s(r[1]),e,t);if("0"==i)return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eatWhile(/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?n(a("'","atom",!1),e,t):e.eat('"')?n(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,n){if("}"==t.peek()){if(1==e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n);n.tokenize[n.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(n.tokenize[n.tokenize.length-1]=i(e+1));return r(t,n)}}function o(){var e=!1;return function(t,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)):(e=!0,r(t,n))}}function a(e,t,n,r){return function(a,s){var l,c=!1;for("read-quoted-paused"===s.context.type&&(s.context=s.context.prev,a.eat("}"));null!=(l=a.next());){if(l==e&&(r||!c)){s.tokenize.pop();break}if(n&&"#"==l&&!c){if(a.eat("{")){"}"==e&&(s.context={prev:s.context,type:"read-quoted-paused"}),s.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){s.tokenize.push(o());break}}c=!c&&"\\"==l}return t}}function s(e){return function(t,n){return t.match(e)?n.tokenize.pop():t.skipToEnd(),"string"}}function l(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),f=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),d=t(["end","until"]),p={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[r],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){c=null,e.sol()&&(t.indented=e.indentation());var n,r=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==r){var o=e.current();r="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==r&&(i=o,f.propertyIsEnumerable(o)?n="indent":d.propertyIsEnumerable(o)?n="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented<t.indented&&(n="indent"):n="indent")}return(c||r&&"comment"!=r)&&(t.lastTok=i),"|"==c&&(t.varList=!t.varList),"indent"==n||/[\(\[\{]/.test(c)?t.context={prev:t.context,type:c||r,indented:t.indented}:("dedent"==n||/[\)\]\}]/.test(c))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==c||"operator"==r),r},indent:function(t,n){if(t.tokenize[t.tokenize.length-1]!=r)return 0;var i=n&&n.charAt(0),o=t.context,a=o.type==p[i]||"keyword"==o.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(n);return o.indented+(a?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricInput:/^\s*(?:end|rescue|\})$/,lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e){return e.scopes[e.scopes.length-1]}var r=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],o=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];e.registerHelper("hintWords","python",i.concat(o)),e.defineMode("python",function(a,s){function l(e,t){if(e.sol()&&(t.indent=e.indentation()),e.sol()&&"py"==n(t).type){var r=n(t).offset;if(e.eatSpace()){var i=e.indentation();return i>r?f(t):i<r&&p(e,t)&&(t.errorToken=!0),null}var o=c(e,t);return r>0&&p(e,t)&&(o+=" "+m),o}return c(e,t)}function c(e,t){if(e.eatSpace())return null;var n=e.peek();if("#"==n)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^\d+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f]+/i)&&(o=!0),e.match(/^0b[01]+/i)&&(o=!0),e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(M)?(t.tokenize=u(e.current()),t.tokenize(e,t)):e.match(b)||e.match(y)?"punctuation":e.match(v)||e.match(C)?"operator":e.match(g)?"punctuation":"."==t.lastToken&&e.match(S)?"property":e.match(L)||e.match(r)?"keyword":e.match(T)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(S)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),m)}function u(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),n&&t.eol())return r}else{if(t.match(e))return i.tokenize=l,r;t.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return m;i.tokenize=l}return r}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,r="string";return t.isString=!0,t}function f(e){for(;"py"!=n(e).type;)e.scopes.pop();e.scopes.push({offset:n(e).offset+a.indentUnit,type:"py",align:null})}function d(e,t,n){var r=e.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+k,type:n,align:r})}function p(e,t){for(var r=e.indentation();t.scopes.length>1&&n(t).offset>r;){if("py"!=n(t).type)return!0;t.scopes.pop()}return n(t).offset!=r}function h(e,t){e.sol()&&(t.beginningOfLine=!0);var r=t.tokenize(e,t),i=e.current();if(t.beginningOfLine&&"@"==i)return e.match(S,!1)?"meta":_?"operator":m;/\S/.test(i)&&(t.beginningOfLine=!1),"variable"!=r&&"builtin"!=r||"meta"!=t.lastToken||(r="meta"),"pass"!=i&&"return"!=i||(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=n(t).type||f(t);var o=1==i.length?"[({".indexOf(i):-1;if(o!=-1&&d(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),o!=-1){if(n(t).type!=i)return m;t.indent=t.scopes.pop().offset-k}return t.dedent>0&&e.eol()&&"py"==n(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),r}var m="error",g=s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,v=s.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,y=s.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,b=s.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/,k=s.hangingIndent||a.indentUnit,x=i,w=o;void 0!=s.extra_keywords&&(x=x.concat(s.extra_keywords)),void 0!=s.extra_builtins&&(w=w.concat(s.extra_builtins)); +var _=s.version&&3==parseInt(s.version,10);if(_){var C=s.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,S=s.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;x=x.concat(["nonlocal","False","True","None","async","await"]),w=w.concat(["ascii","bytes","exec","print"]);var M=new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))","i")}else{var C=s.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,S=s.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;x=x.concat(["exec","print"]),w=w.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);var M=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var L=t(x),T=t(w),A={startState:function(e){return{tokenize:l,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=h(e,t);return r&&"comment"!=r&&(t.lastToken="keyword"==r||"punctuation"==r?e.current():r),"punctuation"==r&&(r=null),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+m:r},indent:function(t,r){if(t.tokenize!=l)return t.tokenize.isString?e.Pass:0;var i=n(t),o=i.type==r.charAt(0);return null!=i.align?i.align-(o?1:0):i.offset-(o?k:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return A}),e.defineMIME("text/x-python","python");var a=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:a("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var n=t.split(" "),r=0;r<n.length;r++)i[n[r]]=e}function t(e,t){if(e.eatSpace())return null;var a=e.sol(),s=e.next();if("\\"===s)return e.next(),null;if("'"===s||'"'===s||"`"===s)return t.tokens.unshift(n(s)),r(e,t);if("#"===s)return a&&e.eat("!")?(e.skipToEnd(),"meta"):(e.skipToEnd(),"comment");if("$"===s)return t.tokens.unshift(o),r(e,t);if("+"===s||"="===s)return"operator";if("-"===s)return e.eat("-"),e.eatWhile(/\w/),"attribute";if(/\d/.test(s)&&(e.eatWhile(/\d/),e.eol()||!/\w/.test(e.peek())))return"number";e.eatWhile(/[\w-]/);var l=e.current();return"="===e.peek()&&/\w+/.test(l)?"def":i.hasOwnProperty(l)?i[l]:null}function n(e){return function(t,n){for(var r,i=!1,a=!1;null!=(r=t.next());){if(r===e&&!a){i=!0;break}if("$"===r&&!a&&"'"!==e){a=!0,t.backUp(1),n.tokens.unshift(o);break}a=!a&&"\\"===r}return!i&&a||n.tokens.shift(),"`"===e||")"===e?"quote":"string"}}function r(e,n){return(n.tokens[0]||t)(e,n)}var i={};e("atom","true false"),e("keyword","if then do else elif while until for in esac fi fin fil done exit set unset export function"),e("builtin","ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep kill killall ln ls make mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo tee telnet top touch vi vim wall wc wget who write yes zsh");var o=function(e,t){t.tokens.length>1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=n(")"),r(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return r(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t,i){return 0==e.length?r(t):function(o,a){for(var s=e[0],l=0;l<s.length;l++)if(o.match(s[l][0]))return a.tokenize=n(e.slice(1),t),s[l][1];return a.tokenize=r(t,i),"string"}}function r(e,t){return function(n,r){return i(n,r,e,t)}}function i(e,t,r,i){if(i!==!1&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(i!==!1&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=n([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],r,i)),e.match(/\-\>\w/,!1)&&(t.tokenize=n([[["->",null]],[[/[\w]+/,"variable"]]],r,i)),"variable-2";for(var o=!1;!e.eol()&&(o||i===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(r)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",s="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,s].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var l={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(a),builtin:t(s),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var n;if(n=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(n[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=r(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=r('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=r(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,n){function r(t,n){var r=n.curMode==o;if(t.sol()&&n.pending&&'"'!=n.pending&&"'"!=n.pending&&(n.pending=null),r)return r&&null==n.php.tokenize&&t.match("?>")?(n.curMode=i,n.curState=n.html,n.php.context.prev||(n.php=null),"meta"):o.token(t,n.curState);if(t.match(/^<\?\w*/))return n.curMode=o,n.php||(n.php=e.startState(o,i.indent(n.html,""))),n.curState=n.php,"meta";if('"'==n.pending||"'"==n.pending){for(;!t.eol()&&t.next()!=n.pending;);var a="string"}else if(n.pending&&t.pos<n.pending.end){t.pos=n.pending.end;var a=n.pending.style}else var a=i.token(t,n.curState);n.pending&&(n.pending=null);var s,l=t.current(),c=l.search(/<\?/);return c!=-1&&("string"==a&&(s=l.match(/[\'\"]$/))&&!/\?>/.test(l)?n.pending=s[0]:n.pending={end:t.pos,style:a},t.backUp(l.length-c)),a}var i=e.getMode(t,"text/html"),o=e.getMode(t,l);return{startState:function(){var t=e.startState(i),r=n.startOpen?e.startState(o):null;return{html:t,php:r,curMode:n.startOpen?o:i,curState:n.startOpen?r:t,pending:null}},copyState:function(t){var n,r=t.html,a=e.copyState(i,r),s=t.php,l=s&&e.copyState(o,s);return n=t.curMode==i?a:l,{html:a,php:l,curMode:t.curMode,curState:n,pending:t.pending}},token:r,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",l)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,n){function r(e,t){var n=e.next();if(h[n]){var r=h[n](e,t);if(r!==!1)return r}if(1==p.hexNumber&&("0"==n&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==n||"X"==n)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==n||"B"==n)&&e.match(/^'[01]+'/)||"0"==n&&e.match(/^b[01]+/)))return"number";if(n.charCodeAt(0)>47&&n.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==n&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==n||'"'==n&&p.doubleQuote)return t.tokenize=i(n),t.tokenize(e,t);if((1==p.nCharCast&&("n"==n||"N"==n)||1==p.charsetCast&&"_"==n&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(n))return null;if(p.commentSlashSlash&&"/"==n&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==n||"-"==n&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==n&&e.eat("*"))return t.tokenize=o,t.tokenize(e,t);if("."!=n){if(d.test(n))return e.eatWhile(d),null;if("{"==n&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return m.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(a)?"atom":u.hasOwnProperty(a)?"builtin":f.hasOwnProperty(a)?"keyword":l.hasOwnProperty(a)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function i(e){return function(t,n){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){n.tokenize=r;break}o=!o&&"\\"==i}return"string"}}function o(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=r;break}}return"comment"}function a(e,t,n){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:n}}function s(e){e.indent=e.context.indent,e.context=e.context.prev}var l=n.client||{},c=n.atoms||{"false":!0,"true":!0,"null":!0},u=n.builtin||{},f=n.keywords||{},d=n.operatorChars||/^[*+\-%<>!=&|~^]/,p=n.support||{},h=n.hooks||{},m=n.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:r,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var n=t.tokenize(e,t);if("comment"==n)return n;t.context&&null==t.context.align&&(t.context.align=!0);var r=e.current();return"("==r?a(e,t,")"):"["==r?a(e,t,"]"):t.context&&t.context.type==r&&s(t),n},indent:function(n,r){var i=n.context;if(!i)return e.Pass;var o=r.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function n(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function r(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function i(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}var o="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";e.defineMIME("text/x-sql",{name:"sql",keywords:i(o+"begin"),builtin:i("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:i("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":n}}),e.defineMIME("text/x-mysql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":r}}),e.defineMIME("text/x-mariadb",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":r}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:i("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:i("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"), +builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-pgsql",{name:"sql",client:i("source"),keywords:i(o+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:i("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),e.defineMIME("text/x-gql",{name:"sql",keywords:i("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:i("false true"),builtin:i("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})}()}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(e,t){function n(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function r(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var n=t.scope.offset;if(e.eatSpace()){var r=e.indentation();return r>n&&"coffee"==t.scope.type?"indent":r<n?"dedent":null}n>0&&s(e,t)}if(e.eatSpace())return null;var a=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===a)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var l=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(l=!0),e.match(/^-?\d+\.\d*/)&&(l=!0),e.match(/^-?\.\d+/)&&(l=!0),l)return"."==e.peek()&&e.backUp(1),"number";var m=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(m=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^-?0(?![\dx])/i)&&(m=!0),m)return"number"}if(e.match(y))return t.tokenize=i(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(b)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=i(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(u)||e.match(h)?"operator":e.match(f)?"punctuation":e.match(x)?"atom":e.match(p)||t.prop&&e.match(d)?"property":e.match(v)?"keyword":e.match(d)?"variable":(e.next(),c)}function i(e,n,i){return function(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return i}else{if(o.match(e))return a.tokenize=r,i;o.eat(/['"\/]/)}return n&&(t.singleLineStringErrors?i=c:a.tokenize=r),i}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=r;break}e.eatWhile("#")}return"comment"}function a(t,n,r){r=r||"coffee";for(var i=0,o=!1,a=null,s=n.scope;s;s=s.prev)if("coffee"===s.type||"}"==s.type){i=s.offset+e.indentUnit;break}"coffee"!==r?(o=null,a=t.column()+t.current().length):n.scope.align&&(n.scope.align=!1),n.scope={offset:i,type:r,prev:n.scope,align:o,alignOffset:a}}function s(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var n=e.indentation(),r=!1,i=t.scope;i;i=i.prev)if(n===i.offset){r=!0;break}if(!r)return!0;for(;t.scope.prev&&t.scope.offset!==n;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function l(e,t){var n=t.tokenize(e,t),r=e.current();"return"===r&&(t.dedent=!0),(("->"===r||"=>"===r)&&e.eol()||"indent"===n)&&a(e,t);var i="[({".indexOf(r);if(i!==-1&&a(e,t,"])}".slice(i,i+1)),m.exec(r)&&a(e,t),"then"==r&&s(e,t),"dedent"===n&&s(e,t))return c;if(i="])}".indexOf(r),i!==-1){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==r&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),n}var c="error",u=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,f=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,d=/^[_A-Za-z$][_A-Za-z$0-9]*/,p=/^@[_A-Za-z$][_A-Za-z$0-9]*/,h=n(["and","or","not","is","isnt","in","instanceof","typeof"]),m=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],v=n(m.concat(g));m=n(m);var y=/^('{3}|\"{3}|['\"])/,b=/^(\/{3}|\/)/,k=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],x=n(k),w={startState:function(e){return{tokenize:r,scope:{offset:e||0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,t){var n=null===t.scope.align&&t.scope;n&&e.sol()&&(n.align=!1);var r=l(e,t);return r&&"comment"!=r&&(n&&(n.align=!0),t.prop="punctuation"==r&&"."==e.current()),r},indent:function(e,t){if(e.tokenize!=r)return 0;var n=e.scope,i=t&&"])}".indexOf(t.charAt(0))>-1;if(i)for(;"coffee"==n.type&&n.prev;)n=n.prev;var o=i&&n.type===t.charAt(0);return n.align?n.alignOffset-(o?1:0):(o?n.prev:n).offset},lineComment:"#",fold:"indent"};return w}),e.defineMIME("text/x-coffeescript","coffeescript"),e.defineMIME("text/coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,n){var r=e.peek(),i=n.escaped;if(n.escaped=!1,"#"==r&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(n.literal&&e.indentation()>n.keyCol)return e.skipToEnd(),"string";if(n.literal&&(n.literal=!1),e.sol()){if(n.keyCol=0,n.pair=!1,n.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==r?n.inlinePairs++:"}"==r?n.inlinePairs--:"["==r?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&","==r)return e.next(),"meta";if(n.inlinePairs>0&&!i&&","==r)return n.keyCol=0,n.pair=!1,n.pairStart=!1,e.next(),"meta";if(n.pairStart){if(e.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==n.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!n.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(n.pair=!0,n.keyCol=e.indentation(),"atom"):n.pair&&e.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped="\\"==r,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),e.defineMIME("text/x-yaml","yaml")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jade",function(t){function n(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=e.startState(Y),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function r(e,t){if(e.sol()&&(t.javaScriptLine=!1,t.javaScriptLineExcludesColon=!1),t.javaScriptLine){if(t.javaScriptLineExcludesColon&&":"===e.peek())return t.javaScriptLine=!1,void(t.javaScriptLineExcludesColon=!1);var n=Y.token(e,t.jsState);return e.eol()&&(t.javaScriptLine=!1),n||!0}}function i(e,t){if(t.javaScriptArguments){if(0===t.javaScriptArgumentsDepth&&"("!==e.peek())return void(t.javaScriptArguments=!1);if("("===e.peek()?t.javaScriptArgumentsDepth++:")"===e.peek()&&t.javaScriptArgumentsDepth--,0===t.javaScriptArgumentsDepth)return void(t.javaScriptArguments=!1);var n=Y.token(e,t.jsState);return n||!0}}function o(e){if(e.match(/^yield\b/))return"keyword"}function a(e){if(e.match(/^(?:doctype) *([^\n]+)?/))return V}function s(e,t){if(e.match("#{"))return t.isInterpolating=!0,t.interpolationNesting=0,"punctuation"}function l(e,t){if(t.isInterpolating){if("}"===e.peek()){if(t.interpolationNesting--,t.interpolationNesting<0)return e.next(),t.isInterpolating=!1,"punctuation"}else"{"===e.peek()&&t.interpolationNesting++;return Y.token(e,t.jsState)||!0}}function c(e,t){if(e.match(/^case\b/))return t.javaScriptLine=!0,K}function u(e,t){if(e.match(/^when\b/))return t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,K}function f(e){if(e.match(/^default\b/))return K}function d(e,t){if(e.match(/^extends?\b/))return t.restOfLine="string",K}function p(e,t){if(e.match(/^append\b/))return t.restOfLine="variable",K}function h(e,t){if(e.match(/^prepend\b/))return t.restOfLine="variable",K}function m(e,t){if(e.match(/^block\b *(?:(prepend|append)\b)?/))return t.restOfLine="variable",K}function g(e,t){if(e.match(/^include\b/))return t.restOfLine="string",K}function v(e,t){if(e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match("include"))return t.isIncludeFiltered=!0,K}function y(e,t){if(t.isIncludeFiltered){var n=L(e,t);return t.isIncludeFiltered=!1,t.restOfLine="string",n}}function b(e,t){if(e.match(/^mixin\b/))return t.javaScriptLine=!0,K}function k(e,t){return e.match(/^\+([-\w]+)/)?(e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),"variable"):e.match(/^\+#{/,!1)?(e.next(),t.mixinCallAfter=!0,s(e,t)):void 0}function x(e,t){if(t.mixinCallAfter)return t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0}function w(e,t){if(e.match(/^(if|unless|else if|else)\b/))return t.javaScriptLine=!0,K}function _(e,t){if(e.match(/^(- *)?(each|for)\b/))return t.isEach=!0,K}function C(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,K;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return"variable"}}}function S(e,t){if(e.match(/^while\b/))return t.javaScriptLine=!0,K}function M(e,t){var n;if(n=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))return t.lastTag=n[1].toLowerCase(),"script"===t.lastTag&&(t.scriptType="application/javascript"),"tag"}function L(n,r){if(n.match(/^:([\w\-]+)/)){var i;return t&&t.innerModes&&(i=t.innerModes(n.current().substring(1))),i||(i=n.current().substring(1)),"string"==typeof i&&(i=e.getMode(t,i)),W(n,r,i),"atom"}}function T(e,t){if(e.match(/^(!?=|-)/))return t.javaScriptLine=!0,"punctuation"}function A(e){if(e.match(/^#([\w-]+)/))return G}function E(e){if(e.match(/^\.([\w-]+)/))return X}function z(e,t){if("("==e.peek())return e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue="",t.attributeIsType=!1,"punctuation"}function O(t,n){if(n.isAttrs){if(Z[t.peek()]&&n.attrsNest.push(Z[t.peek()]),n.attrsNest[n.attrsNest.length-1]===t.peek())n.attrsNest.pop();else if(t.eat(")"))return n.isAttrs=!1,"punctuation";if(n.inAttributeName&&t.match(/^[^=,\)!]+/))return"="!==t.peek()&&"!"!==t.peek()||(n.inAttributeName=!1,n.jsState=e.startState(Y),"script"===n.lastTag&&"type"===t.current().trim().toLowerCase()?n.attributeIsType=!0:n.attributeIsType=!1),"attribute";var r=Y.token(t,n.jsState);if(n.attributeIsType&&"string"===r&&(n.scriptType=t.current().toString()),0===n.attrsNest.length&&("string"===r||"variable"===r||"keyword"===r))try{return Function("","var x "+n.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),n.inAttributeName=!0,n.attrValue="",t.backUp(t.current().length),O(t,n)}catch(i){}return n.attrValue+=t.current(),r||!0}}function I(e,t){if(e.match(/^&attributes\b/))return t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,"keyword"}function N(e){if(e.sol()&&e.eatSpace())return"indent"}function q(e,t){if(e.match(/^ *\/\/(-)?([^\n]*)/))return t.indentOf=e.indentation(),t.indentToken="comment","comment"}function P(e){if(e.match(/^: */))return"colon"}function R(e,t){return e.match(/^(?:\| ?| )([^\n]+)/)?"string":e.match(/^(<[^\n]*)/,!1)?(W(e,t,"htmlmixed"),t.innerModeForLine=!0,B(e,t,!0)):void 0}function j(e,t){if(e.eat(".")){var n=null;return"script"===t.lastTag&&t.scriptType.toLowerCase().indexOf("javascript")!=-1?n=t.scriptType.toLowerCase().replace(/"|'/g,""):"style"===t.lastTag&&(n="css"),W(e,t,n),"dot"}}function D(e){return e.next(),null}function W(n,r,i){i=e.mimeModes[i]||i,i=t.innerModes?t.innerModes(i)||i:i,i=e.mimeModes[i]||i,i=e.getMode(t,i),r.indentOf=n.indentation(),i&&"null"!==i.name?r.innerMode=i:r.indentToken="string"}function B(t,n,r){return t.indentation()>n.indentOf||n.innerModeForLine&&!t.sol()||r?n.innerMode?(n.innerState||(n.innerState=n.innerMode.startState?e.startState(n.innerMode,t.indentation()):{}),t.hideFirstChars(n.indentOf+2,function(){return n.innerMode.token(t,n.innerState)||!0})):(t.skipToEnd(),n.indentToken):void(t.sol()&&(n.indentOf=1/0,n.indentToken=null,n.innerMode=null,n.innerState=null))}function F(e,t){if(e.sol()&&(t.restOfLine=""),t.restOfLine){e.skipToEnd();var n=t.restOfLine;return t.restOfLine="",n}}function H(){return new n}function $(e){return e.copy()}function U(e,t){var n=B(e,t)||F(e,t)||l(e,t)||y(e,t)||C(e,t)||O(e,t)||r(e,t)||i(e,t)||x(e,t)||o(e,t)||a(e,t)||s(e,t)||c(e,t)||u(e,t)||f(e,t)||d(e,t)||p(e,t)||h(e,t)||m(e,t)||g(e,t)||v(e,t)||b(e,t)||k(e,t)||w(e,t)||_(e,t)||S(e,t)||M(e,t)||L(e,t)||T(e,t)||A(e,t)||E(e,t)||z(e,t)||I(e,t)||N(e,t)||R(e,t)||q(e,t)||P(e,t)||j(e,t)||D(e,t);return n===!0?null:n}var K="keyword",V="meta",G="builtin",X="qualifier",Z={"{":"}","(":")","[":"]"},Y=e.getMode(t,"javascript");return n.prototype.copy=function(){var t=new n;return t.javaScriptLine=this.javaScriptLine,t.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,t.javaScriptArguments=this.javaScriptArguments,t.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,t.isInterpolating=this.isInterpolating,t.interpolationNesting=this.interpolationNesting,t.jsState=e.copyState(Y,this.jsState),t.innerMode=this.innerMode,this.innerMode&&this.innerState&&(t.innerState=e.copyState(this.innerMode,this.innerState)),t.restOfLine=this.restOfLine,t.isIncludeFiltered=this.isIncludeFiltered,t.isEach=this.isEach,t.lastTag=this.lastTag,t.scriptType=this.scriptType,t.isAttrs=this.isAttrs,t.attrsNest=this.attrsNest.slice(),t.inAttributeName=this.inAttributeName,t.attributeIsType=this.attributeIsType,t.attrValue=this.attrValue,t.indentOf=this.indentOf,t.indentToken=this.indentToken,t.innerModeForLine=this.innerModeForLine,t},{startState:H,copyState:$,token:U}},"javascript","css","htmlmixed"),e.defineMIME("text/x-jade","jade")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("lua",function(e,t){function n(e){return new RegExp("^(?:"+e.join("|")+")","i")}function r(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function i(e){for(var t=0;e.eat("=");)++t;return e.eat("["),t}function o(e,t){var n=e.next();return"-"==n&&e.eat("-")?e.eat("[")&&e.eat("[")?(t.cur=a(i(e),"comment"))(e,t):(e.skipToEnd(),"comment"):'"'==n||"'"==n?(t.cur=s(n))(e,t):"["==n&&/[\[=]/.test(e.peek())?(t.cur=a(i(e),"string"))(e,t):/\d/.test(n)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(n)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function a(e,t){return function(n,r){for(var i,a=null;null!=(i=n.next());)if(null==a)"]"==i&&(a=0);else if("="==i)++a;else{if("]"==i&&a==e){r.cur=o;break}a=null}return t}}function s(e){return function(t,n){for(var r,i=!1;null!=(r=t.next())&&(r!=e||i);)i=!i&&"\\"==r;return i||(n.cur=o),"string"}}var l=e.indentUnit,c=r(t.specials||[]),u=r(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),f=r(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),d=r(["function","if","repeat","do","\\(","{"]),p=r(["end","until","\\)","}"]),h=n(["end","until","\\)","}","else","elseif"]);return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:o}},token:function(e,t){if(e.eatSpace())return null;var n=t.cur(e,t),r=e.current();return"variable"==n&&(f.test(r)?n="keyword":u.test(r)?n="builtin":c.test(r)&&(n="variable-2")),"comment"!=n&&"string"!=n&&(d.test(r)?++t.indentDepth:p.test(r)&&--t.indentDepth),n},indent:function(e,t){var n=h.test(t);return e.basecol+l*(e.indentDepth-(n?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),e.defineMIME("text/x-lua","lua")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("cmake",function(){function e(e,t){for(var n,r,i=!1;!e.eol()&&(n=e.next())!=t.pending;){if("$"===n&&"\\"!=r&&'"'==t.pending){i=!0;break}r=n}return i&&e.backUp(1),n==t.pending?t.continueString=!1:t.continueString=!0,"string"}function t(t,r){var i=t.next();return"$"===i?t.match(n)?"variable-2":"variable":r.continueString?(t.backUp(1),e(t,r)):t.match(/(\s+)?\w+\(/)||t.match(/(\s+)?\w+\ \(/)?(t.backUp(1),"def"):"#"==i?(t.skipToEnd(),"comment"):"'"==i||'"'==i?(r.pending=i,e(t,r)):"("==i||")"==i?"bracket":i.match(/[0-9]/)?"number":(t.eatWhile(/[\w-]/),null)}var n=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var e={};return e.inDefinition=!1,e.inInclude=!1,e.continueString=!1,e.pending=!1,e},token:function(e,n){return e.eatSpace()?null:t(e,n)}}}),e.defineMIME("text/x-cmake","cmake")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t){return s=t,e}function r(e,t){e.eatWhile(/[\w\$_]/);var r=e.current();if(l.propertyIsEnumerable(r))return"keyword";if(c.propertyIsEnumerable(r))return"variable-2";if(u.propertyIsEnumerable(r))return"string-2";var s=e.next();return"@"==s?(e.eatWhile(/[\w\\\-]/),n("meta",e.current())):"/"==s&&e.eat("*")?(t.tokenize=i,i(e,t)):"<"==s&&e.eat("!")?(t.tokenize=o,o(e,t)):"="!=s?"~"!=s&&"|"!=s||!e.eat("=")?'"'==s||"'"==s?(t.tokenize=a(s),t.tokenize(e,t)):"#"==s?(e.skipToEnd(),n("comment","comment")):"!"==s?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(s)?(e.eatWhile(/[\w.%]/),n("number","unit")):/[,.+>*\/]/.test(s)?n(null,"select-op"):/[;{}:\[\]]/.test(s)?n(null,s):(e.eatWhile(/[\w\\\-]/),n("variable","variable")):n(null,"compare"):void n(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=r;break}o="*"==i}return n("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=r;break}o="-"==i?o+1:0}return n("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=r),n("string","string")}}var s,l=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),c=t("http mail events server types location upstream charset_map limit_except if geo map"),u=t("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),f=e.indentUnit; +return{startState:function(e){return{tokenize:r,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;s=null;var n=t.tokenize(e,t),r=t.stack[t.stack.length-1];return"hash"==s&&"rule"==r?n="atom":"variable"==n&&("rule"==r?n="number":r&&"@media{"!=r||(n="tag")),"rule"==r&&/^[\{\};]$/.test(s)&&t.stack.pop(),"{"==s?"@media"==r?t.stack[t.stack.length-1]="@media{":t.stack.push("{"):"}"==s?t.stack.pop():"@media"==s?t.stack.push("@media"):"{"==r&&"comment"!=s&&t.stack.push("rule"),n},indent:function(e,t){var n=e.stack.length;return/^\}/.test(t)&&(n-="rule"==e.stack[e.stack.length-1]?2:1),e.baseIndent+n*f},electricChars:"}"}}),e.defineMIME("text/x-nginx-conf","nginx")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.string.charAt(e.pos+(t||0))}function n(e,t){if(t){var n=e.pos-t;return e.string.substr(n>=0?n:0,t)}return e.string.substr(0,e.pos-1)}function r(e,t){var n=e.string.length,r=n-e.pos+1;return e.string.substr(e.pos,t&&t<n?t:r)}function i(e,t){var n,r=e.pos+t;r<=0?e.pos=0:r>=(n=e.string.length-1)?e.pos=n:e.pos=r}e.defineMode("perl",function(){function e(e,t,n,r,i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e,t){for(var o,s=!1,l=0;o=e.next();){if(o===n[l]&&!s)return void 0!==n[++l]?(t.chain=n[l],t.style=r,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,r;s=!s&&"\\"==o}return r},t.tokenize(e,t)}function o(e,t,n){return t.tokenize=function(e,t){return e.string==n&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var f=a.next();if('"'==f||"'"==f){if(n(a,3)=="<<"+f){var d=a.pos;a.eatWhile(/\w/);var p=a.current().substr(1);if(p&&a.eat(f))return o(a,u,p);a.pos=d}return e(a,u,[f],"string")}if("q"==f){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==f){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],l,c);if("("==h)return e(a,u,[")"],l,c);if("["==h)return e(a,u,["]"],l,c);if("{"==h)return e(a,u,["}"],l,c);if("<"==h)return e(a,u,[">"],l,c)}}if("s"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("y"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("t"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat("r"),h&&(h=a.eat(/[(\[{<\^'"!~\/]/))))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("`"==f)return e(a,u,[f],"variable-2");if("/"==f)return/~\s*$/.test(n(a))?e(a,u,[f],l,c):"operator";if("$"==f){var d=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=d}if(/[$@%]/.test(f)){var d=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(t(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var h=a.current();if(s[h])return"variable-2"}a.pos=d}if(/[$@%&]/.test(f)&&(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}"))){var h=a.current();return s[h]?"variable-2":"variable"}if("#"==f&&"$"!=t(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(f)){var d=a.pos;if(a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),s[a.current()])return"operator";a.pos=d}if("_"==f&&1==a.pos){if("_END__"==r(a,6))return e(a,u,["\0"],"comment");if("_DATA__"==r(a,7))return e(a,u,["\0"],"variable-2");if("_C__"==r(a,7))return e(a,u,["\0"],"string")}if(/\w/.test(f)){var d=a.pos;if("{"==t(a,-2)&&("}"==t(a,0)||a.eatWhile(/\w/)&&"}"==t(a,0)))return"string";a.pos=d}if(/[A-Z]/.test(f)){var m=t(a,-2),d=a.pos;if(a.eatWhile(/[A-Z_]/),!/[\da-z]/.test(t(a,0))){var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}a.pos=d}if(/[a-zA-Z_]/.test(f)){var m=t(a,-2);a.eatWhile(/\w/);var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}return null}var s={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},l="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:a,chain:null,style:null,tail:null}},token:function(e,t){return(t.tokenize||a)(e,t)},lineComment:"#"}}),e.registerHelper("wordChars","perl",/[\w$]/),e.defineMIME("text/x-perl","perl")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sass",function(e){function t(e){return new RegExp("^"+e.join("|"))}function n(e,t){var n=e.peek();return")"===n?(e.next(),t.tokenizer=l,"operator"):"("===n?(e.next(),e.eatSpace(),"operator"):"'"===n||'"'===n?(t.tokenizer=i(e.next()),"string"):(t.tokenizer=i(")",!1),"string")}function r(e,t){return function(n,r){return n.sol()&&n.indentation()<=e?(r.tokenizer=l,l(n,r)):(t&&n.skipTo("*/")?(n.next(),n.next(),r.tokenizer=l):n.skipToEnd(),"comment")}}function i(e,t){function n(r,i){var a=r.next(),s=r.peek(),c=r.string.charAt(r.pos-2),u="\\"!==a&&s===e||a===e&&"\\"!==c;return u?(a!==e&&t&&r.next(),i.tokenizer=l,"string"):"#"===a&&"{"===s?(i.tokenizer=o(n),r.next(),"operator"):"string"}return null==t&&(t=!0),n}function o(e){return function(t,n){return"}"===t.peek()?(t.next(),n.tokenizer=e,"operator"):l(t,n)}}function a(t){if(0==t.indentCount){t.indentCount++;var n=t.scopes[0].offset,r=n+e.indentUnit;t.scopes.unshift({offset:r})}}function s(e){1!=e.scopes.length&&e.scopes.shift()}function l(e,t){var c=e.peek();if(e.match("/*"))return t.tokenizer=r(e.indentation(),!0),t.tokenizer(e,t);if(e.match("//"))return t.tokenizer=r(e.indentation(),!1),t.tokenizer(e,t);if(e.match("#{"))return t.tokenizer=o(l),"operator";if('"'===c||"'"===c)return e.next(),t.tokenizer=i(c),"string";if(t.cursorHalf){if("#"===c&&(e.next(),e.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^-?[0-9\.]+/))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^(px|em|in)\b/))return e.peek()||(t.cursorHalf=0),"unit";if(e.match(f))return e.peek()||(t.cursorHalf=0),"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=n,e.peek()||(t.cursorHalf=0),"atom";if("$"===c)return e.next(),e.eatWhile(/[\w-]/),e.peek()||(t.cursorHalf=0),"variable-3";if("!"===c)return e.next(),e.peek()||(t.cursorHalf=0),e.match(/^[\w]+/)?"keyword":"operator";if(e.match(p))return e.peek()||(t.cursorHalf=0),"operator";if(e.eatWhile(/[\w-]/))return e.peek()||(t.cursorHalf=0),"attribute";if(!e.peek())return t.cursorHalf=0,null}else{if("."===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("#"===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("$"===c)return e.next(),e.eatWhile(/[\w-]/),"variable-2";if(e.match(/^-?[0-9\.]+/))return"number";if(e.match(/^(px|em|in)\b/))return"unit";if(e.match(f))return"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=n,"atom";if("="===c&&e.match(/^=[\w-]+/))return a(t),"meta";if("+"===c&&e.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&e.match(/@extend/)&&(e.match(/\s*[\w]/)||s(t)),e.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(t),"meta";if("@"===c)return e.next(),e.eatWhile(/[\w-]/),"meta";if(e.eatWhile(/[\w-]/))return e.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":e.match(/ *:/,!1)?(a(t),t.cursorHalf=1,"atom"):e.match(/ *,/,!1)?"atom":(a(t),"atom");if(":"===c)return e.match(h)?"keyword":(e.next(),t.cursorHalf=1,"operator")}return e.match(p)?"operator":(e.next(),null)}function c(t,n){t.sol()&&(n.indentCount=0);var r=n.tokenizer(t,n),i=t.current();if("@return"!==i&&"}"!==i||s(n),null!==r){for(var o=t.pos-i.length,a=o+e.indentUnit*n.indentCount,l=[],c=0;c<n.scopes.length;c++){var u=n.scopes[c];u.offset<=a&&l.push(u)}n.scopes=l}return r}var u=["true","false","null","auto"],f=new RegExp("^"+u.join("|")),d=["\\(","\\)","=",">","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],p=t(d),h=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:l,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(e,t){var n=c(e,t);return t.lastToken={style:n,content:e.current()},n},indent:function(e){return e.scopes[0].offset}}}),e.defineMIME("text/x-sass","sass")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("wordChars","r",/[\w.]/),e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),n={},r=0;r<t.length;++r)n[t[r]]=!0;return n}function n(e,t){a=null;var n=e.next();if("#"==n)return e.skipToEnd(),"comment";if("0"==n&&e.eat("x"))return e.eatWhile(/[\da-f]/i),"number";if("."==n&&e.eat(/\d/))return e.match(/\d*(?:e[+\-]?\d+)?/),"number";if(/\d/.test(n))return e.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/),"number";if("'"==n||'"'==n)return t.tokenize=r(n),"string";if("."==n&&e.match(/.[.\d]+/))return"keyword";if(/[\w\.]/.test(n)&&"_"!=n){e.eatWhile(/[\w\.]/);var i=e.current();return s.propertyIsEnumerable(i)?"atom":c.propertyIsEnumerable(i)?(u.propertyIsEnumerable(i)&&!e.match(/\s*if(\s+|$)/,!1)&&(a="block"),"keyword"):l.propertyIsEnumerable(i)?"builtin":"variable"}return"%"==n?(e.skipTo("%")&&e.next(),"variable-2"):"<"==n&&e.eat("-")?"arrow":"="==n&&t.ctx.argList?"arg-is":f.test(n)?"$"==n?"dollar":(e.eatWhile(f),"operator"):/[\(\){}\[\];]/.test(n)?(a=n,";"==n?"semi":null):null}function r(e){return function(t,r){if(t.eat("\\")){var i=t.next();return"x"==i?t.match(/^[a-f0-9]{2}/i):("u"==i||"U"==i)&&t.eat("{")&&t.skipTo("}")?t.next():"u"==i?t.match(/^[a-f0-9]{4}/i):"U"==i?t.match(/^[a-f0-9]{8}/i):/[0-7]/.test(i)&&t.match(/^[0-7]{1,2}/),"string-2"}for(var o;null!=(o=t.next());){if(o==e){r.tokenize=n;break}if("\\"==o){t.backUp(1);break}}return"string"}}function i(e,t,n){e.ctx={type:t,indent:e.indent,align:null,column:n.column(),prev:e.ctx}}function o(e){e.indent=e.ctx.indent,e.ctx=e.ctx.prev}var a,s=t("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"),l=t("list quote bquote eval return call parse deparse"),c=t("if else repeat while function for in next break"),u=t("if else repeat while function for"),f=/[+\-*\/^<>=!&|~$:]/;return{startState:function(){return{tokenize:n,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var n=t.tokenize(e,t);"comment"!=n&&null==t.ctx.align&&(t.ctx.align=!0);var r=t.ctx.type;return";"!=a&&"{"!=a&&"}"!=a||"block"!=r||o(t),"{"==a?i(t,"}",e):"("==a?(i(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==a?i(t,"]",e):"block"==a?i(t,"block",e):a==r&&o(t),t.afterIdent="variable"==n||"keyword"==n,n},indent:function(t,r){if(t.tokenize!=n)return 0;var i=r&&r.charAt(0),o=t.ctx,a=i==o.type;return"block"==o.type?o.indent+("{"==i?0:e.indentUnit):o.align?o.column+(a?0:1):o.indent+(a?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],e):e(CodeMirror)}(function(e){"use strict";var t=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],n="("+t.join("|")+")",r=new RegExp(n+"\\s*$","i"),i=new RegExp(n+"(\\s+)","i");e.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:r,token:"variable-2"},{regex:i,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}],meta:{lineComment:"#"}}),e.defineMIME("text/x-dockerfile","dockerfile")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("tiddlywiki",function(){function e(e,t,n){return t.tokenize=n,n(e,t)}function t(t,u){var x=t.sol(),w=t.peek();if(u.block=!1,x&&/[<\/\*{}\-]/.test(w)){if(t.match(k))return u.block=!0,e(t,u,i);if(t.match(m))return"quote";if(t.match(p)||t.match(h))return"comment";if(t.match(g)||t.match(v)||t.match(y)||t.match(b))return"comment";if(t.match(d))return"hr"}if(t.next(),x&&/[\/\*!#;:>|]/.test(w)){if("!"==w)return t.skipToEnd(),"header";if("*"==w)return t.eatWhile("*"),"comment";if("#"==w)return t.eatWhile("#"),"comment";if(";"==w)return t.eatWhile(";"),"comment";if(":"==w)return t.eatWhile(":"),"comment";if(">"==w)return t.eatWhile(">"),"quote";if("|"==w)return"header"}if("{"==w&&t.match(/\{\{/))return e(t,u,i);if(/[hf]/i.test(w)&&/[ti]/i.test(t.peek())&&t.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))return"link";if('"'==w)return"string";if("~"==w)return"brace";if(/[\[\]]/.test(w)&&t.match(w))return"brace";if("@"==w)return t.eatWhile(f),"link";if(/\d/.test(w))return t.eatWhile(/\d/),"number";if("/"==w){if(t.eat("%"))return e(t,u,n);if(t.eat("/"))return e(t,u,o)}if("_"==w&&t.eat("_"))return e(t,u,a);if("-"==w&&t.eat("-")){if(" "!=t.peek())return e(t,u,s);if(" "==t.peek())return"brace"}return"'"==w&&t.eat("'")?e(t,u,r):"<"==w&&t.eat("<")?e(t,u,l):(t.eatWhile(/[\w\$_]/),c.propertyIsEnumerable(t.current())?"keyword":null)}function n(e,n){for(var r,i=!1;r=e.next();){if("/"==r&&i){n.tokenize=t;break}i="%"==r}return"comment"}function r(e,n){for(var r,i=!1;r=e.next();){if("'"==r&&i){n.tokenize=t;break}i="'"==r}return"strong"}function i(e,n){var r=n.block;return r&&e.current()?"comment":!r&&e.match(w)?(n.tokenize=t,"comment"):r&&e.sol()&&e.match(x)?(n.tokenize=t,"comment"):(e.next(),"comment")}function o(e,n){for(var r,i=!1;r=e.next();){if("/"==r&&i){n.tokenize=t;break}i="/"==r}return"em"}function a(e,n){for(var r,i=!1;r=e.next();){if("_"==r&&i){n.tokenize=t;break}i="_"==r}return"underlined"}function s(e,n){for(var r,i=!1;r=e.next();){if("-"==r&&i){n.tokenize=t;break}i="-"==r}return"strikethrough"}function l(e,n){if("<<"==e.current())return"macro";var r=e.next();return r?">"==r&&">"==e.peek()?(e.next(),n.tokenize=t,"macro"):(e.eatWhile(/[\w\$_]/),u.propertyIsEnumerable(e.current())?"keyword":null):(n.tokenize=t,null)}var c={},u={allTags:!0,closeAll:!0,list:!0,newJournal:!0,newTiddler:!0,permaview:!0,saveChanges:!0,search:!0,slider:!0,tabs:!0,tag:!0,tagging:!0,tags:!0,tiddler:!0,timeline:!0,today:!0,version:!0,option:!0,"with":!0,filter:!0},f=/[\w_\-]/i,d=/^\-\-\-\-+$/,p=/^\/\*\*\*$/,h=/^\*\*\*\/$/,m=/^<<<$/,g=/^\/\/\{\{\{$/,v=/^\/\/\}\}\}$/,y=/^<!--\{\{\{-->$/,b=/^<!--\}\}\}-->$/,k=/^\{\{\{$/,x=/^\}\}\}$/,w=/.*?\}\}\}/;return{startState:function(){return{tokenize:t}},token:function(e,t){if(e.eatSpace())return null;var n=t.tokenize(e,t);return n}}}),e.defineMIME("text/x-tiddlywiki","tiddlywiki")}),function(e){e(CodeMirror)}(function(e){"use strict";function t(e,t,n){var r;return r=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),r?n+=" mw-mnemonic":t}function n(e,n){return function(r,i,o){o&&r.sol()?i.ownLine=!0:o===!1&&i.ownLine&&(i.ownLine=!1);var a=i.ownLine?n:e;return r.match(/[^&]+/)?a:(r.next(),t(r,a,a))}}e.defineMode("mediawiki",function(n){function r(e,t,n){return t.isBold&&(e+=" strong"),t.isItalic&&(e+=" em"),i(e,t,n)}function i(e,t,n){var r="";switch(t.nTemplate){case 0:break;case 1:r+="-template";break;case 2:r+="-template2";break;default:r+="-template3"}switch(t.nExt){case 0:break;case 1:r+="-ext";break;case 2:r+="-ext2";break;default:r+="-ext3"}return t.nLink>0&&(r+="-link"),""!==r&&(e="mw"+r+"-ground "+e),n&&t[n]--,e}function o(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=r.stack.pop();break}n.next()}return i(e,r)}}function a(e){return function(t,n){return t.skipToEnd(),n.tokenize=n.stack.pop(),i(e,n)}}function s(e,t){return function(n,r){return r.tokenize=r.stack.pop(),n.eat(e)?i(t,r):i("error",r)}}function l(e){return function(t,n){return t.match(/[^&<\[\{~]+/)?(t.eol()&&(t.backUp(e),n.tokenize=a("mw-section-header")),null):E("","")(t,n)}}function c(e,t){return e.match(/[^\{\}\|]+/)?i("mw-templatevariable-name",t):e.eat("|")?(t.tokenize=u,i("mw-templatevariable-delimiter",t)):e.match("}}}")?(t.tokenize=t.stack.pop(),i("mw-templatevariable-bracket",t)):e.match("{{{")?(t.stack.push(t.tokenize),i("mw-templatevariable-bracket",t)):(e.next(),i("mw-templatevariable-name",t))}function u(e,t){return e.match(/[^\{\}\[<\&~]+/)?i("mw-templatevariable",t):e.match("}}}")?(t.tokenize=t.stack.pop(),i("mw-templatevariable-bracket",t)):E("mw-templatevariable","")(e,t)}function f(e,t){return e.match(/#?[^\:\}\{~]+/)?i("mw-parserfunction-name",t):e.eat(":")?(t.tokenize=d,i("mw-parserfunction-delimiter",t)):e.match("}}")?(t.tokenize=t.stack.pop(),i("mw-parserfunction-bracket",t,"nExt")):E("mw-parserfunction","")(e,t)}function d(e,t){return e.match(/[^\|\}\{\[<\&~]+/)?i("mw-parserfunction",t):e.eat("|")?i("mw-parserfunction-delimiter",t):e.match("}}")?(t.tokenize=t.stack.pop(),i("mw-parserfunction-bracket",t,"nExt")):E("mw-parserfunction","")(e,t)}function p(e){return function(t,n){return t.match(/[\s\u00a0]*\|[\s\u00a0]*/)?(n.tokenize=h(!0),i("mw-template-delimiter",n)):t.match(/[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),i("mw-template-bracket",n,"nTemplate")):e&&t.sol()?(n.nTemplate--,void(n.tokenize=n.stack.pop())):t.match(/[\s\u00a0]*[^\s\u00a0\|\}<\{\&~]+/)?(n.tokenize=p(!0),i("mw-template-name mw-pagename",n)):t.eatSpace()?t.eol()===!0?i("mw-template-name",n):i("mw-template-name mw-pagename",n):E("mw-template-name mw-pagename","mw-template-name-mnemonic mw-pagename")(t,n)}}function h(e){return function(t,n){return e&&t.eatWhile(/[^=\|\}\{\[<\&~]/)?t.eat("=")?(n.tokenize=h(!1),i("mw-template-argument-name",n)):i("mw-template",n):t.eatWhile(/[^\|\}\{\[<\&~]/)?i("mw-template",n):t.eat("|")?(n.tokenize=h(!0),i("mw-template-delimiter",n)):t.match("}}")?(n.tokenize=n.stack.pop(),i("mw-template-bracket",n,"nTemplate")):E("mw-template","")(t,n)}}function m(e){return function(t,n){for(;e>0;)e--,t.next();return t.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=g,i("mw-extlink-protocol",n)}}function g(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.match(/[\s\u00a0]*\]/)?(t.tokenize=t.stack.pop(),i("mw-extlink-bracket",t,"nLink")):e.eatSpace()?(t.tokenize=v,r("",t)):e.match(/[^\s\u00a0\]\{\&~]+/)||e.eatSpace()?r("mw-extlink",t):E("mw-extlink","")(e,t)}function v(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.eat("]")?(t.tokenize=t.stack.pop(),i("mw-extlink-bracket",t,"nLink")):e.match(/[^'\]\{\&~]+/)?r("mw-extlink-text",t):E("mw-extlink-text","")(e,t)}function y(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.match(/[\s\u00a0]*#[\s\u00a0]*/)?(t.tokenize=b,i("mw-link",t)):e.match(/[\s\u00a0]*\|[\s\u00a0]*/)?(t.tokenize=k(),i("mw-link-delimiter",t)):e.match(/[\s\u00a0]*\]\]/)?(t.tokenize=t.stack.pop(),i("mw-link-bracket",t,"nLink")):e.match(/[\s\u00a0]*[^\s\u00a0#\|\]\&~\{]+/)||e.eatSpace()?r("mw-link-pagename mw-pagename",t):E("mw-link-pagename mw-pagename","mw-pagename")(e,t)}function b(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.match(/[^\|\]\&~\{\}]+/)?i("mw-link-tosection",t):e.eat("|")?(t.tokenize=k(),i("mw-link-delimiter",t)):e.match("]]")?(t.tokenize=t.stack.pop(),i("mw-link-bracket",t,"nLink")):E("mw-link-tosection","")(e,t)}function k(){var e,t;return function(n,o){if(n.match("]]"))return o.tokenize=o.stack.pop(),i("mw-link-bracket",o,"nLink");if(n.match("'''"))return e=!e,i("mw-link-text mw-apostrophes",o);if(n.match("''"))return t=!t,i("mw-link-text mw-apostrophes",o);var a="mw-link-text";return e&&(a+=" strong"),t&&(a+=" em"),n.match(/[^'\]\{\&~]+/)?r(a,o):E(a,"")(n,o)}}function x(e,t,n){return function(r,o){for(var a="";e>0;)e--,a+=r.next();return r.eol()?(o.tokenize=o.stack.pop(),i(n?"mw-htmltag-name":"mw-exttag-name",o)):(r.eatSpace(),r.eol()?(o.tokenize=o.stack.pop(),i(n?"mw-htmltag-name":"mw-exttag-name",o)):n?(t?o.tokenize=s(">","mw-htmltag-bracket"):o.tokenize=w(a),i("mw-htmltag-name",o)):(t?o.tokenize=s(">","mw-exttag-bracket"):o.tokenize=_(a),i("mw-exttag-name",o)))}}function w(e){return function(t,n){return t.match(/[^>\/<\{\&~]+/)?i("mw-htmltag-attribute",n):t.eat(">")?(n.InHtmlTag.push(e),n.tokenize=n.stack.pop(),i("mw-htmltag-bracket",n)):t.match("/>")?(n.tokenize=n.stack.pop(),i("mw-htmltag-bracket",n)):E("mw-htmltag-attribute","")(t,n)}}function _(t){return function(r,o){return r.match(/[^>\/<\{\&~]+/)?i("mw-exttag-attribute",o):r.eat(">")?(o.extName=t,n.mwextMode&&t in n.mwextMode.tag&&(o.extMode=e.getMode(n,n.mwextMode.tag[t]),o.extState=e.startState(o.extMode)),o.tokenize=C(t),i("mw-exttag-bracket",o)):r.match("/>")?(o.tokenize=o.stack.pop(),i("mw-exttag-bracket",o)):E("mw-exttag-attribute","")(r,o)}}function C(e){return function(t,n){var r,i=!1,o=t.pos,a=new RegExp("</"+e+"\\s*>"),s=a.exec(o?t.string.slice(o):t.string);if(s){if(0===s.index)return n.tokenize=S(e),n.extName=!1,n.extMode!==!1&&(n.extMode=!1,n.extState=!1),n.tokenize(t,n);r=s.index+o,i=t.string,t.string=i.slice(0,r)}return n.stack.push(n.tokenize),n.tokenize=M(i),n.tokenize(t,n)}}function S(e){return function(t,n){return t.next(),t.next(),n.tokenize=x(e.length,!0,!1),i("mw-exttag-bracket",n)}}function M(e){return function(t,n){var r;return n.extMode===!1?(r=e===!1&&t.sol()?"line-cm-mw-exttag":"mw-exttag",t.skipToEnd()):(r=(e===!1&&t.sol()?"line-cm-mw-tag-":"mw-tag-")+n.extName,r+=" "+n.extMode.token(t,n.extState,e===!1)),t.eol()&&(e!==!1&&(t.string=e),n.tokenize=n.stack.pop()),i(r,n)}}function L(e,t){return e.sol()?(t.tokenize=T,T(e,t)):E("mw-table-definition","")(e,t)}function T(e,t){if(e.sol()){if(e.eat("|"))return e.eat("-")?(e.eatSpace(),t.tokenize=L,i("mw-table-delimiter",t)):e.eat("}")?(t.tokenize=t.stack.pop(),i("mw-table-bracket",t)):(e.eatSpace(),t.tokenize=A(!0,!1),i("mw-table-delimiter",t));if(e.eat("!"))return e.eatSpace(),t.tokenize=A(!0,!0),i("mw-table-delimiter",t)}return E("","")(e,t)}function A(e,t){return function(n,o){if(n.sol()){var a=n.peek();if("|"===a||"!"===a)return o.tokenize=T,o.tokenize(n,o);o.isBold=!1,o.isItalic=!1}else{if(n.match(/[^'\|\{\[<\&~]+/))return r(t?"strong":"",o);if(n.match("||")||t&&n.match("!!")||e&&n.eat("|"))return o.isBold=!1,o.isItalic=!1,e&&(o.tokenize=A(!1,t)),i("mw-table-delimiter",o)}return E(t?"strong":"",t?"strong":"")(n,o)}}function E(e,a){return function(s,u){function d(e){return u.stack.push(u.tokenize),u.tokenize=e,e(s,u)}var h=s.sol(),g=s.next();if(h)switch(u.isBold=!1,u.isItalic=!1,g){case" ":return"mw-skipformatting";case"-":if(s.match("---"))return"mw-hr";break;case"=":var v=s.match(/(={0,5})(.+?(=\1\s*))$/);if(v)return s.backUp(v[2].length),u.stack.push(u.tokenize),u.tokenize=l(v[3].length),"mw-section-header line-cm-mw-section-"+(v[1].length+1);break;case"*":case"#":if(s.match(/[\*#]*:*/))return"mw-list";break;case":":if(s.match(/:*[\*#]*/))return"mw-indenting";break;case"{":if(s.eat("|"))return s.eatSpace(),u.stack.push(u.tokenize),u.tokenize=L,"mw-table-bracket"}switch(g){case"&":return r(t(s,e,a),u);case"'":if(s.match("''"))return u.isBold=!u.isBold,i("mw-apostrophes",u);if(s.eat("'"))return u.isItalic=!u.isItalic,i("mw-apostrophes",u);break;case"[":if(s.eat("[")){if(s.eatSpace(),/[^\]\|\[]/.test(s.peek()))return u.nLink++,u.stack.push(u.tokenize),u.tokenize=y,i("mw-link-bracket",u)}else{var b=s.match(z);if(b)return u.nLink++,s.backUp(b[0].length),u.stack.push(u.tokenize),u.tokenize=m(b[0].length),i("mw-extlink-bracket",u)}break;case"{":if(s.match("{{"))return s.eatSpace(),u.stack.push(u.tokenize),u.tokenize=c,i("mw-templatevariable-bracket",u);if(s.match(/\{[\s\u00a0]*/)){if("#"===s.peek())return u.nExt++,u.stack.push(u.tokenize),u.tokenize=f,i("mw-parserfunction-bracket",u);var k=s.match(/([^\s\u00a0\}\[\]<\{\'\|\&\:]+)(\:|[\s\u00a0]*)(\}\}?)?(.)?/);return k&&(s.backUp(k[0].length),(":"===k[2]||void 0===k[4]||"}}"===k[3])&&n.mwextFunctionSynonyms&&(k[1].toLowerCase()in n.mwextFunctionSynonyms[0]||k[1]in n.mwextFunctionSynonyms[1]))?(u.nExt++,u.stack.push(u.tokenize),u.tokenize=f,i("mw-parserfunction-bracket",u)):(u.nTemplate++,u.stack.push(u.tokenize),u.tokenize=p(!1),i("mw-template-bracket",u))}break;case"<":if(s.match("!--"))return d(o("mw-comment","-->"));var w=!!s.eat("/"),_=s.match(/[^>\/\s\u00a0\.\*\,\[\]\{\}\$\^\+\?\|\/\\'`~<=!@#%&\(\)-]+/);if(_){if(_=_[0].toLowerCase(),n.mwextTags&&_ in n.mwextTags)return w===!0?"error":(s.backUp(_.length),u.stack.push(u.tokenize),u.tokenize=x(_.length,w,!1),i("mw-exttag-bracket",u));if(_ in O)return w===!0&&_!==u.InHtmlTag.pop()?"error":(s.backUp(_.length),u.stack.push(u.tokenize),u.tokenize=x(_.length,w,!0),i("mw-htmltag-bracket",u));s.backUp(_.length)}break;case"~":if(s.match(/~{2,4}/))return"mw-signature"}s.match(/[^\s\u00a0_>\}\[\]<\{\'\|\&\:~]+/);var C=r(e,u);return C}}var z=new RegExp(n.mwextUrlProtocols,"i"),O={b:!0,bdi:!0,del:!0,i:!0,ins:!0,u:!0,font:!0,big:!0,small:!0,sub:!0,sup:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,cite:!0,code:!0,em:!0,s:!0,strike:!0,strong:!0,tt:!0,"var":!0,div:!0,center:!0,blockquote:!0,ol:!0,ul:!0,dl:!0,table:!0,caption:!0,pre:!0,ruby:!0,rb:!0,rp:!0,rt:!0,rtc:!0,p:!0,span:!0,abbr:!0,dfn:!0,kbd:!0,samp:!0, +data:!0,time:!0,mark:!0,br:!0,wbr:!0,hr:!0,li:!0,dt:!0,dd:!0,td:!0,th:!0,tr:!0,noinclude:!0,includeonly:!0,onlyinclude:!0};return{startState:function(){return{tokenize:E("",""),stack:[],InHtmlTag:[],isBold:!1,isItalic:!1,extName:!1,extMode:!1,extState:!1,nTemplate:0,nLink:0,nExt:0}},copyState:function(t){return{tokenize:t.tokenize,stack:t.stack.concat([]),InHtmlTag:t.InHtmlTag.concat([]),isBold:t.isBold,isItalic:t.isItalic,extName:t.extName,extMode:t.extMode,extState:t.extMode!==!1&&e.copyState(t.extMode,t.extState),nTemplate:t.nTemplate,nLink:t.nLink,nExt:t.nExt}},token:function(e,t){return t.tokenize(e,t)},blankLine:function(e){if(e.extName){if(e.extMode){var t="";return e.extMode.blankLine&&(t=" "+e.extMode.blankLine(e.extState)),"line-cm-mw-tag-"+e.extName+t}return"line-cm-mw-exttag"}}}}),e.defineMIME("text/mediawiki","mediawiki"),e.defineMode("mw-tag-pre",function(){return{startState:function(){return{}},token:n("mw-tag-pre","line-cm-mw-tag-pre")}}),e.defineMode("mw-tag-nowiki",function(){return{startState:function(){return{}},token:n("mw-tag-nowiki","line-cm-mw-tag-nowiki")}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line==t.line&&e.ch==t.ch}function n(e){N.push(e),N.length>50&&N.shift()}function r(e){return N.length?void(N[N.length-1]+=e):n(e)}function i(e){return N[N.length-(e?Math.min(e,1):1)]||""}function o(){return N.length>1&&N.pop(),i()}function a(e,i,o,a,s){null==s&&(s=e.getRange(i,o)),a&&q&&q.cm==e&&t(i,q.pos)&&e.isClean(q.gen)?r(s):n(s),e.replaceRange("",i,o,"+delete"),q=a?{cm:e,pos:i,gen:e.changeGeneration()}:null}function s(e,t,n){return e.findPosH(t,n,"char",!0)}function l(e,t,n){return e.findPosH(t,n,"word",!0)}function c(e,t,n){return e.findPosV(t,n,"line",e.doc.sel.goalColumn)}function u(e,t,n){return e.findPosV(t,n,"page",e.doc.sel.goalColumn)}function f(e,t,n){for(var r=t.line,i=e.getLine(r),o=/\S/.test(n<0?i.slice(0,t.ch):i.slice(t.ch)),a=e.firstLine(),s=e.lastLine();;){if(r+=n,r<a||r>s)return e.clipPos(I(r-n,n<0?0:null));i=e.getLine(r);var l=/\S/.test(i);if(l)o=!0;else if(o)return I(r,0)}}function d(e,t,n){for(var r=t.line,i=t.ch,o=e.getLine(t.line),a=!1;;){var s=o.charAt(i+(n<0?-1:0));if(s){if(a&&/[!?.]/.test(s))return I(r,i+(n>0?1:0));a||(a=/\w/.test(s)),i+=n}else{if(r==(n<0?e.firstLine():e.lastLine()))return I(r,i);if(o=e.getLine(r+n),!/\S/.test(o))return I(r,i);r+=n,i=n<0?o.length:0}}}function p(e,n,r){var i;if(e.findMatchingBracket&&(i=e.findMatchingBracket(n,!0))&&i.match&&(i.forward?1:-1)==r)return r>0?I(i.to.line,i.to.ch+1):i.to;for(var o=!0;;o=!1){var a=e.getTokenAt(n),s=I(n.line,r<0?a.start:a.end);if(!(o&&r>0&&a.end==n.ch)&&/\w/.test(a.string))return s;var l=e.findPosH(s,r,"char");if(t(s,l))return n;n=l}}function h(e,t){var n=e.state.emacsPrefix;return n?(w(e),"-"==n?-1:Number(n)):t?null:1}function m(e){var t="string"==typeof e?function(t){t.execCommand(e)}:e;return function(e){var n=h(e);t(e);for(var r=1;r<n;++r)t(e)}}function g(e,n,r,i){var o=h(e);o<0&&(i=-i,o=-o);for(var a=0;a<o;++a){var s=r(e,n,i);if(t(s,n))break;n=s}return n}function v(e,t){var n=function(n){n.extendSelection(g(n,n.getCursor(),e,t))};return n.motion=!0,n}function y(e,t,n){for(var r,i=e.listSelections(),o=i.length;o--;)r=i[o].head,a(e,r,g(e,r,t,n),!0)}function b(e){if(e.somethingSelected()){for(var t,n=e.listSelections(),r=n.length;r--;)t=n[r],a(e,t.anchor,t.head);return!0}}function k(e,t){return e.state.emacsPrefix?void("-"!=t&&(e.state.emacsPrefix+=t)):(e.state.emacsPrefix=t,e.on("keyHandled",x),void e.on("inputRead",_))}function x(e,t){e.state.emacsPrefixMap||P.hasOwnProperty(t)||w(e)}function w(e){e.state.emacsPrefix=null,e.off("keyHandled",x),e.off("inputRead",_)}function _(e,t){var n=h(e);if(n>1&&"+input"==t.origin){for(var r=t.text.join("\n"),i="",o=1;o<n;++o)i+=r;e.replaceSelection(i)}}function C(e){e.state.emacsPrefixMap=!0,e.addKeyMap(j),e.on("keyHandled",S),e.on("inputRead",S)}function S(e,t){("string"!=typeof t||!/^\d$/.test(t)&&"Ctrl-U"!=t)&&(e.removeKeyMap(j),e.state.emacsPrefixMap=!1,e.off("keyHandled",S),e.off("inputRead",S))}function M(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",function(){e.setExtending(!1)})}function L(e){e.setExtending(!1),e.setCursor(e.getCursor())}function T(e,t,n){e.openDialog?e.openDialog(t+': <input type="text" style="width: 10em"/>',n,{bottom:!0}):n(prompt(t,""))}function A(e,t){var n=e.getCursor(),r=e.findPosH(n,1,"word");e.replaceRange(t(e.getRange(n,r)),n,r),e.setCursor(r)}function E(e){for(var t=e.getCursor(),n=t.line,r=t.ch,i=[];n>=e.firstLine();){for(var o=e.getLine(n),a=null==r?o.length:r;a>0;){var r=o.charAt(--a);if(")"==r)i.push("(");else if("]"==r)i.push("[");else if("}"==r)i.push("{");else if(/[\(\{\[]/.test(r)&&(!i.length||i.pop()!=r))return e.extendSelection(I(n,a))}--n,r=null}}function z(e){e.execCommand("clearSearch"),L(e)}function O(e){j[e]=function(t){k(t,e)},R["Ctrl-"+e]=function(t){k(t,e)},P["Ctrl-"+e]=!0}for(var I=e.Pos,N=[],q=null,P={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0},R=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":function(e){a(e,e.getCursor("start"),e.getCursor("end"))},"Ctrl-K":m(function(e){var t=e.getCursor(),n=e.clipPos(I(t.line)),r=e.getRange(t,n);/\S/.test(r)||(r+="\n",n=I(t.line+1,0)),a(e,t,n,!0,r)}),"Alt-W":function(e){n(e.getSelection()),L(e)},"Ctrl-Y":function(e){var t=e.getCursor();e.replaceRange(i(h(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},"Alt-Y":function(e){e.replaceSelection(o(),"around","paste")},"Ctrl-Space":M,"Ctrl-Shift-2":M,"Ctrl-F":v(s,1),"Ctrl-B":v(s,-1),Right:v(s,1),Left:v(s,-1),"Ctrl-D":function(e){y(e,s,1)},Delete:function(e){b(e)||y(e,s,1)},"Ctrl-H":function(e){y(e,s,-1)},Backspace:function(e){b(e)||y(e,s,-1)},"Alt-F":v(l,1),"Alt-B":v(l,-1),"Alt-D":function(e){y(e,l,1)},"Alt-Backspace":function(e){y(e,l,-1)},"Ctrl-N":v(c,1),"Ctrl-P":v(c,-1),Down:v(c,1),Up:v(c,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":v(u,-1),"Ctrl-V":v(u,1),PageUp:v(u,-1),PageDown:v(u,1),"Ctrl-Up":v(f,-1),"Ctrl-Down":v(f,1),"Alt-A":v(d,-1),"Alt-E":v(d,1),"Alt-K":function(e){y(e,d,1)},"Ctrl-Alt-K":function(e){y(e,p,1)},"Ctrl-Alt-Backspace":function(e){y(e,p,-1)},"Ctrl-Alt-F":v(p,1),"Ctrl-Alt-B":v(p,-1),"Shift-Ctrl-Alt-2":function(e){var t=e.getCursor();e.setSelection(g(e,t,p,1),t)},"Ctrl-Alt-T":function(e){var t=p(e,e.getCursor(),-1),n=p(e,t,1),r=p(e,n,1),i=p(e,r,-1);e.replaceRange(e.getRange(i,r)+e.getRange(n,i)+e.getRange(t,n),t,r)},"Ctrl-Alt-U":m(E),"Alt-Space":function(e){for(var t=e.getCursor(),n=t.ch,r=t.ch,i=e.getLine(t.line);n&&/\s/.test(i.charAt(n-1));)--n;for(;r<i.length&&/\s/.test(i.charAt(r));)++r;e.replaceRange(" ",I(t.line,n),I(t.line,r))},"Ctrl-O":m(function(e){e.replaceSelection("\n","start")}),"Ctrl-T":m(function(e){e.execCommand("transposeChars")}),"Alt-C":m(function(e){A(e,function(e){var t=e.search(/\w/);return t==-1?e:e.slice(0,t)+e.charAt(t).toUpperCase()+e.slice(t+1).toLowerCase()})}),"Alt-U":m(function(e){A(e,function(e){return e.toUpperCase()})}),"Alt-L":m(function(e){A(e,function(e){return e.toLowerCase()})}),"Alt-;":"toggleComment","Ctrl-/":m("undo"),"Shift-Ctrl--":m("undo"),"Ctrl-Z":m("undo"),"Cmd-Z":m("undo"),"Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findNext","Ctrl-R":"findPrev","Ctrl-G":z,"Shift-Alt-5":"replace","Alt-/":"autocomplete","Ctrl-J":"newlineAndIndent",Enter:!1,Tab:"indentAuto","Alt-G G":function(e){var t=h(e,!0);return null!=t&&t>0?e.setCursor(t-1):void T(e,"Goto line",function(t){var n;t&&!isNaN(n=Number(t))&&n==(0|n)&&n>0&&e.setCursor(n-1)})},"Ctrl-X Tab":function(e){e.indentSelection(h(e,!0)||e.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":m("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(e){a(e,e.getCursor(),d(e,e.getCursor(),1),!0)},"Ctrl-X H":"selectAll","Ctrl-Q Tab":m("insertTab"),"Ctrl-U":C}),j={"Ctrl-G":w},D=0;D<10;++D)O(String(D));O("-")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n,r){if(r<0&&0==n.ch)return t.clipPos(d(n.line-1));var i=t.getLine(n.line);if(r>0&&n.ch>=i.length)return t.clipPos(d(n.line+1,0));for(var o,a="start",s=n.ch,l=r<0?0:i.length,c=0;s!=l;s+=r,c++){var u=i.charAt(r<0?s-1:s),f="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==f&&u.toUpperCase()==u&&(f="W"),"start"==a)"o"!=f&&(a="in",o=f);else if("in"==a&&o!=f){if("w"==o&&"W"==f&&r<0&&s--,"W"==o&&"w"==f&&r>0){o="w";continue}break}}return d(n.line,s)}function n(e,n){e.extendSelectionsBy(function(r){return e.display.shift||e.doc.extend||r.empty()?t(e.doc,r.head,n):n<0?r.from():r.to()})}function r(t,n){return t.isReadOnly()?e.Pass:(t.operation(function(){for(var e=t.listSelections().length,r=[],i=-1,o=0;o<e;o++){var a=t.listSelections()[o].head;if(!(a.line<=i)){var s=d(a.line+(n?0:1),0);t.replaceRange("\n",s,null,"+insertLine"),t.indentLine(s.line,null,!0),r.push({head:s,anchor:s}),i=a.line+1}}t.setSelections(r)}),void t.execCommand("indentAuto"))}function i(t,n){for(var r=n.ch,i=r,o=t.getLine(n.line);r&&e.isWordChar(o.charAt(r-1));)--r;for(;i<o.length&&e.isWordChar(o.charAt(i));)++i;return{from:d(n.line,r),to:d(n.line,i),word:o.slice(r,i)}}function o(e){var t=e.getCursor(),n=e.scanForBracket(t,-1);if(n)for(;;){var r=e.scanForBracket(t,1);if(!r)return;if(r.ch==v.charAt(v.indexOf(n.ch)+1))return e.setSelection(d(n.pos.line,n.pos.ch+1),r.pos,!1),!0;t=d(r.pos.line,r.pos.ch+1)}}function a(t,n){if(t.isReadOnly())return e.Pass;for(var r,i=t.listSelections(),o=[],a=0;a<i.length;a++){var s=i[a];if(!s.empty()){for(var l=s.from().line,c=s.to().line;a<i.length-1&&i[a+1].from().line==c;)c=s[++a].to().line;o.push(l,c)}}o.length?r=!0:o.push(t.firstLine(),t.lastLine()),t.operation(function(){for(var e=[],i=0;i<o.length;i+=2){var a=o[i],s=o[i+1],l=d(a,0),c=d(s),u=t.getRange(l,c,!1);n?u.sort():u.sort(function(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return n!=r&&(e=n,t=r),e<t?-1:e==t?0:1}),t.replaceRange(u,l,c),r&&e.push({anchor:l,head:c})}r&&t.setSelections(e,0)})}function s(t,n){t.operation(function(){for(var r=t.listSelections(),o=[],a=[],s=0;s<r.length;s++){var l=r[s];l.empty()?(o.push(s),a.push("")):a.push(n(t.getRange(l.from(),l.to())))}t.replaceSelections(a,"around","case");for(var c,s=o.length-1;s>=0;s--){var l=r[o[s]];if(!(c&&e.cmpPos(l.head,c)>0)){var u=i(t,l.head);c=u.from,t.replaceRange(n(u.word),u.from,u.to)}}})}function l(t){var n=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(n,r)){var o=i(t,n);if(!o.word)return;n=o.from,r=o.to}return{from:n,to:r,query:t.getRange(n,r),word:o}}function c(e,t){var n=l(e);if(n){var r=n.query,i=e.getSearchCursor(r,t?n.to:n.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(r,t?d(e.firstLine(),0):e.clipPos(d(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):n.word&&e.setSelection(n.from,n.to))}}var u=e.keyMap.sublime={fallthrough:"default"},f=e.commands,d=e.Pos,p=e.keyMap["default"]==e.keyMap.macDefault,h=p?"Cmd-":"Ctrl-",m=p?"Ctrl-":"Alt-";f[u[m+"Left"]="goSubwordLeft"]=function(e){n(e,-1)},f[u[m+"Right"]="goSubwordRight"]=function(e){n(e,1)},p&&(u["Cmd-Left"]="goLineStartSmart");var g=p?"Ctrl-Alt-":"Ctrl-";f[u[g+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},f[u[g+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},f[u["Shift-"+h+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)for(var i=t[r].from(),o=t[r].to(),a=i.line;a<=o.line;++a)o.line>i.line&&a==o.line&&0==o.ch||n.push({anchor:a==i.line?i:d(a,0),head:a==o.line?o:d(a)});e.setSelections(n,0)},u["Shift-Tab"]="indentLess",f[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},f[u[h+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r];n.push({anchor:d(i.from().line,0),head:d(i.to().line+1,0)})}e.setSelections(n)},u["Shift-Ctrl-K"]="deleteLine",f[u[h+"Enter"]="insertLineAfter"]=function(e){return r(e,!1)},f[u["Shift-"+h+"Enter"]="insertLineBefore"]=function(e){return r(e,!0)},f[u[h+"D"]="selectNextOccurrence"]=function(t){var n=t.getCursor("from"),r=t.getCursor("to"),o=t.state.sublimeFindFullWord==t.doc.sel;if(0==e.cmpPos(n,r)){var a=i(t,n);if(!a.word)return;t.setSelection(a.from,a.to),o=!0}else{var s=t.getRange(n,r),l=o?new RegExp("\\b"+s+"\\b"):s,c=t.getSearchCursor(l,r);c.findNext()?t.addSelection(c.from(),c.to()):(c=t.getSearchCursor(l,d(t.firstLine(),0)),c.findNext()&&t.addSelection(c.from(),c.to()))}o&&(t.state.sublimeFindFullWord=t.doc.sel)};var v="(){}[]";f[u["Shift-"+h+"Space"]="selectScope"]=function(e){o(e)||e.execCommand("selectAll")},f[u["Shift-"+h+"M"]="selectBetweenBrackets"]=function(t){if(!o(t))return e.Pass},f[u[h+"M"]="goToBracket"]=function(t){t.extendSelectionsBy(function(n){var r=t.scanForBracket(n.head,1);if(r&&0!=e.cmpPos(r.pos,n.head))return r.pos;var i=t.scanForBracket(n.head,-1);return i&&d(i.pos.line,i.pos.ch+1)||n.head})};var y=p?"Cmd-Ctrl-":"Shift-Ctrl-";f[u[y+"Up"]="swapLineUp"]=function(t){if(t.isReadOnly())return e.Pass;for(var n=t.listSelections(),r=[],i=t.firstLine()-1,o=[],a=0;a<n.length;a++){var s=n[a],l=s.from().line-1,c=s.to().line;o.push({anchor:d(s.anchor.line-1,s.anchor.ch),head:d(s.head.line-1,s.head.ch)}),0!=s.to().ch||s.empty()||--c,l>i?r.push(l,c):r.length&&(r[r.length-1]=c),i=c}t.operation(function(){for(var e=0;e<r.length;e+=2){var n=r[e],i=r[e+1],a=t.getLine(n);t.replaceRange("",d(n,0),d(n+1,0),"+swapLine"),i>t.lastLine()?t.replaceRange("\n"+a,d(t.lastLine()),null,"+swapLine"):t.replaceRange(a+"\n",d(i,0),null,"+swapLine")}t.setSelections(o),t.scrollIntoView()})},f[u[y+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var n=t.listSelections(),r=[],i=t.lastLine()+1,o=n.length-1;o>=0;o--){var a=n[o],s=a.to().line+1,l=a.from().line;0!=a.to().ch||a.empty()||s--,s<i?r.push(s,l):r.length&&(r[r.length-1]=l),i=l}t.operation(function(){for(var e=r.length-2;e>=0;e-=2){var n=r[e],i=r[e+1],o=t.getLine(n);n==t.lastLine()?t.replaceRange("",d(n-1),d(n),"+swapLine"):t.replaceRange("",d(n,0),d(n+1,0),"+swapLine"),t.replaceRange(o+"\n",d(i,0),null,"+swapLine")}t.scrollIntoView()})},f[u[h+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},f[u[h+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){for(var i=t[r],o=i.from(),a=o.line,s=i.to().line;r<t.length-1&&t[r+1].from().line==s;)s=t[++r].to().line;n.push({start:a,end:s,anchor:!i.empty()&&o})}e.operation(function(){for(var t=0,r=[],i=0;i<n.length;i++){for(var o,a=n[i],s=a.anchor&&d(a.anchor.line-t,a.anchor.ch),l=a.start;l<=a.end;l++){var c=l-t;l==a.end&&(o=d(c,e.getLine(c).length+1)),c<e.lastLine()&&(e.replaceRange(" ",d(c),d(c+1,/^\s*/.exec(e.getLine(c+1))[0].length)),++t)}r.push({anchor:s||o,head:o})}e.setSelections(r,0)})},f[u["Shift-"+h+"D"]="duplicateLine"]=function(e){e.operation(function(){for(var t=e.listSelections().length,n=0;n<t;n++){var r=e.listSelections()[n];r.empty()?e.replaceRange(e.getLine(r.head.line)+"\n",d(r.head.line,0)):e.replaceRange(e.getRange(r.from(),r.to()),r.from())}e.scrollIntoView()})},u[h+"T"]="transposeChars",f[u.F9="sortLines"]=function(e){a(e,!0)},f[u[h+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},f[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),r=n.find();if(r)return t.push(n),e.setSelection(r.from,r.to)}},f[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(n)return e.setSelection(n.from,n.to);t.pop()}},f[u[h+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),r=0;r<t.length;r++){for(var i=t[r].from(),o=t[r].to(),a=e.findMarks(i,o),s=0;s<a.length;s++)if(a[s].sublimeBookmark){a[s].clear();for(var l=0;l<n.length;l++)n[l]==a[s]&&n.splice(l--,1);break}s==a.length&&n.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},f[u["Shift-"+h+"F2"]="clearBookmarks"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},f[u["Alt-F2"]="selectBookmarks"]=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var r=0;r<t.length;r++){var i=t[r].find();i?n.push({anchor:i.from,head:i.to}):t.splice(r--,0)}n.length&&e.setSelections(n,0)},u["Alt-Q"]="wrapLines";var b=h+"K ";u[b+h+"Backspace"]="delLineLeft",f[u.Backspace="smartBackspace"]=function(t){return t.somethingSelected()?e.Pass:void t.operation(function(){for(var n=t.listSelections(),r=t.getOption("indentUnit"),i=n.length-1;i>=0;i--){var o=n[i].head,a=t.getRange({line:o.line,ch:0},o),s=e.countColumn(a,null,t.getOption("tabSize")),l=t.findPosH(o,-1,"char",!1);if(a&&!/\S/.test(a)&&s%r==0){var c=new d(o.line,e.findColumn(a,s-r,r));c.ch!=o.ch&&(l=c)}t.replaceRange("",l,o,"+delete")}})},f[u[b+h+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange("",t[n].anchor,d(t[n].to().line),"+delete");e.scrollIntoView()})},f[u[b+h+"U"]="upcaseAtCursor"]=function(e){s(e,function(e){return e.toUpperCase()})},f[u[b+h+"L"]="downcaseAtCursor"]=function(e){s(e,function(e){return e.toLowerCase()})},f[u[b+h+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},f[u[b+h+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},f[u[b+h+"W"]="deleteToSublimeMark"]=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),i=n;if(e.cmpPos(r,i)>0){var o=i;i=r,r=o}t.state.sublimeKilled=t.getRange(r,i),t.replaceRange("",r,i)}},f[u[b+h+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},f[u[b+h+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[b+h+"G"]="clearBookmarks",f[u[b+h+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)};var k=p?"Ctrl-Shift-":"Ctrl-Alt-";f[u[k+"Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0;n<t.length;n++){var r=t[n];r.head.line>e.firstLine()&&e.addSelection(d(r.head.line-1,r.head.ch))}})},f[u[k+"Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0;n<t.length;n++){var r=t[n];r.head.line<e.lastLine()&&e.addSelection(d(r.head.line+1,r.head.ch))}})},f[u[h+"F3"]="findUnder"]=function(e){c(e,!0)},f[u["Shift-"+h+"F3"]="findUnderPrevious"]=function(e){c(e,!1)},f[u["Alt-F3"]="findAllUnder"]=function(e){var t=l(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],i=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&i++;e.setSelections(r,i)}},u["Shift-"+h+"["]="fold",u["Shift-"+h+"]"]="unfold",u[b+h+"0"]=u[b+h+"j"]="unfoldAll",u[h+"I"]="findIncremental",u["Shift-"+h+"I"]="findIncrementalReverse",u[h+"H"]="replace",u.F3="findNext",u["Shift-F3"]="findPrev",e.normalizeKeyMap(u)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";var t=[{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:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"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:"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:"<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:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"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:"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:"moveToEol",motionArgs:{inclusive:!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-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{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:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},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:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",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:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0, +toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],n=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],r=e.Pos,i=function(){function i(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",et),_(t),e.on(t.getInputField(),"paste",u(t))}function o(t){t.setOption("disableInput",!1),t.off("cursorActivity",et),e.off(t.getInputField(),"paste",u(t)),t.state.vim=null}function a(t,n){this==e.keyMap.vim&&e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),n&&n.attach==s||o(t,!1)}function s(t,n){this==e.keyMap.vim&&e.addClass(t.getWrapperElement(),"cm-fat-cursor"),n&&n.attach==s||i(t)}function l(t,n){if(n){if(this[t])return this[t];var r=c(t);if(!r)return!1;var i=e.Vim.findKey(n,r);return"function"==typeof i&&e.signal(n,"vim-keypress",r),i}}function c(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),n=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==n.length)return!1;for(var r=!1,i=0;i<t.length;i++){var o=t[i];o in st?t[i]=st[o]:r=!0,o in lt&&(t[i]=lt[o])}return!!r&&(g(n)&&(t[t.length-1]=n.toLowerCase()),"<"+t.join("-")+">")}function u(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(R(e.getCursor(),0,1)),Mt.enterInsertMode(e,{},t))}),t.onPasteFn}function f(e,t){for(var n=[],r=e;r<e+t;r++)n.push(String.fromCharCode(r));return n}function d(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function p(e){return/^[a-z]$/.test(e)}function h(e){return"()[]{}".indexOf(e)!=-1}function m(e){return ct.test(e)}function g(e){return/^[A-Z]$/.test(e)}function v(e){return/^\s*$/.test(e)}function y(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}function b(e,t,n,r,i){if(void 0===t&&!i)throw Error("defaultValue is required unless callback is provided");if(n||(n="string"),vt[e]={type:n,defaultValue:t,callback:i},r)for(var o=0;o<r.length;o++)vt[r[o]]=vt[e];t&&k(e,t)}function k(e,t,n,r){var i=vt[e];r=r||{};var o=r.scope;if(!i)throw Error("Unknown option: "+e);if("boolean"==i.type){if(t&&t!==!0)throw Error("Invalid argument: "+e+"="+t);t!==!1&&(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 x(e,t,n){var r=vt[e];n=n||{};var i=n.scope;if(!r)throw Error("Unknown option: "+e);{if(!r.callback){var o="global"!==i&&t&&t.state.vim.options[e];return(o||"local"!==i&&r||{}).value}var o=t&&r.callback(void 0,t);if("global"!==i&&void 0!==o)return o;if("local"!==i)return r.callback()}}function w(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=bt()}function _(e){return e.state.vim||(e.state.vim={inputState:new S,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function C(){kt={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:yt(),macroModeState:new w,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new A({}),searchHistoryController:new E({}),exCommandHistoryController:new E({})};for(var e in vt){var t=vt[e];t.value=t.defaultValue}}function S(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function M(t,n){t.state.vim.inputState=new S,e.signal(t,"vim-command-done",n)}function L(e,t,n){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}function T(e,t){var n=kt.registerController.registers[e];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,gt.push(e)}function A(e){this.registers=e,this.unnamedRegister=e['"']=new L,e["."]=new L,e[":"]=new L,e["/"]=new L}function E(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}function z(e,t){Ct[e]=t}function O(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n}function I(e,t){St[e]=t}function N(e,t){Mt[e]=t}function q(e,t,n){var i=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),o=X(e,i)-1;o=n?o+1:o;var a=Math.min(Math.max(0,t.ch),o);return r(i,a)}function P(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function R(e,t,n){return"object"==typeof t&&(n=t.ch,t=t.line),r(e.line+t,e.ch+n)}function j(e,t){return{line:t.line-e.line,ch:t.line-e.line}}function D(e,t,n,r){for(var i,o=[],a=[],s=0;s<t.length;s++){var l=t[s];"insert"==n&&"insert"!=l.context||l.context&&l.context!=n||r.operator&&"action"==l.type||!(i=W(e,l.keys))||("partial"==i&&o.push(l),"full"==i&&a.push(l))}return{partial:o.length&&o,full:a.length&&a}}function W(e,t){if("<character>"==t.slice(-11)){var n=t.length-11,r=e.slice(0,n),i=t.slice(0,n);return r==i&&e.length>n?"full":0==i.indexOf(r)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function B(e){var t=/^.*(<[\w\-]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(n.length>1)switch(n){case"<CR>":n="\n";break;case"<Space>":n=" "}return n}function F(e,t,n){return function(){for(var r=0;r<n;r++)t(e)}}function H(e){return r(e.line,e.ch)}function $(e,t){return e.ch==t.ch&&e.line==t.line}function U(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function K(e,t){return arguments.length>2&&(t=K.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?e:t}function V(e,t){return arguments.length>2&&(t=V.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?t:e}function G(e,t,n){var r=U(e,t),i=U(t,n);return r&&i}function X(e,t){return e.getLine(t).length}function Z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Q(e,t,n){var i=X(e,t),o=new Array(n-i+1).join(" ");e.setCursor(r(t,i)),e.replaceRange(o,e.getCursor())}function J(e,t){var n=[],i=e.listSelections(),o=H(e.clipPos(t)),a=!$(t,o),s=e.getCursor("head"),l=te(i,s),c=$(i[l].head,i[l].anchor),u=i.length-1,f=u-l>l?u:0,d=i[f].anchor,p=Math.min(d.line,o.line),h=Math.max(d.line,o.line),m=d.ch,g=o.ch,v=i[f].head.ch-m,y=g-m;v>0&&y<=0?(m++,a||g--):v<0&&y>=0?(m--,c||g++):v<0&&y==-1&&(m--,g++);for(var b=p;b<=h;b++){var k={anchor:new r(b,m),head:new r(b,g)};n.push(k)}return l=o.line==h?n.length-1:0,e.setSelections(n),t.ch=g,d.ch=m,d}function ee(e,t,n){for(var r=[],i=0;i<n;i++){var o=R(t,i,0);r.push({anchor:o,head:o})}e.setSelections(r,0)}function te(e,t,n){for(var r=0;r<e.length;r++){var i="head"!=n&&$(e[r].anchor,t),o="anchor"!=n&&$(e[r].head,t);if(i||o)return r}return-1}function ne(e,t){var n=t.lastSelection,i=function(){var t=e.listSelections(),n=t[0],r=t[t.length-1],i=U(n.anchor,n.head)?n.anchor:n.head,o=U(r.anchor,r.head)?r.head:r.anchor;return[i,o]},o=function(){var t=e.getCursor(),i=e.getCursor(),o=n.visualBlock;if(o){var a=o.width,s=o.height;i=r(t.line+s,t.ch+a);for(var l=[],c=t.line;c<i.line;c++){var u=r(c,t.ch),f=r(c,i.ch),d={anchor:u,head:f};l.push(d)}e.setSelections(l)}else{var p=n.anchorMark.find(),h=n.headMark.find(),m=h.line-p.line,g=h.ch-p.ch;i={line:i.line+m,ch:m?i.ch:g+i.ch},n.visualLine&&(t=r(t.line,0),i=r(i.line,X(e,i.line))),e.setSelection(t,i)}return[t,i]};return t.visualMode?i():o()}function re(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:H(n),head:H(r),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ie(e,t,n){var i,o=e.state.vim.sel,a=o.head,s=o.anchor;return U(n,t)&&(i=n,n=t,t=i),U(a,s)?(a=K(t,a),s=V(s,n)):(s=K(t,s),a=V(a,n),a=R(a,0,-1),a.ch==-1&&a.line!=e.firstLine()&&(a=r(a.line-1,X(e,a.line-1)))),[s,a]}function oe(e,t,n){var r=e.state.vim;t=t||r.sel;var n=n||r.visualLine?"line":r.visualBlock?"block":"char",i=ae(e,t,n);e.setSelections(i.ranges,i.primary),tt(e)}function ae(e,t,n,i){var o=H(t.head),a=H(t.anchor);if("char"==n){var s=i||U(t.head,t.anchor)?0:1,l=U(t.head,t.anchor)?1:0;return o=R(t.head,0,s),a=R(t.anchor,0,l),{ranges:[{anchor:a,head:o}],primary:0}}if("line"==n){if(U(t.head,t.anchor))o.ch=0,a.ch=X(e,a.line);else{a.ch=0;var c=e.lastLine();o.line>c&&(o.line=c),o.ch=X(e,o.line)}return{ranges:[{anchor:a,head:o}],primary:0}}if("block"==n){for(var u=Math.min(a.line,o.line),f=Math.min(a.ch,o.ch),d=Math.max(a.line,o.line),p=Math.max(a.ch,o.ch)+1,h=d-u+1,m=o.line==u?0:h-1,g=[],v=0;v<h;v++)g.push({anchor:r(u+v,f),head:r(u+v,p)});return{ranges:g,primary:m}}}function se(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=K(t,e.getCursor("anchor"))),t}function le(t,n){var r=t.state.vim;n!==!1&&t.setCursor(q(t,r.sel.head)),re(t,r),r.visualMode=!1,r.visualLine=!1,r.visualBlock=!1,e.signal(t,"vim-mode-change",{mode:"normal"}),r.fakeCursor&&r.fakeCursor.clear()}function ce(e,t,n){var r=e.getRange(t,n);if(/\n\s*$/.test(r)){var i=r.split("\n");i.pop();for(var o,o=i.pop();i.length>0&&o&&v(o);o=i.pop())n.line--,n.ch=0;o?(n.line--,n.ch=X(e,n.line)):n.ch=0}}function ue(e,t,n){t.ch=0,n.ch=0,n.line++}function fe(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function de(e,t,n,i,o){for(var a=se(e),s=e.getLine(a.line),l=a.ch,c=o?ut[0]:ft[0];!c(s.charAt(l));)if(l++,l>=s.length)return null;i?c=ft[0]:(c=ut[0],c(s.charAt(l))||(c=ut[1]));for(var u=l,f=l;c(s.charAt(u))&&u<s.length;)u++;for(;c(s.charAt(f))&&f>=0;)f--;if(f++,t){for(var d=u;/\s/.test(s.charAt(u))&&u<s.length;)u++;if(d==u){for(var p=f;/\s/.test(s.charAt(f-1))&&f>0;)f--;f||(f=p)}}return{start:r(a.line,f),end:r(a.line,u)}}function pe(e,t,n){$(t,n)||kt.jumpList.add(e,t,n)}function he(e,t){kt.lastCharacterSearch.increment=e,kt.lastCharacterSearch.forward=t.forward,kt.lastCharacterSearch.selectedCharacter=t.selectedCharacter}function me(e,t,n,i){var o=H(e.getCursor()),a=n?1:-1,s=n?e.lineCount():-1,l=o.ch,c=o.line,u=e.getLine(c),f={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:i,reverseSymb:(n?{")":"(","}":"{"}:{"(":")","{":"}"})[i],forward:n,depth:0,curMoveThrough:!1},d=Lt[i];if(!d)return o;var p=Tt[d].init,h=Tt[d].isComplete;for(p&&p(f);c!==s&&t;){if(f.index+=a,f.nextCh=f.lineText.charAt(f.index),!f.nextCh){if(c+=a,f.lineText=e.getLine(c)||"",a>0)f.index=0;else{var m=f.lineText.length;f.index=m>0?m-1:0}f.nextCh=f.lineText.charAt(f.index)}h(f)&&(o.line=c,o.ch=f.index,t--)}return f.nextCh||f.curMoveThrough?r(c,f.index):o}function ge(e,t,n,r,i){var o=t.line,a=t.ch,s=e.getLine(o),l=n?1:-1,c=r?ft:ut;if(i&&""==s){if(o+=l,s=e.getLine(o),!d(e,o))return null;a=n?0:s.length}for(;;){if(i&&""==s)return{from:0,to:0,line:o};for(var u=l>0?s.length:-1,f=u,p=u;a!=u;){for(var h=!1,m=0;m<c.length&&!h;++m)if(c[m](s.charAt(a))){for(f=a;a!=u&&c[m](s.charAt(a));)a+=l;if(p=a,h=f!=p,f==t.ch&&o==t.line&&p==f+l)continue;return{from:Math.min(f,p+1),to:Math.max(f,p),line:o}}h||(a+=l)}if(o+=l,!d(e,o))return null;s=e.getLine(o),a=l>0?0:s.length}}function ve(e,t,n,i,o,a){var s=H(t),l=[];(i&&!o||!i&&o)&&n++;for(var c=!(i&&o),u=0;u<n;u++){var f=ge(e,t,i,a,c);if(!f){var d=X(e,e.lastLine());l.push(i?{line:e.lastLine(),from:d,to:d}:{line:0,from:0,to:0});break}l.push(f),t=r(f.line,i?f.to-1:f.from)}var p=l.length!=n,h=l[0],m=l.pop();return i&&!o?(p||h.from==s.ch&&h.line==s.line||(m=l.pop()),r(m.line,m.from)):i&&o?r(m.line,m.to-1):!i&&o?(p||h.to==s.ch&&h.line==s.line||(m=l.pop()),r(m.line,m.to)):r(m.line,m.from)}function ye(e,t,n,i){for(var o,a=e.getCursor(),s=a.ch,l=0;l<t;l++){var c=e.getLine(a.line);if(o=xe(s,c,i,n,!0),o==-1)return null;s=o}return r(e.getCursor().line,o)}function be(e,t){var n=e.getCursor().line;return q(e,r(n,t-1))}function ke(e,t,n,r){y(n,mt)&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function xe(e,t,n,r,i){var o;return r?(o=t.indexOf(n,e+1),o==-1||i||(o-=1)):(o=t.lastIndexOf(n,e-1),o==-1||i||(o+=1)),o}function we(e,t,n,i,o){function a(t){return!e.getLine(t)}function s(e,t,n){return n?a(e)!=a(e+t):!a(e)&&a(e+t)}var l,c,u=t.line,f=e.firstLine(),d=e.lastLine(),p=u;if(i){for(;f<=p&&p<=d&&n>0;)s(p,i)&&n--,p+=i;return new r(p,0)}var h=e.state.vim;if(h.visualLine&&s(u,1,!0)){var m=h.sel.anchor;s(m.line,-1,!0)&&(o&&m.line==u||(u+=1))}var g=a(u);for(p=u;p<=d&&n;p++)s(p,1,!0)&&(o&&a(p)==g||n--);for(c=new r(p,0),p>d&&!g?g=!0:o=!1,p=u;p>f&&(o&&a(p)!=g&&p!=u||!s(p,-1,!0));p--);return l=new r(p,0),{start:l,end:c}}function _e(e,t,n,i){var o,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[n],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[n],u=e.getLine(s.line).charAt(s.ch),f=u===c?1:0;if(o=e.scanForBracket(r(s.line,s.ch+f),-1,null,{bracketRegex:l}),a=e.scanForBracket(r(s.line,s.ch+f),1,null,{bracketRegex:l}),!o||!a)return{start:s,end:s};if(o=o.pos,a=a.pos,o.line==a.line&&o.ch>a.ch||o.line>a.line){var d=o;o=a,a=d}return i?a.ch+=1:o.ch+=1,{start:o,end:a}}function Ce(e,t,n,i){var o,a,s,l,c=H(t),u=e.getLine(c.line),f=u.split(""),d=f.indexOf(n);if(c.ch<d?c.ch=d:d<c.ch&&f[c.ch]==n&&(a=c.ch,--c.ch),f[c.ch]!=n||a)for(s=c.ch;s>-1&&!o;s--)f[s]==n&&(o=s+1);else o=c.ch+1;if(o&&!a)for(s=o,l=f.length;s<l&&!a;s++)f[s]==n&&(a=s);return o&&a?(i&&(--o,++a),{start:r(c.line,o),end:r(c.line,a)}):{start:c,end:c}}function Se(){}function Me(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Se)}function Le(e,t,n,r,i){e.openDialog?e.openDialog(t,r,{bottom:!0,value:i.value,onKeyDown:i.onKeyDown,onKeyUp:i.onKeyUp,selectValueOnOpen:!1}):r(prompt(n,""))}function Te(e){var t=Ae(e)||[];if(!t.length)return[];var n=[];if(0===t[0]){for(var r=0;r<t.length;r++)"number"==typeof t[r]&&n.push(e.substring(t[r]+1,t[r+1]));return n}}function Ae(e){for(var t=!1,n=[],r=0;r<e.length;r++){var i=e.charAt(r);t||"/"!=i||n.push(r),t=!t&&"\\"==i}return n}function Ee(e){for(var t="|(){",n="}",r=!1,i=[],o=-1;o<e.length;o++){var a=e.charAt(o)||"",s=e.charAt(o+1)||"",l=s&&t.indexOf(s)!=-1;r?("\\"===a&&l||i.push(a),r=!1):"\\"===a?(r=!0,s&&n.indexOf(s)!=-1&&(l=!0),l&&"\\"!==s||i.push(a)):(i.push(a),l&&"\\"!==s&&i.push("\\"))}return i.join("")}function ze(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||"",o=e.charAt(r+1)||"";At[i+o]?(n.push(At[i+o]),r++):t?(n.push(i),t=!1):"\\"===i?(t=!0,m(o)||"$"===o?n.push("$"):"/"!==o&&"\\"!==o&&n.push("\\")):("$"===i&&n.push("$"),n.push(i),"/"===o&&n.push("\\"))}return n.join("")}function Oe(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 Et)if(n.match(o,!0)){i=!0,r.push(Et[o]);break}i||r.push(n.next())}return r.join("")}function Ie(e,t,n){var r=kt.registerController.getRegister("/");if(r.setText(e),e instanceof RegExp)return e;var i,o,a=Ae(e);if(a.length){i=e.substring(0,a[0]);var s=e.substring(a[0]);o=s.indexOf("i")!=-1}else i=e;if(!i)return null;x("pcre")||(i=Ee(i)),n&&(t=/^[^A-Z]*$/.test(i));var l=new RegExp(i,t||o?"i":void 0);return l}function Ne(e,t){e.openNotification?e.openNotification('<span style="color: red">'+t+"</span>",{bottom:!0,duration:5e3}):alert(t)}function qe(e,t){var n='<span style="font-family: monospace; white-space: pre">'+(e||"")+'<input type="text"></span>';return t&&(n+=' <span style="color: #888">'+t+"</span>"),n}function Pe(e,t){var n=(t.prefix||"")+" "+(t.desc||""),r=qe(t.prefix,t.desc);Le(e,r,n,t.onClose,t)}function Re(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}function je(e,t,n,r){if(t){var i=Me(e),o=Ie(t,!!n,!!r);if(o)return We(e,o),Re(o,i.getQuery())?o:(i.setQuery(o),o)}}function De(e){if("^"==e.source.charAt(0))var t=!0;return{token:function(n){if(t&&!n.sol())return void n.skipToEnd();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)););},query:e}}function We(e,t){var n=Me(e),r=n.getOverlay();r&&t==r.query||(r&&e.removeOverlay(r),r=De(t),e.addOverlay(r),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(r))}function Be(e,t,n,i){return void 0===i&&(i=1),e.operation(function(){for(var o=e.getCursor(),a=e.getSearchCursor(n,o),s=0;s<i;s++){var l=a.find(t);if(0==s&&l&&$(a.from(),o)&&(l=a.find(t)),!l&&(a=e.getSearchCursor(n,t?r(e.lastLine()):r(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function Fe(e){var t=Me(e);e.removeOverlay(Me(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function He(e,t,n){return"number"!=typeof e&&(e=e.line),t instanceof Array?y(e,t):n?e>=t&&e<=n:e==t}function $e(e){var t=e.getScrollInfo(),n=6,r=10,i=e.coordsChar({left:0,top:n+t.top},"local"),o=t.clientHeight-r+t.top,a=e.coordsChar({left:0,top:o},"local");return{top:i.line,bottom:a.line}}function Ue(t,n,r,i,o,a,s,l,c){function u(){t.operation(function(){for(;!m;)f(),d();p()})}function f(){var e=t.getRange(a.from(),a.to()),n=e.replace(s,l);a.replace(n)}function d(){for(;a.findNext()&&He(a.from(),i,o);)if(r||!g||a.from().line!=g.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),g=a.from(),void(m=!1);m=!0}function p(e){if(e&&e(),t.focus(),g){t.setCursor(g);var n=t.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=g.ch}c&&c()}function h(n,r,i){e.e_stop(n);var o=e.keyName(n);switch(o){case"Y":f(),d();break;case"N":d();break;case"A":var a=c;c=void 0,t.operation(u),c=a;break;case"L":f();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":p(i)}return m&&p(i),!0}t.state.vim.exMode=!0;var m=!1,g=a.from();return d(),m?void Ne(t,"No matches for "+s.source):n?void Pe(t,{prefix:"replace with <strong>"+l+"</strong> (y/n/a/q/l)",onKeyDown:h}):(u(),void(c&&c()))}function Ke(t){var n=t.state.vim,r=kt.macroModeState,i=kt.registerController.getRegister("."),o=r.isPlaying,a=r.lastInsertModeChanges,s=[];if(!o){for(var l=a.inVisualBlock?n.lastSelection.visualBlock.height:1,c=a.changes,s=[],u=0;u<c.length;)s.push(c[u]),c[u]instanceof rt?u++:u+=l;a.changes=s,t.off("change",Je),e.off(t.getInputField(),"keydown",it)}!o&&n.insertModeRepeat>1&&(ot(t,n,n.insertModeRepeat-1,!0),n.lastEditInputState.repeatOverride=n.insertModeRepeat),delete n.insertModeRepeat,n.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),i.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),r.isRecording&&Ye(r)}function Ve(e){t.unshift(e)}function Ge(e,t,n,r,i){var o={keys:e,type:t};o[t]=n,o[t+"Args"]=r;for(var a in i)o[a]=i[a];Ve(o)}function Xe(t,n,r,i){var o=kt.registerController.getRegister(i);if(":"==i)return o.keyBuffer[0]&&Nt.processCommand(t,o.keyBuffer[0]),void(r.isPlaying=!1);var a=o.keyBuffer,s=0;r.isPlaying=!0,r.replaySearchQueries=o.searchQueries.slice(0);for(var l=0;l<a.length;l++)for(var c,u,f=a[l];f;)if(c=/<\w+-.+?>|<\w+>|./.exec(f),u=c[0],f=f.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),n.insertMode){var d=o.insertModeChanges[s++].changes;kt.macroModeState.lastInsertModeChanges.changes=d,at(t,d,1),Ke(t)}r.isPlaying=!1}function Ze(e,t){if(!e.isPlaying){var n=e.latestRegister,r=kt.registerController.getRegister(n);r&&r.pushText(t)}}function Ye(e){if(!e.isPlaying){var t=e.latestRegister,n=kt.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function Qe(e,t){if(!e.isPlaying){var n=e.latestRegister,r=kt.registerController.getRegister(n);r&&r.pushSearchQuery&&r.pushSearchQuery(t)}}function Je(e,t){var n=kt.macroModeState,r=n.lastInsertModeChanges;if(!n.isPlaying)for(;t;){if(r.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var i=t.text.join("\n");r.changes.push(i)}t=t.next}}function et(e){var t=e.state.vim;if(t.insertMode){var n=kt.macroModeState;if(n.isPlaying)return;var r=n.lastInsertModeChanges;r.expectCursorActivityForChange?r.expectCursorActivityForChange=!1:r.changes=[]}else e.curOp.isVimOp||nt(e,t);t.visualMode&&tt(e)}function tt(e){var t=e.state.vim,n=q(e,H(t.sel.head)),r=R(n,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(n,r,{className:"cm-animate-fat-cursor"})}function nt(t,n){var r=t.getCursor("anchor"),i=t.getCursor("head");if(n.visualMode&&!t.somethingSelected()?le(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=U(i,r)?0:-1,a=U(i,r)?-1:0;i=R(i,0,o),r=R(r,0,a),n.sel={anchor:r,head:i},ke(t,n,"<",K(i,r)),ke(t,n,">",V(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function rt(e){this.keyName=e}function it(t){function n(){return i.changes.push(new rt(o)),!0}var r=kt.macroModeState,i=r.lastInsertModeChanges,o=e.keyName(t);o&&(o.indexOf("Delete")==-1&&o.indexOf("Backspace")==-1||e.lookupKey(o,"vim-insert",n))}function ot(e,t,n,r){function i(){s?_t.processAction(e,t,t.lastEditActionCommand):_t.evalInput(e,t)}function o(n){if(a.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=a.lastInsertModeChanges;at(e,r.changes,n)}}var a=kt.macroModeState;a.isPlaying=!0;var s=!!t.lastEditActionCommand,l=t.inputState;if(t.inputState=t.lastEditInputState,s&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c<n;c++)i(),o(1);else r||i(),o(n);t.inputState=l,t.insertMode&&!r&&Ke(e),a.isPlaying=!1}function at(t,n,r){function i(n){return"string"==typeof n?e.commands[n](t):n(t),!0}var o=t.getCursor("head"),a=kt.macroModeState.lastInsertModeChanges.inVisualBlock;if(a){var s=t.state.vim,l=s.lastSelection,c=j(l.anchor,l.head);ee(t,o,c.line+1),r=t.listSelections().length,t.setCursor(o)}for(var u=0;u<r;u++){a&&t.setCursor(R(o,u,0));for(var f=0;f<n.length;f++){var d=n[f];if(d instanceof rt)e.lookupKey(d.keyName,"vim-insert",i);else{var p=t.getCursor();t.replaceRange(d,p,p)}}}a&&t.setCursor(R(o,0,1))}e.defineOption("vimMode",!1,function(t,n,r){n&&"vim"!=t.getOption("keyMap")?t.setOption("keyMap","vim"):!n&&r!=e.Init&&/^vim/.test(t.getOption("keyMap"))&&t.setOption("keyMap","default")});var st={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},lt={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},ct=/[\d]/,ut=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],ft=[function(e){return/\S/.test(e)}],dt=f(65,26),pt=f(97,26),ht=f(48,10),mt=[].concat(dt,pt,ht,["<",">"]),gt=[].concat(dt,pt,ht,["-",'"',".",":","/"]),vt={};b("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e){var n=t.getOption("mode");return"null"==n?"":n}var n=""==e?"null":e;t.setOption("mode",n)}});var yt=function(){function e(e,t,s){function l(t){var i=++r%n,o=a[i];o&&o.clear(),a[i]=e.setBookmark(t)}var c=r%n,u=a[c];if(u){var f=u.find();f&&!$(f,t)&&l(t)}else l(t);l(s),i=r,o=r-n+1,o<0&&(o=0)}function t(e,t){r+=t,r>i?r=i:r<o&&(r=o);var s=a[(n+r)%n];if(s&&!s.find()){var l,c=t>0?1:-1,u=e.getCursor();do if(r+=c,s=a[(n+r)%n],s&&(l=s.find())&&!$(u,l))break;while(r<i&&r>o)}return s}var n=100,r=-1,i=0,o=0,a=new Array(n);return{cachedCursor:void 0,add:e,move:t}},bt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var e=kt.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var n=kt.registerController.getRegister(t);n&&(n.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var kt,xt,wt={buildKeyMap:function(){},getRegisterController:function(){return kt.registerController},resetVimGlobalState_:C,getVimGlobalState_:function(){return kt},maybeInitVimState_:_,suppressErrorLogging:!1,InsertModeKey:rt,map:function(e,t,n){Nt.map(e,t,n)},unmap:function(e,t){Nt.unmap(e,t)},setOption:k,getOption:x,defineOption:b,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;It[e]=n,Nt.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()},findKey:function(n,r,i){function o(){var e=kt.macroModeState;if(e.isRecording){if("q"==r)return e.exitMacroRecordMode(),M(n),!0;"mapping"!=i&&Ze(e,r)}}function a(){if("<Esc>"==r)return M(n),f.visualMode?le(n):f.insertMode&&Ke(n),!0}function s(t){for(var i;t;)i=/<\w+-.+?>|<\w+>|./.exec(t),r=i[0],t=t.substring(i.index+r.length),e.Vim.handleKey(n,r,"mapping")}function l(){if(a())return!0;for(var e=f.inputState.keyBuffer=f.inputState.keyBuffer+r,i=1==r.length,o=_t.matchCommand(e,t,f.inputState,"insert");e.length>1&&"full"!=o.type;){var e=f.inputState.keyBuffer=e.slice(1),s=_t.matchCommand(e,t,f.inputState,"insert");"none"!=s.type&&(o=s)}if("none"==o.type)return M(n),!1;if("partial"==o.type)return xt&&window.clearTimeout(xt),xt=window.setTimeout(function(){f.insertMode&&f.inputState.keyBuffer&&M(n)},x("insertModeEscKeysTimeout")),!i;if(xt&&window.clearTimeout(xt),i){var l=n.getCursor();n.replaceRange("",R(l,0,-(e.length-1)),l,"+input")}return M(n),o.command}function c(){if(o()||a())return!0;var e=f.inputState.keyBuffer=f.inputState.keyBuffer+r;if(/^[1-9]\d*$/.test(e))return!0;var i=/^(\d*)(.*)$/.exec(e);if(!i)return M(n),!1;var s=f.visualMode?"visual":"normal",l=_t.matchCommand(i[2]||i[1],t,f.inputState,s);if("none"==l.type)return M(n),!1;if("partial"==l.type)return!0;f.inputState.keyBuffer="";var i=/^(\d*)(.*)$/.exec(e);return i[1]&&"0"!=i[1]&&f.inputState.pushRepeatDigit(i[1]),l.command}var u,f=_(n);return u=f.insertMode?l():c(),u===!1?void 0:u===!0?function(){}:function(){return n.operation(function(){n.curOp.isVimOp=!0;try{"keyToKey"==u.type?s(u.toKeys):_t.processCommand(n,f,u)}catch(t){throw n.state.vim=void 0,_(n),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Nt.processCommand(e,t)},defineMotion:z,defineAction:N,defineOperator:I,mapCommand:Ge,_mapCommand:Ve,defineRegister:T,exitVisualMode:le,exitInsertMode:Ke};S.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},S.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},L.prototype={setText:function(e,t,n){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!n},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(bt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},A.prototype={pushText:function(e,t,n,r,i){r&&"\n"==n.charAt(0)&&(n=n.slice(1)+"\n"),r&&"\n"!==n.charAt(n.length-1)&&(n+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new L(n,r,i);break;case"delete":case"change":n.indexOf("\n")==-1?this.registers["-"]=new L(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new L(n,r))}return void this.unnamedRegister.setText(n,r,i)}var a=g(e);a?o.pushText(n,r):o.setText(n,r,i),this.unnamedRegister.setText(o.toString(),r)},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new L),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&y(e,gt)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},E.prototype={nextMatch:function(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],a=0;a<=o.length;a++)if(this.initialPrefix==o.substring(0,a))return this.iterator=i,o;return i>=n.length?(this.iterator=n.length,this.initialPrefix):i<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var _t={matchCommand:function(e,t,n,r){var i=D(e,t,r,n);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o,a=0;a<i.full.length;a++){var s=i.full[a];o||(o=s)}return"<character>"==o.keys.slice(-11)&&(n.selectedCharacter=B(e)),{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=P(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},void this.evalInput(e,t);M(e)}r.operator=n.operator,r.operatorArgs=P(n.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var r=t.visualMode,i=P(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,a=P(n.actionArgs)||{};r.selectedCharacter&&(a.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),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=r.registerName,M(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,r,n),Mt[n.action](e,a,t)},processSearch:function(t,n,r){function i(e,i,o){kt.searchHistoryController.pushInput(e),kt.searchHistoryController.reset();try{je(t,e,i,o)}catch(a){return Ne(t,"Invalid regex: "+e),void M(t)}_t.processMotion(t,n,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function o(e){t.scrollTo(d.left,d.top),i(e,!0,!0);var n=kt.macroModeState;n.isRecording&&Qe(n,e)}function a(n,r,i){var o,a=e.keyName(n);"Up"==a||"Down"==a?(o="Up"==a,r=kt.searchHistoryController.nextMatch(r,o)||"",i(r)):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.searchHistoryController.reset();var s;try{s=je(t,r,!0,!0)}catch(n){}s?t.scrollIntoView(Be(t,!l,s),30):(Fe(t),t.scrollTo(d.left,d.top))}function s(n,r,i){var o=e.keyName(n);"Esc"==o||"Ctrl-C"==o||"Ctrl-["==o||"Backspace"==o&&""==r?(kt.searchHistoryController.pushInput(r), +kt.searchHistoryController.reset(),je(t,f),Fe(t),t.scrollTo(d.left,d.top),e.e_stop(n),M(t),i(),t.focus()):"Ctrl-U"==o&&(e.e_stop(n),i(""))}if(t.getSearchCursor){var l=r.searchArgs.forward,c=r.searchArgs.wholeWordOnly;Me(t).setReversed(!l);var u=l?"/":"?",f=Me(t).getQuery(),d=t.getScrollInfo();switch(r.searchArgs.querySrc){case"prompt":var p=kt.macroModeState;if(p.isPlaying){var h=p.replaySearchQueries.shift();i(h,!0,!1)}else Pe(t,{onClose:o,prefix:u,desc:zt,onKeyUp:a,onKeyDown:s});break;case"wordUnderCursor":var m=de(t,!1,!0,!1,!0),g=!0;if(m||(m=de(t,!1,!0,!1,!1),g=!1),!m)return;var h=t.getLine(m.start.line).substring(m.start.ch,m.end.ch);h=g&&c?"\\b"+h+"\\b":Y(h),kt.jumpList.cachedCursor=t.getCursor(),t.setCursor(m.start),i(h,!0,!1)}}},processEx:function(t,n,r){function i(e){kt.exCommandHistoryController.pushInput(e),kt.exCommandHistoryController.reset(),Nt.processCommand(t,e)}function o(n,r,i){var o,a=e.keyName(n);("Esc"==a||"Ctrl-C"==a||"Ctrl-["==a||"Backspace"==a&&""==r)&&(kt.exCommandHistoryController.pushInput(r),kt.exCommandHistoryController.reset(),e.e_stop(n),M(t),i(),t.focus()),"Up"==a||"Down"==a?(o="Up"==a,r=kt.exCommandHistoryController.nextMatch(r,o)||"",i(r)):"Ctrl-U"==a?(e.e_stop(n),i("")):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.exCommandHistoryController.reset()}"keyToEx"==r.type?Nt.processCommand(t,r.exArgs.input):n.visualMode?Pe(t,{onClose:i,prefix:":",value:"'<,'>",onKeyDown:o}):Pe(t,{onClose:i,prefix:":",onKeyDown:o})},evalInput:function(e,t){var n,i,o,a=t.inputState,s=a.motion,l=a.motionArgs||{},c=a.operator,u=a.operatorArgs||{},f=a.registerName,d=t.sel,p=H(t.visualMode?q(e,d.head):e.getCursor("head")),h=H(t.visualMode?q(e,d.anchor):e.getCursor("anchor")),m=H(p),g=H(h);if(c&&this.recordLastEdit(t,a),o=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat(),o>0&&l.explicitRepeat?l.repeatIsExplicit=!0:(l.noRepeat||!l.explicitRepeat&&0===o)&&(o=1,l.repeatIsExplicit=!1),a.selectedCharacter&&(l.selectedCharacter=u.selectedCharacter=a.selectedCharacter),l.repeat=o,M(e),s){var v=Ct[s](e,p,l,t);if(t.lastMotion=Ct[s],!v)return;if(l.toJumplist){var y=kt.jumpList,b=y.cachedCursor;b?(pe(e,b,v),delete y.cachedCursor):pe(e,p,v)}v instanceof Array?(i=v[0],n=v[1]):n=v,n||(n=H(p)),t.visualMode?(t.visualBlock&&n.ch===1/0||(n=q(e,n,t.visualBlock)),i&&(i=q(e,i,!0)),i=i||g,d.anchor=i,d.head=n,oe(e),ke(e,t,"<",U(i,n)?i:n),ke(e,t,">",U(i,n)?n:i)):c||(n=q(e,n),e.setCursor(n.line,n.ch))}if(c){if(u.lastSel){i=g;var k=u.lastSel,x=Math.abs(k.head.line-k.anchor.line),w=Math.abs(k.head.ch-k.anchor.ch);n=k.visualLine?r(g.line+x,g.ch):k.visualBlock?r(g.line+x,g.ch+w):k.head.line==k.anchor.line?r(g.line,g.ch+w):r(g.line+x,g.ch),t.visualMode=!0,t.visualLine=k.visualLine,t.visualBlock=k.visualBlock,d=t.sel={anchor:i,head:n},oe(e)}else t.visualMode&&(u.lastSel={anchor:H(d.anchor),head:H(d.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var _,C,S,L,T;if(t.visualMode){if(_=K(d.head,d.anchor),C=V(d.head,d.anchor),S=t.visualLine||u.linewise,L=t.visualBlock?"block":S?"line":"char",T=ae(e,{anchor:_,head:C},L),S){var A=T.ranges;if("block"==L)for(var E=0;E<A.length;E++)A[E].head.ch=X(e,A[E].head.line);else"line"==L&&(A[0].head=r(A[0].head.line+1,0))}}else{if(_=H(i||g),C=H(n||m),U(C,_)){var z=_;_=C,C=z}S=l.linewise||u.linewise,S?ue(e,_,C):l.forward&&ce(e,_,C),L="char";var O=!l.inclusive||S;T=ae(e,{anchor:_,head:C},L,O)}e.setSelections(T.ranges,T.primary),t.lastMotion=null,u.repeat=o,u.registerName=f,u.linewise=S;var I=St[c](e,u,T.ranges,g,n);t.visualMode&&le(e,null!=I),I&&e.setCursor(I)}},recordLastEdit:function(e,t,n){var r=kt.macroModeState;r.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=n,r.lastInsertModeChanges.changes=[],r.lastInsertModeChanges.expectCursorActivityForChange=!1)}},Ct={moveToTopLine:function(e,t,n){var i=$e(e).top+n.repeat-1;return r(i,fe(e.getLine(i)))},moveToMiddleLine:function(e){var t=$e(e),n=Math.floor(.5*(t.top+t.bottom));return r(n,fe(e.getLine(n)))},moveToBottomLine:function(e,t,n){var i=$e(e).bottom-n.repeat+1;return r(i,fe(e.getLine(i)))},expandToLine:function(e,t,n){var i=t;return r(i.line+n.repeat-1,1/0)},findNext:function(e,t,n){var r=Me(e),i=r.getQuery();if(i){var o=!n.forward;return o=r.isReversed()?!o:o,We(e,i),Be(e,o,i,n.repeat)}},goToMark:function(e,t,n,r){var i=r.marks[n.selectedCharacter];if(i){var o=i.find();return n.linewise?{line:o.line,ch:fe(e.getLine(o.line))}:o}return null},moveToOtherHighlightedEnd:function(e,t,n,i){if(i.visualBlock&&n.sameLine){var o=i.sel;return[q(e,r(o.anchor.line,o.head.ch)),q(e,r(o.head.line,o.anchor.ch))]}return[i.sel.head,i.sel.anchor]},jumpToMark:function(e,t,n,i){for(var o=t,a=0;a<n.repeat;a++){var s=o;for(var l in i.marks)if(p(l)){var c=i.marks[l].find(),u=n.forward?U(c,s):U(s,c);if(!(u||n.linewise&&c.line==s.line)){var f=$(s,o),d=n.forward?G(s,c,o):G(o,c,s);(f||d)&&(o=c)}}}return n.linewise&&(o=r(o.line,fe(e.getLine(o.line)))),o},moveByCharacters:function(e,t,n){var i=t,o=n.repeat,a=n.forward?i.ch+o:i.ch-o;return r(i.line,a)},moveByLines:function(e,t,n,i){var o=t,a=o.ch;switch(i.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:a=i.lastHPos;break;default:i.lastHPos=a}var s=n.repeat+(n.repeatOffset||0),l=n.forward?o.line+s:o.line-s,c=e.firstLine(),u=e.lastLine();return l<c&&o.line==c?this.moveToStartOfLine(e,t,n,i):l>u&&o.line==u?this.moveToEol(e,t,n,i):(n.toFirstChar&&(a=fe(e.getLine(l)),i.lastHPos=a),i.lastHSPos=e.charCoords(r(l,a),"div").left,r(l,a))},moveByDisplayLines:function(e,t,n,i){var o=t;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 a=n.repeat,s=e.findPosV(o,n.forward?a:-a,"line",i.lastHSPos);if(s.hitSide)if(n.forward)var l=e.charCoords(s,"div"),c={top:l.top+8,left:i.lastHSPos},s=e.coordsChar(c,"div");else{var u=e.charCoords(r(e.firstLine(),0),"div");u.left=i.lastHSPos,s=e.coordsChar(u,"div")}return i.lastHPos=s.ch,s},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 we(e,t,n.repeat,r)},moveByScroll:function(e,t,n,r){var i=e.getScrollInfo(),o=null,a=n.repeat;a||(a=i.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");n.repeat=a;var o=Ct.moveByDisplayLines(e,t,n,r);if(!o)return null;var l=e.charCoords(o,"local");return e.scrollTo(null,i.top+l.top-s.top),o},moveByWords:function(e,t,n){return ve(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var r=n.repeat,i=ye(e,r,n.forward,n.selectedCharacter),o=n.forward?-1:1;return he(o,n),i?(i.ch+=o,i):null},moveToCharacter:function(e,t,n){var r=n.repeat;return he(0,n),ye(e,r,n.forward,n.selectedCharacter)||t},moveToSymbol:function(e,t,n){var r=n.repeat;return me(e,r,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,r){var i=n.repeat;return r.lastHPos=i-1,r.lastHSPos=e.charCoords(t,"div").left,be(e,i)},moveToEol:function(e,t,n,i){var o=t;i.lastHPos=1/0;var a=r(o.line+n.repeat-1,1/0),s=e.clipPos(a);return s.ch--,i.lastHSPos=e.charCoords(s,"div").left,a},moveToFirstNonWhiteSpaceCharacter:function(e,t){var n=t;return r(n.line,fe(e.getLine(n.line)))},moveToMatchedSymbol:function(e,t){var n,i=t,o=i.line,a=i.ch,s=e.getLine(o);do if(n=s.charAt(a++),n&&h(n)){var l=e.getTokenTypeAt(r(o,a));if("string"!==l&&"comment"!==l)break}while(n);if(n){var c=e.findMatchingBracket(r(o,a));return c.to}return i},moveToStartOfLine:function(e,t){return r(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,n){var i=n.forward?e.lastLine():e.firstLine();return n.repeatIsExplicit&&(i=n.repeat-e.getOption("firstLineNumber")),r(i,fe(e.getLine(i)))},textObjectManipulation:function(e,t,n,r){var i={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},o={"'":!0,'"':!0},a=n.selectedCharacter;"b"==a?a="(":"B"==a&&(a="{");var s,l=!n.textObjectInner;if(i[a])s=_e(e,t,a,l);else if(o[a])s=Ce(e,t,a,l);else if("W"===a)s=de(e,l,!0,!0);else if("w"===a)s=de(e,l,!0,!1);else{if("p"!==a)return null;if(s=we(e,t,n.repeat,0,l),n.linewise=!0,r.visualMode)r.visualLine||(r.visualLine=!0);else{var c=r.inputState.operatorArgs;c&&(c.linewise=!0),s.end.line--}}return e.state.vim.visualMode?ie(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,n){var r=kt.lastCharacterSearch,i=n.repeat,o=n.forward===r.forward,a=(r.increment?1:0)*(o?-1:1);e.moveH(-a,"char"),n.inclusive=!!o;var s=ye(e,i,o,r.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}},St={change:function(t,n,i){var o,a,s=t.state.vim;if(kt.macroModeState.lastInsertModeChanges.inVisualBlock=s.visualBlock,s.visualMode){a=t.getSelection();var l=O("",i.length);t.replaceSelections(l),o=K(i[0].head,i[0].anchor)}else{var c=i[0].anchor,u=i[0].head;a=t.getRange(c,u);var f=s.lastEditInputState||{};if("moveByWords"==f.motion&&!v(a)){var d=/\s+$/.exec(a);d&&f.motionArgs&&f.motionArgs.forward&&(u=R(u,0,-d[0].length),a=a.slice(0,-d[0].length))}var p=new r(c.line-1,Number.MAX_VALUE),h=t.firstLine()==t.lastLine();u.line>t.lastLine()&&n.linewise&&!h?t.replaceRange("",p,u):t.replaceRange("",c,u),n.linewise&&(h||(t.setCursor(p),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),o=c}kt.registerController.pushText(n.registerName,"change",a,n.linewise,i.length>1),Mt.enterInsertMode(t,{head:o},t.state.vim)},"delete":function(e,t,n){var i,o,a=e.state.vim;if(a.visualBlock){o=e.getSelection();var s=O("",n.length);e.replaceSelections(s),i=n[0].anchor}else{var l=n[0].anchor,c=n[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=r(l.line-1,X(e,l.line-1))),o=e.getRange(l,c),e.replaceRange("",l,c),i=l,t.linewise&&(i=Ct.moveToFirstNonWhiteSpaceCharacter(e,l))}return kt.registerController.pushText(t.registerName,"delete",o,t.linewise,a.visualBlock),q(e,i)},indent:function(e,t,n){var r=e.state.vim,i=n[0].anchor.line,o=r.visualBlock?n[n.length-1].anchor.line:n[0].head.line,a=r.visualMode?t.repeat:1;t.linewise&&o--;for(var s=i;s<=o;s++)for(var l=0;l<a;l++)e.indentLine(s,t.indentRight);return Ct.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},changeCase:function(e,t,n,r,i){for(var o=e.getSelections(),a=[],s=t.toLower,l=0;l<o.length;l++){var c=o[l],u="";if(s===!0)u=c.toLowerCase();else if(s===!1)u=c.toUpperCase();else for(var f=0;f<c.length;f++){var d=c.charAt(f);u+=g(d)?d.toLowerCase():d.toUpperCase()}a.push(u)}return e.replaceSelections(a),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?Ct.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:K(n[0].anchor,n[0].head)},yank:function(e,t,n,r){var i=e.state.vim,o=e.getSelection(),a=i.visualMode?K(i.sel.anchor,i.sel.head,n[0].head,n[0].anchor):r;return kt.registerController.pushText(t.registerName,"yank",o,t.linewise,i.visualBlock),a}},Mt={jumpListWalk:function(e,t,n){if(!n.visualMode){var r=t.repeat,i=t.forward,o=kt.jumpList,a=o.move(e,i?r:-r),s=a?a.find():void 0;s=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,a=i*r,s=t.forward?o+a:o-a,l=H(e.getCursor()),c=e.charCoords(l,"local");if(t.forward)s>c.top?(l.line+=(s-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,s);else{var u=s+e.getScrollInfo().clientHeight;u<c.bottom?(l.line-=(c.bottom-u)/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,s)}}},scrollToCursor:function(e,t){var n=e.getCursor().line,i=e.charCoords(r(n,0),"local"),o=e.getScrollInfo().clientHeight,a=i.top,s=i.bottom-a;switch(t.position){case"center":a=a-o/2+s;break;case"bottom":a=a-o+s}e.scrollTo(null,a)},replayMacro:function(e,t,n){var r=t.selectedCharacter,i=t.repeat,o=kt.macroModeState;for("@"==r&&(r=o.latestRegister);i--;)Xe(e,n,o,r)},enterMacroRecordMode:function(e,t){var n=kt.macroModeState,r=t.selectedCharacter;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(t,n,i){if(!t.getOption("readOnly")){i.insertMode=!0,i.insertModeRepeat=n&&n.repeat||1;var o=n?n.insertAt:null,a=i.sel,s=n.head||t.getCursor("head"),l=t.listSelections().length;if("eol"==o)s=r(s.line,X(t,s.line));else if("charAfter"==o)s=R(s,0,1);else if("firstNonBlank"==o)s=Ct.moveToFirstNonWhiteSpaceCharacter(t,s);else if("startOfSelectedArea"==o)i.visualBlock?(s=r(Math.min(a.head.line,a.anchor.line),Math.min(a.head.ch,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line<a.anchor.line?a.head:r(a.anchor.line,0);else if("endOfSelectedArea"==o)i.visualBlock?(s=r(Math.min(a.head.line,a.anchor.line),Math.max(a.head.ch+1,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line>=a.anchor.line?R(a.head,0,1):r(a.anchor.line,0);else if("inplace"==o&&i.visualMode)return;t.setOption("disableInput",!1),n&&n.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),kt.macroModeState.isPlaying||(t.on("change",Je),e.on(t.getInputField(),"keydown",it)),i.visualMode&&le(t),ee(t,s,l)}},toggleVisualMode:function(t,n,i){var o,a=n.repeat,s=t.getCursor();i.visualMode?i.visualLine^n.linewise||i.visualBlock^n.blockwise?(i.visualLine=!!n.linewise,i.visualBlock=!!n.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t)):le(t):(i.visualMode=!0,i.visualLine=!!n.linewise,i.visualBlock=!!n.blockwise,o=q(t,r(s.line,s.ch+a-1),!0),i.sel={anchor:s,head:o},e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t),ke(t,i,"<",K(s,o)),ke(t,i,">",V(s,o)))},reselectLastSelection:function(t,n,r){var i=r.lastSelection;if(r.visualMode&&re(t,r),i){var o=i.anchorMark.find(),a=i.headMark.find();if(!o||!a)return;r.sel={anchor:o,head:a},r.visualMode=!0,r.visualLine=i.visualLine,r.visualBlock=i.visualBlock,oe(t),ke(t,r,"<",K(o,a)),ke(t,r,">",V(o,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""})}},joinLines:function(e,t,n){var i,o;if(n.visualMode){if(i=e.getCursor("anchor"),o=e.getCursor("head"),U(o,i)){var a=o;o=i,i=a}o.ch=X(e,o.line)-1}else{var s=Math.max(t.repeat,2);i=e.getCursor(),o=q(e,r(i.line+s-1,1/0))}for(var l=0,c=i.line;c<o.line;c++){l=X(e,i.line);var a=r(i.line+1,X(e,i.line+1)),u=e.getRange(i,a);u=u.replace(/\n\s*/g," "),e.replaceRange(u,i,a)}var f=r(i.line,l);n.visualMode&&le(e,!1),e.setCursor(f)},newLineAndEnterInsertMode:function(t,n,i){i.insertMode=!0;var o=H(t.getCursor());if(o.line!==t.firstLine()||n.after){o.line=n.after?o.line:o.line-1,o.ch=X(t,o.line),t.setCursor(o);var a=e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent;a(t)}else t.replaceRange("\n",r(t.firstLine(),0)),t.setCursor(t.firstLine(),0);this.enterInsertMode(t,{repeat:n.repeat},i)},paste:function(e,t,n){var i=H(e.getCursor()),o=kt.registerController.getRegister(t.registerName),a=o.toString();if(a){if(t.matchIndent){var s=e.getOption("tabSize"),l=function(e){var t=e.split("\t").length-1,n=e.split(" ").length-1;return t*s+1*n},c=e.getLine(e.getCursor().line),u=l(c.match(/^\s*/)[0]),f=a.replace(/\n$/,""),d=a!==f,p=l(a.match(/^\s*/)[0]),a=f.replace(/^\s*/gm,function(t){var n=u+(l(t)-p);if(n<0)return"";if(e.getOption("indentWithTabs")){var r=Math.floor(n/s);return Array(r+1).join("\t")}return Array(n+1).join(" ")});a+=d?"\n":""}if(t.repeat>1)var a=Array(t.repeat+1).join(a);var h=o.linewise,m=o.blockwise;if(h)n.visualMode?a=n.visualLine?a.slice(0,-1):"\n"+a.slice(0,a.length-1)+"\n":t.after?(a="\n"+a.slice(0,a.length-1),i.ch=X(e,i.line)):i.ch=0;else{if(m){a=a.split("\n");for(var g=0;g<a.length;g++)a[g]=""==a[g]?" ":a[g]}i.ch+=t.after?1:0}var v,y;if(n.visualMode){n.lastPastedText=a;var b,k=ne(e,n),x=k[0],w=k[1],_=e.getSelection(),C=e.listSelections(),S=new Array(C.length).join("1").split("1");n.lastSelection&&(b=n.lastSelection.headMark.find()),kt.registerController.unnamedRegister.setText(_),m?(e.replaceSelections(S),w=r(x.line+a.length-1,x.ch),e.setCursor(x),J(e,w),e.replaceSelections(a),v=x):n.visualBlock?(e.replaceSelections(S),e.setCursor(x),e.replaceRange(a,x,x),v=x):(e.replaceRange(a,x,w),v=e.posFromIndex(e.indexFromPos(x)+a.length-1)),b&&(n.lastSelection.headMark=e.setBookmark(b)),h&&(v.ch=0)}else if(m){e.setCursor(i);for(var g=0;g<a.length;g++){var M=i.line+g;M>e.lastLine()&&e.replaceRange("\n",r(M,0));var L=X(e,M);L<i.ch&&Q(e,M,i.ch)}e.setCursor(i),J(e,r(i.line+a.length-1,i.ch)),e.replaceSelections(a),v=i}else e.replaceRange(a,i),h&&t.after?v=r(i.line+1,fe(e.getLine(i.line+1))):h&&!t.after?v=r(i.line,fe(e.getLine(i.line))):!h&&t.after?(y=e.indexFromPos(i),v=e.posFromIndex(y+a.length-1)):(y=e.indexFromPos(i),v=e.posFromIndex(y+a.length));n.visualMode&&le(e,!1),e.setCursor(v)}},undo:function(t,n){t.operation(function(){F(t,e.commands.undo,n.repeat)(),t.setCursor(t.getCursor("anchor"))})},redo:function(t,n){F(t,e.commands.redo,n.repeat)()},setRegister:function(e,t,n){n.inputState.registerName=t.selectedCharacter},setMark:function(e,t,n){var r=t.selectedCharacter;ke(e,n,r,e.getCursor())},replace:function(t,n,i){var o,a,s=n.selectedCharacter,l=t.getCursor(),c=t.listSelections();if(i.visualMode)l=t.getCursor("start"),a=t.getCursor("end");else{var u=t.getLine(l.line);o=l.ch+n.repeat,o>u.length&&(o=u.length),a=r(l.line,o)}if("\n"==s)i.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var f=t.getRange(l,a);if(f=f.replace(/[^\n]/g,s),i.visualBlock){var d=new Array(t.getOption("tabSize")+1).join(" ");f=t.getSelection(),f=f.replace(/\t/g,d).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(f)}else t.replaceRange(f,l,a);i.visualMode?(l=U(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),le(t,!1)):t.setCursor(R(a,0,-1))}},incrementNumberToken:function(e,t){for(var n,i,o,a,s,l=e.getCursor(),c=e.getLine(l.line),u=/-?\d+/g;null!==(n=u.exec(c))&&(s=n[0],i=n.index,o=i+s.length,!(l.ch<o)););if((t.backtrack||!(o<=l.ch))&&s){var f=t.increase?1:-1,d=parseInt(s)+f*t.repeat,p=r(l.line,i),h=r(l.line,o);a=d.toString(),e.replaceRange(a,p,h),e.setCursor(r(l.line,i+a.length-1))}},repeatLastEdit:function(e,t,n){var r=n.lastEditInputState;if(r){var i=t.repeat;i&&t.repeatIsExplicit?n.lastEditInputState.repeatOverride=i:i=n.lastEditInputState.repeatOverride||i,ot(e,n,i,!1)}},exitInsertMode:Ke},Lt={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Tt={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}}};b("pcre",!0,"boolean"),Se.prototype={getQuery:function(){return kt.query},setQuery:function(e){kt.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return kt.isReversed},setReversed:function(e){kt.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var At={"\\n":"\n","\\r":"\r","\\t":"\t"},Et={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},zt="(Javascript regexp)",Ot=function(){this.buildCommandMap_()};Ot.prototype={processCommand:function(e,t,n){var r=this;e.operation(function(){e.curOp.isVimOp=!0,r._processCommand(e,t,n)})},_processCommand:function(t,n,r){var i=t.state.vim,o=kt.registerController.getRegister(":"),a=o.toString();i.visualMode&&le(t);var s=new e.StringStream(n);o.setText(n);var l=r||{};l.input=n;try{this.parseInput_(t,s,l)}catch(c){throw Ne(t,c),c}var u,f;if(l.commandName){if(u=this.matchCommand_(l.commandName)){if(f=u.name,u.excludeFromCommandHistory&&o.setText(a),this.parseCommandArgs_(s,l,u),"exToKey"==u.type){for(var d=0;d<u.toKeys.length;d++)e.Vim.handleKey(t,u.toKeys[d],"mapping");return}if("exToEx"==u.type)return void this.processCommand(t,u.toInput)}}else void 0!==l.line&&(f="move");if(!f)return void Ne(t,'Not an editor command ":'+n+'"');try{It[f](t,l),u&&u.possiblyAsync||!l.callback||l.callback()}catch(c){throw Ne(t,c),c}},parseInput_:function(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)));var r=t.match(/^(\w+)/);return r?n.commandName=r[1]:n.commandName=t.match(/.*/)[0],n},parseLineSpec_:function(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case".":return e.getCursor().line;case"$":return e.lastLine();case"'":var r=e.state.vim.marks[t.next()];if(r&&r.find())return r.find().line;throw new Error("Mark not set");default:return void t.backUp(1)}},parseCommandArgs_:function(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)[0];var r=n.argDelimiter||/\s+/,i=Z(t.argString).split(r);i.length&&i[0]&&(t.args=i)}},matchCommand_:function(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_:function(){this.commandMap_={};for(var e=0;e<n.length;e++){var t=n[e],r=t.shortName||t.name;this.commandMap_[r]=t}},map:function(e,n,r){if(":"!=e&&":"==e.charAt(0)){if(r)throw Error("Mode not supported for ex mappings");var i=e.substring(1);":"!=n&&":"==n.charAt(0)?this.commandMap_[i]={name:i,type:"exToEx",toInput:n.substring(1),user:!0}:this.commandMap_[i]={name:i,type:"exToKey",toKeys:n,user:!0}}else if(":"!=n&&":"==n.charAt(0)){var o={keys:e,type:"keyToEx",exArgs:{input:n.substring(1)},user:!0};r&&(o.context=r),t.unshift(o)}else{var o={keys:e,type:"keyToKey",toKeys:n,user:!0};r&&(o.context=r),t.unshift(o)}},unmap:function(e,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var r=e.substring(1);if(this.commandMap_[r]&&this.commandMap_[r].user)return void delete this.commandMap_[r]}else for(var i=e,o=0;o<t.length;o++)if(i==t[o].keys&&t[o].context===n&&t[o].user)return void t.splice(o,1);throw Error("No such mapping.")}};var It={colorscheme:function(e,t){return!t.args||t.args.length<1?void Ne(e,e.getOption("theme")):void e.setOption("theme",t.args[0])},map:function(e,t,n){var r=t.args;return!r||r.length<2?void(e&&Ne(e,"Invalid mapping: "+t.input)):void Nt.map(r[0],r[1],n)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,n){var r=t.args;return!r||r.length<1?void(e&&Ne(e,"No such mapping: "+t.input)):void Nt.unmap(r[0],n)},move:function(e,t){_t.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1)return void(e&&Ne(e,"Invalid mapping: "+t.input));var i=n[0].split("="),o=i[0],a=i[1],s=!1;if("?"==o.charAt(o.length-1)){if(a)throw Error("Trailing characters: "+t.argString);o=o.substring(0,o.length-1),s=!0}void 0===a&&"no"==o.substring(0,2)&&(o=o.substring(2),a=!1);var l=vt[o]&&"boolean"==vt[o].type;if(l&&void 0==a&&(a=!0),!l&&void 0===a||s){var c=x(o,e,r);c===!0||c===!1?Ne(e," "+(c?"":"no")+o):Ne(e," "+o+"="+c)}else k(o,a,e,r)},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=kt.registerController.registers,i="----------Registers----------<br><br>";if(n){var o;n=n.join("");for(var a=0;a<n.length;a++)if(o=n.charAt(a),kt.registerController.isValidRegister(o)){var s=r[o]||new L;i+='"'+o+" "+s.toString()+"<br>"}}else for(var o in r){var l=r[o].toString();l.length&&(i+='"'+o+" "+l+"<br>")}Ne(e,i)},sort:function(t,n){function i(){if(n.argString){var t=new e.StringStream(n.argString);if(t.eat("!")&&(a=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var r=t.match(/[a-z]+/);if(r){r=r[0],s=r.indexOf("i")!=-1,l=r.indexOf("u")!=-1;var i=r.indexOf("d")!=-1&&1,o=r.indexOf("x")!=-1&&1,u=r.indexOf("o")!=-1&&1;if(i+o+u>1)return"Invalid arguments";c=i&&"decimal"||o&&"hex"||u&&"octal"}if(t.match(/\/.*\//))return"patterns not supported"}}function o(e,t){if(a){var n;n=e,e=t,t=n}s&&(e=e.toLowerCase(),t=t.toLowerCase());var r=c&&g.exec(e),i=c&&g.exec(t);return r?(r=parseInt((r[1]+r[2]).toLowerCase(),v),i=parseInt((i[1]+i[2]).toLowerCase(),v),r-i):e<t?-1:1}var a,s,l,c,u=i();if(u)return void Ne(t,u+": "+n.argString);var f=n.line||t.firstLine(),d=n.lineEnd||n.line||t.lastLine();if(f!=d){var p=r(f,0),h=r(d,X(t,d)),m=t.getRange(p,h).split("\n"),g="decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,v="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,y=[],b=[];if(c)for(var k=0;k<m.length;k++)g.exec(m[k])?y.push(m[k]):b.push(m[k]);else b=m;if(y.sort(o),b.sort(o),m=a?y.concat(b):b.concat(y),l){var x,w=m;m=[];for(var k=0;k<w.length;k++)w[k]!=x&&m.push(w[k]),x=w[k]}t.replaceRange(m.join("\n"),p,h)}},global:function(e,t){var n=t.argString;if(!n)return void Ne(e,"Regular Expression missing from global");var r,i=void 0!==t.line?t.line:e.firstLine(),o=t.lineEnd||t.line||e.lastLine(),a=Te(n),s=n;if(a.length&&(s=a[0],r=a.slice(1,a.length).join("/")),s)try{je(e,s,!0,!0)}catch(l){return void Ne(e,"Invalid regex: "+s)}for(var c=Me(e).getQuery(),u=[],f="",d=i;d<=o;d++){var p=c.test(e.getLine(d));p&&(u.push(d+1),f+=e.getLine(d)+"<br>")}if(!r)return void Ne(e,f);var h=0,m=function(){if(h<u.length){var t=u[h]+r;Nt.processCommand(e,t,{callback:m})}h++};m()},substitute:function(e,t){if(!e.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var n,i,o,a,s=t.argString,l=s?Te(s):[],c="",u=!1,f=!1;if(l.length)n=l[0],c=l[1],void 0!==c&&(c=x("pcre")?Oe(c):ze(c),kt.lastSubstituteReplacePart=c),i=l[2]?l[2].split(" "):[];else if(s&&s.length)return void Ne(e,"Substitutions should be of the form :s/pattern/replace/");if(i&&(o=i[0],a=parseInt(i[1]),o&&(o.indexOf("c")!=-1&&(u=!0,o.replace("c","")),o.indexOf("g")!=-1&&(f=!0,o.replace("g","")),n=n+"/"+o)),n)try{je(e,n,!0,!0)}catch(d){return void Ne(e,"Invalid regex: "+n)}if(c=c||kt.lastSubstituteReplacePart,void 0===c)return void Ne(e,"No previous substitute regular expression");var p=Me(e),h=p.getQuery(),m=void 0!==t.line?t.line:e.getCursor().line,g=t.lineEnd||m;m==e.firstLine()&&g==e.lastLine()&&(g=1/0),a&&(m=g,g=m+a-1);var v=q(e,r(m,0)),y=e.getSearchCursor(h,v);Ue(e,u,f,m,g,y,h,c,t.callback)},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){Fe(e)},yank:function(e){var t=H(e.getCursor()),n=t.line,r=e.getLine(n);kt.registerController.pushText("0","yank",r,!0,!0)},delmarks:function(t,n){if(!n.argString||!Z(n.argString))return void Ne(t,"Argument required");for(var r=t.state.vim,i=new e.StringStream(Z(n.argString));!i.eol();){i.eatSpace();var o=i.pos;if(!i.match(/[a-zA-Z]/,!1))return void Ne(t,"Invalid argument: "+n.argString.substring(o));var a=i.next();if(i.match("-",!0)){if(!i.match(/[a-zA-Z]/,!1))return void Ne(t,"Invalid argument: "+n.argString.substring(o));var s=a,l=i.next();if(!(p(s)&&p(l)||g(s)&&g(l)))return void Ne(t,"Invalid argument: "+s+"-");var c=s.charCodeAt(0),u=l.charCodeAt(0);if(c>=u)return void Ne(t,"Invalid argument: "+n.argString.substring(o));for(var f=0;f<=u-c;f++){var d=String.fromCharCode(c+f);delete r.marks[d]}}else delete r.marks[a]}}},Nt=new Ot;return e.keyMap.vim={attach:s,detach:a,call:l},b("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={fallthrough:["default"],attach:s,detach:a,call:l},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:s,detach:a,call:l},C(),wt};e.Vim=i()});
\ No newline at end of file diff --git a/public/vendor/codemirror/compress.sh b/public/vendor/codemirror/compress.sh index a2aebc76..678df9b1 100644 --- a/public/vendor/codemirror/compress.sh +++ b/public/vendor/codemirror/compress.sh @@ -53,6 +53,8 @@ mode/perl/perl.js \ mode/sass/sass.js \ mode/r/r.js \ mode/dockerfile/dockerfile.js \ +mode/tiddlywiki/tiddlywiki.js \ +mode/mediawiki/mediawiki.js \ keymap/emacs.js \ keymap/sublime.js \ keymap/vim.js
\ No newline at end of file diff --git a/public/vendor/codemirror/mode/mediawiki/README.salvus b/public/vendor/codemirror/mode/mediawiki/README.salvus new file mode 100755 index 00000000..1babd779 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/README.salvus @@ -0,0 +1,16 @@ +This is from https://github.com/wikimedia/mediawiki-extensions-CodeMirror + +1. However, note I fixed a bug in their code: + +@@ -684,7 +684,7 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) { + var tagname = stream.match( /[^>\/\s\u00a0\.\*\,\[\]\{\}\$\^\+\?\|\/\\'`~<=!@#%&\(\)-]+/ ); + if ( tagname ) { + tagname = tagname[0].toLowerCase(); +- if ( tagname in config.mwextTags ) { // Parser function ++ if ( config.mwextTags && tagname in config.mwextTags ) { // Parser function + if ( isCloseTag === true ) { + // @todo message + return 'error'; + + +2. Note the comment about "evil BS" in the css file.
\ No newline at end of file diff --git a/public/vendor/codemirror/mode/mediawiki/img/black4.png b/public/vendor/codemirror/mode/mediawiki/img/black4.png Binary files differnew file mode 100755 index 00000000..c66d7014 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/img/black4.png diff --git a/public/vendor/codemirror/mode/mediawiki/img/ext2.png b/public/vendor/codemirror/mode/mediawiki/img/ext2.png Binary files differnew file mode 100755 index 00000000..d78a7429 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/img/ext2.png diff --git a/public/vendor/codemirror/mode/mediawiki/img/ext4.png b/public/vendor/codemirror/mode/mediawiki/img/ext4.png Binary files differnew file mode 100755 index 00000000..11b439d4 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/img/ext4.png diff --git a/public/vendor/codemirror/mode/mediawiki/img/link4.png b/public/vendor/codemirror/mode/mediawiki/img/link4.png Binary files differnew file mode 100755 index 00000000..07eca617 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/img/link4.png diff --git a/public/vendor/codemirror/mode/mediawiki/img/template4.png b/public/vendor/codemirror/mode/mediawiki/img/template4.png Binary files differnew file mode 100755 index 00000000..7eda15ab --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/img/template4.png diff --git a/public/vendor/codemirror/mode/mediawiki/img/template8.png b/public/vendor/codemirror/mode/mediawiki/img/template8.png Binary files differnew file mode 100755 index 00000000..4df75b05 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/img/template8.png diff --git a/public/vendor/codemirror/mode/mediawiki/mediawiki.css b/public/vendor/codemirror/mode/mediawiki/mediawiki.css new file mode 100755 index 00000000..a549ad66 --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/mediawiki.css @@ -0,0 +1,110 @@ +/* WTF: What kind of evil BS is this?! -- commented out. + +.CodeMirror { + border: 1px solid #CCC; + font-size: medium; + line-height: 1.5em; +} + +.CodeMirrorIE { + font-size: small; +} +*/ + +.cm-mw-pagename { text-decoration: underline; } + +.cm-mw-matching {background-color: gold;} + +.cm-mw-skipformatting { background-color: #adf; } +.cm-mw-list {color: #08f; font-weight: bold; background-color: #eee;} +.cm-mw-signature, +.cm-mw-hr { color: #08f; font-weight: bold; background-color: #eee; } +.cm-mw-indenting {color: #08f; font-weight: bold; background-color: #ddd;} +.cm-mw-mnemonic {color: #090;} +.cm-mw-comment {color: #aaa; font-weight: normal;} +.cm-mw-apostrophes {color: #08f;} + +pre.cm-mw-section-1 {font-weight: bold;} +pre.cm-mw-section-2 {font-weight: bold;} +pre.cm-mw-section-3 {font-weight: bold;} +pre.cm-mw-section-4 {font-weight: bold;} +pre.cm-mw-section-5 {font-weight: bold;} +pre.cm-mw-section-6 {font-weight: bold;} +.cm-mw-section-header {color: #08f; font-weight: normal;} + +.cm-mw-template {color: #a11; font-weight: normal;} +.cm-mw-template-name {color: #a11; font-weight: bold;} +.cm-mw-template-name-mnemonic {font-weight: normal;} +.cm-mw-template-argument-name {color: #a11; font-weight: bold;} +.cm-mw-template-delimiter {color: #a11; font-weight: bold;} +.cm-mw-template-bracket {color: #a11; font-weight: bold;} + +.cm-mw-templatevariable {color: #f50; font-weight: normal;} +.cm-mw-templatevariable-name {color: #f50; font-weight: bold;} +.cm-mw-templatevariable-bracket {color: #f50; font-weight: normal;} +.cm-mw-templatevariable-delimiter {color: #f50; font-weight: bold;} + +.cm-mw-parserfunction {font-weight: normal;} +.cm-mw-parserfunction-name {color: #70a; font-weight: bold;} +.cm-mw-parserfunction-bracket {color: #70a; font-weight: bold;} +.cm-mw-parserfunction-delimiter {color: #70a; font-weight: bold;} + +pre.cm-mw-exttag {background-image: url(img/ext2.png);} +.cm-mw-exttag {background-image: url(img/ext4.png);} +.cm-mw-exttag-name {color: #70a; font-weight: bold;} +.cm-mw-exttag-bracket {color: #70a; font-weight: normal;} +.cm-mw-exttag-attribute {color: #70a; font-weight: normal;} + +.cm-mw-htmltag-name {color: #170; font-weight: bold;} +.cm-mw-htmltag-bracket {color: #170; font-weight: normal;} +.cm-mw-htmltag-attribute {color: #170; font-weight: normal;} + +pre.cm-mw-tag-pre, .cm-mw-tag-pre {background-image: url(img/black4.png);} +pre.cm-mw-tag-nowiki, .cm-mw-tag-nowiki {background-image: url(img/black4.png);} + +.cm-mw-link-pagename {color: #219; font-weight: normal;} +.cm-mw-link-tosection {color: #08f; font-weight: normal;} +.cm-mw-link-bracket {color: #219; font-weight: normal;} +.cm-mw-link-text {} +.cm-mw-link-delimiter {color: #219; font-weight: normal;} + +.cm-mw-extlink {color: #219; font-weight: normal;} +.cm-mw-extlink-protocol {color: #219; font-weight: bold;} +.cm-mw-extlink-text {} +.cm-mw-extlink-bracket {color: #219; font-weight: bold;} + +.cm-mw-table-bracket {color: #e0e; font-weight: bold;} +.cm-mw-table-delimiter {color: #e0e; font-weight: bold;} +.cm-mw-table-definition {color: #e0e; font-weight: normal;} + +.cm-mw-template-ground {} +.cm-mw-template2-ground {background-image: url(img/template4.png);} +.cm-mw-template3-ground {background-image: url(img/template8.png);} +.cm-mw-template-ext-ground {background-image: url(img/ext4.png);} +.cm-mw-template-ext2-ground {background-image: url(img/ext4.png),url(img/ext4.png);} +.cm-mw-template-ext3-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);} +.cm-mw-template-link-ground {background-image: url(img/link4.png);} +.cm-mw-template-ext-link-ground {background-image: url(img/ext4.png),url(img/link4.png);} +.cm-mw-template-ext2-link-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template-ext3-link-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template2-ext-ground {background-image: url(img/template4.png),url(img/ext4.png);} +.cm-mw-template2-ext2-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png);} +.cm-mw-template2-ext3-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);} +.cm-mw-template2-link-ground {background-image: url(img/template4.png),url(img/link4.png);} +.cm-mw-template2-ext-link-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template2-ext2-link-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template2-ext3-link-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template3-ext-ground {background-image: url(img/template8.png),url(img/ext4.png);} +.cm-mw-template3-ext2-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png);} +.cm-mw-template3-ext3-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);} +.cm-mw-template3-link-ground {background-image: url(img/template8.png),url(img/link4.png);} +.cm-mw-template3-ext-link-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template3-ext2-link-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-template3-ext3-link-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-ext-ground {background-image: url(img/ext4.png)} +.cm-mw-ext2-ground {background-image: url(img/ext4.png),url(img/ext4.png);} +.cm-mw-ext3-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);} +.cm-mw-ext-link-ground {background-image: url(img/link4.png);} +.cm-mw-ext2-link-ground {background-image: url(img/ext4.png),url(img/link4.png);} +.cm-mw-ext3-link-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/link4.png);} +.cm-mw-link-ground {background-image: url(img/link4.png);} diff --git a/public/vendor/codemirror/mode/mediawiki/mediawiki.js b/public/vendor/codemirror/mode/mediawiki/mediawiki.js new file mode 100755 index 00000000..ed9b008c --- /dev/null +++ b/public/vendor/codemirror/mode/mediawiki/mediawiki.js @@ -0,0 +1,791 @@ +/* global CodeMirror */ +(function( mod ) { mod( CodeMirror ); })(function( CodeMirror ) { +'use strict'; + +function eatMnemonic( stream, style, mnemonicStyle ) { + var ok; + if ( stream.eat( '#' ) ) { + if (stream.eat( 'x' ) ) { + ok = stream.eatWhile( /[a-fA-F\d]/ ) && stream.eat( ';'); + } else { + ok = stream.eatWhile( /[\d]/ ) && stream.eat( ';' ); + } + } else { + ok = stream.eatWhile( /[\w\.\-:]/ ) && stream.eat( ';' ); + } + if ( ok ) { + mnemonicStyle += ' mw-mnemonic'; + return mnemonicStyle; + } + return style; +} + +CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) { + + var urlProtocols = new RegExp( config.mwextUrlProtocols, 'i' ); + var permittedHtmlTags = {'b': true, 'bdi': true, 'del': true, 'i': true, 'ins': true, + 'u': true, 'font': true, 'big': true, 'small': true, 'sub': true, 'sup': true, + 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, 'cite': true, + 'code': true, 'em': true, 's': true, 'strike': true, 'strong': true, 'tt': true, + 'var': true, 'div': true, 'center': true, 'blockquote': true, 'ol': true, 'ul': true, + 'dl': true, 'table': true, 'caption': true, 'pre': true, 'ruby': true, 'rb': true, + 'rp': true, 'rt': true, 'rtc': true, 'p': true, 'span': true, 'abbr': true, 'dfn': true, + 'kbd': true, 'samp': true, 'data': true, 'time': true, 'mark': true, 'br': true, + 'wbr': true, 'hr': true, 'li': true, 'dt': true, 'dd': true, 'td': true, 'th': true, + 'tr': true, 'noinclude': true, 'includeonly': true, 'onlyinclude': true}; + + function makeStyle( style, state, endGround ) { + if ( state.isBold ) { + style += ' strong'; + } + if ( state.isItalic ) { + style += ' em'; + } + return makeLocalStyle( style, state, endGround ); + } + + function makeLocalStyle( style, state, endGround ) { + var ground = ''; + switch ( state.nTemplate ) { + case 0: + break; + case 1: + ground += '-template'; + break; + case 2: + ground += '-template2'; + break; + default: + ground += '-template3'; + break; + } + switch ( state.nExt ) { + case 0: + break; + case 1: + ground += '-ext'; + break; + case 2: + ground += '-ext2'; + break; + default: + ground += '-ext3'; + break; + } + if ( state.nLink > 0 ) { + ground += '-link'; + } + if ( ground !== '' ) { + style = 'mw' + ground + '-ground ' + style; + } + if ( endGround ) { + state[endGround]--; + } + return style; + } + + function eatBlock( style, terminator ) { + return function( stream, state ) { + while ( !stream.eol() ) { + if ( stream.match( terminator ) ) { + state.tokenize = state.stack.pop(); + break; + } + stream.next(); + } + return makeLocalStyle( style, state ); + }; + } + + function eatEnd( style ) { + return function( stream, state ) { + stream.skipToEnd(); + state.tokenize = state.stack.pop(); + return makeLocalStyle( style, state ); + }; + } + + function eatChar( char, style ) { + return function( stream, state ) { + state.tokenize = state.stack.pop(); + if ( stream.eat( char ) ) { + return makeLocalStyle( style, state ); + } + return makeLocalStyle( 'error', state ); + }; + } + + function eatSectionHeader( count ) { + return function( stream, state ) { + if ( stream.match( /[^&<\[\{~]+/ ) ) { + if ( stream.eol() ) { + stream.backUp( count ); + state.tokenize = eatEnd( 'mw-section-header' ); + } + return null; // style is null + } + return eatWikiText( '', '' )( stream, state ); + }; + } + + function inVariable( stream, state ) { + if ( stream.match( /[^\{\}\|]+/ ) ) { + return makeLocalStyle( 'mw-templatevariable-name', state ); + } + if ( stream.eat( '|' ) ) { + state.tokenize = inVariableDefault; + return makeLocalStyle( 'mw-templatevariable-delimiter', state ); + } + if ( stream.match( '}}}' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-templatevariable-bracket', state ); + } + if ( stream.match( '{{{' ) ) { + state.stack.push( state.tokenize ); + return makeLocalStyle( 'mw-templatevariable-bracket', state ); + } + stream.next(); + return makeLocalStyle( 'mw-templatevariable-name', state ); + } + + function inVariableDefault( stream, state ) { + if ( stream.match( /[^\{\}\[<\&~]+/ ) ) { + return makeLocalStyle( 'mw-templatevariable', state ); + } + if ( stream.match( '}}}' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-templatevariable-bracket', state ); + } + return eatWikiText( 'mw-templatevariable', '' )( stream, state ); + } + + function inParserFunctionName( stream, state ) { + if ( stream.match( /#?[^\:\}\{~]+/ ) ) { // FIXME: {{#name}} and {{uc}} are wrong, must have ':' + return makeLocalStyle( 'mw-parserfunction-name', state ); + } + if ( stream.eat( ':' ) ) { + state.tokenize = inParserFunctionArguments; + return makeLocalStyle( 'mw-parserfunction-delimiter', state ); + } + if ( stream.match( '}}' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-parserfunction-bracket', state, 'nExt' ); + } + return eatWikiText( 'mw-parserfunction', '' )( stream, state ); + } + + function inParserFunctionArguments( stream, state ) { + if ( stream.match( /[^\|\}\{\[<\&~]+/ ) ) { + return makeLocalStyle( 'mw-parserfunction', state ); + } else if ( stream.eat( '|' ) ) { + return makeLocalStyle( 'mw-parserfunction-delimiter', state ); + } else if ( stream.match( '}}' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-parserfunction-bracket', state, 'nExt' ); + } + return eatWikiText( 'mw-parserfunction', '' )( stream, state ); + } + + function eatTemplatePageName( haveAte ) { + return function( stream, state ) { + if ( stream.match( /[\s\u00a0]*\|[\s\u00a0]*/ ) ) { + state.tokenize = eatTemplateArgument( true ); + return makeLocalStyle( 'mw-template-delimiter', state ); + } + if ( stream.match( /[\s\u00a0]*\}\}/ ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-template-bracket', state, 'nTemplate' ); + } + if ( haveAte && stream.sol() ) { + // @todo error message + state.nTemplate--; + state.tokenize = state.stack.pop(); + return; + } + if ( stream.match( /[\s\u00a0]*[^\s\u00a0\|\}<\{\&~]+/ ) ) { + state.tokenize = eatTemplatePageName( true ); + return makeLocalStyle( 'mw-template-name mw-pagename', state ); + } else if ( stream.eatSpace() ) { + if ( stream.eol() === true ) { + return makeLocalStyle( 'mw-template-name', state ); + } + return makeLocalStyle( 'mw-template-name mw-pagename', state ); + } + return eatWikiText( 'mw-template-name mw-pagename', 'mw-template-name-mnemonic mw-pagename' )( stream, state ); + }; + } + + function eatTemplateArgument( expectArgName ) { + return function( stream, state ) { + if ( expectArgName && stream.eatWhile( /[^=\|\}\{\[<\&~]/ ) ) { + if ( stream.eat( '=' ) ) { + state.tokenize = eatTemplateArgument( false ); + return makeLocalStyle( 'mw-template-argument-name', state ); + } + return makeLocalStyle( 'mw-template', state ); + } else if ( stream.eatWhile( /[^\|\}\{\[<\&~]/ ) ) { + return makeLocalStyle( 'mw-template', state ); + } else if ( stream.eat( '|' ) ) { + state.tokenize = eatTemplateArgument( true ); + return makeLocalStyle( 'mw-template-delimiter', state ); + } else if ( stream.match( '}}' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-template-bracket', state, 'nTemplate' ); + } + return eatWikiText( 'mw-template', '' )( stream, state ); + }; + } + + function eatExternalLinkProtocol( chars ) { + return function( stream, state ) { + while ( chars > 0 ) { + chars--; + stream.next(); + } + if ( stream.eol() ) { + state.nLink--; + // @todo error message + state.tokenize = state.stack.pop(); + } else { + state.tokenize = inExternalLink; + } + return makeLocalStyle( 'mw-extlink-protocol', state ); + }; + } + + function inExternalLink( stream, state ) { + if ( stream.sol() ) { + state.nLink--; + // @todo error message + state.tokenize = state.stack.pop(); + return; + } + if ( stream.match( /[\s\u00a0]*\]/ ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-extlink-bracket', state, 'nLink' ); + } + if ( stream.eatSpace() ) { + state.tokenize = inExternalLinkText; + return makeStyle( '', state ); + } + if ( stream.match( /[^\s\u00a0\]\{\&~]+/ ) || stream.eatSpace() ) { + return makeStyle( 'mw-extlink', state ); + } + return eatWikiText( 'mw-extlink', '' )( stream, state ); + } + + function inExternalLinkText( stream, state ) { + if ( stream.sol() ) { + state.nLink--; + // @todo error message + state.tokenize = state.stack.pop(); + return; + } + if ( stream.eat( ']' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-extlink-bracket', state, 'nLink' ); + } + if ( stream.match( /[^'\]\{\&~]+/ ) ) { + return makeStyle( 'mw-extlink-text', state ); + } + return eatWikiText( 'mw-extlink-text', '' )( stream, state ); + } + + function inLink( stream, state ) { + if ( stream.sol() ) { + state.nLink--; + // @todo error message + state.tokenize = state.stack.pop(); + return; + } + if ( stream.match( /[\s\u00a0]*#[\s\u00a0]*/ ) ) { + state.tokenize = inLinkToSection; + return makeLocalStyle( 'mw-link', state ); + } + if ( stream.match( /[\s\u00a0]*\|[\s\u00a0]*/ ) ) { + state.tokenize = eatLinkText(); + return makeLocalStyle( 'mw-link-delimiter', state ); + } + if ( stream.match( /[\s\u00a0]*\]\]/ ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-link-bracket', state, 'nLink' ); +// if ( !stream.eatSpace() ) { +// state.ImInBlock.push( 'LinkTrail' ); +// } + } + if ( stream.match( /[\s\u00a0]*[^\s\u00a0#\|\]\&~\{]+/ ) || stream.eatSpace() ) { //FIXME '{{' brokes Link, sample [[z{{page]] + return makeStyle( 'mw-link-pagename mw-pagename', state ); + } + return eatWikiText( 'mw-link-pagename mw-pagename', 'mw-pagename' )( stream, state ); + } + + function inLinkToSection( stream, state ) { + if ( stream.sol() ) { + // @todo error message + state.nLink--; + state.tokenize = state.stack.pop(); + return; + } + if ( stream.match( /[^\|\]\&~\{\}]+/ ) ) { //FIXME '{{' brokes Link, sample [[z{{page]] + return makeLocalStyle( 'mw-link-tosection', state ); + } + if ( stream.eat( '|' ) ) { + state.tokenize = eatLinkText(); + return makeLocalStyle( 'mw-link-delimiter', state ); + } + if ( stream.match( ']]' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-link-bracket', state, 'nLink' ); +// if ( !stream.eatSpace() ) { +// state.ImInBlock.push( 'LinkTrail' ); +// } + } + return eatWikiText( 'mw-link-tosection', '' )( stream, state ); + } + + function eatLinkText() { + var isBold, isItalic; + return function ( stream, state ) { + if ( stream.match( ']]' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-link-bracket', state, 'nLink' ); + } + if ( stream.match( '\'\'\'' ) ) { + isBold = (isBold ? false : true); + return makeLocalStyle( 'mw-link-text mw-apostrophes', state ); + } + if ( stream.match( '\'\'' ) ) { + isItalic = (isItalic ? false : true); + return makeLocalStyle( 'mw-link-text mw-apostrophes', state ); + } + var tmpstyle = 'mw-link-text'; + if ( isBold ) { + tmpstyle += ' strong'; + } + if ( isItalic ) { + tmpstyle += ' em'; + } + if ( stream.match( /[^'\]\{\&~]+/ ) ) { + return makeStyle( tmpstyle, state ); + } + return eatWikiText( tmpstyle, '' )( stream, state ); + }; + } + + function eatTagName( chars, isCloseTag, isHtmlTag ) { + return function ( stream, state ) { + var name = ''; + while ( chars > 0 ) { + chars--; + name = name + stream.next(); + } + if ( stream.eol() ) { + // @todo error message + state.tokenize = state.stack.pop(); + return makeLocalStyle( (isHtmlTag ? 'mw-htmltag-name' : 'mw-exttag-name'), state ); + } + stream.eatSpace(); + if ( stream.eol() ) { + // @todo error message + state.tokenize = state.stack.pop(); + return makeLocalStyle( (isHtmlTag ? 'mw-htmltag-name' : 'mw-exttag-name'), state ); + } + + if ( isHtmlTag ) { + if ( isCloseTag ) { + state.tokenize = eatChar( '>', 'mw-htmltag-bracket' ); + } else { + state.tokenize = eatHtmlTagAttribute( name ); + } + return makeLocalStyle( 'mw-htmltag-name', state ); + } // it is the extension tag + if ( isCloseTag ) { + state.tokenize = eatChar( '>', 'mw-exttag-bracket' ); + } else { + state.tokenize = eatExtTagAttribute( name ); + } + return makeLocalStyle( 'mw-exttag-name', state ); + }; + } + + function eatHtmlTagAttribute( name ) { + return function ( stream, state ) { + if ( stream.match( /[^>\/<\{\&~]+/ ) ) { + return makeLocalStyle( 'mw-htmltag-attribute', state ); + } + if ( stream.eat( '>' ) ) { + state.InHtmlTag.push( name ); + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-htmltag-bracket', state ); + } + if ( stream.match( '/>') ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-htmltag-bracket', state ); + } + return eatWikiText( 'mw-htmltag-attribute', '' )( stream, state ); + }; + } + + function eatExtTagAttribute( name ) { + return function ( stream, state ) { + if ( stream.match( /[^>\/<\{\&~]+/ ) ) { + return makeLocalStyle( 'mw-exttag-attribute', state ); + } + if ( stream.eat( '>' ) ) { + state.extName = name; + if ( config.mwextMode && name in config.mwextMode.tag ) { + state.extMode = CodeMirror.getMode( config, config.mwextMode.tag[name] ); + state.extState = CodeMirror.startState( state.extMode ); + } + state.tokenize = eatExtTagArea( name ); + return makeLocalStyle( 'mw-exttag-bracket', state ); + } + if ( stream.match( '/>') ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-exttag-bracket', state ); + } + return eatWikiText( 'mw-exttag-attribute', '' )( stream, state ); + }; + } + + function eatExtTagArea( name ) { + return function( stream, state ) { + var origString = false, from = stream.pos, to; + var pattern = new RegExp( '</' + name + '\\s*>' ); + var m = pattern.exec( from ? stream.string.slice( from ) : stream.string ); + if ( m ) { + if ( m.index === 0 ) { + state.tokenize = eatExtCloseTag( name ); + state.extName = false; + if ( state.extMode !== false ) { + state.extMode = false; + state.extState = false; + } + return state.tokenize( stream, state ); + } + to = m.index + from; + origString = stream.string; + stream.string = origString.slice( 0, to ); + } + state.stack.push( state.tokenize ); + state.tokenize = eatExtTokens( origString ); + return state.tokenize( stream, state ); + }; + } + + function eatExtCloseTag( name ) { + return function ( stream, state ) { + stream.next(); // eat < + stream.next(); // eat / + state.tokenize = eatTagName( name.length, true, false ); + return makeLocalStyle( 'mw-exttag-bracket', state ); + }; + } + + function eatExtTokens( origString ) { + return function ( stream, state ) { + var ret; + if ( state.extMode === false ) { + ret = (origString === false && stream.sol() ? 'line-cm-mw-exttag' : 'mw-exttag'); + stream.skipToEnd(); + } else { + ret = (origString === false && stream.sol() ? 'line-cm-mw-tag-' : 'mw-tag-') + state.extName; + ret += ' ' + state.extMode.token( stream, state.extState, origString === false ); + } + if ( stream.eol() ) { + if ( origString !== false ) { + stream.string = origString; + } + state.tokenize = state.stack.pop(); + } + return makeLocalStyle( ret, state ); + }; + } + + function inTableDefinition( stream, state ) { + if ( stream.sol() ) { + state.tokenize = inTable; + return inTable( stream, state ); + } + return eatWikiText( 'mw-table-definition', '' )( stream, state ); + } + + function inTable( stream, state ) { + if ( stream.sol() ) { + if ( stream.eat( '|' ) ) { + if ( stream.eat( '-' ) ) { + stream.eatSpace(); + state.tokenize = inTableDefinition; + return makeLocalStyle( 'mw-table-delimiter', state ); + } + if ( stream.eat( '}' ) ) { + state.tokenize = state.stack.pop(); + return makeLocalStyle( 'mw-table-bracket', state ); + } + stream.eatSpace(); + state.tokenize = eatTableRow( true, false ); + return makeLocalStyle( 'mw-table-delimiter', state ); + } + if ( stream.eat( '!' ) ) { + stream.eatSpace(); + state.tokenize = eatTableRow( true, true ); + return makeLocalStyle( 'mw-table-delimiter', state ); + } + } + return eatWikiText( '', '' )( stream, state ); + } + + function eatTableRow( isStart, isHead ) { + return function ( stream, state ) { + if ( stream.sol() ) { + var peek = stream.peek(); + if ( peek === '|' || peek === '!' ) { + state.tokenize = inTable; + return state.tokenize( stream, state ); + } + state.isBold = false; + state.isItalic = false; + } else { + if ( stream.match( /[^'\|\{\[<\&~]+/ ) ) { + return makeStyle( (isHead ? 'strong' : ''), state ); + } + if ( stream.match( '||' ) || isHead && stream.match( '!!' ) || (isStart && stream.eat( '|' )) ) { + state.isBold = false; + state.isItalic = false; + if ( isStart ) { + state.tokenize = eatTableRow( false, isHead ); + } + return makeLocalStyle( 'mw-table-delimiter', state ); + } + } + return eatWikiText( (isHead ? 'strong' : ''), (isHead ? 'strong' : '') )( stream, state ); + }; + } + + function eatWikiText( style, mnemonicStyle ) { + return function( stream, state ) { + function chain( parser ) { + state.stack.push( state.tokenize ); + state.tokenize = parser; + return parser( stream, state ); + } + var sol = stream.sol(); + var ch = stream.next(); + + if ( sol ) { + state.isBold = false; + state.isItalic = false; + switch ( ch ) { + case ' ': + return 'mw-skipformatting'; + case '-': + if ( stream.match( '---' ) ) { + return 'mw-hr'; + } + break; + case '=': + var tmp = stream.match( /(={0,5})(.+?(=\1\s*))$/ ); + if ( tmp ) { // Title + stream.backUp( tmp[2].length ); + state.stack.push( state.tokenize ); + state.tokenize = eatSectionHeader( tmp[3].length ); + return 'mw-section-header line-cm-mw-section-' + ( tmp[1].length + 1 ); + } + break; + case '*': + case '#': + if ( stream.match( /[\*#]*:*/ ) ) { + return 'mw-list'; + } + break; + case ':': + if ( stream.match( /:*[\*#]*/ ) ) { + return 'mw-indenting'; + } + break; + case '{': + if ( stream.eat( '|' ) ) { + stream.eatSpace(); + state.stack.push( state.tokenize ); + state.tokenize = inTableDefinition; + return 'mw-table-bracket'; + } + } + } + + switch ( ch ) { + case '&': + return makeStyle( eatMnemonic( stream, style, mnemonicStyle ), state ); + case '\'': + if ( stream.match( '\'\'' ) ) { + state.isBold = state.isBold ? false : true; + return makeLocalStyle( 'mw-apostrophes', state ); + } else if ( stream.eat( '\'' ) ) { + state.isItalic = state.isItalic ? false : true; + return makeLocalStyle( 'mw-apostrophes', state ); + } + break; + case '[': + if ( stream.eat( '[' ) ) { // Link Example: [[ Foo | Bar ]] + stream.eatSpace(); + if ( /[^\]\|\[]/.test( stream.peek() ) ) { + state.nLink++; + state.stack.push( state.tokenize ); + state.tokenize = inLink; + return makeLocalStyle( 'mw-link-bracket', state ); + } + } else { + var mt = stream.match( urlProtocols ); + if ( mt ) { + state.nLink++; + stream.backUp( mt[0].length ); + state.stack.push( state.tokenize ); + state.tokenize = eatExternalLinkProtocol( mt[0].length ); + return makeLocalStyle( 'mw-extlink-bracket', state ); + } + } + break; + case '{': + if ( stream.match( '{{' ) ) { // Variable + stream.eatSpace(); + state.stack.push( state.tokenize ); + state.tokenize = inVariable; + return makeLocalStyle( 'mw-templatevariable-bracket', state ); + } else if ( stream.match( /\{[\s\u00a0]*/ ) ) { + if ( stream.peek() === '#' ) { // Parser function + state.nExt++; + state.stack.push( state.tokenize ); + state.tokenize = inParserFunctionName; + return makeLocalStyle( 'mw-parserfunction-bracket', state ); + } + // Check for parser function without '#' + var name = stream.match( /([^\s\u00a0\}\[\]<\{\'\|\&\:]+)(\:|[\s\u00a0]*)(\}\}?)?(.)?/ ); + if ( name ) { + stream.backUp( name[0].length ); + if ( (name[2] === ':' || name[4] === undefined || name[3] === '}}') && config.mwextFunctionSynonyms && (name[1].toLowerCase() in config.mwextFunctionSynonyms[0] || name[1] in config.mwextFunctionSynonyms[1]) ) { + state.nExt++; + state.stack.push( state.tokenize ); + state.tokenize = inParserFunctionName; + return makeLocalStyle( 'mw-parserfunction-bracket', state ); + } + } + // Template + state.nTemplate++; + state.stack.push( state.tokenize ); + state.tokenize = eatTemplatePageName( false ); + return makeLocalStyle( 'mw-template-bracket', state ); + } + break; + case '<': + if ( stream.match( '!--' ) ) { // coment + return chain( eatBlock( 'mw-comment', '-->' ) ); + } + var isCloseTag = ( stream.eat( '/' ) ? true : false ); + var tagname = stream.match( /[^>\/\s\u00a0\.\*\,\[\]\{\}\$\^\+\?\|\/\\'`~<=!@#%&\(\)-]+/ ); + if ( tagname ) { + tagname = tagname[0].toLowerCase(); + if ( config.mwextTags && tagname in config.mwextTags ) { // Parser function + if ( isCloseTag === true ) { + // @todo message + return 'error'; + } + stream.backUp( tagname.length ); + state.stack.push( state.tokenize ); + state.tokenize = eatTagName( tagname.length, isCloseTag, false ); + return makeLocalStyle( 'mw-exttag-bracket', state ); + } + if ( tagname in permittedHtmlTags ) { // Html tag + if ( isCloseTag === true && tagname !== state.InHtmlTag.pop() ) { + // @todo message + return 'error'; + } + stream.backUp( tagname.length ); + state.stack.push( state.tokenize ); + state.tokenize = eatTagName( tagname.length, isCloseTag, true ); + return makeLocalStyle( 'mw-htmltag-bracket', state ); + } + stream.backUp( tagname.length ); + } + break; + case '~': + if ( stream.match( /~{2,4}/ ) ) { + return 'mw-signature'; + } + break; + } + stream.match( /[^\s\u00a0_>\}\[\]<\{\'\|\&\:~]+/ ); + var ret = makeStyle( style, state ); + return ret; + }; + } + + return { + startState: function() { + return { tokenize: eatWikiText('', ''), stack: [], InHtmlTag:[], isBold: false, isItalic: false, extName: false, extMode: false, extState: false, nTemplate: 0, nLink: 0, nExt: 0 }; + }, + copyState: function( state ) { + return { + tokenize: state.tokenize, + stack: state.stack.concat( [] ), + InHtmlTag: state.InHtmlTag.concat( [] ), + isBold: state.isBold, + isItalic: state.isItalic, + extName: state.extName, + extMode: state.extMode, + extState: state.extMode !== false && CodeMirror.copyState( state.extMode, state.extState ), + nTemplate: state.nTemplate, + nLink: state.nLink, + nExt: state.nExt + }; + }, + token: function( stream, state ) { + return state.tokenize( stream, state ); + }, + blankLine: function( state ) { + if ( state.extName ) { + if ( state.extMode ) { + var ret = ''; + if ( state.extMode.blankLine ) { + ret = ' ' + state.extMode.blankLine( state.extState ); + } + return 'line-cm-mw-tag-' + state.extName + ret; + } + return 'line-cm-mw-exttag'; + } + } + }; +}); + +CodeMirror.defineMIME( 'text/mediawiki', 'mediawiki' ); + +function eatNowiki( style, lineStyle ) { + return function( stream , state, ownLine ) { + if ( ownLine && stream.sol() ) { + state.ownLine = true; + } else if( ownLine === false && state.ownLine ) { + state.ownLine = false; + } + var s = ( state.ownLine ? lineStyle : style ); + if ( stream.match( /[^&]+/ ) ) { + return s; + } + stream.next(); // eat & + return eatMnemonic( stream, s, s ); + }; +} + +CodeMirror.defineMode( 'mw-tag-pre', function( /*config, parserConfig */ ) { + return { + startState: function() { return {}; }, + token: eatNowiki( 'mw-tag-pre', 'line-cm-mw-tag-pre' ) + }; +}); + +CodeMirror.defineMode( 'mw-tag-nowiki', function( /*config, parserConfig */ ) { + return { + startState: function() { return {}; }, + token: eatNowiki( 'mw-tag-nowiki', 'line-cm-mw-tag-nowiki' ) + }; +}); + +}); |