HackMD/public/vendor/codemirror/codemirror.min.js
2015-05-15 12:58:13 +08:00

14 lines
284 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.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(Ko,r,!1),h(r);var i=r.value;"string"==typeof i&&(i=new va(i,r.mode)),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),l(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!Co&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Li,keySeq:null,specialChars:null};var s=this;ho&&11>po&&setTimeout(function(){s.display.input.reset(!0)},20),jt(this),Vi(),yt(this),this.curOp.forceUpdate=!0,Gr(this,i),r.autofocus&&!Co||s.hasFocus()?setTimeout(Wi(hn,this),20):pn(this);for(var u in $o)$o.hasOwnProperty(u)&&$o[u](this,r[u],Xo);k(this),r.finishInit&&r.finishInit(this);for(var f=0;f<Jo.length;++f)Jo[f](this);xt(this),mo&&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=Hi("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=Hi("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=Hi("div",null,"CodeMirror-code"),r.selectionDiv=Hi("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=Hi("div",null,"CodeMirror-cursors"),r.measure=Hi("div",null,"CodeMirror-measure"),r.lineMeasure=Hi("div",null,"CodeMirror-measure"),r.lineSpace=Hi("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=Hi("div",[Hi("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=Hi("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=Hi("div",null,null,"position: absolute; height: "+Ta+"px; width: 1px;"),r.gutters=Hi("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=Hi("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=Hi("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),ho&&8>po&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),mo||co&&Co||(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,Fe(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ra(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Dt(e),ot(e),setTimeout(function(){y(e)},100)}function o(e){var t=gt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(i){if(yr(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&&Yr(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ot(e)}function s(e){c(e),Dt(e),setTimeout(function(){w(e)},20)}function c(e){var t=e.display.gutters,n=e.options.gutters;Bi(t);for(var r=0;r<n.length;++r){var i=n[r],o=t.appendChild(Hi("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=fr(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=dr(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=Kr(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 h(e){var t=Oi(e.gutters,"CodeMirror-linenumbers");-1==t&&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 p(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Re(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+Ue(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=Hi("div",[Hi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Hi("div",[Hi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Ca(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ca(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,ho&&8>po&&(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&&Ra(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),Ca(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?en(t,e):Jt(t,e)},t),t.display.scrollbars.addClass&&qa(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&P(e),b(e,p(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",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 x(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=Qr(t,r),a=Qr(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;o>l?(o=l,a=Qr(t,Jr(Kr(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Qr(t,Jr(Kr(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function w(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=S(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 l=n[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=C(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(Hi("div",[Hi("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 C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function L(e,t,n){var r=e.display;this.viewport=t,this.visible=x(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ve(e),this.force=n,this.dims=D(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=Ue(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ue(e)+"px",t.scrollbarsClipped=!0)}function T(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Et(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==Bt(e))return!1;k(e)&&(Et(e),t.dims=D(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)),No&&(o=gr(e.doc,o),a=vr(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),n.viewOffset=Jr(Kr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Bt(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=_i();return s>4&&(n.lineDiv.style.display="none"),W(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&_i()!=c&&c.offsetHeight&&c.focus(),Bi(n.cursorDiv),Bi(n.selectionDiv),n.gutters.style.height=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Fe(e,400)),n.updateLineNumbers=null,!0}function A(e,t){for(var n=t.force,r=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e))n=!0;else if(n=!1,r&&null!=r.top&&(r={top:Math.min(e.doc.height+Re(e.display)-Ge(e),r.top)}),t.visible=x(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!T(e,t))break;P(e);var o=p(e);ze(e),N(e,o),y(e,o)}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 O(e,t){var n=new L(e,t);if(T(e,n)){P(e),A(e,n);var r=p(e);ze(e),N(e,r),y(e,r),n.finish()}}function N(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Ue(e),t.clientHeight)+"px"}function P(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(ho&&8>po){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=gt(t)),(s>.001||-.001>s)&&(Yr(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.offsetHeight}function D(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:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function W(e,t,n){function r(t){var n=t.nextSibling;return mo&&So&&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,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var f=s[u];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;l!=f.node;)l=r(l);var d=o&&null!=t&&c>=t&&f.lineNumber;f.changes&&(Oi(f.changes,"gutter")>-1&&(d=!1),E(e,f,c,n)),d&&(Bi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=f.node.nextSibling}else{var h=q(e,f,c,n);a.insertBefore(h,l)}c+=f.size}for(;l;)l=r(l)}function E(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?B(e,t):"gutter"==o?_(e,t,n,r):"class"==o?j(t):"widget"==o&&R(e,t,r)}t.changes=null}function I(e){return e.node==e.text&&(e.node=Hi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),ho&&8>po&&(e.node.style.zIndex=2)),e.node}function F(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=I(e);e.background=n.insertBefore(Hi("div",null,t),n.firstChild)}}function H(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 B(e,t){var n=t.text.className,r=H(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,j(t)):n&&(t.text.className=n)}function j(e){F(e),e.line.wrapClass?I(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 _(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=I(t),a=t.gutter=Hi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px");if(e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Hi("div",C(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=i.hasOwnProperty(s)&&i[s];c&&a.appendChild(Hi("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[s]+"px; width: "+r.gutterWidth[s]+"px"))}}}function R(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 q(e,t,n,r){var i=H(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),_(e,t,n,r),U(e,t,r),t.node}function U(e,t,n){if(V(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)V(e,t.rest[r],t,n,!1)}function V(e,t,n,r,i){if(t.widgets)for(var o=I(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=Hi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),G(s,c,n,r),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),bi(s,"redraw")}}function G(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 K(e){return Po(e.line,e.ch)}function X(e,t){return zo(e,t)<0?t:e}function Y(e,t){return zo(e,t)<0?e:t}function Z(e){e.state.focused||(e.display.input.focus(),hn(e))}function Q(e){return e.options.readOnly||e.doc.cantEdit}function J(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var a=Ga(t),l=null;e.state.pasteIncoming&&r.ranges.length>1&&(Do&&Do.join("\n")==t?l=r.ranges.length%Do.length==0&&Ni(Do,Ga):a.length==r.ranges.length&&(l=Ni(a,function(e){return[e]})));for(var s=r.ranges.length-1;s>=0;s--){var c=r.ranges[s],u=c.from(),f=c.to();c.empty()&&(n&&n>0?u=Po(u.line,u.ch-n):e.state.overwrite&&!e.state.pasteIncoming&&(f=Po(f.line,Math.min(Kr(o,f.line).text.length,f.ch+Ai(a).length))));var d=e.curOp.updateInput,h={from:u,to:f,text:l?l[s%l.length]:a,origin:i||(e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input")};if(kn(e.doc,h),bi(e,"inputRead",e,h),t&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&c.head.ch<100&&(!s||r.ranges[s-1].head.line!=c.head.line)){var p=e.getModeAt(c.head),m=Go(h),g=!1;if(p.electricChars){for(var v=0;v<p.electricChars.length;v++)if(t.indexOf(p.electricChars.charAt(v))>-1){g=In(e,m.line,"smart");break}}else p.electricInput&&p.electricInput.test(Kr(o,m.line).text.slice(0,m.ch))&&(g=In(e,m.line,"smart"));g&&bi(e,"electricInput",e,m.line)}}Wn(e),e.curOp.updateInput=d,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function ee(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:Po(i,0),head:Po(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function te(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 Li,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function re(){var e=Hi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Hi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return mo?e.style.width="1000px":e.setAttribute("wrap","off"),ko&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Li,this.gracePeriod=!1}function oe(e,t){var n=Ze(e,t.line);if(!n||n.hidden)return null;var r=Kr(e.doc,t.line),i=$e(n,r,t.line),o=ei(r),a="left";if(o){var l=oo(o,t.ch);a=l%2?"right":"left"}var s=et(i.map,t.ch,"left");return s.offset="right"==s.collapse?s.end:s.start,s}function ae(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 ae(e.clipPos(Po(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 se(o,t,n)}}function se(e,t,n){function r(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=0>i?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==n){var s=Zr(0>i?e.line:e.rest[i]),f=o[a]+r;return(0>r||l!=t)&&(f=o[a+(r?1:0)]),Po(s,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Ba(i,t))return ae(Po(Zr(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?Ai(e.rest):e.line;return ae(Po(Zr(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,f=r(l,s,n);if(f)return ae(f,o);for(var d=s.nextSibling,h=l?l.nodeValue.length-n:0;d;d=d.nextSibling){if(f=r(d,d.firstChild,0))return ae(Po(f.line,f.ch-h),o);h+=d.textContent.length}for(var p=s.previousSibling,h=n;p;p=p.previousSibling){if(f=r(p,p.firstChild,-1))return ae(Po(f.line,f.ch+h),o);h+=d.textContent.length}}function ce(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(l+=n);var c,u=t.getAttribute("cm-marker");if(u){var f=e.findMarks(Po(r,0),Po(i+1,0),o(+u));return void(f.length&&(c=f[0].find())&&(l+=$r(e.doc,c.from,c.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var d=0;d<t.childNodes.length;d++)a(t.childNodes[d]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var h=t.nodeValue;if(!h)return;s&&(l+="\n",s=!1),l+=h}}for(var l="",s=!1;a(t),t!=n;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function fe(e,t){this.anchor=e,this.head=t}function de(e,t){var n=e[t];e.sort(function(e,t){return zo(e.from(),t.from())}),t=Oi(e,n);for(var r=1;r<e.length;r++){var i=e[r],o=e[r-1];if(zo(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=X(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new fe(s?l:a,s?a:l))}}return new ue(e,t)}function he(e,t){return new ue([new fe(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.line<e.first)return Po(e.first,0);var n=e.first+e.size-1;return t.line>n?Po(n,Kr(e,n).text.length):ge(t,Kr(e,t.line).text.length)}function ge(e,t){var n=e.ch;return null==n||n>t?Po(e.line,t):0>n?Po(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=me(e,t[r]);return n}function be(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=zo(n,i)<0;o!=zo(r,i)<0?(i=n,n=r):o!=zo(n,r)<0&&(n=r)}return new fe(i,n)}return new fe(r||n,n)}function xe(e,t,n,r){Me(e,new ue([be(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]=be(e,e.sel.ranges[i],t[i],null);var o=de(r,e.sel.primIndex);Me(e,o,n)}function ke(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Me(e,de(i,e.sel.primIndex),r)}function Ce(e,t,n,r){Me(e,he(t,n),r)}function Se(e,t){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new fe(me(e,t[n].anchor),me(e,t[n].head))}};return La(e,"beforeSelectionChange",e,n),e.cm&&La(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?de(n.ranges,n.ranges.length-1):t}function Le(e,t,n){var r=e.history.done,i=Ai(r);i&&i.ranges?(r[r.length-1]=t,Te(e,t,n)):Me(e,t,n)}function Me(e,t,n){Te(e,t,n),li(e,e.sel,e.cm?e.cm.curOp.id:0/0,n)}function Te(e,t,n){(Ci(e,"beforeSelectionChange")||e.cm&&Ci(e.cm,"beforeSelectionChange"))&&(t=Se(e,t));var r=n&&n.bias||(zo(t.primary().head,e.sel.primary().head)<0?-1:1);Ae(e,Ne(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,ki(e.cm)),bi(e,"cursorActivity",e))}function Oe(e){Ae(e,Ne(e,e.sel,null,!1),Oa)}function Ne(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=Pe(e,a.anchor,n,r),s=Pe(e,a.head,n,r);(i||l!=a.anchor||s!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new fe(l,s))}return i?de(i,t.primIndex):t}function Pe(e,t,n,r){var i=!1,o=t,a=n||1;e.cantEdit=!1;e:for(;;){var l=Kr(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var c=l.markedSpans[s],u=c.marker;if((null==c.from||(u.inclusiveLeft?c.from<=o.ch:c.from<o.ch))&&(null==c.to||(u.inclusiveRight?c.to>=o.ch:c.to>o.ch))){if(r&&(La(u,"beforeCursorEnter"),u.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!u.atomic)continue;var f=u.find(0>a?-1:1);if(0==zo(f,o)&&(f.ch+=a,f.ch<0?f=f.line>e.first?me(e,Po(f.line-1)):null:f.ch>l.text.length&&(f=f.line<e.first+e.size-1?Po(f.line+1,0):null),!f)){if(i)return r?(e.cantEdit=!0,Po(e.first,0)):Pe(e,t,n,!0);i=!0,f=t,a=-a}o=f;continue e}}return o}}function ze(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(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 l=n.sel.ranges[a],s=l.empty();(s||e.options.showCursorWhenSelecting)&&We(e,l,i),s||Ee(e,l,o)}return r}function We(e,t,n){var r=ft(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(Hi("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(Hi("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=e.charCoords({line:$(n).attr("data-line"),ch:$(n).attr("data-ch")},"windows");$(n)[0].style.left=r.left+"px",$(n)[0].style.top=r.top+"px"})}function Ee(e,t,n){function r(e,t,n,r){0>t&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild(Hi("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 ut(e,Po(t,n),"div",f,r)}var l,s,f=Kr(a,t),d=f.text.length;return Yi(ei(f),n||0,null==i?d:i,function(e,t,a){var f,h,p,m=o(e,"left");if(e==t)f=m,h=p=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}h=m.left,p=f.right}null==n&&0==e&&(h=c),f.top-m.top>3&&(r(h,m.top,null,m.bottom),h=c,m.bottom<f.top&&r(h,m.bottom,null,f.top)),null==i&&t==d&&(p=u),(!l||m.top<l.top||m.top==l.top&&m.left<l.left)&&(l=m),(!s||f.bottom>s.bottom||f.bottom==s.bottom&&f.right>s.right)&&(s=f),c+1>h&&(h=c),r(h,f.top,p-h,f.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=qe(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var h=Kr(a,f.line),p=Kr(a,d.line),m=pr(h)==pr(p),g=i(f.line,f.ch,m?h.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(l)}function Ie(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 Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Wi(He,e))}function He(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=ta(t.mode,je(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,l=Nr(e,o,r,!0);o.styles=l.styles;var s=o.styleClasses,c=l.classes;c?o.styleClasses=c:s&&(o.styleClasses=null);for(var u=!a||a.length!=o.styles.length||s!=c&&(!s||!c||s.bgClass!=c.bgClass||s.textClass!=c.textClass),f=0;!u&&f<a.length;++f)u=a[f]!=o.styles[f];u&&i.push(t.frontier),o.stateAfter=ta(t.mode,r)}else zr(e,o.text,r),o.stateAfter=t.frontier%5==0?ta(t.mode,r):null;return++t.frontier,+new Date>n?(Fe(e,e.options.workDelay),!0):void 0}),i.length&&Tt(e,function(){for(var t=0;t<i.length;t++)Wt(e,i[t],"text")})}}function Be(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Kr(o,l-1);if(s.stateAfter&&(!n||l<=o.frontier))return l;var c=za(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}function je(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=Be(e,t,n),a=o>r.first&&Kr(r,o-1).stateAfter;return a=a?ta(r.mode,a):na(r.mode),r.iter(o,t,function(n){zr(e,n.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;n.stateAfter=l?ta(r.mode,a):null,++o}),n&&(r.frontier=o),a}function _e(e){return e.lineSpace.offsetTop}function Re(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qe(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=ji(e.measure,Hi("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 Ue(e){return Ta-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-Ue(e)-e.display.barWidth}function Ge(e){return e.display.scroller.clientHeight-Ue(e)-e.display.barHeight}function Ke(e,t,n){var r=e.options.lineWrapping,i=r&&Ve(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(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function $e(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(Zr(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Xe(e,t){t=pr(t);var n=Zr(t),r=e.display.externalMeasured=new Pt(e.doc,t,n);r.lineN=n;var i=r.built=Wr(e,r);return r.text=i.pre,ji(e.display.lineMeasure,i.pre),r}function Ye(e,t,n,r){return Je(e,Qe(e,t),n,r)}function Ze(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[It(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function Qe(e,t){var n=Zr(t),r=Ze(e,n);r&&!r.text?r=null:r&&r.changes&&E(e,r,n,D(e)),r||(r=Xe(e,t));var i=$e(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Je(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||(Ke(e,t.view,t.rect),t.hasHeights=!0),o=tt(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 et(e,t,n){for(var r,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(s>t?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[l+2],s==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[(l-=3)+2],a="left";if("right"==n&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)r=e[(l+=3)+2],a="right";break}}return{node:r,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function tt(e,t,n,r){var i,o=et(t.map,n,r),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;4>u;u++){for(;l&&Fi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Fi(t.line.text.charAt(o.coverStart+s));)++s;if(ho&&9>po&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(ho&&e.options.lineWrapping){var f=Ea(a,l,s).getClientRects();i=f.length?f["right"==r?f.length-1:0]:Fo}else i=Ea(a,l,s).getBoundingClientRect()||Fo;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}ho&&11>po&&(i=nt(e.display.measure,i))}else{l>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(ho&&9>po&&!l&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+vt(e.display),top:d.top,
bottom:d.bottom}:Fo}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/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=h,b.rbottom=p),b}function nt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Xi(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 rt(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 it(e){e.display.externalMeasure=null,Bi(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rt(e.display.view[t])}function ot(e){it(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function at(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function st(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=wr(t.widgets[i]);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Jr(t);if("local"==r?a+=_e(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:lt());var s=l.left+("window"==r?0:at());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function ct(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=at(),i-=lt();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 ut(e,t,n,r,i){return r||(r=Kr(e.doc,t.line)),st(e,r,Ye(e,r,t.ch,i),n)}function ft(e,t,n,r,i,o){function a(t,a){var l=Je(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,st(e,r,l,n)}function l(e,t){var n=s[t],r=n.level%2;return e==Zi(n)&&t&&n.level<s[t-1].level?(n=s[--t],e=Qi(n)-(n.level%2?0:1),r=!0):e==Qi(n)&&t<s.length-1&&n.level<s[t+1].level&&(n=s[++t],e=Zi(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||Kr(e.doc,t.line),i||(i=Qe(e,r));var s=ei(r),c=t.ch;if(!s)return a(c);var u=oo(s,c),f=l(c,u);return null!=Za&&(f.other=l(c,Za)),f}function dt(e,t){var n=0,t=me(e.doc,t);e.options.lineWrapping||(n=vt(e.display)*t.ch);var r=Kr(e.doc,t.line),i=Jr(r)+_e(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ht(e,t,n,r){var i=Po(e,t);return i.xRel=r,n&&(i.outside=!0),i}function pt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return ht(r.first,0,!0,-1);var i=Qr(r,n),o=r.first+r.size-1;if(i>o)return ht(r.first+r.size-1,Kr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Kr(r,i);;){var l=mt(e,a,i,t,n),s=dr(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=Zr(a=c.to.line)}}function mt(e,t,n,r,i){function o(r){var i=ft(e,Po(n,r),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-Jr(t),l=!1,s=2*e.display.wrapper.clientWidth,c=Qe(e,t),u=ei(t),f=t.text.length,d=Ji(t),h=eo(t),p=o(d),m=l,g=o(h),v=l;if(r>g)return ht(n,h,v,1);for(;;){if(u?h==d||h==lo(t,d,1):1>=h-d){for(var y=p>r||g-r>=r-p?d:h,b=r-(y==d?p:g);Fi(t.text.charAt(y));)++y;var x=ht(n,y,y==d?m:v,-1>b?-1:b>1?1:0);return x}var w=Math.ceil(f/2),k=d+w;if(u){k=d;for(var C=0;w>C;++C)k=lo(t,k,1)}var S=o(k);S>r?(h=k,g=S,(v=l)&&(g+=1e3),f=w):(d=k,p=S,m=l,f-=w)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Wo){Wo=Hi("pre");for(var t=0;49>t;++t)Wo.appendChild(document.createTextNode("x")),Wo.appendChild(Hi("br"));Wo.appendChild(document.createTextNode("x"))}ji(e.measure,Wo);var n=Wo.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Bi(e.measure),n||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hi("span","xxxxxxxxxx"),n=Hi("pre",[t]);ji(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function yt(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:++Bo},Ho?Ho.ops.push(e.curOp):e.curOp.ownsGroup=Ho={ops:[e.curOp],delayedCallbacks:[]}}function bt(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n]();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++](i.cm)}}while(n<t.length)}function xt(e){var t=e.curOp,n=t.ownsGroup;if(n)try{bt(n)}finally{Ho=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;wt(n)}}function wt(e){for(var t=e.ops,n=0;n<t.length;n++)kt(t[n]);for(var n=0;n<t.length;n++)Ct(t[n]);for(var n=0;n<t.length;n++)St(t[n]);for(var n=0;n<t.length;n++)Lt(t[n]);for(var n=0;n<t.length;n++)Mt(t[n])}function kt(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 L(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ct(e){e.updatedDisplay=e.mustUpdate&&T(e.cm,e.update)}function St(e){var t=e.cm,n=t.display;e.updatedDisplay&&P(t),e.barMeasure=p(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ye(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+Ue(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&en(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),e.updatedDisplay&&N(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Ie(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),e.focus&&e.focus==_i()&&Z(e.cm)}function Mt(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&A(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-Ve(t),e.scrollLeft)),n.scrollbars.setScrollLeft(r.scrollLeft),n.scroller.scrollLeft=r.scrollLeft,w(t)),e.scrollToPos){var i=Nn(t,me(r,e.scrollToPos.from),me(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&On(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||La(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&La(a[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&La(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Tt(e,t){if(e.curOp)return t();yt(e);try{return t()}finally{xt(e)}}function At(e,t){return function(){if(e.curOp)return t.apply(e,arguments);yt(e);try{return t.apply(e,arguments)}finally{xt(e)}}}function Ot(e){return function(){if(this.curOp)return e.apply(this,arguments);yt(this);try{return e.apply(this,arguments)}finally{xt(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);yt(t);try{return e.apply(this,arguments)}finally{xt(t)}}}function Pt(e,t,n){this.line=t,this.rest=mr(t),this.size=this.rest?Zr(Ai(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function zt(e,t,n){for(var r,i=[],o=t;n>o;o=r){var a=new Pt(e.doc,Kr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function Dt(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)No&&gr(e.doc,t)<i.viewTo&&Et(e);else if(n<=i.viewFrom)No&&vr(e.doc,n+r)>i.viewFrom?Et(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Et(e);else if(t<=i.viewFrom){var o=Ft(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Et(e)}else if(n>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Et(e)}else{var a=Ft(e,t,t,-1),l=Ft(e,n,n+r,1);a&&l?(i.view=i.view.slice(0,a.index).concat(zt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):Et(e)}var s=i.externalMeasured;s&&(n<s.lineN?s.lineN+=r:t<s.lineN+s.size&&(i.externalMeasured=null))}function Wt(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[It(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Oi(a,n)&&a.push(n)}}}function Et(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function It(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,0>t)return r}function Ft(e,t,n,r){var i,o=It(e,t),a=e.display.view;if(!No||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;gr(e.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:n}}function Ht(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=zt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=zt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(It(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(zt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,It(e,n)))),r.viewTo=n}function Bt(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 jt(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;Ca(i.scroller,"mousedown",At(e,Vt)),ho&&11>po?Ca(i.scroller,"dblclick",At(e,function(t){if(!wi(e,t)){var n=Ut(e,t);if(n&&!Yt(e,t)&&!qt(e.display,t)){xa(t);var r=e.findWordAt(n);xe(e.doc,r.anchor,r.head)}}})):Ca(i.scroller,"dblclick",function(t){wi(e,t)||xa(t)}),Ao||Ca(i.scroller,"contextmenu",function(t){mn(e,t)});var o,a={end:0};Ca(i.scroller,"touchstart",function(e){if(!n(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-a.end<=300?a:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Ca(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Ca(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!qt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new fe(l,l):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(l):new fe(Po(l.line,0),me(e.doc,Po(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),xa(n)}t()}),Ca(i.scroller,"touchcancel",t),Ca(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Jt(e,i.scroller.scrollTop),en(e,i.scroller.scrollLeft,!0),La(e,"scroll",e))}),Ca(i.scroller,"mousewheel",function(t){tn(e,t)}),Ca(i.scroller,"DOMMouseScroll",function(t){tn(e,t)}),Ca(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={simple:function(t){wi(e,t)||ka(t)},start:function(t){Qt(e,t)},drop:At(e,Zt)};var l=i.input.getField();Ca(l,"keyup",function(t){un.call(e,t)}),Ca(l,"keydown",At(e,sn)),Ca(l,"keypress",At(e,fn)),Ca(l,"focus",Wi(hn,e)),Ca(l,"blur",Wi(pn,e))}function _t(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?Ca:Sa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.simple),a(t.display.scroller,"dragover",o.simple),a(t.display.scroller,"drop",o.drop)}}function Rt(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 qt(e,t){for(var n=vi(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 Ut(e,t,n,r){var i=e.display;if(!n&&"true"==vi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=pt(e,o,a);if(r&&1==c.xRel&&(s=Kr(e.doc,c.line).text).length==c.ch){var u=za(s,s.length,e.options.tabSize)-s.length;c=Po(c.line,Math.max(0,Math.round((o-qe(e.display).left)/vt(e.display))-u))}return c}function Vt(e){var t=this,n=t.display;if(!(n.activeTouch&&n.input.supportsTouch()||wi(t,e))){if(n.shift=e.shiftKey,qt(n,e))return void(mo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Yt(t,e)){var r=Ut(t,e);switch(window.focus(),yi(e)){case 1:r?Gt(t,e,r):vi(e)==n.scroller&&xa(e);break;case 2:mo&&(t.state.lastMiddleDown=+new Date),r&&xe(t.doc,r),setTimeout(function(){n.input.focus()},20),xa(e);break;case 3:Ao?mn(t,e):dn(t)}}}}function Gt(e,t,n){ho?setTimeout(Wi(Z,e),0):e.curOp.focus=_i();var r,i=+new Date;Io&&Io.time>i-400&&0==zo(Io.pos,n)?r="triple":Eo&&Eo.time>i-400&&0==zo(Eo.pos,n)?(r="double",Io={time:i,pos:n}):(r="single",Eo={time:i,pos:n});var o,a=e.doc.sel,l=So?t.metaKey:t.ctrlKey;e.options.dragDrop&&Va&&!Q(e)&&"single"==r&&(o=a.contains(n))>-1&&!a.ranges[o].empty()?Kt(e,t,n,l):$t(e,t,n,r,l)}function Kt(e,t,n,r){var i=e.display,o=+new Date,a=At(e,function(l){mo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Sa(document,"mouseup",a),Sa(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(xa(l),!r&&+new Date-200<o&&xe(e.doc,n),mo||ho&&9==po?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});mo&&(i.scroller.draggable=!0),e.state.draggingText=a,i.scroller.dragDrop&&i.scroller.dragDrop(),Ca(document,"mouseup",a),Ca(i.scroller,"drop",a)}function $t(e,t,n,r,i){function o(t){if(0!=zo(g,t))if(g=t,"rect"==r){for(var i=[],o=e.options.tabSize,a=za(Kr(c,n.line).text,n.ch,o),l=za(Kr(c,t.line).text,t.ch,o),s=Math.min(a,l),h=Math.max(a,l),p=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));m>=p;p++){var v=Kr(c,p).text,y=Mi(v,s,o);s==h?i.push(new fe(Po(p,y),Po(p,y))):v.length>y&&i.push(new fe(Po(p,y),Po(p,Mi(v,h,o))))}i.length||i.push(new fe(n,n)),Me(c,de(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,x=b.anchor,w=t;if("single"!=r){if("double"==r)var k=e.findWordAt(t);else var k=new fe(Po(t.line,0),me(c,Po(t.line+1,0)));zo(k.anchor,x)>0?(w=k.head,x=Y(b.from(),k.anchor)):(w=k.anchor,x=X(b.to(),k.head))}var i=d.ranges.slice(0);i[f]=new fe(me(c,x),w),Me(c,de(i,f),Na)}}function a(t){var n=++y,i=Ut(e,t,!0,"rect"==r);if(i)if(0!=zo(i,g)){e.curOp.focus=_i(),o(i);var l=x(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(At(e,function(){y==n&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(At(e,function(){y==n&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(e){y=1/0,xa(e),s.input.focus(),Sa(document,"mousemove",b),Sa(document,"mouseup",w),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;xa(t);var u,f,d=c.sel,h=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(n),u=f>-1?h[f]:new fe(n,n)):(u=c.sel.primary(),f=c.sel.primIndex),t.altKey)r="rect",i||(u=new fe(n,n)),n=Ut(e,t,!0,!0),f=-1;else if("double"==r){var p=e.findWordAt(n);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==r){var m=new fe(Po(n.line,0),me(c,Po(n.line+1,0)));u=e.display.shift||c.extend?be(c,u,m.anchor,m.head):m}else u=be(c,u,n);i?-1==f?(f=h.length,Me(c,de(h.concat([u]),f),{scroll:!1,origin:"*mouse"})):h.length>1&&h[f].empty()&&"single"==r&&!t.shiftKey?(Me(c,de(h.slice(0,f).concat(h.slice(f+1)),0)),d=c.sel):ke(c,f,u,Na):(f=0,Me(c,new ue([u],0),Na),d=c.sel);var g=n,v=s.wrapper.getBoundingClientRect(),y=0,b=At(e,function(e){yi(e)?a(e):l(e)}),w=At(e,l);Ca(document,"mousemove",b),Ca(document,"mouseup",w)}function Xt(e,t,n,r,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&xa(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Ci(e,n))return gi(t);a-=s.top-l.viewOffset;for(var c=0;c<e.options.gutters.length;++c){var u=l.gutters.childNodes[c];if(u&&u.getBoundingClientRect().right>=o){var f=Qr(e.doc,a),d=e.options.gutters[c];return i(e,n,e,f,d,t),gi(t)}}}function Yt(e,t){return Xt(e,t,"gutterClick",!0,bi)}function Zt(e){var t=this;if(!wi(t,e)&&!qt(t.display,e)){xa(e),ho&&(jo=+new Date);var n=Ut(t,e,!0),r=e.dataTransfer.files;if(n&&!Q(t))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,l=function(e,r){var l=new FileReader;l.onload=At(t,function(){if(o[r]=l.result,++a==i){n=me(t.doc,n);var e={from:n,to:n,text:Ga(o.join("\n")),origin:"paste"};kn(t.doc,e),Le(t.doc,he(n,Go(e)))}}),l.readAsText(e)},s=0;i>s;++s)l(r[s],s);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&&!(So?e.altKey:e.ctrlKey))var c=t.listSelections();if(Te(t.doc,he(n,n)),c)for(var s=0;s<c.length;++s)An(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Qt(e,t){if(ho&&(!e.state.draggingText||+new Date-jo<100))return void ka(t);if(!wi(e,t)&&!qt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!bo)){var n=Hi("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",yo&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),yo&&n.parentNode.removeChild(n)}}function Jt(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,co||O(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),co&&O(e),Fe(e,100))}function en(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,w(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function tn(e,t){var n=qo(t),r=n.x,i=n.y,o=e.display,a=o.scroller;if(r&&a.scrollWidth>a.clientWidth||i&&a.scrollHeight>a.clientHeight){if(i&&So&&mo)e:for(var l=t.target,s=o.view;l!=a;l=l.parentNode)for(var c=0;c<s.length;c++)if(s[c].node==l){e.display.currentWheelTarget=l;break e}if(r&&!co&&!yo&&null!=Ro)return i&&Jt(e,Math.max(0,Math.min(a.scrollTop+i*Ro,a.scrollHeight-a.clientHeight))),en(e,Math.max(0,Math.min(a.scrollLeft+r*Ro,a.scrollWidth-a.clientWidth))),xa(t),void(o.wheelStartX=null);if(i&&null!=Ro){var u=i*Ro,f=e.doc.scrollTop,d=f+o.wrapper.clientHeight;0>u?f=Math.max(0,f+u-50):d=Math.min(e.doc.height,d+u+50),O(e,{top:f,bottom:d})}20>_o&&(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&&(Ro=(Ro*_o+n)/(_o+1),++_o)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function nn(e,t,n){if("string"==typeof t&&(t=ra[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{Q(e)&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Aa}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function rn(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=oa(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&oa(t,e.options.extraKeys,n,e)||oa(t,e.options.keyMap,n,e)}function on(e,t,n,r){var i=e.state.keySeq;if(i){if(aa(t))return"handled";Uo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=rn(e,t,r);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&bi(e,"keyHandled",e,t,n),("handled"==o||"multi"==o)&&(xa(n),Ie(e)),i&&!o&&/\'$/.test(t)?(xa(n),!0):!!o}function an(e,t){var n=la(t,!0);return n?t.shiftKey&&!e.state.keySeq?on(e,"Shift-"+n,t,function(t){return nn(e,t,!0)})||on(e,n,t,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?nn(e,t):void 0}):on(e,n,t,function(t){return nn(e,t)}):!1}function ln(e,t,n){return on(e,"'"+n+"'",t,function(t){return nn(e,t,!0)})}function sn(e){var t=this;if(t.curOp.focus=_i(),!wi(t,e)){ho&&11>po&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=an(t,e);yo&&(Vo=r?n:null,!r&&88==n&&!$a&&(So?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||cn(t)}}function cn(e){function t(e){18!=e.keyCode&&e.altKey||(Ra(n,"CodeMirror-crosshair"),Sa(document,"keyup",t),Sa(document,"mouseover",t))}var n=e.display.lineDiv;qa(n,"CodeMirror-crosshair"),Ca(document,"keyup",t),Ca(document,"mouseover",t)}function un(e){16==e.keyCode&&(this.doc.sel.shift=!1),wi(this,e)}function fn(e){var t=this;if(!(qt(t.display,e)||wi(t,e)||e.ctrlKey&&!e.altKey||So&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(yo&&n==Vo)return Vo=null,void xa(e);if(!yo||e.which&&!(e.which<10)||!an(t,e)){var i=String.fromCharCode(null==r?n:r);ln(t,e,i)||t.display.input.onKeyPress(e)}}}function dn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,pn(e))},100)}function hn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(La(e,"focus",e),e.state.focused=!0,qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),mo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ie(e))}function pn(e){e.state.delayingBlurEvent||(e.state.focused&&(La(e,"blur",e),e.state.focused=!1,Ra(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mn(e,t){qt(e.display,t)||gn(e,t)||e.display.input.onContextMenu(t)}function gn(e,t){return Ci(e,"gutterContextMenu")?Xt(e,t,"gutterContextMenu",!1,La):!1}function vn(e,t){if(zo(e,t.from)<0)return e;if(zo(e,t.to)<=0)return Go(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+=Go(t).ch-t.to.ch),Po(n,r)}function yn(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new fe(vn(i.anchor,t),vn(i.head,t)))}return de(n,e.sel.primIndex)}function bn(e,t,n){return e.line==t.line?Po(n.line,e.ch-t.ch+n.ch):Po(n.line+(e.line-t.line),e.ch)}function xn(e,t,n){for(var r=[],i=Po(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=bn(l.from,i,o),c=bn(Go(l),i,o);if(i=l.to,o=c,"around"==n){var u=e.sel.ranges[a],f=zo(u.head,u.anchor)<0;r[a]=new fe(f?c:s,f?s:c)}else r[a]=new fe(s,s)}return new ue(r,e.sel.primIndex)}function wn(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=me(e,t)),n&&(this.to=me(e,n)),r&&(this.text=r),void 0!==i&&(this.origin=i)}),La(e,"beforeChange",e,r),e.cm&&La(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function kn(e,t,n){if(e.cm){if(!e.cm.curOp)return At(e.cm,kn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ci(e,"beforeChange")||e.cm&&Ci(e.cm,"beforeChange"))||(t=wn(e,t,!0))){var r=Oo&&!n&&ir(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Cn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Cn(e,t)}}function Cn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=zo(t.from,t.to)){var n=yn(e,t);oi(e,t,n,e.cm?e.cm.curOp.id:0/0),Mn(e,t,n,tr(e,t));var r=[];Vr(e,function(e,n){n||-1!=Oi(r,e.history)||(mi(e.history,t),r.push(e.history)),Mn(e,t,null,tr(e,t))})}}function Sn(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(r=a[s],n?!r.ranges||r.equals(e.sel):r.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;r=a.pop(),r.ranges;){if(si(r,l),n&&!r.equals(e.sel))return void Me(e,r,{clearRedo:!1});o=r}var c=[];si(o,l),l.push({changes:c,generation:i.generation}),i.generation=r.generation||++i.maxGeneration;for(var u=Ci(e,"beforeChange")||e.cm&&Ci(e.cm,"beforeChange"),s=r.changes.length-1;s>=0;--s){var f=r.changes[s];if(f.origin=t,u&&!wn(e,f,!1))return void(a.length=0);c.push(ni(e,f));var d=s?yn(e,f):Ai(a);Mn(e,f,d,rr(e,f)),!s&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Go(f)});var h=[];Vr(e,function(e,t){t||-1!=Oi(h,e.history)||(mi(e.history,f),h.push(e.history)),Mn(e,f,null,rr(e,f))})}}}}function Ln(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Ni(e.sel.ranges,function(e){return new fe(Po(e.anchor.line+t,e.anchor.ch),Po(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Wt(e.cm,r,"gutter")}}function Mn(e,t,n,r){if(e.cm&&!e.cm.curOp)return At(e.cm,Mn)(e,t,n,r);if(t.to.line<e.first)return void Ln(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);Ln(e,i),t={from:Po(e.first,0),to:Po(t.to.line+i,t.to.ch),text:[Ai(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Po(o,Kr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=$r(e,t.from,t.to),n||(n=yn(e,t)),e.cm?Tn(e.cm,t,r):Rr(e,t,r),Te(e,n,Oa)}}function Tn(e,t,n){var r=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=Zr(pr(Kr(r,a.line))),r.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&ki(e),Rr(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,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Dt(e):a.line!=l.line||1!=t.text.length||_r(e.doc,t)?Dt(e,a.line,l.line+1,u):Wt(e,a.line,"text");var d=Ci(e,"changes"),h=Ci(e,"change");if(h||d){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&bi(e,"change",e,p),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function An(e,t,n,r,i){if(r||(r=n),zo(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=Ga(t)),kn(e,{from:n,to:r,text:t,origin:i})}function On(e,t){if(!wi(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&&!wo){var o=Hi("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-_e(e.display))+"px; height: "+(t.bottom-t.top+Ue(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Nn(e,t,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=ft(e,t),l=n&&n!=t?ft(e,n):a,s=zn(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-r,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(Jt(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(en(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Pn(e,t,n,r,i){var o=zn(e,t,n,r,i);null!=o.scrollTop&&Jt(e,o.scrollTop),null!=o.scrollLeft&&en(e,o.scrollLeft)}function zn(e,t,n,r,i){var o=e.display,a=gt(e.display);0>n&&(n=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=Ge(e),c={};i-n>s&&(i=n+s);var u=e.doc.height+Re(o),f=a>n,d=i>u-a;if(l>n)c.scrollTop=f?0:n;else if(i>l+s){var h=Math.min(n,(d?u:i)-s);h!=l&&(c.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?c.scrollLeft=0:p>t?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+p-3&&(c.scrollLeft=r+(g?0:10)-m),c}function Dn(e,t,n){(null!=t||null!=n)&&En(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){En(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?Po(t.line,t.ch-1):t,r=Po(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function En(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=dt(e,t.from),r=dt(e,t.to),i=zn(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 In(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=je(e,t):n="prev");var a=e.options.tabSize,l=Kr(o,t),s=za(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Aa||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?za(Kr(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)d+=a,f+=" ";if(c>d&&(f+=Ti(c-d)),f!=u)return An(o,f,Po(t,0),Po(t,u.length),"+input"),l.stateAfter=null,!0;for(var h=0;h<o.sel.ranges.length;h++){var p=o.sel.ranges[h];if(p.head.line==t&&p.head.ch<u.length){var d=Po(t,u.length);ke(o,h,new fe(d,d));break}}}function Fn(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Kr(e,pe(e,t)):i=Zr(t),null==i?null:(r(o,i)&&e.cm&&Wt(e.cm,i,n),o)}function Hn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&zo(o.from,Ai(r).to)<=0;){var a=r.pop();if(zo(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Tt(e,function(){for(var t=r.length-1;t>=0;t--)An(e.doc,"",r[t].from,r[t].to,"+delete");Wn(e)})}function Bn(e,t,n,r,i){function o(){var t=l+n;return t<e.first||t>=e.first+e.size?f=!1:(l=t,u=Kr(e,t))}function a(e){var t=(i?lo:so)(u,s,n,!0);if(null==t){if(e||!o())return f=!1;s=i?(0>n?eo:Ji)(u):0>n?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=n,u=Kr(e,l),f=!0;if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var d=null,h="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>n)||a(!m);m=!1){var g=u.text.charAt(s)||"\n",v=Ei(g,p)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||m||v||(v="s"),d&&d!=v){0>n&&(n=1,a());break}if(v&&(d=v),
n>0&&!a(!m))break}var y=Pe(e,Po(l,s),c,!0);return f||(y.hitSide=!0),y}function jn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(l-(0>n?1.5:.5)*gt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var s=pt(e,a,i);if(!s.outside)break;if(0>n?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*n}return s}function _n(t,n,r,i){e.defaults[t]=n,r&&($o[t]=i?function(e,t,n){n!=Xo&&r(e,t,n)}:r)}function Rn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function qn(e){return"string"==typeof e?ia[e]:e}function Un(e,t,n,r,i){if(r&&r.shared)return Vn(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return At(e.cm,Un)(e,t,n,r,i);var o=new ua(e,i),a=zo(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=Hi("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(hr(e,t.line,t,n,o)||t.line!=n.line&&hr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");No=!0}o.addToHistory&&oi(e,{from:t,to:n,origin:"markText"},e.sel,0/0);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&pr(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Yr(e,0),Qn(e,new Xn(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){yr(e,t)&&Yr(t,0)}),o.clearOnEnter&&Ca(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Oo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ca,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(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++)Wt(c,u,"text");o.atomic&&Oe(c.doc),bi(c,"markerAdded",c,o)}return o}function Vn(e,t,n,r,i){r=Di(r),r.shared=!1;var o=[Un(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Vr(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Un(e,me(e,t),me(e,n),r,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Ai(o)}),new fa(o,a)}function Gn(e){return e.findMarks(Po(e.first,0),e.clipPos(Po(e.lastLine())),function(e){return e.parent})}function Kn(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(zo(o,a)){var l=Un(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}function $n(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];Vr(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==Oi(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}}}function Xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Yn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Zn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Qn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Jn(e,t,n){if(e)for(var r,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Xn(a,o.from,s?null:o.to))}}return r}function er(e,t,n){if(e)for(var r,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Xn(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return r}function tr(e,t){if(t.full)return null;var n=ve(e,t.from.line)&&Kr(e,t.from.line).markedSpans,r=ve(e,t.to.line)&&Kr(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==zo(t.from,t.to),l=Jn(n,i,a),s=er(r,o,a),c=1==t.text.length,u=Ai(t.text).length+(c?i:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var h=Yn(s,d.marker);h?c&&(d.to=null==h.to?null:h.to+u):d.to=i}}if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null!=d.to&&(d.to+=u),null==d.from){var h=Yn(l,d.marker);h||(d.from=u,c&&(l||(l=[])).push(d))}else d.from+=u,c&&(l||(l=[])).push(d)}l&&(l=nr(l)),s&&s!=l&&(s=nr(s));var p=[l];if(!c){var m,g=t.text.length-2;if(g>0&&l)for(var f=0;f<l.length;++f)null==l[f].to&&(m||(m=[])).push(new Xn(l[f].marker,null,null));for(var f=0;g>f;++f)p.push(m);p.push(s)}return p}function nr(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 rr(e,t){var n=fi(e,t),r=tr(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 l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function ir(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&&-1!=Oi(r,n)||(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],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(zo(c.to,l.from)<0||zo(c.from,l.to)>0)){var u=[s,1],f=zo(c.from,l.from),d=zo(c.to,l.to);(0>f||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function or(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function ar(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function lr(e){return e.inclusiveLeft?-1:0}function sr(e){return e.inclusiveRight?1:0}function cr(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=zo(r.from,i.from)||lr(e)-lr(t);if(o)return-o;var a=zo(r.to,i.to)||sr(e)-sr(t);return a?a:t.id-e.id}function ur(e,t){var n,r=No&&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||cr(n,i.marker)<0)&&(n=i.marker);return n}function fr(e){return ur(e,!0)}function dr(e){return ur(e,!1)}function hr(e,t,n,r,i){var o=Kr(e,t),a=No&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=zo(c.from,n)||lr(s.marker)-lr(i),f=zo(c.to,r)||sr(s.marker)-sr(i);if(!(u>=0&&0>=f||0>=u&&f>=0)&&(0>=u&&(zo(c.to,n)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(zo(c.from,r)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function pr(e){for(var t;t=fr(e);)e=t.find(-1,!0).line;return e}function mr(e){for(var t,n;t=dr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function gr(e,t){var n=Kr(e,t),r=pr(n);return n==r?t:Zr(r)}function vr(e,t){if(t>e.lastLine())return t;var n,r=Kr(e,t);if(!yr(e,r))return t;for(;n=dr(r);)r=n.find(1,!0).line;return Zr(r)+1}function yr(e,t){var n=No&&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&&br(e,t,r))return!0}}function br(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return br(e,r.line,Yn(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)&&br(e,t,i))return!0}function xr(e,t,n){Jr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dn(e,null,n)}function wr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ba(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;"),ji(t.display.measure,Hi("div",[e.node],null,n))}return e.height=e.node.offsetHeight}function kr(e,t,n,r){var i=new da(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Fn(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&&!yr(e,t)){var r=Jr(t)<e.scrollTop;Yr(t,t.height+wr(i)),r&&Dn(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Cr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),or(e),ar(e,n);var i=r?r(e):1;i!=e.height&&Yr(e,i)}function Sr(e){e.parent=null,or(e)}function Lr(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 Mr(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 Tr(t,n,r,i){for(var o=0;10>o;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 Ar(e,t,n,r){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?ta(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=me(a,t);var s,c=Kr(a,t.line),u=je(e,t.line,n),f=new sa(c.text,e.options.tabSize);for(r&&(s=[]);(r||f.pos<t.ch)&&!f.eol();)f.start=f.pos,o=Tr(l,f,u),r&&s.push(i(!0));return r?s:i()}function Or(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,f=new sa(t,e.options.tabSize),d=e.options.addModeClass&&[null];for(""==t&&Lr(Mr(n,r),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&zr(e,t,r,f.pos),f.pos=t.length,s=null):s=Lr(Tr(n,f,r,d),o),d){var h=d[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<f.start;)c=Math.min(f.start,c+5e4),i(c,u);u=s}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e4);i(p,u),c=p}}function Nr(e,t,n,r){var i=[e.state.modeGen],o={};Or(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 l=e.state.overlays[a],s=1,c=0;Or(e,t.text,l.mode,!0,function(e,t){for(var n=s;e>c;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"cm-overlay "+t),s=n+2;else for(;s>n;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 Pr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Nr(e,t,t.stateAfter=je(e,Zr(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function zr(e,t,n,r){var i=e.doc.mode,o=new sa(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Mr(i,n);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Tr(i,o,n),o.start=o.pos}function Dr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ma:pa;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Wr(e,t){var n=Hi("span",null,null,mo?"padding-right: .1px":null),r={pre:Hi("pre",[n]),content:n,col:0,pos:0,cm:e,splitSpaces:(ho||mo)&&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=Ir,$i(e.display.measure)&&(o=ei(a))&&(r.addToken=Hr(r.addToken,o)),r.map=[];var l=t!=e.display.externalMeasured&&Zr(a);jr(a,r,Pr(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=qi(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=qi(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ki(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({}))}return mo&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),La(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=qi(r.pre.className,r.textClass||"")),r}function Er(e){var t=Hi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ir(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Fr):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),f=0;;){s.lastIndex=f;var d=s.exec(t),h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(l.slice(f,f+h));u.appendChild(ho&&9>po?Hi("span",[p]):p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!d)break;if(f+=h+1," "==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,p=u.appendChild(Hi("span",Ti(g),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=g}else{var p=e.cm.options.specialCharPlaceholder(d[0]);p.setAttribute("cm-text",d[0]),u.appendChild(ho&&9>po?Hi("span",[p]):p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),ho&&9>po&&(c=!0),e.pos+=t.length}if(n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=Hi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Fr(e){for(var t=" ",n=0;n<e.length-2;++n)t+=n%2?" ":" ";return t+=" "}function Hr(e,t){return function(n,r,i,o,a,l,s){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,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function Br(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}function jr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,f,d,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=f=l="",d=null,v=1/0;for(var y=[],b=0;b<r.length;++b){var x=r[b],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(s+=" "+w.className),w.css&&(l=w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(c+=" "+w.endStyle),w.title&&!f&&(f=w.title),w.collapsed&&(!d||cr(d.marker,w)<0)&&(d=x)):x.from>p&&v>x.from&&(v=x.from)}if(d&&(d.from||0)==p){if(Br(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}if(!d&&y.length)for(var b=0;b<y.length;++b)Br(t,0,y[b])}if(p>=h)break;for(var k=Math.min(h,v);;){if(g){var C=p+g.length;if(!d){var S=C>k?g.slice(0,k-p):g;t.addToken(t,S,a?a+s:s,u,p+S.length==v?c:"",f,l)}if(C>=k){g=g.slice(k-p),p=k;break}p=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 _r(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ai(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Rr(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){Cr(e,n,i,r),bi(e,"change",e,t)}function a(e,t){for(var n=e,o=[];t>n;++n)o.push(new ha(c[n],i(n),r));return o}var l=t.from,s=t.to,c=t.text,u=Kr(e,l.line),f=Kr(e,s.line),d=Ai(c),h=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(_r(e,t)){var m=a(0,c.length-1);o(f,f.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,l.ch)+d+u.text.slice(s.ch),h);else{var m=a(1,c.length-1);m.push(new ha(d+u.text.slice(s.ch),h,r)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(f,d+f.text.slice(s.ch),h);var m=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,m)}bi(e,"change",e,t)}function qr(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 Ur(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 Vr(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!n||s)&&(t(l.doc,s),r(l.doc,e,s))}}}r(e,null,!0)}function Gr(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,Dt(e)}function Kr(e,t){if(t-=e.first,0>t||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(o>t){n=i;break}t-=o}return n.lines[t]}function $r(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 Xr(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Yr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Zr(e){if(null==e.parent)return null;for(var t=e.parent,n=Oi(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 Qr(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(o>t){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],l=a.height;if(l>t)break;t-=l}return n+r}function Jr(e){e=pr(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 ei(e){var t=e.order;return null==t&&(t=e.order=Qa(e.text)),t}function ti(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 ni(e,t){var n={from:K(t.from),to:Go(t),text:$r(e,t.from,t.to)};return ci(e,n,t.from.line,t.to.line+1),Vr(e,function(e){ci(e,n,t.from.line,t.to.line+1)},!0),n}function ri(e){for(;e.length;){var t=Ai(e);if(!t.ranges)break;e.pop()}}function ii(e,t){return t?(ri(e.done),Ai(e.done)):e.done.length&&!Ai(e.done).ranges?Ai(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ai(e.done)):void 0}function oi(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=ii(i,i.lastOp==r))){var l=Ai(o.changes);0==zo(t.from,t.to)&&0==zo(t.from,l.to)?l.to=Go(t):o.changes.push(ni(e,t))}else{var s=Ai(i.done);for(s&&s.ranges||si(e.sel,i.done),o={changes:[ni(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,l||La(e,"historyAdded")}}function ai(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 li(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||ai(e,o,Ai(i.done),t))?i.done[i.done.length-1]=t:si(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ri(i.undone)}function si(e,t){var n=Ai(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ci(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 ui(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 fi(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(ui(n[r]));return i}function di(e,t,n){for(var r=0,i=[];r<e.length;++r){var o=e[r];if(o.ranges)i.push(n?ue.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&Oi(t,Number(c[1]))>-1&&(Ai(l)[f]=u[f],delete u[f])}}}return i}function hi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function pi(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 l=0;l<o.ranges.length;l++)hi(o.ranges[l].anchor,t,n,r),hi(o.ranges[l].head,t,n,r)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(n<s.from.line)s.from=Po(s.from.line+r,s.from.ch),s.to=Po(s.to.line+r,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function mi(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;pi(e.done,n,r,i),pi(e.undone,n,r,i)}function gi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function vi(e){return e.target||e.srcElement}function yi(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),So&&e.ctrlKey&&1==t&&(t=3),t}function bi(e,t){function n(e){return function(){e.apply(null,o)}}var r=e._handlers&&e._handlers[t];if(r){var i,o=Array.prototype.slice.call(arguments,2);Ho?i=Ho.delayedCallbacks:Ma?i=Ma:(i=Ma=[],setTimeout(xi,0));for(var a=0;a<r.length;++a)i.push(n(r[a]))}}function xi(){var e=Ma;Ma=null;for(var t=0;t<e.length;++t)e[t]()}function wi(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),La(e,n||t.type,e,t),gi(t)||t.codemirrorIgnore}function ki(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)-1==Oi(n,t[r])&&n.push(t[r])}function Ci(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function Si(e){e.prototype.on=function(e,t){Ca(this,e,t)},e.prototype.off=function(e,t){Sa(this,e,t)}}function Li(){this.id=null}function Mi(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);-1==o&&(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}}function Ti(e){for(;Da.length<=e;)Da.push(Ai(Da)+" ");return Da[e]}function Ai(e){return e[e.length-1]}function Oi(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function Ni(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Pi(){}function zi(e,t){var n;return Object.create?n=Object.create(e):(Pi.prototype=e,n=new Pi),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 Ei(e,t){return t?t.source.indexOf("\\w")>-1&&Fa(e)?!0:t.test(e):Fa(e)}function Ii(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Fi(e){return e.charCodeAt(0)>=768&&Ha.test(e)}function Hi(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 Bi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ji(e,t){return Bi(e).appendChild(t)}function _i(){return document.activeElement}function Ri(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function qi(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Ri(n[r]).test(t)&&(t+=" "+n[r]);return t}function Ui(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 Vi(){Ua||(Gi(),Ua=!0)}function Gi(){var e;Ca(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ui(Rt)},100))}),Ca(window,"blur",function(){Ui(pn)})}function Ki(e){if(null==ja){var t=Hi("span","");ji(e,Hi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ja=t.offsetWidth<=1&&t.offsetHeight>2&&!(ho&&8>po))}var n=ja?Hi("span",""):Hi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function $i(e){if(null!=_a)return _a;var t=ji(e,document.createTextNode("AخA")),n=Ea(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Ea(t,1,2).getBoundingClientRect();return _a=r.right-n.right<3}function Xi(e){if(null!=Xa)return Xa;var t=ji(e,Hi("span","x")),n=t.getBoundingClientRect(),r=Ea(t,0,1).getBoundingClientRect();return Xa=Math.abs(n.left-r.left)>1}function Yi(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 Zi(e){return e.level%2?e.to:e.from}function Qi(e){return e.level%2?e.from:e.to}function Ji(e){var t=ei(e);return t?Zi(t[0]):0}function eo(e){var t=ei(e);return t?Qi(Ai(t)):e.text.length}function to(e,t){var n=Kr(e.doc,t),r=pr(n);r!=n&&(t=Zr(r));var i=ei(r),o=i?i[0].level%2?eo(r):Ji(r):0;return Po(t,o)}function no(e,t){for(var n,r=Kr(e.doc,t);n=dr(r);)r=n.find(1,!0).line,t=null;var i=ei(r),o=i?i[0].level%2?Ji(r):eo(r):r.text.length;return Po(null==t?Zr(r):t,o)}function ro(e,t){var n=to(e,t.line),r=Kr(e.doc,n.line),i=ei(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 Po(n.line,a?0:o)}return n}function io(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:n>t}function oo(e,t){Za=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 io(e,i.level,e[n].level)?(i.from!=i.to&&(Za=n),r):(i.from!=i.to&&(Za=r),n);n=r}}return n}function ao(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Fi(e.text.charAt(t)));return t}function lo(e,t,n,r){var i=ei(e);if(!i)return so(e,t,n,r);for(var o=oo(i,t),a=i[o],l=ao(e,t,a.level%2?-n:n,r);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return oo(i,l)==o?l:(a=i[o+=n],n>0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;l=n>0==a.level%2?ao(e,a.to,-1,r):ao(e,a.from,1,r)}}function so(e,t,n,r){var i=t+n;if(r)for(;i>0&&Fi(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var co=/gecko\/\d/i.test(navigator.userAgent),uo=/MSIE \d/.test(navigator.userAgent),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ho=uo||fo,po=ho&&(uo?document.documentMode||6:fo[1]),mo=/WebKit\//.test(navigator.userAgent),go=mo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),vo=/Chrome\//.test(navigator.userAgent),yo=/Opera\//.test(navigator.userAgent),bo=/Apple Computer/.test(navigator.vendor),xo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),wo=/PhantomJS/.test(navigator.userAgent),ko=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Co=ko||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),So=ko||/Mac/.test(navigator.platform),Lo=/win/i.test(navigator.platform),Mo=yo&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Mo&&(Mo=Number(Mo[1])),Mo&&Mo>=15&&(yo=!1,mo=!0);var To=So&&(go||yo&&(null==Mo||12.11>Mo)),Ao=co||ho&&po>=9,Oo=!1,No=!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.checkedOverlay&&e.clientHeight>0&&(0==r&&this.overlayHack(),this.checkedOverlay=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=So&&!xo?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,n=function(e){vi(e)!=t.vert&&vi(e)!=t.horiz&&At(t.cm,Vt)(e)};Ca(this.vert,"mousedown",n),Ca(this.horiz,"mousedown",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},L.prototype.signal=function(e,t){Ci(e,t)&&this.events.push(arguments)},L.prototype.finish=function(){for(var e=0;e<this.events.length;e++)La.apply(null,this.events[e])};var Po=e.Pos=function(e,t){return this instanceof Po?(this.line=e,void(this.ch=t)):new Po(e,t)},zo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Do=null;ne.prototype=Di({init:function(e){function t(e){if(r.somethingSelected())Do=r.getSelections(),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=Do.join("\n"),Wa(o));else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);Do=t.text,"cut"==e.type?r.setSelections(t.ranges,null,Oa):(n.prevInput="",o.value=t.text.join("\n"),Wa(o))}"cut"==e.type&&(r.state.cutIncoming=!0)}var n=this,r=this.cm,i=this.wrapper=re(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),ko&&(o.style.width="0px"),Ca(o,"input",function(){ho&&po>=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Ca(o,"paste",function(){if(mo&&!r.state.fakedLastChar&&!(new Date-r.state.lastMiddleDown<200)){var e=o.selectionStart,t=o.selectionEnd;o.value+="$",o.selectionEnd=t,o.selectionStart=e,r.state.fakedLastChar=!0}r.state.pasteIncoming=!0,n.fastPoll()}),Ca(o,"cut",t),Ca(o,"copy",t),Ca(e.scroller,"paste",function(t){qt(e,t)||(r.state.pasteIncoming=!0,n.focus())}),Ca(e.lineSpace,"selectstart",function(t){qt(e,t)||xa(t)}),Ca(o,"compositionstart",function(){var e=r.getCursor("from");n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ca(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=De(e);if(e.options.moveInputWithCursor){var i=ft(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;ji(n.cursorDiv,e.cursors),ji(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=$a&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.textarea.value=a,r.state.focused&&Wa(this.textarea),ho&&po>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",ho&&po>=9&&(this.hasSelection=null));this.inaccurateSelection=t;
}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Co||_i()!=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(!e.state.focused||Ka(t)&&!n||Q(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(ho&&po>=9&&this.hasSelection===r||So&&/[\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);a>o&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var l=this;return Tt(e,function(){J(e,r.slice(o),n.length-o,null,l.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=r,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){ho&&po>=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.position="relative",a.style.cssText=u,ho&&9>po&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!ho||ho&&9>po)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==r.prevInput?At(i,ra.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,l=Ut(i,e),s=o.scroller.scrollTop;if(l&&!yo){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&At(i,Me)(i.doc,he(l),Oa);var u=a.style.cssText;if(r.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ho?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",mo)var f=window.scrollY;if(o.input.focus(),mo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),ho&&po>=9&&t(),Ao){ka(e);var d=function(){Sa(window,"mouseup",d),setTimeout(n,20)};Ca(window,"mouseup",d)}else setTimeout(n,50)}},setUneditable:Pi,needsContentAttribute:!1},ne.prototype),ie.prototype=Di({init:function(e){function t(e){if(r.somethingSelected())Do=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);Do=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Oa),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!ko)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Do.join("\n"));else{var n=re(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Do.join("\n");var o=document.activeElement;Wa(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}var n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable="true",te(i),Ca(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),r.replaceSelection(t,null,"paste"))}),Ca(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(Po(i.head.line,a),Po(i.head.line,a+t.length)))}}),Ca(i,"compositionupdate",function(e){n.composing.data=e.data}),Ca(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))}),Ca(i,"touchstart",function(){n.forceCompositionEnd()}),Ca(i,"input",function(){n.composing||n.pollContent()||Tt(n.cm,function(){Dt(r)})}),Ca(i,"copy",t),Ca(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&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!=zo(Y(n,r),t.from())||0!=zo(X(n,r),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.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=Ea(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(e.removeAllRanges(),e.addRange(u),l&&null==e.anchorNode?e.addRange(l):co&&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){ji(this.cm.display.cursorDiv,e.cursors),ji(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 Ba(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():Tt(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&&Tt(t,function(){Me(t.doc,he(n,r),Oa),(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=It(e,r.line)))var a=Zr(t.view[0].line),l=t.view[0].node;else var a=Zr(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=It(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.view[s].node;else var c=Zr(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var f=Ga(ce(e,l,u,a,c)),d=$r(e.doc,Po(a,0),Po(c,Kr(e.doc,c).text.length));f.length>1&&d.length>1;)if(Ai(f)==Ai(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var h=0,p=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);v>h&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=Ai(f),b=Ai(d),x=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));x>p&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;f[f.length-1]=y.slice(0,y.length-p),f[0]=f[0].slice(h);var w=Po(a,h),k=Po(c,d.length?Ai(d).length-p:0);return f.length>1||f[0]||zo(w,k)?(An(e.doc,f,w,k,"+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){e.data&&e.data!=e.startData&&At(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),At(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Pi,resetPosition:Pi,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:ne,contenteditable:ie},ue.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!=zo(n.anchor,r.anchor)||0!=zo(n.head,r.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new fe(K(this.ranges[t].anchor),K(this.ranges[t].head));return new ue(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(zo(t,r.from())>=0&&zo(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return Y(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 Wo,Eo,Io,Fo={left:0,right:0,top:0,bottom:0},Ho=null,Bo=0,jo=0,_o=0,Ro=null;ho?Ro=-.53:co?Ro=15:vo?Ro=-.7:bo&&(Ro=-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*=Ro,t.y*=Ro,t};var Uo=new Li,Vo=null,Go=e.changeEnd=function(e){return e.text?Po(e.from.line+e.text.length-1,Ai(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,$o.hasOwnProperty(e)&&At(this,$o[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"](qn(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:Ot(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++,Dt(this)}),removeOverlay:Ot(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 Dt(this)}}),indentLine:Ot(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&In(this,e,t,n)}),indentSelection:Ot(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&&(In(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(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;n>s;++s)In(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&ke(this.doc,r,new fe(o,c[r].to()),Oa)}}}),getTokenAt:function(e,t){return Ar(this,e,t)},getLineTokens:function(e,t){return Ar(this,Po(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,n=Pr(this,Kr(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 l=t?t.indexOf("cm-overlay "):-1;return 0>l?t:0==l?null:t.slice(0,l-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(!ea.hasOwnProperty(t))return n;var r=ea[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 l=r._global[o];l.pred(i,this)&&-1==Oi(n,l.val)&&n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=pe(n,null==e?n.first+n.size-1:e),je(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?me(this.doc,e):e?r.from():r.to(),ft(this,n,t||"page")},charCoords:function(e,t){return ut(this,me(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ct(this,e,t||"page"),pt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ct(this,{top:e,left:0},t||"page").top,Qr(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=Kr(this.doc,e)}else n=e;return st(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-Jr(n):0)},defaultTextHeight:function(){return gt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Ot(function(e,t,n){return Fn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Ii(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Wt(t,r,"gutter"),Ii(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Kr(this.doc,e),!e)return null}else{var t=Zr(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=ft(this,me(this.doc,e));var a=e.bottom,l=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 s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&Pn(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(sn),triggerOnKeyPress:Ot(fn),triggerOnKeyUp:un,execCommand:function(e){return ra.hasOwnProperty(e)?ra[e](this):void 0},findPosH:function(e,t,n,r){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=me(this.doc,e);t>o&&(a=Bn(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Bn(n.doc,r.head,e,t,n.options.rtlMoveVisually):0>e?r.from():r.to()},Pa)}),deleteH:Ot(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Hn(this,function(n){var i=Bn(r,n.head,e,t,!1);return 0>e?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;0>t&&(i=-1,t=-t);for(var a=0,l=me(this.doc,e);t>a;++a){var s=ft(this,l,"div");if(null==o?o=s.left:s.left=o,l=jn(this,s,i,n),l.hitSide)break}return l},moveV:Ot(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 0>e?a.from():a.to();var l=ft(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=jn(n,l,e,t);return"page"==t&&a==r.sel.primary()&&Dn(n,null,ut(n,s,"div").top-l.top),s},Pa),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=Kr(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),l=Ei(a,o)?function(e){return Ei(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ei(e)};r>0&&l(n.charAt(r-1));)--r;for(;i<n.length&&l(n.charAt(i));)++i}return new fe(Po(e.line,r),Po(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?qa(this.display.cursorDiv,"CodeMirror-overwrite"):Ra(this.display.cursorDiv,"CodeMirror-overwrite"),La(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==_i()},scrollTo:Ot(function(e,t){(null!=e||null!=t)&&En(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-Ue(this)-this.display.barHeight,width:e.scrollWidth-Ue(this)-this.display.barWidth,clientHeight:Ge(this),clientWidth:Ve(this)}},scrollIntoView:Ot(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:Po(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)En(this),this.curOp.scrollToPos=e;else{var n=zn(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:Ot(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&&it(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){Wt(r,i,"widget");break}++i}),r.curOp.forceUpdate=!0,La(r,"refresh",this)}),operation:function(e){return Tt(this,e)},refresh:Ot(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,ot(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-gt(this.display))>.5)&&a(this),La(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Gr(this,e),ot(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,bi(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}},Si(e);var Ko=e.defaults={},$o=e.optionHandlers={},Xo=e.Init={toString:function(){return"CodeMirror.Init"}};_n("value","",function(e,t){e.setValue(t)},!0),_n("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),_n("indentUnit",2,n,!0),_n("indentWithTabs",!1),_n("smartIndent",!0),_n("tabSize",4,function(e){r(e),ot(e),Dt(e)},!0),_n("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),r!=e.Init&&t.refresh()}),_n("specialCharPlaceholder",Er,function(e){e.refresh()},!0),_n("electricChars",!0),_n("inputStyle",Co?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),_n("rtlMoveVisually",!Lo),_n("wholeLineUpdateBefore",!0),_n("theme","default",function(e){l(e),s(e)},!0),_n("keyMap","default",function(t,n,r){var i=qn(n),o=r!=e.Init&&qn(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),_n("extraKeys",null),_n("lineWrapping",!1,i,!0),_n("gutters",[],function(e){h(e.options),s(e)},!0),_n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?S(e.display)+"px":"0",e.refresh()},!0),_n("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),_n("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),_n("lineNumbers",!1,function(e){h(e.options),s(e)},!0),_n("firstLineNumber",1,s,!0),_n("lineNumberFormatter",function(e){return e},s,!0),_n("showCursorWhenSelecting",!1,ze,!0),_n("resetSelectionOnContextMenu",!0),_n("lineWiseCopyCut",!0),_n("readOnly",!1,function(e,t){"nocursor"==t?(pn(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),_n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),_n("dragDrop",!0,_t),_n("cursorBlinkRate",530),_n("cursorScrollMargin",0),_n("cursorHeight",1,ze,!0),_n("singleCursorHeightPerLine",!0,ze,!0),_n("workTime",100),_n("workDelay",100),_n("flattenSpans",!0,r,!0),_n("addModeClass",!1,r,!0),_n("pollInterval",100),_n("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),_n("historyEventDelay",1250),_n("viewportMargin",10,function(e){e.refresh()},!0),_n("maxHighlightLength",1e4,r,!0),_n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),_n("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),_n("autofocus",null);var Yo=e.modes={},Zo=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)),Yo[t]=n},e.defineMIME=function(e,t){Zo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Zo.hasOwnProperty(t))t=Zo[t];else if(t&&"string"==typeof t.name&&Zo.hasOwnProperty(t.name)){var n=Zo[t.name];"string"==typeof n&&(n={name:n}),t=zi(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=Yo[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(Qo.hasOwnProperty(n.name)){var o=Qo[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 Qo=e.modeExtensions={};e.extendMode=function(e,t){var n=Qo.hasOwnProperty(e)?Qo[e]:Qo[e]={};Di(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){va.prototype[e]=t},e.defineOption=_n;var Jo=[];e.defineInitHook=function(e){Jo.push(e)};var ea=e.helpers={};e.registerHelper=function(t,n,r){ea.hasOwnProperty(t)||(ea[t]=e[t]={_global:[]}),ea[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),ea[t]._global.push({pred:r,val:i})};var ta=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},na=e.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};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 ra=e.commands={selectAll:function(e){e.setSelection(Po(e.firstLine(),0),Po(e.lastLine()),Oa)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Oa)},killLine:function(e){Hn(e,function(t){if(t.empty()){var n=Kr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Po(t.head.line+1,0)}:{from:t.head,to:Po(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Hn(e,function(t){return{from:Po(t.from().line,0),to:me(e.doc,Po(t.to().line+1,0))}})},delLineLeft:function(e){Hn(e,function(e){return{from:Po(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Hn(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){Hn(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(Po(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Po(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return to(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return ro(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return no(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")},Pa)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Pa)},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/)?ro(e,t.head):r},Pa)},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(" ")},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=za(e.getLine(o.line),o.ch,r);t.push(new Array(r-a%r+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Tt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r].head,o=Kr(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Po(i.line,i.ch-1)),i.ch>0)i=new Po(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Po(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Kr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),Po(i.line-1,a.length-1),Po(i.line,1),"+transpose")}n.push(new fe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){Tt(e,function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),Wn(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},ia=e.keyMap={};ia.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"},ia.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"},ia.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"},ia.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"]},ia["default"]=So?ia.macDefault:ia.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=Ni(n.split(" "),Rn),o=0;o<i.length;o++){var a,l;o==i.length-1?(l=n,a=r):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var c in t)e[c]=t[c];return e};var oa=e.lookupKey=function(e,t,n,r){t=qn(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 oa(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=oa(e,t.fallthrough[o],n,r);if(a)return a}}},aa=e.isModifierKey=function(e){var t="string"==typeof e?e:Ya[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},la=e.keyName=function(e,t){if(yo&&34==e.keyCode&&e["char"])return!1;var n=Ya[e.keyCode],r=n;return null==r||e.altGraphKey?!1:(e.altKey&&"Alt"!=n&&(r="Alt-"+r),(To?e.metaKey:e.ctrlKey)&&"Ctrl"!=n&&(r="Ctrl-"+r),(To?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=_i();n.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Ca(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){r(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}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&&(Sa(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 sa=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};sa.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(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},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));return n?(++this.pos,t):void 0},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);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=za(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?za(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return za(this.string,null,this.tabSize)-(this.lineStart?za(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);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 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 ca=0,ua=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ca};Si(ua),ua.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&yt(e),Ci(this,"clear")){var n=this.find();n&&bi(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Yn(a.markedSpans,this);e&&!this.collapsed?Wt(e,Zr(a),"text"):e&&(null!=l.to&&(i=Zr(a)),null!=l.from&&(r=Zr(a))),a.markedSpans=Zn(a.markedSpans,l),null==l.from&&this.collapsed&&!yr(this.doc,a)&&e&&Yr(a,gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=pr(this.lines[o]),c=f(s);c>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Dt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Oe(e.doc)),e&&bi(e,"markerCleared",e,this),t&&xt(e),this.parent&&this.parent.clear()}},ua.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=Yn(o.markedSpans,this);if(null!=a.from&&(n=Po(t?o:Zr(o),a.from),-1==e))return n;if(null!=a.to&&(r=Po(t?o:Zr(o),a.to),1==e))return r}return n&&{from:n,to:r}},ua.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;e&&n&&Tt(n,function(){var r=e.line,i=Zr(e.line),o=Ze(n,i);if(o&&(rt(o),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!yr(t.doc,r)&&null!=t.height){var a=t.height;t.height=null;var l=wr(t)-a;l&&Yr(r,r.height+l)}})},ua.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Oi(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ua.prototype.detachLine=function(e){if(this.lines.splice(Oi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ca=0,fa=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Si(fa),fa.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();bi(this,"clear")}},fa.prototype.find=function(e,t){return this.primary.find(e,t)};var da=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};Si(da),da.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Zr(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=wr(this);Yr(n,Math.max(0,n.height-o)),e&&Tt(e,function(){xr(e,n,-o),Wt(e,r,"widget")})}},da.prototype.changed=function(){var e=this.height,t=this.doc.cm,n=this.line;this.height=null;var r=wr(this)-e;r&&(Yr(n,n.height+r),t&&Tt(t,function(){t.curOp.forceUpdate=!0,xr(t,n,r)}))};var ha=e.Line=function(e,t,n){this.text=e,ar(this,t),this.height=n?n(this):1};Si(ha),ha.prototype.lineNo=function(){return Zr(this)};var pa={},ma={};qr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;r>n;++n){var i=this.lines[n];this.height-=i.height,Sr(i),bi(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;r>e;++e)if(n(this.lines[e]))return!0}},Ur.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(i>e){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 qr))){var l=[];this.collapse(l),this.children=[new qr(l)],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(o>=e){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new qr(a);i.height-=l.height,this.children.splice(r+1,0,l),l.parent=this}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 Ur(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Oi(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Ur(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(o>e){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 ga=0,va=e.Doc=function(e,t,n){if(!(this instanceof va))return new va(e,t,n);null==n&&(n=0),Ur.call(this,[new qr([new ha("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=Po(n,0);this.sel=he(r),this.history=new ti(null),this.id=++ga,this.modeOption=t,"string"==typeof e&&(e=Ga(e)),Rr(this,{from:r,to:r,text:e}),Me(this,he(r),Oa)};va.prototype=zi(Ur.prototype,{constructor:va,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=Xr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:Nt(function(e){var t=Po(this.first,0),n=this.first+this.size-1;kn(this,{from:t,to:Po(n,Kr(this,n).text.length),text:Ga(e),origin:"setValue",full:!0},!0),Me(this,he(t))}),replaceRange:function(e,t,n,r){t=me(this,t),n=n?me(this,n):t,An(this,e,t,n,r)},getRange:function(e,t,n){var r=$r(this,me(this,e),me(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ve(this,e)?Kr(this,e):void 0},getLineNumber:function(e){return Zr(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Kr(this,e)),pr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return me(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,me(this,"number"==typeof e?Po(e,t||0):e),null,n)}),setSelection:Nt(function(e,t,n){Ce(this,me(this,e),me(this,t||e),n)}),extendSelection:Nt(function(e,t,n){xe(this,me(this,e),t&&me(this,t),n)}),extendSelections:Nt(function(e,t){we(this,ye(this,e,t))}),extendSelectionsBy:Nt(function(e,t){we(this,Ni(this.sel.ranges,e),t)}),setSelections:Nt(function(e,t,n){if(e.length){for(var r=0,i=[];r<e.length;r++)i[r]=new fe(me(this,e[r].anchor),me(this,e[r].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Me(this,de(i,t),n)}}),addSelection:Nt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new fe(me(this,e),me(this,t||e))),Me(this,de(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=$r(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=$r(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||"\n")),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:Ga(e[o]),origin:n}}for(var l=t&&"end"!=t&&xn(this,r,t),o=r.length-1;o>=0;o--)kn(this,r[o]);l?Le(this,l):this.cm&&Wn(this.cm)}),undo:Nt(function(){Sn(this,"undo")}),redo:Nt(function(){Sn(this,"redo")}),undoSelection:Nt(function(){Sn(this,"undo",!0)}),redoSelection:Nt(function(){Sn(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 ti(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:di(this.history.done),undone:di(this.history.undone)}},setHistory:function(e){var t=this.history=new ti(this.history.maxGeneration);t.done=di(e.done.slice(0),null,!0),t.undone=di(e.undone.slice(0),null,!0)},addLineClass:Nt(function(e,t,n){return Fn(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(Ri(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:Nt(function(e,t,n){return Fn(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(Ri(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 kr(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Un(this,me(this,e),me(this,t),n,"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=me(this,e),Un(this,e,e,n,"bookmark")},findMarksAt:function(e){e=me(this,e);var t=[],n=Kr(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=me(this,e),t=me(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 l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.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;return this.iter(function(r){var i=r.text.length+1;return i>e?(t=e,!0):(e-=i,void++n)}),me(this,Po(n,t))},indexFromPos:function(e){e=me(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new va(Xr(this,this.first,this.first+this.size),this.modeOption,this.first);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 va(Xr(this,t,n),e.mode||this.modeOption,t);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}],Kn(r,Gn(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),$n(Gn(this));break}}if(t.history==this.history){var i=[t.id];Vr(t,function(e){i.push(e.id)},!0),t.history=new ti(null),t.history.done=di(this.history.done,i),t.history.undone=di(this.history.undone,i)}},iterLinkedDocs:function(e){Vr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),va.prototype.eachLine=va.prototype.iter;var ya="iter insert remove copy getEditor".split(" ");for(var ba in va.prototype)va.prototype.hasOwnProperty(ba)&&Oi(ya,ba)<0&&(e.prototype[ba]=function(e){return function(){return e.apply(this.doc,arguments)}}(va.prototype[ba]));Si(va);var xa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},wa=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ka=e.e_stop=function(e){xa(e),wa(e)},Ca=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)}},Sa=e.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},La=e.signal=function(e,t){var n=e._handlers&&e._handlers[t];if(n)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)},Ma=null,Ta=30,Aa=e.Pass={toString:function(){return"CodeMirror.Pass"}},Oa={scroll:!1},Na={origin:"*mouse"},Pa={origin:"+move"};Li.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var za=e.countColumn=function(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}},Da=[""],Wa=function(e){e.select()};ko?Wa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ho&&(Wa=function(e){try{e.select()}catch(t){}});var Ea,Ia=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Fa=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ia.test(e))},Ha=/[\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]/;Ea=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 Ba=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)};ho&&11>po&&(_i=function(){try{return document.activeElement}catch(e){return document.body}});var ja,_a,Ra=e.rmClass=function(e,t){var n=e.className,r=Ri(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:"")}},qa=e.addClass=function(e,t){var n=e.className;Ri(t).test(n)||(e.className+=(n?" ":"")+t)},Ua=!1,Va=function(){if(ho&&9>po)return!1;var e=Hi("div");return"draggable"in e||"dragDrop"in e}(),Ga=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;r>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(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/)},Ka=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):!1},$a=function(){var e=Hi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Xa=null,Ya={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",107:"=",109:"-",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"};e.keyNames=Ya,function(){for(var e=0;10>e;e++)Ya[e+48]=Ya[e+96]=String(e);for(var e=65;90>=e;e++)Ya[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Ya[e+111]=Ya[e+63235]="F"+e}();var Za,Qa=function(){function e(e){return 247>=e?n.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?r.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"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]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,f=[],d=0;u>d;++d)f.push(r=e(n.charCodeAt(d)));for(var d=0,h=c;u>d;++d){var r=f[d];"m"==r?f[d]=h:h=r}for(var d=0,p=c;u>d;++d){var r=f[d];"1"==r&&"r"==p?f[d]="n":a.test(r)&&(p=r,"r"==r&&(f[d]="R"))}for(var d=1,h=f[0];u-1>d;++d){var r=f[d];"+"==r&&"1"==h&&"1"==f[d+1]?f[d]="1":","!=r||h!=f[d+1]||"1"!=h&&"n"!=h||(f[d]=h),h=r}for(var d=0;u>d;++d){var r=f[d];if(","==r)f[d]="N";else if("%"==r){for(var m=d+1;u>m&&"%"==f[m];++m);for(var g=d&&"!"==f[d-1]||u>m&&"1"==f[m]?"1":"N",v=d;m>v;++v)f[v]=g;d=m-1}}for(var d=0,p=c;u>d;++d){var r=f[d];"L"==p&&"1"==r?f[d]="L":a.test(r)&&(p=r)}for(var d=0;u>d;++d)if(o.test(f[d])){for(var m=d+1;u>m&&o.test(f[m]);++m);for(var y="L"==(d?f[d-1]:c),b="L"==(u>m?f[m]:c),g=y||b?"L":"R",v=d;m>v;++v)f[v]=g;d=m-1}for(var x,w=[],d=0;u>d;)if(l.test(f[d])){var k=d;for(++d;u>d&&l.test(f[d]);++d);w.push(new t(0,k,d))}else{var C=d,S=w.length;for(++d;u>d&&"L"!=f[d];++d);for(var v=C;d>v;)if(s.test(f[v])){v>C&&w.splice(S,0,new t(1,C,v));var L=v;for(++v;d>v&&s.test(f[v]);++v);w.splice(S,0,new t(2,L,v)),C=v}else++v;d>C&&w.splice(S,0,new t(1,C,d))}return 1==w[0].level&&(x=n.match(/^\s+/))&&(w[0].from=x[0].length,w.unshift(new t(0,0,x[0].length))),1==Ai(w).level&&(x=n.match(/\s+$/))&&(Ai(w).to-=x[0].length,w.push(new t(0,u-x[0].length,u))),2==w[0].level&&w.unshift(new t(1,w[0].to,w[0].to)),w[0].level!=Ai(w).level&&w.push(new t(w[0].level,u,u)),w}}();return e.version="5.2.0",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){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)}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 s=r[l];if(s.empty()){var c=e.getLineHandleVisualStart(s.head.line);i[i.length-1]!=c&&i.push(c)}}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.state.activeLines=i})}function i(e,t){r(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(n,o,a){var l=a&&a!=e.Init;o&&!l?(n.state.activeLines=[],r(n,n.listSelections()),n.on("beforeSelectionChange",i)):!o&&l&&(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,l=e.getLine(i.line).slice(0,i.ch),s=0;;){t.lastIndex=s;var c=t.exec(l);if(!c)break;if(o=c,a=o.index,s=o.index+(o[0].length||1),s==l.length)break}var u=o&&o[0].length||0;u||(0==a&&0==l.length?o=void 0:a!=e.getLine(i.line).length&&u++)}else{t.lastIndex=i.ch;var l=e.getLine(i.line),o=t.exec(l),u=o&&o[0].length||0,a=o&&o.index;a+u==l.length||u||(u=1)}return o&&u?{from:r(i.line,a),to:r(i.line,a+u),match:o}:void 0};else{var a=t;o&&(t=t.toLowerCase());var l=o?function(e){return e.toLowerCase()}:function(e){return e},s=t.split("\n");if(1==s.length)t.length?this.matches=function(i,o){if(i){var s=e.getLine(o.line).slice(0,o.ch),c=l(s),u=c.lastIndexOf(t);if(u>-1)return u=n(s,c,u),{from:r(o.line,u),to:r(o.line,u+a.length)}}else{var s=e.getLine(o.line).slice(o.ch),c=l(s),u=c.indexOf(t);if(u>-1)return u=n(s,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=s.length-1;if(t){if(n.line-(s.length-1)<e.firstLine())return;if(l(e.getLine(n.line).slice(0,c[i].length))!=s[s.length-1])return;for(var o=r(n.line,c[i].length),a=n.line-1,u=i-1;u>=1;--u,--a)if(s[u]!=l(e.getLine(a)))return;var f=e.getLine(a),d=f.length-c[0].length;if(l(f.slice(d))!=s[0])return;return{from:r(a,d),to:o}}if(!(n.line+(s.length-1)>e.lastLine())){var f=e.getLine(n.line),d=f.length-c[0].length;if(l(f.slice(d))==s[0]){for(var h=r(n.line,d),a=n.line+1,u=1;i>u;++u,++a)if(s[u]!=l(e.getLine(a)))return;if(l(e.getLine(a).slice(0,c[i].length))==s[i])return{from:h,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(n>i)++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(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},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=[],o=this.getSearchCursor(t,this.getCursor("from"),n);(r=o.findNext())&&!(e.cmpPos(o.to(),this.getCursor("to"))>0);)i.push({anchor:o.from(),head:o.to()});i.length&&this.setSelections(i,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,"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?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 s(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(n){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,n){var o=r(e);if(o.query)return u(e,n);var l=e.getSelection()||o.lastQuery;a(e,h,"Search for:",l,function(r){e.operation(function(){r&&!o.query&&(o.query=s(r),e.removeOverlay(o.overlay,i(o.query)),o.overlay=t(o.query,i(o.query)),e.addOverlay(o.overlay),e.showMatchesOnScrollbar&&(o.annotate&&(o.annotate.clear(),o.annotate=null),o.annotate=e.showMatchesOnScrollbar(o.query,i(o.query))),o.posFrom=o.posTo=e.getCursor(),u(e,n))})})}function u(t,n){t.operation(function(){var i=r(t),a=o(t,i.query,n?i.posFrom:i.posTo);(a.find(n)||(a=o(t,i.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(n)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()}),i.posFrom=a.from(),i.posTo=a.to())})}function f(e){e.operation(function(){var t=r(e);t.lastQuery=t.query,t.query&&(t.query=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function d(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||r(e).lastQuery;a(e,p,"Replace:",n,function(n){n&&(n=s(n),a(e,m,"Replace with:","",function(r){if(t)e.operation(function(){for(var t=o(e,n);t.findNext();)if("string"!=typeof n){var i=e.getRange(t.from(),t.to()).match(n);t.replace(r.replace(/\$(\d)/g,function(e,t){return i[t]}),"+input")}else t.replace(r,"+input")});else{f(e);
var i=o(e,n,e.getCursor()),a=function(){var t,r=i.from();!(t=i.findNext())&&(i=o(e,n),!(t=i.findNext())||r&&i.from().line==r.line&&i.from().ch==r.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,g,"Replace?",[function(){s(t)},a]))},s=function(e){i.replace("string"==typeof n?r:r.replace(/\$(\d)/g,function(t,n){return e[n]}),"+input"),a()};a()}}))})}}var h='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>',p='Replace: <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>',m='With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',g="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";e.commands.find=function(e){f(e),c(e)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=f,e.commands.replace=d,e.commands.replaceAll=function(e){d(e,!0)}}),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 t>=e?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 l=this.matches[a],s=n(l.from.line,r,o);s!=l.from.line&&(l.from=e.Pos(s,l.from.ch));var c=n(l.to.line,r,o);c!=l.to.line&&(l.to=e.Pos(c,l.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")):"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(l+(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],l=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.moveTo=function(e,t){0>e&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),e!=this.pos&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",t!==!1&&this.scroll(e,this.orientation))};var r=10;t.prototype.update=function(e,t,n){this.screen=t,this.total=e,this.size=n;var i=this.screen*(this.size/this.total);r>i&&(this.size-=r-i,i=r),this.inner.style["horizontal"==this.orientation?"width":"height"]=i-4+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},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.display="block",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.moveTo(e,!1)},n.prototype.setScrollLeft=function(e){this.horiz.moveTo(e,!1)},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.heightAtLine(e.lastLine()+1,"local");return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(s!=e.line&&(s=e.line,c=n.getLineHandle(s)),a&&c.height>l)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"),l=a&&1.5*n.defaultTextHeight(),s=null,c=null;if(n.display.barWidth)for(var u,f=0;f<o.length;f++){for(var d=o[f],h=u||t(d.from,!0)*r,p=t(d.to,!1)*r;f<o.length-1&&(u=t(o[f+1].from,!0)*r,!(u>p+.9));)d=o[++f],p=t(d.to,!1)*r;if(p!=h){var m=Math.max(p-h,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(2*n.display.barWidth,2)+"px; top: "+(h+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className}}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){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,s.parentNode.removeChild(s),u.focus(),o.onClose&&o.onClose(s)}}o||(o={}),n(this,null);var l,s=t(this,r,o.bottom),c=!1,u=this,f=s.getElementsByTagName("input")[0];return f?(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),f.focus()):(l=s.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(l,"blur",a),l.focus()),a}),e.defineExtension("openConfirm",function(r,i,o){function a(){c||(c=!0,l.parentNode.removeChild(l),u.focus())}n(this,null);var l=t(this,r,o&&o.bottom),s=l.getElementsByTagName("button"),c=!1,u=this,f=1;s[0].focus();for(var d=0;d<s.length;++d){var h=s[d];!function(t){e.on(h,"click",function(n){e.e_preventDefault(n),a(),t&&t(u)})}(i[d]),e.on(h,"blur",function(){--f,setTimeout(function(){0>=f&&a()},200)}),e.on(h,"focus",function(){++f})}}),e.defineExtension("openNotification",function(r,i){function o(){s||(s=!0,clearTimeout(a),l.parentNode.removeChild(l))}n(this,o);var a,l=t(this,r,i&&i.bottom),s=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(l,"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),s=t.ch-1,c=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(s==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,s+1)),d=n(e,a(t.line,s+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,s),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,s=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),d=t.line;d!=f;d+=n){var h=e.getLine(d);if(h){var p=n>0?0:h.length-1,m=n>0?h.length:-1;if(!(h.length>o))for(d==t.line&&(p=t.ch-(0>n?1:0));p!=m;p+=n){var g=h.charAt(p);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(d,p+1))==r)){var v=l[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(d,p),ch:g};c.pop()}}}}}return d-n==(n>0?e.lastLine():e.firstLine())?!1:null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;c<s.length;c++){var u=s[c].empty()&&t(e,s[c].head,!1,r);if(u&&e.getLine(u.from.line).length<=i){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=i&&l.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:f}))}}if(l.length){o&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<l.length;e++)l[e].clear()})};if(!n)return d;setTimeout(d,800)}}function i(e){e.operation(function(){s&&(s(),s=null),s=r(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",i),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]:u[t]}function n(e){return function(t){return a(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(),l=0;l<a.length;l++){if(!a[l].empty())return e.Pass;var c=s(n,a[l].head);if(!c||o.indexOf(c)%2!=0)return e.Pass}for(var l=a.length-1;l>=0;l--){var u=a[l].head;n.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1))}}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(),l=0;l<a.length;l++){if(!a[l].empty())return e.Pass;var c=s(n,a[l].head);if(!c||o.indexOf(c)%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(n,i){var o=r(n);if(!o||n.getOption("disableInput"))return e.Pass;var a=t(o,"pairs"),s=a.indexOf(i);if(-1==s)return e.Pass;for(var u,d,h=t(o,"triples"),p=a.charAt(s+1)==i,m=n.listSelections(),g=s%2==0,v=0;v<m.length;v++){var y,b=m[v],x=b.head,d=n.getRange(x,f(x.line,x.ch+1));if(g&&!b.empty())y="surround";else if(!p&&g||d!=i)if(p&&x.ch>1&&h.indexOf(i)>=0&&n.getRange(f(x.line,x.ch-2),x)==i+i&&(x.ch<=2||n.getRange(f(x.line,x.ch-3),f(x.line,x.ch-2))!=i))y="addFour";else if(p){if(e.isWordChar(d)||!c(n,x,i))return e.Pass;y="both"}else{if(!g||n.getLine(x.line).length!=x.ch&&!l(d,a)&&!/\s/.test(d))return e.Pass;y="both"}else y=h.indexOf(i)>=0&&n.getRange(x,f(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=y)return e.Pass}else u=y}var w=s%2?a.charAt(s-1):i,k=s%2?i:a.charAt(s+1);n.operation(function(){if("skip"==u)n.execCommand("goCharRight");else if("skipThree"==u)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==u){for(var t=n.getSelections(),e=0;e<t.length;e++)t[e]=w+t[e]+k;n.replaceSelections(t,"around")}else"both"==u?(n.replaceSelection(w+k,null),n.execCommand("goCharLeft")):"addFour"==u&&(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 s(e,t){var n=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return 2==n.length?n:null}function c(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 l=t.getMode().token(a,o.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},f=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 d=u.pairs+"`",h={Backspace:i,Enter:o},p=0;p<d.length;p++)h["'"+d.charAt(p)+"'"]=n(d.charAt(p))}),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 l="close"==o.at?o.open:o.close;l?n.state.tagOther=n.markText(l.from,l.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=[],s=0;s<n.length;s++){if(!n[s].empty())return e.Pass;var c=n[s].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 h=t.getOption("autoCloseTags"),p="html"==f.mode.configuration,m="object"==typeof h&&h.dontCloseTags||p&&a,g="object"==typeof h&&h.indentTags||p&&l,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[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=n.length-1;s>=0;s--){var x=r[s];t.replaceRange(x.text,n[s].head,n[s].anchor,"+input");var w=t.listSelections().slice(0);w[s]={head:x.newPos,anchor:x.newPos},t.setSelections(w),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var r=t.listSelections(),i=[],a=n?"/":"</",l=0;l<r.length;l++){if(!r[l].empty())return e.Pass;var s=r[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),f=u.state;if(n&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)i[l]=a+"script>";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;i[l]=a+"style>"}else{if(!f.context||!f.context.tagName||o(t,f.context.tagName,s,f))return e.Pass;i[l]=a+f.context.tagName+">"}}t.replaceSelections(i,null,"+input"),r=t.listSelections();for(var l=0;l<r.length;l++)(l==r.length-1||r[l].head.line<r[l+1].head.line)&&t.indentLine(r[l].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;r>n;++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),l=e.scanForClosingTag(t,r,null,a);if(!l||l.tag!=n)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==n;s=s.prev)++c;r=l.to;for(var u=1;c>u;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"],l=["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*)/,n=/^(\s*)(>[> ]*|[*+-]|(\d+)\.)(\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],l=0;l<o.length;l++){var s=o[l].head,c=i.getStateAfter(s.line),u=c.list!==!1,f=0!==c.quote,d=i.getLine(s.line),h=t.exec(d);if(!o[l].empty()||!u&&!f||!h)return void i.execCommand("newlineAndIndent");if(n.test(d))i.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1},"+delete"),a[l]="\n";else{var p=h[1],m=h[4],g=r.test(h[2])||h[2].indexOf(">")>=0?h[2]:parseInt(h[3],10)+1+".";a[l]="\n"+p+g+m}}i.replaceSelections(a,null,"+input")}}),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(r);return-1==t?0:t}var n={},r=/[^\s\u00a0]/,i=e.Pos;e.commands.toggleComment=function(e){for(var t=1/0,n=e.listSelections(),r=null,o=n.length-1;o>=0;o--){var a=n[o].from(),l=n[o].to();a.line>=t||(l.line>=t&&(l=i(t,0)),t=a.line,null==r?e.uncomment(a,l)?r="un":(e.lineComment(a,l),r="line"):"un"==r?e.uncomment(a,l):e.lineComment(a,l))}},e.defineExtension("lineComment",function(e,o,a){a||(a=n);var l=this,s=l.getModeAt(e),c=a.lineComment||s.lineComment;if(!c)return void((a.blockCommentStart||s.blockCommentStart)&&(a.fullLines=!0,l.blockComment(e,o,a)));var u=l.getLine(e.line);if(null!=u){var f=Math.min(0!=o.ch||o.line==e.line?o.line+1:o.line,l.lastLine()+1),d=null==a.padding?" ":a.padding,h=a.commentBlankLines||e.line==o.line;l.operation(function(){if(a.indent)for(var n=u.slice(0,t(u)),o=e.line;f>o;++o){var s=l.getLine(o),p=n.length;(h||r.test(s))&&(s.slice(0,p)!=n&&(p=t(s)),l.replaceRange(n+c+d,i(o,0),i(o,p)))}else for(var o=e.line;f>o;++o)(h||r.test(l.getLine(o)))&&l.replaceRange(c+d,i(o,0))})}}),e.defineExtension("blockComment",function(e,t,o){o||(o=n);var a=this,l=a.getModeAt(e),s=o.blockCommentStart||l.blockCommentStart,c=o.blockCommentEnd||l.blockCommentEnd;if(!s||!c)return void((o.lineComment||l.lineComment)&&0!=o.fullLines&&a.lineComment(e,t,o));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&r.test(a.getLine(u))&&--u;var f=null==o.padding?" ":o.padding;e.line>u||a.operation(function(){if(0!=o.fullLines){var n=r.test(a.getLine(u));a.replaceRange(f+c,i(u)),a.replaceRange(s+f,i(e.line,0));var d=o.blockCommentLead||l.blockCommentLead;if(null!=d)for(var h=e.line+1;u>=h;++h)(h!=u||n)&&a.replaceRange(d+f,i(h,0))}else a.replaceRange(c,t),a.replaceRange(s,e)})}),e.defineExtension("uncomment",function(e,t,o){o||(o=n);var a,l=this,s=l.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,l.lastLine()),u=Math.min(e.line,c),f=o.lineComment||s.lineComment,d=[],h=null==o.padding?" ":o.padding;e:if(f){for(var p=u;c>=p;++p){var m=l.getLine(p),g=m.indexOf(f);if(g>-1&&!/comment/.test(l.getTokenTypeAt(i(p,g+1)))&&(g=-1),-1==g&&(p!=c||p==u)&&r.test(m))break e;if(g>-1&&r.test(m.slice(0,g)))break e;d.push(m)}if(l.operation(function(){for(var e=u;c>=e;++e){var t=d[e-u],n=t.indexOf(f),r=n+f.length;0>n||(t.slice(r,r+h.length)==h&&(r+=h.length),a=!0,l.replaceRange("",i(e,n),i(e,r)))}}),a)return!0}var v=o.blockCommentStart||s.blockCommentStart,y=o.blockCommentEnd||s.blockCommentEnd;if(!v||!y)return!1;var b=o.blockCommentLead||s.blockCommentLead,x=l.getLine(u),w=c==u?x:l.getLine(c),k=x.indexOf(v),C=w.lastIndexOf(y);if(-1==C&&u!=c&&(w=l.getLine(--c),C=w.lastIndexOf(y)),-1==k||-1==C||!/comment/.test(l.getTokenTypeAt(i(u,k+1)))||!/comment/.test(l.getTokenTypeAt(i(c,C+1))))return!1;var S=x.lastIndexOf(v,e.ch),L=-1==S?-1:x.slice(0,e.ch).indexOf(y,S+v.length);if(-1!=S&&-1!=L&&L+y.length!=e.ch)return!1;L=w.indexOf(y,t.ch);var M=w.slice(t.ch).lastIndexOf(v,L-t.ch);return S=-1==L||-1==M?-1:t.ch+M,-1!=L&&-1!=S&&S!=t.ch?!1:(l.operation(function(){l.replaceRange("",i(c,C-(h&&w.slice(C-h.length,C)==h?h.length:0)),i(c,C+y.length));var e=k+v.length;if(h&&x.slice(e,e+h.length)==h&&(e+=h.length),l.replaceRange("",i(u,k),i(u,e)),b)for(var t=u+1;c>=t;++t){var n=l.getLine(t),o=n.indexOf(b);if(-1!=o&&!r.test(n.slice(0,o))){var a=o+b.length;h&&n.slice(a,a+h.length)==h&&(a+=h.length),l.replaceRange("",i(t,o),i(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){"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 l=n.paragraphEnd||e.getHelper(t,"paragraphEnd"),s=t.line+1,c=e.lastLine();c>=s;++s){var a=e.getLine(s);if(l&&l.test(a)){++s;break}if(!/\S/.test(a))break}return{from:i,to:s}}function n(e,t,n,r){for(var i=t;i>0&&!n.test(e.slice(i-1,i+1));--i);0==i&&(i=t);var o=i;if(r)for(;" "==e.charAt(o-1);)--o;return{from:o,to:i}}function r(t,r,o,a){r=t.clipPos(r),o=t.clipPos(o);var l=a.column||80,s=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],f="",d=r.line,h=t.getRange(r,o,!1);if(!h.length)return null;for(var p=h[0].match(/^[ \t]*/)[0],m=0;m<h.length;++m){var g=h[m],v=f.length,y=0;f&&g&&!s.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 x=f.length>l&&p==b&&n(f,l,s,c);x&&x.from==v&&x.to==v+y?(f=p+g,++d):u.push({text:[y?" ":""],from:i(d,v),to:i(d+1,b.length)})}for(;f.length>l;){var w=n(f,l,s,c);u.push({text:["",p],from:i(d,w.from),to:i(d,w.to)}),f=p+f.slice(w.to),++d}}return u.length&&t.operation(function(){for(var e=0;e<u.length;++e){var n=u[e];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,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 l,s=n[a];if(s.empty()){var c=t(e,s.head,{});l={from:i(c.from,0),to:i(c.to-1)}}else l={from:s.from(),to:s.to()};l.to.line>=o||(o=l.from.line,r(e,l.from,l.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,l=[],s=e.line;s<=n.line;){var c=t(a,i(s,0),o);l.push(c),s=c.to}var u=!1;return l.length&&a.operation(function(){for(var e=l.length-1;e>=0;--e)u=u||r(a,i(l[e].from,0),i(l[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 l(e){var n=s(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 s=o;o=null}else var s=r(t,o,"rangeFinder");"number"==typeof i&&(i=e.Pos(i,0));var c=r(t,o,"minFoldSize"),u=l(!0);if(r(t,o,"scanUp"))for(;!u&&i.line>t.firstLine();)i=e.Pos(i.line-1,0),u=l(!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:!0,__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();r>=n;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();r>=n;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};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 i=n.ch,s=0;;){var c=0>=i?-1:l.lastIndexOf(r,i-1);if(-1!=c){if(1==s&&c<n.ch)break;if(o=t.getTokenTypeAt(e.Pos(a,c+1)),!/^(comment|string)/.test(o))return c+1;i=c-1}else{if(1==s)break;s=1,i=l.length}}}var i,o,a=n.line,l=t.getLine(a),s="{",c="}",i=r("{");if(null==i&&(s="[",c="]",i=r("[")),null!=i){var u,f,d=1,h=t.lastLine();e:for(var p=a;h>=p;++p)for(var m=t.getLine(p),g=p==a?i:0;;){var v=m.indexOf(s,g),y=m.indexOf(c,g);if(0>v&&(v=m.length),0>y&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(p,g+1))==o)if(g==v)++d;else if(!--d){u=p,f=g;break e}++g}if(null!=u&&(a!=u||f!=i))return{from:e.Pos(a,i),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);o>=i;++i){var a=t.getLine(i),l=a.indexOf(";");if(-1!=l)return{startCh:r.end,end:e.Pos(i,l)}}}var i,n=n.line,o=r(n);if(!o||r(n-1)||(i=r(n-2))&&i.end.line==n-1)return null;for(var a=o.end;;){var l=r(a.line+1);if(null==l)break;a=l.end}return{from:t.clipPos(e.Pos(n,o.startCh+1)),
to:a}}),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 n=n.line,i=r(n);if(null==i||null!=r(n-1))return null;for(var o=n;;){var a=r(o+1);if(null==a)break;++o}return{from:e.Pos(n,i+1),to:t.clipPos(e.Pos(o))}})}),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.findMarksAt(f(t)),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,l=e.foldOption(o,"minFoldSize"),s=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=s&&s(e,c);u&&u.to.line-u.from.line>=l&&(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 l(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 s(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",l),r.off("change",s),r.off("viewportChange",c),r.off("fold",u),r.off("unfold",u),r.off("swapDoc",a)),i&&(r.state.foldGutter=new t(n(i)),a(r),r.on("gutterClick",l),r.on("change",s),r.on("viewportChange",c),r.on("fold",u),r.on("unfold",u),r.on("swapDoc",a))});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),l=t.getLine(n.line+1),s=i(n.line,a,l);if(s===o)return void 0;for(var c=t.lastLine(),u=n.line,f=t.getLine(u+2);c>u&&!(i(u+1,l,f)<=s);)++u,l=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){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(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(-1==t){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 l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){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 s(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(-1==t){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=s(e),o=e.line,l=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(0>c&&(!t||t==i[2]))return{tag:i[2],from:d(o,l),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=l(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var s=n.length-1;s>=0;--s)if(n[s]==a[2]){n.length=s;break}if(0>s&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(i,o)}}}else l(e)}}var d=e.Pos,h="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",p=h+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+h+"]["+p+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var r=new n(e,t.line,0);;){var i,o=s(r);if(!o||r.line!=t.line||!(i=a(r)))return;if(!o[1]&&"selfClose"!=i){var t=d(r.line,r.ch),l=u(r,o[2]);return l&&{from:t,to:l.from}}}}),e.findMatchingTag=function(e,r,i){var o=new n(e,r.line,r.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var s=a(o),c=s&&d(o.line,o.ch),h=s&&l(o);if(s&&h&&!(t(o,r)>0)){var p={from:d(o.line,o.ch),to:c,tag:h[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:h[1]?{open:f(o,h[2]),close:p,at:"close"}:(o=new n(e,c.line,c.ch,i),{open:p,close:u(o,h[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),l=u(a,o.tag);if(l)return{open:o,close:l}}},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";e.defineMode("xml",function(t,n){function r(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(a("atom","]]>")):null:e.match("--")?n(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(l(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(C=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==r){var o;return o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=r,C=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return C="equals",null;if("<"==n){t.tokenize=r,t.state=f,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=o(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(n,i){for(;!n.eol();){if(n.match(t)){i.tokenize=r;break}n.next()}return e}}function l(e){return function(t,n){for(var i;null!=(i=t.next());){if("<"==i)return n.tokenize=l(e+1),n.tokenize(t,n);if(">"==i){if(1==e){n.tokenize=r;break}return n.tokenize=l(e-1),n.tokenize(t,n)}}return"meta"}}function s(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(L.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!L.contextGrabbers.hasOwnProperty(n)||!L.contextGrabbers[n].hasOwnProperty(t))return;c(e)}}function f(e,t,n){return"openTag"==e?(n.tagStart=t.column(),d):"closeTag"==e?h:f}function d(e,t,n){return"word"==e?(n.tagName=t.current(),S="tag",g):(S="error",d)}function h(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&L.implicitlyClosed.hasOwnProperty(n.context.tagName)&&c(n),n.context&&n.context.tagName==r?(S="tag",p):(S="tag error",m)}return S="error",m}function p(e,t,n){return"endTag"!=e?(S="error",p):(c(n),f)}function m(e,t,n){return S="error",p(e,t,n)}function g(e,t,n){if("word"==e)return S="attribute",v;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||L.autoSelfClosers.hasOwnProperty(r)?u(n,r):(u(n,r),n.context=new s(n,r,i==n.indented)),f}return S="error",g}function v(e,t,n){return"equals"==e?y:(L.allowMissing||(S="error"),g(e,t,n))}function y(e,t,n){return"string"==e?b:"word"==e&&L.allowUnquoted?(S="string",g):(S="error",g(e,t,n))}function b(e,t,n){return"string"==e?b:g(e,t,n)}var x=t.indentUnit,w=n.multilineTagIndentFactor||1,k=n.multilineTagIndentPastTag;null==k&&(k=!0);var C,S,L=n.htmlMode?{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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},M=n.alignCDATA;return{startState:function(){return{tokenize:r,state:f,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;C=null;var n=t.tokenize(e,t);return(n||C)&&"comment"!=n&&(S=null,t.state=t.state(C||n,e,t),S&&(n="error"==S?n+" error":S)),n},indent:function(t,n,o){var a=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+x;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=r)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return k?t.tagStart+t.tagName.length+2:t.tagStart+x*w;if(M&&/<!\[CDATA\[/.test(n))return 0;var l=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(l&&l[1])for(;a;){if(a.tagName==l[2]){a=a.prev;break}if(!L.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(l)for(;a;){var s=L.contextGrabbers[a.tagName];if(!s||!s.hasOwnProperty(l[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+x:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}}),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.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,w||e.f!=s||(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.thisLineHasContent=!1,null}function l(e,t){var o=e.sol(),a=t.list!==!1;a&&(t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.indentation>0?(t.list=null,t.listDepth=Math.floor(t.indentation/4)):(t.list=!1,t.listDepth=0));var l=null;if(t.indentationDiff>=4)return t.indentation-=4,e.skipToEnd(),L;if(e.eatSpace())return null;if(l=e.match(U))return t.header=Math.min(6,-1!==l[0].indexOf(" ")?l[0].length-1:l[0].length),n.highlightFormatting&&(t.formatting="header"),t.f=t.inline,f(t);if(t.prevLineHasContent&&(l=e.match(V)))return t.header="="==l[0].charAt(0)?1:2,n.highlightFormatting&&(t.formatting="header"),t.f=t.inline,f(t);if(e.eat(">"))return t.indentation++,t.quote=o?1:t.quote+1,n.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),f(t);if("["===e.peek())return i(e,t,v);if(e.match(j,!0))return N;if((!t.prevLineHasContent||a)&&(e.match(_,!1)||e.match(R,!1))){var s=null;return e.match(_,!0)?s="ul":(e.match(R,!0),s="ol"),t.indentation+=4,t.list=!0,t.listDepth++,n.taskLists&&e.match(q,!1)&&(t.taskList=!0),t.f=t.inline,n.highlightFormatting&&(t.formatting=["list","list-"+s]),f(t)}return n.fencedCodeBlocks&&e.match(/^```[ \t]*([\w+#]*)/,!0)?(t.localMode=r(RegExp.$1),t.localMode&&(t.localState=t.localMode.startState()),t.f=t.block=c,n.highlightFormatting&&(t.formatting="code-block"),t.code=!0,f(t)):i(e,t,t.inline)}function s(e,t){var n=k.token(e,t.htmlState);return(w&&null===t.htmlState.tagStart&&!t.htmlState.context||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=h,t.block=l,t.htmlState=null),n}function c(e,t){return e.sol()&&e.match("```",!1)?(t.localMode=t.localState=null,t.f=t.block=u,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),L)}function u(e,t){e.match("```"),t.block=l,t.f=h,n.highlightFormatting&&(t.formatting="code-block"),t.code=!0;var r=f(t);return t.code=!1,r}function f(e){var t=[];if(e.formatting){t.push(z),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(z+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(z+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&t.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?z+"-"+e.formatting[r]+"-"+e.quote:"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)return t.push(I),t.length?t.join(" "):null;if(e.strong&&t.push(H),e.em&&t.push(F),e.strikethrough&&t.push(B),e.linkText&&t.push(E),e.code&&t.push(L),e.header&&(t.push(S),t.push(S+"-"+e.header)),e.quote&&(t.push(M),t.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?M+"-"+e.quote:M+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listDepth-1)%3;t.push(i?1===i?A:O:T)}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 d(e,t){return e.match(G,!0)?f(t):void 0}function h(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,f(r);if(r.taskList){var a="x"!==t.match(q,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,f(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),f(r);var l=t.sol(),c=t.next();if("\\"===c&&(t.next(),n.highlightFormatting)){var u=f(r);return u?u+" formatting-escape":"formatting-escape"}if(r.linkTitle){r.linkTitle=!1;var d=c;"("===c&&(d=")"),d=(d+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var h="^\\s*(?:[^"+d+"\\\\]+|\\\\\\\\|\\\\.)"+d;if(t.match(new RegExp(h),!0))return I}if("`"===c){var g=r.formatting;n.highlightFormatting&&(r.formatting="code");var v=f(r),y=t.pos;t.eatWhile("`");var b=1+t.pos-y;return r.code?b===C?(r.code=!1,v):(r.formatting=g,f(r)):(C=b,r.code=!0,f(r))}if(r.code)return f(r);if("!"===c&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),r.inline=r.f=m,P;if("["===c&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),f(r);if("]"===c&&r.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){n.highlightFormatting&&(r.formatting="link");var u=f(r);return r.linkText=!1,r.inline=r.f=m,u}if("<"===c&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=p,n.highlightFormatting&&(r.formatting="link");var u=f(r);return u?u+=" ":u="",u+D}if("<"===c&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=p,n.highlightFormatting&&(r.formatting="link");var u=f(r);return u?u+=" ":u="",u+W}if("<"===c&&t.match(/^\w/,!1)){if(-1!=t.string.indexOf(">")){var x=t.string.substring(1,t.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(r.md_inside=!0)}return t.backUp(1),r.htmlState=e.startState(k),o(t,r,s)}if("<"===c&&t.match(/^\/\w*?>/))return r.md_inside=!1,"tag";var w=!1;if(!n.underscoresBreakWords&&"_"===c&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var L=t.string.charAt(S);"_"!==L&&L.match(/(\w)/,!1)&&(w=!0)}}if("*"===c||"_"===c&&!w)if(l&&" "===t.peek());else{if(r.strong===c&&t.eat(c)){n.highlightFormatting&&(r.formatting="strong");var v=f(r);return r.strong=!1,v}if(!r.strong&&t.eat(c))return r.strong=c,n.highlightFormatting&&(r.formatting="strong"),f(r);if(r.em===c){n.highlightFormatting&&(r.formatting="em");var v=f(r);return r.em=!1,v}if(!r.em)return r.em=c,n.highlightFormatting&&(r.formatting="em"),f(r)}else if(" "===c&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return f(r);t.backUp(1)}if(n.strikethrough)if("~"===c&&t.eatWhile(c)){if(r.strikethrough){n.highlightFormatting&&(r.formatting="strikethrough");var v=f(r);return r.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return r.strikethrough=!0,n.highlightFormatting&&(r.formatting="strikethrough"),f(r)}else if(" "===c&&t.match(/^~~/,!0)){if(" "===t.peek())return f(r);t.backUp(2)}return" "===c&&(t.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),f(r)}function p(e,t){var r=e.next();if(">"===r){t.f=t.inline=h,n.highlightFormatting&&(t.formatting="link");var i=f(t);return i?i+=" ":i="",i+D}return e.match(/^[^>]+/,!0),D}function m(e,t){if(e.eatSpace())return null;var r=e.next();return"("===r||"["===r?(t.f=t.inline=g("("===r?")":"]"),n.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,f(t)):"error"}function g(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=f(r);return r.linkHref=!1,o}return t.match(x(e),!0)&&t.backUp(1),r.linkHref=!0,f(r)}}function v(e,t){return e.match(/^[^\]]*\]:/,!1)?(t.f=y,e.next(),n.highlightFormatting&&(t.formatting="link"),t.linkText=!0,f(t)):i(e,t,h)}function y(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,n.highlightFormatting&&(t.formatting="link");var r=f(t);return t.linkText=!1,r}return e.match(/^[^\]]+/,!0),E}function b(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,I)}function x(e){return K[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),K[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),K[e]}var w=e.modes.hasOwnProperty("xml"),k=e.getMode(t,w?{name:"xml",htmlMode:!0}:"text/plain");void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.underscoresBreakWords&&(n.underscoresBreakWords=!0),void 0===n.fencedCodeBlocks&&(n.fencedCodeBlocks=!1),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1);var C=0,S="header",L="comment",M="quote",T="variable-2",A="variable-3",O="keyword",N="hr",P="tag",z="formatting",D="link",W="link",E="link",I="string",F="em",H="strong",B="strikethrough",j=/^([*\-=_])(?:\s*\1){2,}\s*$/,_=/^[*\-+]\s+/,R=/^[0-9]+\.\s+/,q=/^\[(x| )\](?=\s)/,U=/^#+ ?/,V=/^(?:\={1,}|-{1,})$/,G=/^[^#!\[\]*_\\<>` "'(~]+/,K=[],$={startState:function(){return{f:l,prevLineHasContent:!1,thisLineHasContent:!1,block:l,htmlState:null,indentation:0,inline:h,text:d,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(t){return{f:t.f,prevLineHasContent:t.prevLineHasContent,thisLineHasContent:t.thisLineHasContent,block:t.block,htmlState:t.htmlState&&e.copyState(k,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,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,taskList:t.taskList,list:t.list,listDepth:t.listDepth,quote:t.quote,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside}},token:function(e,t){if(t.formatting=!1,e.sol()){var n=!!t.header;if(t.header=0,e.match(/^\s*$/,!0)||n)return t.prevLineHasContent=!1,a(t),n?this.token(e,t):null;t.prevLineHasContent=t.thisLineHasContent,t.thisLineHasContent=!0,t.taskList=!1,t.code=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var r=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length,i=4*Math.floor((r-t.indentation)/4);i>4&&(i=4);var o=t.indentation+i;if(t.indentationDiff=o-t.indentation,t.indentation=o,r>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==s?{state:e.htmlState,mode:k}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:$}},blankLine:a,getType:f,fold:"markdown"};return $},"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";e.defineMode("gfm",function(t,n){function r(e){return e.code=!1,null}var i=0,o={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,t){if(t.combineTokens=null,t.codeBlock)return e.match(/^```/)?(t.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```/))return e.skipToEnd(),t.codeBlock=!0,null;if("`"===e.peek()){e.next();var n=e.pos;e.eatWhile("`");var r=1+e.pos-n;return t.code?r===i&&(t.code=!1):(i=r,t.code=!0),null}if(t.code)return e.next(),null;if(e.eatSpace())return t.ateSpace=!0,null;if(e.sol()||t.ateSpace){if(t.ateSpace=!1,e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return t.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return t.combineTokens=!0,"link"}return e.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=e.string.slice(e.start-2,e.start)?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:r},a={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0,strikethrough:!0};for(var l in n)a[l]=n[l];return a.name="markdown",e.defineMIME("gfmBase",a),e.overlayMode(e.getMode(t,"gfmBase"),o)},"markdown")}),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("javascript",function(t,n){function r(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 i(e,t,n){return ge=e,ve=n,t}function o(e,t){var n=e.next();if('"'==n||"'"==n)return t.tokenize=a(n),t.tokenize(e,t);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==n&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return i(n);if("="==n&&e.eat(">"))return i("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==n)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(r(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),i("regexp","string-2")):(e.eatWhile(Le),i("operator","operator",e.current()));if("`"==n)return t.tokenize=s,s(e,t);if("#"==n)return e.skipToEnd(),i("error","error");if(Le.test(n))return e.eatWhile(Le),i("operator","operator",e.current());if(Ce.test(n)){e.eatWhile(Ce);var o=e.current(),c=Se.propertyIsEnumerable(o)&&Se[o];return c&&"."!=t.lastType?i(c.type,c.style,o):i("variable","variable",o)}}function a(e){return function(t,n){var r,a=!1;if(xe&&"@"==t.peek()&&t.match(Me))return n.tokenize=o,i("jsonld-keyword","meta");for(;null!=(r=t.next())&&(r!=e||a);)a=!a&&"\\"==r;return a||(n.tokenize=o),i("string","string")}}function l(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=o;break}r="*"==n}return i("comment","comment")}function s(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",e.current())}function c(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(0>n)){for(var r=0,i=!1,o=n-1;o>=0;--o){var a=e.string.charAt(o),l=Te.indexOf(a);if(l>=0&&3>l){if(!r){++o;break}if(0==--r)break}else if(l>=3&&6>l)++r;else if(Ce.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!r){++o;break}}}i&&!r&&(t.fatArrowAt=o)}}function u(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 f(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 d(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():we?k:w;if(a(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Oe.marked?Oe.marked:"variable"==n&&f(e,r)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Oe.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=Oe.state;if(r.context){if(Oe.marked="def",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 g(){Oe.state.context={prev:Oe.state.context,vars:Oe.state.localVars},Oe.state.localVars=Ne}function v(){Oe.state.localVars=Oe.state.context.vars,Oe.state.context=Oe.state.context.prev}function y(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 u(r,Oe.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function b(){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?p():";"==e?h():p(t)}return t}function w(e,t){return"var"==e?p(y("vardef",t.length),q,x(";"),b):"keyword a"==e?p(y("form"),k,w,b):"keyword b"==e?p(y("form"),w,b):"{"==e?p(y("}"),j,b):";"==e?p():"if"==e?("else"==Oe.state.lexical.info&&Oe.state.cc[Oe.state.cc.length-1]==b&&Oe.state.cc.pop()(),p(y("form"),k,w,b,$)):"function"==e?p(ee):"for"==e?p(y("form"),X,w,b):"variable"==e?p(y("stat"),D):"switch"==e?p(y("form"),k,y("}","switch"),x("{"),j,b,b):"case"==e?p(k,x(":")):"default"==e?p(x(":")):"catch"==e?p(y("form"),g,x("("),te,x(")"),w,b,v):"module"==e?p(y("form"),g,ae,v,b):"class"==e?p(y("form"),ne,b):"export"==e?p(y("form"),le,b):"import"==e?p(y("form"),se,b):h(y("stat"),k,x(";"),b)}function k(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?z:P;if("("==e)return p(g,y(")"),H(U,")"),b,x("=>"),n,v);if("variable"==e)return h(g,U,x("=>"),n,v)}var r=t?A:T;return Ae.hasOwnProperty(e)?p(r):"function"==e?p(ee,r):"keyword c"==e?p(t?M:L):"("==e?p(y(")"),L,pe,x(")"),b,r):"operator"==e||"spread"==e?p(t?C:k):"["==e?p(y("]"),de,b,r):"{"==e?B(E,"}",null,r):"quasi"==e?h(O,r):p()}function L(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?p(k):A(e,t,!1)}function A(e,t,n){var r=0==n?T:A,i=0==n?k:C;return"=>"==e?p(g,n?z:P,v):"operator"==e?/\+\+|--/.test(t)?p(r):"?"==t?p(k,x(":"),i):p(i):"quasi"==e?h(O,r):";"!=e?"("==e?B(C,")","call",r):"."==e?p(W,r):"["==e?p(y("]"),L,x("]"),b,r):void 0:void 0}function O(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(O):p(k,N)}function N(e){return"}"==e?(Oe.marked="string-2",Oe.state.tokenize=s,p(O)):void 0}function P(e){return c(Oe.stream,Oe.state),h("{"==e?w:k)}function z(e){return c(Oe.stream,Oe.state),h("{"==e?w:C)}function D(e){return":"==e?p(b,w):h(T,x(";"),b)}function W(e){return"variable"==e?(Oe.marked="property",p()):void 0}function E(e,t){return"variable"==e||"keyword"==Oe.style?(Oe.marked="property",p("get"==t||"set"==t?I:F)):"number"==e||"string"==e?(Oe.marked=xe?"property":Oe.style+" property",p(F)):"jsonld-keyword"==e?p(F):"["==e?p(k,x("]"),F):void 0}function I(e){return"variable"!=e?h(F):(Oe.marked="property",p(ee))}function F(e){return":"==e?p(C):"("==e?h(ee):void 0}function H(e,t){function n(r){if(","==r){var i=Oe.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,n)}return r==t?p():p(x(t))}return function(r){return r==t?p():h(e,n)}}function B(e,t,n){for(var r=3;r<arguments.length;r++)Oe.cc.push(arguments[r]);return p(y(t,n),H(e,t),b)}function j(e){return"}"==e?p():h(w,j)}function _(e){return ke&&":"==e?p(R):void 0}function R(e){return"variable"==e?(Oe.marked="variable-3",p()):void 0}function q(){return h(U,_,G,K)}function U(e,t){return"variable"==e?(m(t),p()):"["==e?B(U,"]"):"{"==e?B(V,"}"):void 0}function V(e,t){return"variable"!=e||Oe.stream.match(/^\s*:/,!1)?("variable"==e&&(Oe.marked="property"),p(x(":"),U,G)):(m(t),p(G))}function G(e,t){return"="==t?p(C):void 0}function K(e){return","==e?p(q):void 0}function $(e,t){return"keyword b"==e&&"else"==t?p(y("form","else"),w,b):void 0}function X(e){return"("==e?p(y(")"),Y,x(")"),b):void 0}function Y(e){return"var"==e?p(q,x(";"),Q):";"==e?p(Q):"variable"==e?p(Z):h(k,x(";"),Q)}function Z(e,t){return"in"==t||"of"==t?(Oe.marked="keyword",p(k)):p(T,Q)}function Q(e,t){return";"==e?p(J):"in"==t||"of"==t?(Oe.marked="keyword",p(k)):h(k,x(";"),J)}function J(e){")"!=e&&p(k)}function ee(e,t){return"*"==t?(Oe.marked="keyword",p(ee)):"variable"==e?(m(t),p(ee)):"("==e?p(g,y(")"),H(te,")"),b,w,v):void 0}function te(e){return"spread"==e?p(te):h(U,_)}function ne(e,t){return"variable"==e?(m(t),p(re)):void 0}function re(e,t){return"extends"==t?p(k,re):"{"==e?p(y("}"),ie,b):void 0}function ie(e,t){return"variable"==e||"keyword"==Oe.style?"static"==t?(Oe.marked="keyword",
p(ie)):(Oe.marked="property","get"==t||"set"==t?p(oe,ee,ie):p(ee,ie)):"*"==t?(Oe.marked="keyword",p(ie)):";"==e?p(ie):"}"==e?p():void 0}function oe(e){return"variable"!=e?h():(Oe.marked="property",p())}function ae(e,t){return"string"==e?p(w):"variable"==e?(m(t),p(fe)):void 0}function le(e,t){return"*"==t?(Oe.marked="keyword",p(fe,x(";"))):"default"==t?(Oe.marked="keyword",p(k,x(";"))):h(w)}function se(e){return"string"==e?p():h(ce,fe)}function ce(e,t){return"{"==e?B(ce,"}"):("variable"==e&&m(t),"*"==t&&(Oe.marked="keyword"),p(ue))}function ue(e,t){return"as"==t?(Oe.marked="keyword",p(ce)):void 0}function fe(e,t){return"from"==t?(Oe.marked="keyword",p(k)):void 0}function de(e){return"]"==e?p():h(C,he)}function he(e){return"for"==e?h(pe,x("]")):","==e?p(H(M,"]")):h(H(C,"]"))}function pe(e){return"for"==e?p(X,pe):"if"==e?p(k,pe):void 0}function me(e,t){return"operator"==e.lastType||","==e.lastType||Le.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var ge,ve,ye=t.indentUnit,be=n.statementIndent,xe=n.jsonld,we=n.json||xe,ke=n.typescript,Ce=n.wordCharacters||/[\w$\xa1-\uffff]/,Se=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":r,"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"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":r,"export":e("export"),"import":e("import"),"extends":r};if(ke){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var c in s)a[c]=s[c]}return a}(),Le=/[+\-*&%=<>!?|~^]/,Me=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Te="([{}])",Ae={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Oe={state:null,column:null,marked:null,cc:null},Ne={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new u((e||0)-ye,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented: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(),c(e,t)),t.tokenize!=l&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==ge?n:(t.lastType="operator"!=ge||"++"!=ve&&"--"!=ve?ge:"incdec",d(t,n,ge,ve,e))},indent:function(t,r){if(t.tokenize==l)return e.Pass;if(t.tokenize!=o)return 0;var i=r&&r.charAt(0),a=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==b)a=a.prev;else if(c!=$)break}"stat"==a.type&&"}"==i&&(a=a.prev),be&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var u=a.type,f=i==u;return"vardef"==u?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==u&&"{"==i?a.indented:"form"==u?a.indented+ye:"stat"==u?a.indented+(me(t,r)?be||ye:0):"switch"!=a.info||f||0==n.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:ye):a.indented+(/^(?:case|default)\b/.test(r)?ye:2*ye)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:we?null:"/*",blockCommentEnd:we?null:"*/",lineComment:we?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:we?"json":"javascript",jsonldMode:xe,jsonMode:we}}),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"]}function r(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["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(g[n]){var i=g[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 l(e,t,n){this.type=e,this.indent=t,this.prev=n}function s(e,t,n){return e.context=new l(n,t.indentation()+m,e.context),n}function c(e){return e.context=e.context.prev,e.context.type}function u(e,t,n){return T[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();p=L.hasOwnProperty(t)?"atom":S.hasOwnProperty(t)?"keyword":"variable"}n.propertyKeywords||(n=e.resolveMode("text/css"));var h,p,m=t.indentUnit,g=n.tokenHooks,v=n.documentTypes||{},y=n.mediaTypes||{},b=n.mediaFeatures||{},x=n.propertyKeywords||{},w=n.nonStandardPropertyKeywords||{},k=n.fontProperties||{},C=n.counterDescriptors||{},S=n.colorKeywords||{},L=n.valueKeywords||{},M=n.allowNested,T={};return T.top=function(e,t,n){if("{"==e)return s(n,t,"block");if("}"==e&&n.context.prev)return c(n);if(/@(media|supports|(-moz-)?document)/.test(e))return s(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 s(n,t,"at");if("hash"==e)p="builtin";else if("word"==e)p="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(n,t,"interpolation");if(":"==e)return"pseudo";if(M&&"("==e)return s(n,t,"parens")}return n.context.type},T.block=function(e,t,n){if("word"==e){var r=t.current().toLowerCase();return x.hasOwnProperty(r)?(p="property","maybeprop"):w.hasOwnProperty(r)?(p="string-2","maybeprop"):M?(p=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==e?"block":M||"hash"!=e&&"qualifier"!=e?T.top(e,t,n):(p="error","block")},T.maybeprop=function(e,t,n){return":"==e?s(n,t,"prop"):u(e,t,n)},T.prop=function(e,t,n){if(";"==e)return c(n);if("{"==e&&M)return s(n,t,"propBlock");if("}"==e||"{"==e)return f(e,t,n);if("("==e)return s(n,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return s(n,t,"interpolation")}else p+=" error";return"prop"},T.propBlock=function(e,t,n){return"}"==e?c(n):"word"==e?(p="property","maybeprop"):n.context.type},T.parens=function(e,t,n){return"{"==e||"}"==e?f(e,t,n):")"==e?c(n):"("==e?s(n,t,"parens"):"interpolation"==e?s(n,t,"interpolation"):("word"==e&&d(t),"parens")},T.pseudo=function(e,t,n){return"word"==e?(p="variable-3",n.context.type):u(e,t,n)},T.atBlock=function(e,t,n){if("("==e)return s(n,t,"atBlock_parens");if("}"==e)return f(e,t,n);if("{"==e)return c(n)&&s(n,t,M?"block":"top");if("word"==e){var r=t.current().toLowerCase();p="only"==r||"not"==r||"and"==r||"or"==r?"keyword":v.hasOwnProperty(r)?"tag":y.hasOwnProperty(r)?"attribute":b.hasOwnProperty(r)?"property":x.hasOwnProperty(r)?"property":w.hasOwnProperty(r)?"string-2":L.hasOwnProperty(r)?"atom":"error"}return n.context.type},T.atBlock_parens=function(e,t,n){return")"==e?c(n):"{"==e||"}"==e?f(e,t,n,2):T.atBlock(e,t,n)},T.restricted_atBlock_before=function(e,t,n){return"{"==e?s(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(p="variable","restricted_atBlock_before"):u(e,t,n)},T.restricted_atBlock=function(e,t,n){return"}"==e?(n.stateArg=null,c(n)):"word"==e?(p="@font-face"==n.stateArg&&!k.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},T.keyframes=function(e,t,n){return"word"==e?(p="variable","keyframes"):"{"==e?s(n,t,"top"):u(e,t,n)},T.at=function(e,t,n){return";"==e?c(n):"{"==e||"}"==e?f(e,t,n):("word"==e?p="tag":"hash"==e&&(p="builtin"),"at")},T.interpolation=function(e,t,n){return"}"==e?c(n):"{"==e||";"==e?f(e,t,n):("word"==e?p="variable":"variable"!=e&&(p="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:"top",stateArg:null,context:new l("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]),p=n,t.state=T[t.state](h,e,t),p},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=n.indent-m,n=n.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["domain","regexp","url","url-prefix"],o=t(i),a=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],l=t(a),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"],c=t(s),u=["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-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-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","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"],f=t(u),d=["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(d),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(p),g=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],v=t(g),y=["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"],b=t(y),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","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","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","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","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","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","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","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-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","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","solid","somali","source-atop","source-in","source-out","source-over","space","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","x-large","x-small","xor","xx-large","xx-small"],w=t(x),k=i.concat(a).concat(s).concat(u).concat(d).concat(y).concat(x);e.registerHelper("hintWords","css",k),e.defineMIME("text/css",{documentTypes:o,mediaTypes:l,mediaFeatures:c,propertyKeywords:f,nonStandardPropertyKeywords:h,fontProperties:m,counterDescriptors:v,colorKeywords:b,valueKeywords:w,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=r,r(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=n,n(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:l,mediaFeatures:c,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:b,valueKeywords:w,fontProperties:m,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,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:l,mediaFeatures:c,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:b,valueKeywords:w,fontProperties:m,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)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),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";e.defineMode("htmlmixed",function(t,n){function r(e,t){var n=t.htmlState.tagName;n&&(n=n.toLowerCase());var r=l.token(e,t.htmlState);if("script"==n&&/\btag\b/.test(r)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var u=0;u<c.length;++u){var f=c[u];if("string"==typeof f.matches?i==f.matches:f.matches.test(i)){f.mode&&(t.token=o,t.localMode=f.mode,t.localState=f.mode.startState&&f.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==n&&/\btag\b/.test(r)&&">"==e.current()&&(t.token=a,t.localMode=s,t.localState=s.startState(l.indent(t.htmlState,"")));return r}function i(e,t,n){var r,i=e.current(),o=i.search(t);return o>-1?e.backUp(i.length-o):(r=i.match(/<\/?$/))&&(e.backUp(i.length),e.match(t,!1)||e.match(i)),n}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,null):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,null):i(e,/<\/\s*style\s*>/,s.token(e,t.localState))}var l=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),s=e.getMode(t,"css"),c=[],u=n&&n.scriptTypes;if(c.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),u)for(var f=0;f<u.length;++f){var d=u[f];c.push({matches:d.matches,mode:d.mode&&e.getMode(t,d.mode)})}return c.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=l.startState();return{token:r,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var n=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:n,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,n){return!t.localMode||/^\s*<\//.test(n)?l.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||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),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=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t){if(!t.startOfLine)return!1;for(;;){if(!e.skipTo("\\")){e.skipToEnd(),t.tokenize=null;break}if(e.next(),e.eol()){t.tokenize=n;break}}return"meta"}function r(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=o,o(e,t)):!1}return e.match(/(u8|u|U|L)/)?e.match(/["']/,!1)?"string":!1:(e.next(),!1)}function i(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function o(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 a(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.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 l(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}e.defineMode("clike",function(t,n){function r(e,t){var n=e.next();if(v[n]){var r=v[n](e,t);if(r!==!1)return r}if('"'==n||"'"==n)return t.tokenize=i(n),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(n))return c=n,null;if(/\d/.test(n))return e.eatWhile(/[\w\.]/),"number";if("/"==n){if(e.eat("*"))return t.tokenize=o,o(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(x.test(n))return e.eatWhile(x),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var a=e.current();return h.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"keyword"):p.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"builtin"):g.propertyIsEnumerable(a)?"atom":"variable";
}function i(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&&!y)&&(n.tokenize=null),"string"}}function o(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function a(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function l(e,t,n){var r=e.indented;return e.context&&"statement"==e.context.type&&(r=e.context.indented),e.context=new a(r,t,n,null,e.context)}function s(e){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}var c,u=t.indentUnit,f=n.statementIndentUnit||u,d=n.dontAlignCalls,h=n.keywords||{},p=n.builtin||{},m=n.blockKeywords||{},g=n.atoms||{},v=n.hooks||{},y=n.multiLineStrings,b=n.indentStatements!==!1,x=/[+\-*&%=<>!?|\/]/;return{startState:function(e){return{tokenize:null,context:new a((e||0)-u,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;c=null;var i=(t.tokenize||r)(e,t);if("comment"==i||"meta"==i)return i;if(null==n.align&&(n.align=!0),";"!=c&&":"!=c&&","!=c||"statement"!=n.type)if("{"==c)l(t,e.column(),"}");else if("["==c)l(t,e.column(),"]");else if("("==c)l(t,e.column(),")");else if("}"==c){for(;"statement"==n.type;)n=s(t);for("}"==n.type&&(n=s(t));"statement"==n.type;)n=s(t)}else c==n.type?s(t):b&&(("}"==n.type||"top"==n.type)&&";"!=c||"statement"==n.type&&"newstatement"==c)&&l(t,e.column(),"statement");else s(t);return t.startOfLine=!1,i},indent:function(t,n){if(t.tokenize!=r&&null!=t.tokenize)return e.Pass;var i=t.context,o=n&&n.charAt(0);"statement"==i.type&&"}"==o&&(i=i.prev);var a=o==i.type;return"statement"==i.type?i.indented+("{"==o?0:f):!i.align||d&&")"==i.type?")"!=i.type||a?i.indented+(a?0:u):i.indented+f:i.column+(a?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var s="auto if break int case long char register continue return default short do sizeof double static else struct switch extern typedef float union for unsigned goto while enum void const signed volatile";a(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(s),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),a(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(s+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),blockKeywords:t("catch class do else finally for if struct switch try while"),atoms:t("true false null"),hooks:{"#":n,u:r,U:r,L:r,R:r},modeProps:{fold:["brace","include"]}}),a("text/x-java",{name:"clike",keywords:t("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:t("catch class do else finally for if switch try while"),atoms:t("true false null"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),a("text/x-csharp",{name:"clike",keywords:t("abstract as 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"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),builtin:t("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=i,i(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),a("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq 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:t("catch class do else finally for forSome if match switch try while"),atoms:t("true false null"),indentStatements:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=l,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),a(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:t("for while do if else struct"),builtin:t("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:t("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"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),a("text/x-nesc",{name:"clike",keywords:t(s+"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"),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),a("text/x-objectivec",{name:"clike",keywords:t(s+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),atoms:t("YES NO NULL NILL ON OFF"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":n},modeProps:{fold:"brace"}})}),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(k.hex),!0):("+"!=e&&"-"!=e||!k.digit.test(t.peek())||(t.eat(k.sign),e=t.next()),k.digit.test(e)?(t.eat(e),t.eatWhile(k.digit),"."==t.peek()&&(t.eat("."),t.eatWhile(k.digit)),t.eat(k.exponent)&&(t.eat(k.sign),t.eatWhile(k.digit)),!0):!1)}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 l="builtin",s="comment",c="string",u="string-2",f="atom",d="number",h="bracket",p="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"),x=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 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 concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare 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 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 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 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-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? 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->>"),w=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"),k={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),e.eatSpace())return null;var n=null;switch(t.mode){case"string":for(var C,S=!1;null!=(C=e.next());){if('"'==C&&!S){t.mode=!1;break}S=!S&&"\\"==C}n=c;break;default:var L=e.next();if('"'==L)t.mode="string",n=c;else if("\\"==L)a(e),n=u;else if("'"!=L||k.digit_or_colon.test(e.peek()))if(";"==L)e.skipToEnd(),n=s;else if(o(L,e))n=d;else if("("==L||"["==L||"{"==L){var M,T="",A=e.column();if("("==L)for(;null!=(M=e.eat(k.keyword_char));)T+=M;T.length>0&&(w.propertyIsEnumerable(T)||/^(?:def|with)/.test(T))?r(t,A+g,L):(e.eatSpace(),e.eol()||";"==e.peek()?r(t,A+v,L):r(t,A+e.current().length,L)),e.backUp(e.current().length-1),n=h}else if(")"==L||"]"==L||"}"==L)n=h,null!=t.indentStack&&t.indentStack.type==(")"==L?"(":"]"==L?"[":"{")&&i(t);else{if(":"==L)return e.eatWhile(k.symbol),f;e.eatWhile(k.symbol),n=b&&b.propertyIsEnumerable(e.current())?p:x&&x.propertyIsEnumerable(e.current())?l: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")}),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;r>n;++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(c=null,e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(s),"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),0>f)break}if(e.backUp(e.current().length-o),0==f)return n(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var p="string",m=!0;e.eat("s")?p="atom":e.eat(/[WQ]/)?p="string":e.eat(/[r]/)?p="string-2":e.eat(/[wxq]/)&&(p="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(h.propertyIsEnumerable(g)&&(g=h[g]),n(a(g,p,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return n(l(r[1]),e,t);if("0"==i)return e.eatWhile(e.eat("x")?/[\da-fA-F]/:e.eat("b")?/[01]/:/[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,l){var s,c=!1;for("read-quoted-paused"===l.context.type&&(l.context=l.context.prev,a.eat("}"));null!=(s=a.next());){if(s==e&&(r||!c)){l.tokenize.pop();break}if(n&&"#"==s&&!c){if(a.eat("{")){"}"==e&&(l.context={prev:l.context,type:"read-quoted-paused"}),l.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){l.tokenize.push(o());break}}c=!c&&"\\"==s}return t}}function l(e){return function(t,n){return t.match(e)?n.tokenize.pop():t.skipToEnd(),"string"}}function s(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","module","then","catch","loop","proc","begin"]),d=t(["end","until"]),h={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[r],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){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==h[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)},electricChars:"}de",lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")}),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(0>r&&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",l=n.ch,s=0>r?0:i.length,c=0;l!=s;l+=r,c++){var u=i.charAt(0>r?l-1:l),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&&0>r&&l--,"W"==o&&"w"==f&&r>0){o="w";continue}break}}return d(n.line,l)}function n(e,n){e.extendSelectionsBy(function(r){return e.display.shift||e.doc.extend||r.empty()?t(e.doc,r.head,n):0>n?r.from():r.to()})}function r(e,t){e.operation(function(){for(var n=e.listSelections().length,r=[],i=-1,o=0;n>o;o++){var a=e.listSelections()[o].head;if(!(a.line<=i)){var l=d(a.line+(t?0:1),0);e.replaceRange("\n",l,null,"+insertLine"),e.indentLine(l.line,null,!0),r.push({head:l,anchor:l}),i=a.line+1}}e.setSelections(r)})}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==m.charAt(m.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(e,t){for(var n,r=e.listSelections(),i=[],o=0;o<r.length;o++){var a=r[o];if(!a.empty()){for(var l=a.from().line,s=a.to().line;o<r.length-1&&r[o+1].from().line==s;)s=a[++o].to().line;i.push(l,s)}}i.length?n=!0:i.push(e.firstLine(),e.lastLine()),e.operation(function(){for(var r=[],o=0;o<i.length;o+=2){var a=i[o],l=i[o+1],s=d(a,0),c=d(l),u=e.getRange(s,c,!1);t?u.sort():u.sort(function(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return n!=r&&(e=n,t=r),t>e?-1:e==t?0:1}),e.replaceRange(u,s,c,"+sortLines"),n&&r.push({anchor:s,head:c})}n&&e.setSelections(r,0)})}function l(t,n){t.operation(function(){for(var r=t.listSelections(),o=[],a=[],l=0;l<r.length;l++){var s=r[l];s.empty()?(o.push(l),a.push("")):a.push(n(t.getRange(s.from(),s.to())))}t.replaceSelections(a,"around","case");for(var c,l=o.length-1;l>=0;l--){var s=r[o[l]];if(!(c&&e.cmpPos(s.head,c)>0)){var u=i(t,s.head);c=u.from,t.replaceRange(n(u.word),u.from,u.to,"case")}}})}function s(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=s(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,h=e.keyMap["default"]==e.keyMap.macDefault,p=h?"Cmd-":"Ctrl-";f[u["Alt-Left"]="goSubwordLeft"]=function(e){n(e,-1)},f[u["Alt-Right"]="goSubwordRight"]=function(e){n(e,1)},f[u[p+"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[p+"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-"+p+"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[p+"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-"+p+"K"]="deleteLine",f[u[p+"Enter"]="insertLineAfter"]=function(e){r(e,!1)},f[u["Shift-"+p+"Enter"]="insertLineBefore"]=function(e){r(e,!0)},f[u[p+"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 l=t.getRange(n,r),s=o?new RegExp("\\b"+l+"\\b"):l,c=t.getSearchCursor(s,r);c.findNext()?t.addSelection(c.from(),c.to()):(c=t.getSearchCursor(s,d(t.firstLine(),0)),c.findNext()&&t.addSelection(c.from(),c.to()))}o&&(t.state.sublimeFindFullWord=t.doc.sel)};var m="(){}[]";f[u["Shift-"+p+"Space"]="selectScope"]=function(e){o(e)||e.execCommand("selectAll")},f[u["Shift-"+p+"M"]="selectBetweenBrackets"]=function(t){return o(t)?void 0:e.Pass},f[u[p+"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 g=h?"Cmd-Ctrl-":"Shift-Ctrl-";f[u[g+"Up"]="swapLineUp"]=function(e){for(var t=e.listSelections(),n=[],r=e.firstLine()-1,i=[],o=0;o<t.length;o++){var a=t[o],l=a.from().line-1,s=a.to().line;i.push({anchor:d(a.anchor.line-1,a.anchor.ch),head:d(a.head.line-1,a.head.ch)}),0!=a.to().ch||a.empty()||--s,l>r?n.push(l,s):n.length&&(n[n.length-1]=s),r=s}e.operation(function(){for(var t=0;t<n.length;t+=2){var r=n[t],o=n[t+1],a=e.getLine(r);e.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),o>e.lastLine()?e.replaceRange("\n"+a,d(e.lastLine()),null,"+swapLine"):e.replaceRange(a+"\n",d(o,0),null,"+swapLine")}e.setSelections(i),e.scrollIntoView()})},f[u[g+"Down"]="swapLineDown"]=function(e){for(var t=e.listSelections(),n=[],r=e.lastLine()+1,i=t.length-1;i>=0;i--){var o=t[i],a=o.to().line+1,l=o.from().line;0!=o.to().ch||o.empty()||a--,r>a?n.push(a,l):n.length&&(n[n.length-1]=l),r=l}e.operation(function(){for(var t=n.length-2;t>=0;t-=2){var r=n[t],i=n[t+1],o=e.getLine(r);r==e.lastLine()?e.replaceRange("",d(r-1),d(r),"+swapLine"):e.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),e.replaceRange(o+"\n",d(i,0),null,"+swapLine")}e.scrollIntoView()})},u[p+"/"]="toggleComment",f[u[p+"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,l=i.to().line;r<t.length-1&&t[r+1].from().line==l;)l=t[++r].to().line;n.push({start:a,end:l,anchor:!i.empty()&&o})}e.operation(function(){for(var t=0,r=[],i=0;i<n.length;i++){for(var o,a=n[i],l=a.anchor&&d(a.anchor.line-t,a.anchor.ch),s=a.start;s<=a.end;s++){var c=s-t;s==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),"+joinLines"),++t)}r.push({anchor:l||o,head:o})}e.setSelections(r,0)})},f[u["Shift-"+p+"D"]="duplicateLine"]=function(e){e.operation(function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];r.empty()?e.replaceRange(e.getLine(r.head.line)+"\n",d(r.head.line,0),null,"+duplicateLine"):e.replaceRange(e.getRange(r.from(),r.to()),r.from(),null,"+duplicateLine")}e.scrollIntoView()})},u[p+"T"]="transposeChars",f[u.F9="sortLines"]=function(e){a(e,!0)},f[u[p+"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[p+"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),l=0;l<a.length;l++)if(a[l].sublimeBookmark){a[l].clear();for(var s=0;s<n.length;s++)n[s]==a[l]&&n.splice(s--,1);break}l==a.length&&n.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},f[u["Shift-"+p+"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 v=p+"K ";u[v+p+"Backspace"]="delLineLeft",f[u.Backspace="smartBackspace"]=function(t){if(t.somethingSelected())return e.Pass;var n=t.getCursor(),r=t.getRange({line:n.line,ch:0},n),i=e.countColumn(r,null,t.getOption("tabSize"));return r&&!/\S/.test(r)&&i%t.getOption("indentUnit")==0?t.indentSelection("subtract"):e.Pass},f[u[v+p+"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[v+p+"U"]="upcaseAtCursor"]=function(e){l(e,function(e){return e.toUpperCase()})},f[u[v+p+"L"]="downcaseAtCursor"]=function(e){l(e,function(e){return e.toLowerCase()})},f[u[v+p+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},f[u[v+p+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},f[u[v+p+"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,"+delete")}},f[u[v+p+"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[v+p+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[v+p+"G"]="clearBookmarks",f[u[v+p+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},f[u["Shift-Alt-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["Shift-Alt-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[p+"F3"]="findUnder"]=function(e){c(e,!0)},f[u["Shift-"+p+"F3"]="findUnderPrevious"]=function(e){c(e,!1)},f[u["Alt-F3"]="findAllUnder"]=function(e){var t=s(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-"+p+"["]="fold",u["Shift-"+p+"]"]="unfold",u[v+p+"0"]=u[v+p+"j"]="unfoldAll",u[p+"I"]="findIncremental",u["Shift-"+p+"I"]="findIncrementalReverse",u[p+"H"]="replace",u.F3="findNext",u["Shift-F3"]="findPrev",e.normalizeKeyMap(u)});