HackMD/public/vendor/codemirror/codemirror.min.js

17 lines
376 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?qi(r):{},qi(Go,r,!1),p(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&&!wo&&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 Si,keySeq:null,specialChars:null};var s=this;po&&11>ho&&setTimeout(function(){s.display.input.reset(!0)},20),Wt(this),Ui(),yt(this),this.curOp.forceUpdate=!0,Vr(this,i),r.autofocus&&!wo||s.hasFocus()?setTimeout(Ni(pn,this),20):hn(this);for(var u in Ko)Ko.hasOwnProperty(u)&&Ko[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=ji("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=ji("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=ji("div",null,"CodeMirror-code"),r.selectionDiv=ji("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=ji("div",null,"CodeMirror-cursors"),r.measure=ji("div",null,"CodeMirror-measure"),r.lineMeasure=ji("div",null,"CodeMirror-measure"),r.lineSpace=ji("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=ji("div",[ji("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=ji("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=ji("div",null,null,"position: absolute; height: "+La+"px; width: 1px;"),r.gutters=ji("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=ji("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=ji("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),po&&8>ho&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),mo||co&&wo||(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,De(e,100),e.state.modeGen++,e.curOp&&qt(e)}function i(e){e.options.lineWrapping?($a(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ha(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),qt(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&&Zr(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),qt(e),setTimeout(function(){_(e)},20)}function c(e){var t=e.display.gutters,n=e.options.gutters;Ri(t);for(var r=0;r<n.length;++r){var i=n[r],o=t.appendChild(ji("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=Gr(n,n.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=f(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function p(e){var t=Ai(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 h(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+He(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+Be(e)+t.barHeight+gt(e.display),nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=ji("div",[ji("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=ji("div",[ji("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),wa(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),wa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,po&&8>ho&&(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&&Ha(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),wa(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&&$a(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&E(e),b(e,h(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",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-Fe(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(Gr(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Qr(t,Jr(Gr(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function _(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&n[a].gutter&&(n[a].gutter.style.left=o);var 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=w(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(ji("div",[ji("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 w(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function C(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function S(e,t,n){var r=e.display;this.viewport=t,this.visible=x(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ue(e),this.force=n,this.dims=q(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=Be(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Be(e)+"px",t.scrollbarsClipped=!0)}function L(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return It(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==Rt(e))return!1;k(e)&&(It(e),t.dims=q(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)),zo&&(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;jt(e,o,a),n.viewOffset=Jr(Gr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Rt(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Fi();return s>4&&(n.lineDiv.style.display="none"),N(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&Fi()!=c&&c.offsetHeight&&c.focus(),Ri(n.cursorDiv),Ri(n.selectionDiv),n.gutters.style.height=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,De(e,400)),n.updateLineNumbers=null,!0}function T(e,t){for(var n=t.force,r=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ue(e))n=!0;else if(n=!1,r&&null!=r.top&&(r={top:Math.min(e.doc.height+He(e.display)-Ve(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(!L(e,t))break;E(e);var o=h(e);Oe(e),z(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 A(e,t){var n=new S(e,t);if(L(e,n)){E(e),T(e,n);var r=h(e);Oe(e),z(e,r),y(e,r),n.finish()}}function z(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+Be(e),t.clientHeight)+"px"}function E(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(po&&8>ho){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)&&(Zr(o.line,i),O(o.line),o.rest))for(var c=0;c<o.rest.length;c++)O(o.rest[c])}}}function O(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function q(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:C(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function N(e,t,n){function r(t){var n=t.nextSibling;return mo&&Co&&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&&(Ai(f.changes,"gutter")>-1&&(d=!1),I(e,f,c,n)),d&&(Ri(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(w(e.options,c)))),l=f.node.nextSibling}else{var p=B(e,f,c,n);a.insertBefore(p,l)}c+=f.size}for(;l;)l=r(l)}function I(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?R(e,t):"gutter"==o?F(e,t,n,r):"class"==o?W(t):"widget"==o&&H(e,t,r)}t.changes=null}function P(e){return e.node==e.text&&(e.node=ji("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),po&&8>ho&&(e.node.style.zIndex=2)),e.node}function D(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=P(e);e.background=n.insertBefore(ji("div",null,t),n.firstChild)}}function j(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Nr(e,t)}function R(e,t){var n=t.text.className,r=j(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,W(t)):n&&(t.text.className=n)}function W(e){D(e),e.line.wrapClass?P(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function F(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=P(t),a=t.gutter=ji("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(ji("div",w(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(ji("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[s]+"px; width: "+r.gutterWidth[s]+"px"))}}}function H(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 B(e,t,n,r){var i=j(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),W(t),F(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=P(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=ji("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 Eo(e.line,e.ch)}function X(e,t){return Oo(e,t)<0?t:e}function Z(e,t){return Oo(e,t)<0?e:t}function Y(e){e.state.focused||(e.display.input.focus(),pn(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=Va(t),l=null;e.state.pasteIncoming&&r.ranges.length>1&&(qo&&qo.join("\n")==t?l=r.ranges.length%qo.length==0&&zi(qo,Va):a.length==r.ranges.length&&(l=zi(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=Eo(u.line,u.ch-n):e.state.overwrite&&!e.state.pasteIncoming&&(f=Eo(f.line,Math.min(Gr(o,f.line).text.length,f.ch+Ti(a).length))));var d=e.curOp.updateInput,p={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,p),bi(e,"inputRead",e,p),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 h=e.getModeAt(c.head),m=Vo(p),g=!1;if(h.electricChars){for(var v=0;v<h.electricChars.length;v++)if(t.indexOf(h.electricChars.charAt(v))>-1){g=Pn(e,m.line,"smart");break}}else h.electricInput&&h.electricInput.test(Gr(o,m.line).text.slice(0,m.ch))&&(g=Pn(e,m.line,"smart"));g&&bi(e,"electricInput",e,m.line)}}Nn(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:Eo(i,0),head:Eo(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 Si,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function re(){var e=ji("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=ji("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 Si,this.gracePeriod=!1}function oe(e,t){var n=Ye(e,t.line);if(!n||n.hidden)return null;var r=Gr(e.doc,t.line),i=Ke(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(Eo(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=Yr(0>i?e.line:e.rest[i]),f=o[a]+r;return(0>r||l!=t)&&(f=o[a+(r?1:0)]),Eo(s,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Ra(i,t))return ae(Eo(Yr(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?Ti(e.rest):e.line;return ae(Eo(Yr(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,p=l?l.nodeValue.length-n:0;d;d=d.nextSibling){if(f=r(d,d.firstChild,0))return ae(Eo(f.line,f.ch-p),o);p+=d.textContent.length}for(var h=s.previousSibling,p=n;h;h=h.previousSibling){if(f=r(h,h.firstChild,-1))return ae(Eo(f.line,f.ch+p),o);p+=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(Eo(r,0),Eo(i+1,0),o(+u));return void(f.length&&(c=f[0].find())&&(l+=Kr(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 p=t.nodeValue;if(!p)return;s&&(l+="\n",s=!1),l+=p}}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 Oo(e.from(),t.from())}),t=Ai(e,n);for(var r=1;r<e.length;r++){var i=e[r],o=e[r-1];if(Oo(o.to(),i.from())>=0){var a=Z(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 pe(e,t){return new ue([new fe(e,t||e)],0)}function he(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 Eo(e.first,0);var n=e.first+e.size-1;return t.line>n?Eo(n,Gr(e,n).text.length):ge(t,Gr(e,t.line).text.length)}function ge(e,t){var n=e.ch;return null==n||n>t?Eo(e.line,t):0>n?Eo(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=Oo(n,i)<0;o!=Oo(r,i)<0?(i=n,n=r):o!=Oo(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 _e(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 we(e,t,n,r){Me(e,pe(t,n),r)}function Ce(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 Sa(e,"beforeSelectionChange",e,n),e.cm&&Sa(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?de(n.ranges,n.ranges.length-1):t}function Se(e,t,n){var r=e.history.done,i=Ti(r);i&&i.ranges?(r[r.length-1]=t,Le(e,t,n)):Me(e,t,n)}function Me(e,t,n){Le(e,t,n),li(e,e.sel,e.cm?e.cm.curOp.id:0/0,n)}function Le(e,t,n){(wi(e,"beforeSelectionChange")||e.cm&&wi(e.cm,"beforeSelectionChange"))&&(t=Ce(e,t));var r=n&&n.bias||(Oo(t.primary().head,e.sel.primary().head)<0?-1:1);Te(e,ze(e,t,r,!0)),n&&n.scroll===!1||!e.cm||Nn(e.cm)}function Te(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 Ae(e){Te(e,ze(e,e.sel,null,!1),Aa)}function ze(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=Ee(e,a.anchor,n,r),s=Ee(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 Ee(e,t,n,r){var i=!1,o=t,a=n||1;e.cantEdit=!1;e:for(;;){var l=Gr(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&&(Sa(u,"beforeCursorEnter"),u.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!u.atomic)continue;var f=u.find(0>a?-1:1);if(0==Oo(f,o)&&(f.ch+=a,f.ch<0?f=f.line>e.first?me(e,Eo(f.line-1)):null:f.ch>l.text.length&&(f=f.line<e.first+e.size-1?Eo(f.line+1,0):null),!f)){if(i)return r?(e.cantEdit=!0,Eo(e.first,0)):Ee(e,t,n,!0);i=!0,f=t,a=-a}o=f;continue e}}return o}}function Oe(e){e.display.input.showSelection(e.display.input.prepareSelection())}function qe(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)&&Ne(e,l,i),s||Ie(e,l,o)}return r}function Ne(e,t,n){var r=ft(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(ji("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(ji("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}$(".other-cursor").each(function(t,n){var r=parseInt($(n).attr("data-line")),i=parseInt($(n).attr("data-ch")),o=parseFloat($(n).attr("data-offset-left")),a=parseFloat($(n).attr("data-offset-top")),l=e.charCoords({line:r,ch:i},"windows");$(n)[0].style.left=l.left+o+"px",$(n)[0].style.top=l.top+a+"px"})}function Ie(e,t,n){function r(e,t,n,r){0>t&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild(ji("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,Eo(t,n),"div",f,r)}var l,s,f=Gr(a,t),d=f.text.length;return Zi(ei(f),n||0,null==i?d:i,function(e,t,a){var f,p,h,m=o(e,"left");if(e==t)f=m,p=h=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}p=m.left,h=f.right}null==n&&0==e&&(p=c),f.top-m.top>3&&(r(p,m.top,null,m.bottom),p=c,m.bottom<f.top&&r(p,m.bottom,null,f.top)),null==i&&t==d&&(h=u),(!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>p&&(p=c),r(p,f.top,h-p,f.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=$e(e.display),c=s.left,u=Math.max(o.sizerWidth,Ue(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 p=Gr(a,f.line),h=Gr(a,d.line),m=hr(p)==hr(h),g=i(f.line,f.ch,m?p.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top<v.top-2?(r(g.right,g.top,null,g.bottom),r(c,v.top,v.left,v.bottom)):r(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&r(c,g.bottom,null,v.top)}n.appendChild(l)}function Pe(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 De(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Ni(je,e))}function je(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,We(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=zr(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 Or(e,o.text,r),o.stateAfter=t.frontier%5==0?ta(t.mode,r):null;return++t.frontier,+new Date>n?(De(e,e.options.workDelay),!0):void 0}),i.length&&Lt(e,function(){for(var t=0;t<i.length;t++)Nt(e,i[t],"text")})}}function Re(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=Gr(o,l-1);if(s.stateAfter&&(!n||l<=o.frontier))return l;var c=Oa(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}function We(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=Re(e,t,n),a=o>r.first&&Gr(r,o-1).stateAfter;return a=a?ta(r.mode,a):na(r.mode),r.iter(o,t,function(n){Or(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 Fe(e){return e.lineSpace.offsetTop}function He(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function $e(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Wi(e.measure,ji("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 Be(e){return La-e.display.nativeBarWidth}function Ue(e){return e.display.scroller.clientWidth-Be(e)-e.display.barWidth}function Ve(e){return e.display.scroller.clientHeight-Be(e)-e.display.barHeight}function Ge(e,t,n){var r=e.options.lineWrapping,i=r&&Ue(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 Ke(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(Yr(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Xe(e,t){t=hr(t);var n=Yr(t),r=e.display.externalMeasured=new Et(e.doc,t,n);r.lineN=n;var i=r.built=Nr(e,r);return r.text=i.pre,Wi(e.display.lineMeasure,i.pre),r}function Ze(e,t,n,r){return Je(e,Qe(e,t),n,r)}function Ye(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pt(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=Yr(t),r=Ye(e,n);r&&!r.text?r=null:r&&r.changes&&I(e,r,n,q(e)),r||(r=Xe(e,t));var i=Ke(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||(Ge(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&&Di(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Di(t.line.text.charAt(o.coverStart+s));)++s;if(po&&9>ho&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(po&&e.options.lineWrapping){var f=Ia(a,l,s).getClientRects();i=f.length?f["right"==r?f.length-1:0]:Do}else i=Ia(a,l,s).getBoundingClientRect()||Do;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}po&&11>ho&&(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(po&&9>ho&&!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}:Do}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);var v=u?g[u-1]:0,y=g[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=p,b.rbottom=h),b}function 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,Ri(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=_r(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+=Fe(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=Gr(e.doc,t.line)),st(e,r,Ze(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==Yi(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=Yi(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||Gr(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!=Ya&&(f.other=l(c,Ya)),f}function dt(e,t){var n=0,t=me(e.doc,t);e.options.lineWrapping||(n=vt(e.display)*t.ch);var r=Gr(e.doc,t.line),i=Jr(r)+Fe(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function pt(e,t,n,r){var i=Eo(e,t);return i.xRel=r,n&&(i.outside=!0),i}function ht(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return pt(r.first,0,!0,-1);var i=Qr(r,n),o=r.first+r.size-1;if(i>o)return pt(r.first+r.size-1,Gr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Gr(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=Yr(a=c.to.line)}}function mt(e,t,n,r,i){function o(r){var i=ft(e,Eo(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),p=eo(t),h=o(d),m=l,g=o(p),v=l;if(r>g)return pt(n,p,v,1);for(;;){if(u?p==d||p==lo(t,d,1):1>=p-d){for(var y=h>r||g-r>=r-h?d:p,b=r-(y==d?h:g);Di(t.text.charAt(y));)++y;var x=pt(n,y,y==d?m:v,-1>b?-1:b>1?1:0);return x}var _=Math.ceil(f/2),k=d+_;if(u){k=d;for(var w=0;_>w;++w)k=lo(t,k,1)}var C=o(k);C>r?(p=k,g=C,(v=l)&&(g+=1e3),f=_):(d=k,h=C,m=l,f-=_)}}function gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==No){No=ji("pre");for(var t=0;49>t;++t)No.appendChild(document.createTextNode("x")),No.appendChild(ji("br"));No.appendChild(document.createTextNode("x"))}Wi(e.measure,No);var n=No.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Ri(e.measure),n||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=ji("span","xxxxxxxxxx"),n=ji("pre",[t]);Wi(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:++Ro},jo?jo.ops.push(e.curOp):e.curOp.ownsGroup=jo={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{jo=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;_t(n)}}function _t(e){for(var t=e.ops,n=0;n<t.length;n++)kt(t[n]);for(var n=0;n<t.length;n++)wt(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++)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 S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function wt(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Ct(e){var t=e.cm,n=t.display;e.updatedDisplay&&E(t),e.barMeasure=h(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ze(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+Be(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ue(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function St(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&&z(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.selectionChanged&&Pe(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),e.focus&&e.focus==Fi()&&Y(e.cm)}function Mt(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&T(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null==e.scrollTop||n.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(r.scrollTop=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop)),n.scrollbars.setScrollTop(r.scrollTop),n.scroller.scrollTop=r.scrollTop),null==e.scrollLeft||n.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(r.scrollLeft=Math.max(0,Math.min(n.scroller.scrollWidth-Ue(t),e.scrollLeft)),n.scrollbars.setScrollLeft(r.scrollLeft),n.scroller.scrollLeft=r.scrollLeft,_(t)),e.scrollToPos){var i=zn(t,me(r,e.scrollToPos.from),me(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&An(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||Sa(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&Sa(a[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Sa(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Lt(e,t){if(e.curOp)return t();yt(e);try{return t()}finally{xt(e)}}function Tt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);yt(e);try{return t.apply(e,arguments)}finally{xt(e)}}}function At(e){return function(){if(this.curOp)return e.apply(this,arguments);yt(this);try{return e.apply(this,arguments)}finally{xt(this)}}}function zt(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 Et(e,t,n){this.line=t,this.rest=mr(t),this.size=this.rest?Yr(Ti(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function Ot(e,t,n){for(var r,i=[],o=t;n>o;o=r){var a=new Et(e.doc,Gr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function qt(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)zo&&gr(e.doc,t)<i.viewTo&&It(e);else if(n<=i.viewFrom)zo&&vr(e.doc,n+r)>i.viewFrom?It(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=Dt(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):It(e)}else if(n>=i.viewTo){var o=Dt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var a=Dt(e,t,t,-1),l=Dt(e,n,n+r,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Ot(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):It(e)}var s=i.externalMeasured;s&&(n<s.lineN?s.lineN+=r:t<s.lineN+s.size&&(i.externalMeasured=null))}function Nt(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[Pt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Ai(a,n)&&a.push(n)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pt(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 Dt(e,t,n,r){var i,o=Pt(e,t),a=e.display.view;if(!zo||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 jt(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Ot(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Ot(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Pt(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Ot(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Pt(e,n)))),r.viewTo=n}function Rt(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 Wt(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;wa(i.scroller,"mousedown",Tt(e,Ut)),po&&11>ho?wa(i.scroller,"dblclick",Tt(e,function(t){if(!_i(e,t)){var n=Bt(e,t);if(n&&!Zt(e,t)&&!$t(e.display,t)){xa(t);var r=e.findWordAt(n);xe(e.doc,r.anchor,r.head)}}})):wa(i.scroller,"dblclick",function(t){_i(e,t)||xa(t)}),To||wa(i.scroller,"contextmenu",function(t){mn(e,t)});var o,a={end:0};wa(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)}}),wa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),wa(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!$t(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(Eo(l.line,0),me(e.doc,Eo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),xa(n)}t()}),wa(i.scroller,"touchcancel",t),wa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Jt(e,i.scroller.scrollTop),en(e,i.scroller.scrollLeft,!0),Sa(e,"scroll",e))}),wa(i.scroller,"mousewheel",function(t){tn(e,t)}),wa(i.scroller,"DOMMouseScroll",function(t){tn(e,t)}),wa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={simple:function(t){_i(e,t)||ka(t)},start:function(t){Qt(e,t)},drop:Tt(e,Yt)};var l=i.input.getField();wa(l,"keyup",function(t){un.call(e,t)}),wa(l,"keydown",Tt(e,sn)),wa(l,"keypress",Tt(e,fn)),wa(l,"focus",Ni(pn,e)),wa(l,"blur",Ni(hn,e))}function Ft(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?wa:Ca;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 Ht(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 $t(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 Bt(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=ht(e,o,a);if(r&&1==c.xRel&&(s=Gr(e.doc,c.line).text).length==c.ch){var u=Oa(s,s.length,e.options.tabSize)-s.length;c=Eo(c.line,Math.max(0,Math.round((o-$e(e.display).left)/vt(e.display))-u))}return c}function Ut(e){var t=this,n=t.display;if(!(n.activeTouch&&n.input.supportsTouch()||_i(t,e))){if(n.shift=e.shiftKey,$t(n,e))return void(mo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Zt(t,e)){var r=Bt(t,e);switch(window.focus(),yi(e)){case 1:r?Vt(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:To?mn(t,e):dn(t)}}}}function Vt(e,t,n){po?setTimeout(Ni(Y,e),0):e.curOp.focus=Fi();var r,i=+new Date;Po&&Po.time>i-400&&0==Oo(Po.pos,n)?r="triple":Io&&Io.time>i-400&&0==Oo(Io.pos,n)?(r="double",Po={time:i,pos:n}):(r="single",Io={time:i,pos:n});var o,a=e.doc.sel,l=Co?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ua&&!Q(e)&&"single"==r&&(o=a.contains(n))>-1&&!a.ranges[o].empty()?Gt(e,t,n,l):Kt(e,t,n,r,l)}function Gt(e,t,n,r){var i=e.display,o=+new Date,a=Tt(e,function(l){mo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ca(document,"mouseup",a),Ca(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||po&&9==ho?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(),wa(document,"mouseup",a),wa(i.scroller,"drop",a)}function Kt(e,t,n,r,i){function o(t){if(0!=Oo(g,t))if(g=t,"rect"==r){for(var i=[],o=e.options.tabSize,a=Oa(Gr(c,n.line).text,n.ch,o),l=Oa(Gr(c,t.line).text,t.ch,o),s=Math.min(a,l),p=Math.max(a,l),h=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));m>=h;h++){var v=Gr(c,h).text,y=Mi(v,s,o);s==p?i.push(new fe(Eo(h,y),Eo(h,y))):v.length>y&&i.push(new fe(Eo(h,y),Eo(h,Mi(v,p,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,_=t;if("single"!=r){if("double"==r)var k=e.findWordAt(t);else var k=new fe(Eo(t.line,0),me(c,Eo(t.line+1,0)));Oo(k.anchor,x)>0?(_=k.head,x=Z(b.from(),k.anchor)):(_=k.anchor,x=X(b.to(),k.head))}var i=d.ranges.slice(0);i[f]=new fe(me(c,x),_),Me(c,de(i,f),za)}}function a(t){var n=++y,i=Bt(e,t,!0,"rect"==r);if(i)if(0!=Oo(i,g)){e.curOp.focus=Fi(),o(i);var l=x(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(Tt(e,function(){y==n&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Tt(e,function(){y==n&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(e){y=1/0,xa(e),s.input.focus(),Ca(document,"mousemove",b),Ca(document,"mouseup",_),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;xa(t);var u,f,d=c.sel,p=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(n),u=f>-1?p[f]:new fe(n,n)):(u=c.sel.primary(),f=c.sel.primIndex),t.altKey)r="rect",i||(u=new fe(n,n)),n=Bt(e,t,!0,!0),f=-1;else if("double"==r){var h=e.findWordAt(n);u=e.display.shift||c.extend?be(c,u,h.anchor,h.head):h}else if("triple"==r){var m=new fe(Eo(n.line,0),me(c,Eo(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=p.length,Me(c,de(p.concat([u]),f),{scroll:!1,origin:"*mouse"})):p.length>1&&p[f].empty()&&"single"==r&&!t.shiftKey?(Me(c,de(p.slice(0,f).concat(p.slice(f+1)),0)),d=c.sel):ke(c,f,u,za):(f=0,Me(c,new ue([u],0),za),d=c.sel);var g=n,v=s.wrapper.getBoundingClientRect(),y=0,b=Tt(e,function(e){yi(e)?a(e):l(e)}),_=Tt(e,l);wa(document,"mousemove",b),wa(document,"mouseup",_)}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||!wi(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 Zt(e,t){return Xt(e,t,"gutterClick",!0,bi)}function Yt(e){var t=this;if(!_i(t,e)&&!$t(t.display,e)){xa(e),po&&(Wo=+new Date);var n=Bt(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=Tt(t,function(){if(o[r]=l.result,++a==i){n=me(t.doc,n);var e={from:n,to:n,text:Va(o.join("\n")),origin:"paste"};kn(t.doc,e),Se(t.doc,pe(n,Vo(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&&!(Co?e.altKey:e.ctrlKey))var c=t.listSelections();if(Le(t.doc,pe(n,n)),c)for(var s=0;s<c.length;++s)Tn(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(po&&(!e.state.draggingText||+new Date-Wo<100))return void ka(t);if(!_i(e,t)&&!$t(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!bo)){var n=ji("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||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),co&&A(e),De(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,_(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function tn(e,t){var n=$o(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&&Co&&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!=Ho)return i&&Jt(e,Math.max(0,Math.min(a.scrollTop+i*Ho,a.scrollHeight-a.clientHeight))),en(e,Math.max(0,Math.min(a.scrollLeft+r*Ho,a.scrollWidth-a.clientWidth))),xa(t),void(o.wheelStartX=null);if(i&&null!=Ho){var u=i*Ho,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),A(e,{top:f,bottom:d})}20>Fo&&(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&&(Ho=(Ho*Fo+n)/(Fo+1),++Fo)}},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)!=Ta}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";Bo.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),Pe(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=Fi(),!_i(t,e)){po&&11>ho&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=an(t,e);yo&&(Uo=r?n:null,!r&&88==n&&!Ka&&(Co?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||(Ha(n,"CodeMirror-crosshair"),Ca(document,"keyup",t),Ca(document,"mouseover",t))}var n=e.display.lineDiv;$a(n,"CodeMirror-crosshair"),wa(document,"keyup",t),wa(document,"mouseover",t)}function un(e){16==e.keyCode&&(this.doc.sel.shift=!1),_i(this,e)}function fn(e){var t=this;if(!($t(t.display,e)||_i(t,e)||e.ctrlKey&&!e.altKey||Co&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(yo&&n==Uo)return Uo=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,hn(e))},100)}function pn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Sa(e,"focus",e),e.state.focused=!0,$a(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()),Pe(e))}function hn(e){e.state.delayingBlurEvent||(e.state.focused&&(Sa(e,"blur",e),e.state.focused=!1,Ha(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mn(e,t){$t(e.display,t)||gn(e,t)||e.display.input.onContextMenu(t)}function gn(e,t){return wi(e,"gutterContextMenu")?Xt(e,t,"gutterContextMenu",!1,Sa):!1}function vn(e,t){if(Oo(e,t.from)<0)return e;if(Oo(e,t.to)<=0)return Vo(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+=Vo(t).ch-t.to.ch),Eo(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?Eo(n.line,e.ch-t.ch+n.ch):Eo(n.line+(e.line-t.line),e.ch)}function xn(e,t,n){for(var r=[],i=Eo(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=bn(l.from,i,o),c=bn(Vo(l),i,o);if(i=l.to,o=c,"around"==n){var u=e.sel.ranges[a],f=Oo(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 _n(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)}),Sa(e,"beforeChange",e,r),e.cm&&Sa(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 Tt(e.cm,kn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(wi(e,"beforeChange")||e.cm&&wi(e.cm,"beforeChange"))||(t=_n(e,t,!0))){var r=Ao&&!n&&ir(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)wn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else wn(e,t)}}function wn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Oo(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=[];Ur(e,function(e,n){n||-1!=Ai(r,e.history)||(mi(e.history,t),r.push(e.history)),Mn(e,t,null,tr(e,t))})}}function Cn(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=wi(e,"beforeChange")||e.cm&&wi(e.cm,"beforeChange"),s=r.changes.length-1;s>=0;--s){var f=r.changes[s];if(f.origin=t,u&&!_n(e,f,!1))return void(a.length=0);c.push(ni(e,f));var d=s?yn(e,f):Ti(a);Mn(e,f,d,rr(e,f)),!s&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Vo(f)});var p=[];Ur(e,function(e,t){t||-1!=Ai(p,e.history)||(mi(e.history,f),p.push(e.history)),Mn(e,f,null,rr(e,f))})}}}}function Sn(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(zi(e.sel.ranges,function(e){return new fe(Eo(e.anchor.line+t,e.anchor.ch),Eo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){qt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Nt(e.cm,r,"gutter")}}function Mn(e,t,n,r){if(e.cm&&!e.cm.curOp)return Tt(e.cm,Mn)(e,t,n,r);if(t.to.line<e.first)return void Sn(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);Sn(e,i),t={from:Eo(e.first,0),to:Eo(t.to.line+i,t.to.ch),text:[Ti(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Eo(o,Gr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Kr(e,t.from,t.to),n||(n=yn(e,t)),e.cm?Ln(e.cm,t,r):Hr(e,t,r),Le(e,n,Aa)}}function Ln(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=Yr(hr(Gr(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),Hr(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),De(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?qt(e):a.line!=l.line||1!=t.text.length||Fr(e.doc,t)?qt(e,a.line,l.line+1,u):Nt(e,a.line,"text");var d=wi(e,"changes"),p=wi(e,"change");if(p||d){var h={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};p&&bi(e,"change",e,h),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Tn(e,t,n,r,i){if(r||(r=n),Oo(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=Va(t)),kn(e,{from:n,to:r,text:t,origin:i})}function An(e,t){if(!_i(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&&!_o){var o=ji("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-Fe(e.display))+"px; height: "+(t.bottom-t.top+Be(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function zn(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=On(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 En(e,t,n,r,i){var o=On(e,t,n,r,i);null!=o.scrollTop&&Jt(e,o.scrollTop),null!=o.scrollLeft&&en(e,o.scrollLeft)}function On(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=Ve(e),c={};i-n>s&&(i=n+s);var u=e.doc.height+He(o),f=a>n,d=i>u-a;if(l>n)c.scrollTop=f?0:n;else if(i>l+s){var p=Math.min(n,(d?u:i)-s);p!=l&&(c.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ue(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?c.scrollLeft=0:h>t?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+h-3&&(c.scrollLeft=r+(g?0:10)-m),c}function qn(e,t,n){(null!=t||null!=n)&&In(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 Nn(e){In(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?Eo(t.line,t.ch-1):t,r=Eo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function In(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=dt(e,t.from),r=dt(e,t.to),i=On(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 Pn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=We(e,t):n="prev");var a=e.options.tabSize,l=Gr(o,t),s=Oa(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==Ta||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Oa(Gr(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 p=Math.floor(c/a);p;--p)d+=a,f+=" ";if(c>d&&(f+=Li(c-d)),f!=u)return Tn(o,f,Eo(t,0),Eo(t,u.length),"+input"),l.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var h=o.sel.ranges[p];if(h.head.line==t&&h.head.ch<u.length){var d=Eo(t,u.length);ke(o,p,new fe(d,d));break}}}function Dn(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Gr(e,he(e,t)):i=Yr(t),null==i?null:(r(o,i)&&e.cm&&Nt(e.cm,i,n),o)}function jn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&Oo(o.from,Ti(r).to)<=0;){var a=r.pop();if(Oo(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Lt(e,function(){for(var t=r.length-1;t>=0;t--)Tn(e.doc,"",r[t].from,r[t].to,"+delete");Nn(e)})}function Rn(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=Gr(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=Gr(e,l),f=!0;if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var d=null,p="group"==r,h=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;!(0>n)||a(!m);m=!1){var g=u.text.charAt(s)||"\n",v=Ii(g,h)?"w":p&&"\n"==g?"n":!p||/\s/.test(g)?null:"p";
if(!p||m||v||(v="s"),d&&d!=v){0>n&&(n=1,a());break}if(v&&(d=v),n>0&&!a(!m))break}var y=Ee(e,Eo(l,s),c,!0);return f||(y.hitSide=!0),y}function Wn(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=ht(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 Fn(t,n,r,i){e.defaults[t]=n,r&&(Ko[t]=i?function(e,t,n){n!=Xo&&r(e,t,n)}:r)}function Hn(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 $n(e){return"string"==typeof e?ia[e]:e}function Bn(e,t,n,r,i){if(r&&r.shared)return Un(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Tt(e.cm,Bn)(e,t,n,r,i);var o=new ua(e,i),a=Oo(t,n);if(r&&qi(r,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=ji("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(pr(e,t.line,t,n,o)||t.line!=n.line&&pr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");zo=!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&&hr(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Zr(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)&&Zr(t,0)}),o.clearOnEnter&&wa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ao=!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)qt(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++)Nt(c,u,"text");o.atomic&&Ae(c.doc),bi(c,"markerAdded",c,o)}return o}function Un(e,t,n,r,i){r=qi(r),r.shared=!1;var o=[Bn(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Ur(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Bn(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=Ti(o)}),new fa(o,a)}function Vn(e){return e.findMarks(Eo(e.first,0),e.clipPos(Eo(e.lastLine())),function(e){return e.parent})}function Gn(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(Oo(o,a)){var l=Bn(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}function Kn(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];Ur(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==Ai(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 Zn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Yn(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)&&Gr(e,t.from.line).markedSpans,r=ve(e,t.to.line)&&Gr(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==Oo(t.from,t.to),l=Jn(n,i,a),s=er(r,o,a),c=1==t.text.length,u=Ti(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 p=Zn(s,d.marker);p?c&&(d.to=null==p.to?null:p.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 p=Zn(l,d.marker);p||(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 h=[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)h.push(m);h.push(s)}return h}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!=Ai(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(!(Oo(c.to,l.from)<0||Oo(c.from,l.to)>0)){var u=[s,1],f=Oo(c.from,l.from),d=Oo(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=Oo(r.from,i.from)||lr(e)-lr(t);if(o)return-o;var a=Oo(r.to,i.to)||sr(e)-sr(t);return a?a:t.id-e.id}function ur(e,t){var n,r=zo&&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 pr(e,t,n,r,i){var o=Gr(e,t),a=zo&&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=Oo(c.from,n)||lr(s.marker)-lr(i),f=Oo(c.to,r)||sr(s.marker)-sr(i);if(!(u>=0&&0>=f||0>=u&&f>=0)&&(0>=u&&(Oo(c.to,n)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Oo(c.from,r)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function hr(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=Gr(e,t),r=hr(n);return n==r?t:Yr(r)}function vr(e,t){if(t>e.lastLine())return t;var n,r=Gr(e,t);if(!yr(e,r))return t;for(;n=dr(r);)r=n.find(1,!0).line;return Yr(r)+1}function yr(e,t){var n=zo&&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,Zn(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)&&qn(e,null,n)}function _r(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ra(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;"),Wi(t.display.measure,ji("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),Dn(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;Zr(t,t.height+_r(i)),r&&qn(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function wr(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&&Zr(e,i)}function Cr(e){e.parent=null,or(e)}function Sr(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 Lr(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 Tr(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=Gr(a,t.line),u=We(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=Lr(l,f,u),r&&s.push(i(!0));return r?s:i()}function Ar(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&&Sr(Mr(n,r),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&Or(e,t,r,f.pos),f.pos=t.length,s=null):s=Sr(Lr(n,f,r,d),o),d){var p=d[0].name;p&&(s="m-"+(s?p+" "+s:p))}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 h=Math.min(f.pos,c+5e4);i(h,u),c=h}}function zr(e,t,n,r){var i=[e.state.modeGen],o={};Ar(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;Ar(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 Er(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=zr(e,t,t.stateAfter=We(e,Yr(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 Or(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;)Lr(i,o,n),o.start=o.pos}function qr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ma:ha;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Nr(e,t){var n=ji("span",null,null,mo?"padding-right: .1px":null),r={pre:ji("pre",[n]),content:n,col:0,pos:0,cm:e,splitSpaces:(po||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=Pr,Ki(e.display.measure)&&(o=ei(a))&&(r.addToken=jr(r.addToken,o)),r.map=[];var l=t!=e.display.externalMeasured&&Yr(a);Wr(a,r,Er(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=$i(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=$i(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Gi(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"),Sa(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=$i(r.pre.className,r.textClass||"")),r}function Ir(e){var t=ji("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Pr(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Dr):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),p=d?d.index-f:t.length-f;if(p){var h=document.createTextNode(l.slice(f,f+p));u.appendChild(po&&9>ho?ji("span",[h]):h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!d)break;if(f+=p+1," "==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild(ji("span",Li(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text"," "),e.col+=g}else{var h=e.cm.options.specialCharPlaceholder(d[0]);h.setAttribute("cm-text",d[0]),u.appendChild(po&&9>ho?ji("span",[h]):h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),po&&9>ho&&(c=!0),e.pos+=t.length}if(n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=ji("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Dr(e){for(var t=" ",n=0;n<e.length-2;++n)t+=n%2?" ":" ";return t+=" "}function jr(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 Rr(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 Wr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,f,d,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){s=c=u=f=l="",d=null,v=1/0;for(var y=[],b=0;b<r.length;++b){var x=r[b],_=x.marker;"bookmark"==_.type&&x.from==h&&_.widgetNode?y.push(_):x.from<=h&&(null==x.to||x.to>h||_.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&v>x.to&&(v=x.to,c=""),_.className&&(s+=" "+_.className),_.css&&(l=_.css),_.startStyle&&x.from==h&&(u+=" "+_.startStyle),_.endStyle&&x.to==v&&(c+=" "+_.endStyle),_.title&&!f&&(f=_.title),_.collapsed&&(!d||cr(d.marker,_)<0)&&(d=x)):x.from>h&&v>x.from&&(v=x.from)}if(d&&(d.from||0)==h){if(Rr(t,(null==d.to?p+1:d.to)-h,d.marker,null==d.from),null==d.to)return;d.to==h&&(d=!1)}if(!d&&y.length)for(var b=0;b<y.length;++b)Rr(t,0,y[b])}if(h>=p)break;for(var k=Math.min(p,v);;){if(g){var w=h+g.length;if(!d){var C=w>k?g.slice(0,k-h):g;t.addToken(t,C,a?a+s:s,u,h+C.length==v?c:"",f,l)}if(w>=k){g=g.slice(k-h),h=k;break}h=w,u=""}g=i.slice(o,o=n[m++]),a=qr(n[m++],t.cm.options)}}else for(var m=1;m<n.length;m+=2)t.addToken(t,i.slice(o,o=n[m]),qr(n[m+1],t.cm.options))}function Fr(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ti(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Hr(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){wr(e,n,i,r),bi(e,"change",e,t)}function a(e,t){for(var n=e,o=[];t>n;++n)o.push(new pa(c[n],i(n),r));return o}var l=t.from,s=t.to,c=t.text,u=Gr(e,l.line),f=Gr(e,s.line),d=Ti(c),p=i(c.length-1),h=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Fr(e,t)){var m=a(0,c.length-1);o(f,f.text,p),h&&e.remove(l.line,h),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),p);else{var m=a(1,c.length-1);m.push(new pa(d+u.text.slice(s.ch),p,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,h);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(f,d+f.text.slice(s.ch),p);var m=a(1,c.length-1);h>1&&e.remove(l.line+1,h-1),e.insert(l.line+1,m)}bi(e,"change",e,t)}function $r(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 Br(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 Ur(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 Vr(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,qt(e)}function Gr(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 Kr(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 Zr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Yr(e){if(null==e.parent)return null;for(var t=e.parent,n=Ai(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=hr(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:Vo(t),text:Kr(e,t.from,t.to)};return ci(e,n,t.from.line,t.to.line+1),Ur(e,function(e){ci(e,n,t.from.line,t.to.line+1)},!0),n}function ri(e){for(;e.length;){var t=Ti(e);if(!t.ranges)break;e.pop()}}function ii(e,t){return t?(ri(e.done),Ti(e.done)):e.done.length&&!Ti(e.done).ranges?Ti(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ti(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=Ti(o.changes);0==Oo(t.from,t.to)&&0==Oo(t.from,l.to)?l.to=Vo(t):o.changes.push(ni(e,t))}else{var s=Ti(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||Sa(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,Ti(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=Ti(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+)$/))&&Ai(t,Number(c[1]))>-1&&(Ti(l)[f]=u[f],delete u[f])}}}return i}function pi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function hi(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++)pi(o.ranges[l].anchor,t,n,r),pi(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=Eo(s.from.line+r,s.from.ch),s.to=Eo(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;hi(e.done,n,r,i),hi(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)),Co&&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);jo?i=jo.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 _i(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Sa(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==Ai(n,t[r])&&n.push(t[r])}function wi(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function Ci(e){e.prototype.on=function(e,t){wa(this,e,t)},e.prototype.off=function(e,t){Ca(this,e,t)}}function Si(){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 Li(e){for(;qa.length<=e;)qa.push(Ti(qa)+" ");return qa[e]}function Ti(e){return e[e.length-1]}function Ai(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function zi(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ei(){}function Oi(e,t){var n;return Object.create?n=Object.create(e):(Ei.prototype=e,n=new Ei),t&&qi(t,n),n}function qi(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 Ni(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Ii(e,t){return t?t.source.indexOf("\\w")>-1&&Da(e)?!0:t.test(e):Da(e)}function Pi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Di(e){return e.charCodeAt(0)>=768&&ja.test(e)}function ji(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 Ri(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Wi(e,t){return Ri(e).appendChild(t)}function Fi(){return document.activeElement}function Hi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function $i(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Hi(n[r]).test(t)&&(t+=" "+n[r]);return t}function Bi(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 Ui(){Ba||(Vi(),Ba=!0)}function Vi(){var e;wa(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Bi(Ht)},100))}),wa(window,"blur",function(){Bi(hn)})}function Gi(e){if(null==Wa){var t=ji("span","");Wi(e,ji("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Wa=t.offsetWidth<=1&&t.offsetHeight>2&&!(po&&8>ho))}var n=Wa?ji("span",""):ji("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ki(e){if(null!=Fa)return Fa;var t=Wi(e,document.createTextNode("AخA")),n=Ia(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Ia(t,1,2).getBoundingClientRect();return Fa=r.right-n.right<3}function Xi(e){if(null!=Xa)return Xa;var t=Wi(e,ji("span","x")),n=t.getBoundingClientRect(),r=Ia(t,0,1).getBoundingClientRect();return Xa=Math.abs(n.left-r.left)>1}function Zi(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 Yi(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?Yi(t[0]):0}function eo(e){var t=ei(e);return t?Qi(Ti(t)):e.text.length}function to(e,t){var n=Gr(e.doc,t),r=hr(n);r!=n&&(t=Yr(r));var i=ei(r),o=i?i[0].level%2?eo(r):Ji(r):0;return Eo(t,o)}function no(e,t){for(var n,r=Gr(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 Eo(null==t?Yr(r):t,o)}function ro(e,t){var n=to(e,t.line),r=Gr(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 Eo(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){Ya=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&&(Ya=n),r):(i.from!=i.to&&(Ya=r),n);n=r}}return n}function ao(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Di(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&&Di(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),po=uo||fo,ho=po&&(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),_o=/PhantomJS/.test(navigator.userAgent),ko=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),wo=ko||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Co=ko||/Mac/.test(navigator.platform),So=/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 Lo=Co&&(go||yo&&(null==Mo||12.11>Mo)),To=co||po&&ho>=9,Ao=!1,zo=!1;m.prototype=qi({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=Co&&!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&&Tt(t.cm,Ut)(e)};wa(this.vert,"mousedown",n),wa(this.horiz,"mousedown",n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=qi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},S.prototype.signal=function(e,t){wi(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Sa.apply(null,this.events[e])};var Eo=e.Pos=function(e,t){return this instanceof Eo?(this.line=e,void(this.ch=t)):new Eo(e,t)},Oo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},qo=null;ne.prototype=qi({init:function(e){function t(e){if(r.somethingSelected())qo=r.getSelections(),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=qo.join("\n"),Na(o));else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);qo=t.text,"cut"==e.type?r.setSelections(t.ranges,null,Aa):(n.prevInput="",o.value=t.text.join("\n"),Na(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"),wa(o,"input",function(){po&&ho>=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),wa(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()}),wa(o,"cut",t),wa(o,"copy",t),wa(e.scroller,"paste",function(t){$t(e,t)||(r.state.pasteIncoming=!0,n.focus())}),wa(e.lineSpace,"selectstart",function(t){$t(e,t)||xa(t)}),wa(o,"compositionstart",function(){var e=r.getCursor("from");n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),wa(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=qe(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;Wi(n.cursorDiv,e.cursors),Wi(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=Ka&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.composing||(this.textarea.value=a),r.state.focused&&Na(this.textarea),po&&ho>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),
po&&ho>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!wo||Fi()!=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||Ga(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(po&&ho>=9&&this.hasSelection===r||Co&&/[\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 Lt(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(){po&&ho>=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,po&&9>ho&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!po||po&&9>ho)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==r.prevInput?Tt(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=Bt(i,e),s=o.scroller.scrollTop;if(l&&!yo){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&Tt(i,Me)(i.doc,pe(l),Aa);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: "+(po?"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),po&&ho>=9&&t(),To){ka(e);var d=function(){Ca(window,"mouseup",d),setTimeout(n,20)};wa(window,"mouseup",d)}else setTimeout(n,50)}},setUneditable:Ei,needsContentAttribute:!1},ne.prototype),ie.prototype=qi({init:function(e){function t(e){if(r.somethingSelected())qo=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);qo=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Aa),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!ko)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",qo.join("\n"));else{var n=re(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=qo.join("\n");var o=document.activeElement;Na(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),wa(i,"paste",function(e){var t=e.clipboardData&&e.clipboardData.getData("text/plain");t&&(e.preventDefault(),r.replaceSelection(t,null,"paste"))}),wa(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=pe(Eo(i.head.line,a),Eo(i.head.line,a+t.length)))}}),wa(i,"compositionupdate",function(e){n.composing.data=e.data}),wa(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))}),wa(i,"touchstart",function(){n.forceCompositionEnd()}),wa(i,"input",function(){n.composing||n.pollContent()||Lt(n.cm,function(){qt(r)})}),wa(i,"copy",t),wa(i,"cut",t)},prepareSelection:function(){var e=qe(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!=Oo(Z(n,r),t.from())||0!=Oo(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=Ia(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){Wi(this.cm.display.cursorDiv,e.cursors),Wi(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 Ra(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():Lt(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&&Lt(t,function(){Me(t.doc,pe(n,r),Aa),(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=Pt(e,r.line)))var a=Yr(t.view[0].line),l=t.view[0].node;else var a=Yr(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=Pt(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.view[s].node;else var c=Yr(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var f=Va(ce(e,l,u,a,c)),d=Kr(e.doc,Eo(a,0),Eo(c,Gr(e.doc,c).text.length));f.length>1&&d.length>1;)if(Ti(f)==Ti(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var p=0,h=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);v>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Ti(f),b=Ti(d),x=Math.min(y.length-(1==f.length?p:0),b.length-(1==d.length?p:0));x>h&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;f[f.length-1]=y.slice(0,y.length-h),f[0]=f[0].slice(p);var _=Eo(a,p),k=Eo(c,d.length?Ti(d).length-h:0);return f.length>1||f[0]||Oo(_,k)?(Tn(e.doc,f,_,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&&Tt(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),Tt(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:Ei,resetPosition:Ei,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!=Oo(n.anchor,r.anchor)||0!=Oo(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(Oo(t,r.from())>=0&&Oo(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return Z(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var No,Io,Po,Do={left:0,right:0,top:0,bottom:0},jo=null,Ro=0,Wo=0,Fo=0,Ho=null;po?Ho=-.53:co?Ho=15:vo?Ho=-.7:bo&&(Ho=-1/3);var $o=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=$o(e);return t.x*=Ho,t.y*=Ho,t};var Bo=new Si,Uo=null,Vo=e.changeEnd=function(e){return e.text?Eo(e.from.line+e.text.length-1,Ti(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,Ko.hasOwnProperty(e)&&Tt(this,Ko[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"]($n(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:At(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++,qt(this)}),removeOverlay:At(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 qt(this)}}),indentLine:At(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)&&Pn(this,e,t,n)}),indentSelection:At(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&&(Pn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Nn(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)Pn(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()),Aa)}}}),getTokenAt:function(e,t){return Tr(this,e,t)},getLineTokens:function(e,t){return Tr(this,Eo(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,n=Er(this,Gr(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==Ai(n,l.val)&&n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=he(n,null==e?n.first+n.size-1:e),We(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"),ht(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=Gr(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:At(function(e,t,n){return Dn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Pi(r)&&(e.gutterMarkers=null),!0})}),clearGutter:At(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Nt(t,r,"gutter"),Pi(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=Gr(this.doc,e),!e)return null}else{var t=Yr(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&&En(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:At(sn),triggerOnKeyPress:At(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=Rn(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:At(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Rn(n.doc,r.head,e,t,n.options.rtlMoveVisually):0>e?r.from():r.to()},Ea)}),deleteH:At(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):jn(this,function(n){var i=Rn(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=Wn(this,s,i,n),l.hitSide)break}return l},moveV:At(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=Wn(n,l,e,t);return"page"==t&&a==r.sel.primary()&&qn(n,null,ut(n,s,"div").top-l.top),s},Ea),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=Gr(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=Ii(a,o)?function(e){return Ii(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ii(e)};r>0&&l(n.charAt(r-1));)--r;for(;i<n.length&&l(n.charAt(i));)++i}return new fe(Eo(e.line,r),Eo(e.line,i))},toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?$a(this.display.cursorDiv,"CodeMirror-overwrite"):Ha(this.display.cursorDiv,"CodeMirror-overwrite"),Sa(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Fi()},scrollTo:At(function(e,t){(null!=e||null!=t)&&In(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-Be(this)-this.display.barHeight,width:e.scrollWidth-Be(this)-this.display.barWidth,clientHeight:Ve(this),clientWidth:Ue(this)}},scrollIntoView:At(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:Eo(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)In(this),this.curOp.scrollToPos=e;else{var n=On(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:At(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){Nt(r,i,"widget");break}++i}),r.curOp.forceUpdate=!0,Sa(r,"refresh",this)}),operation:function(e){return Lt(this,e)},refresh:At(function(){var e=this.display.cachedTextHeight;qt(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),Sa(this,"refresh",this)}),swapDoc:At(function(e){var t=this.doc;return t.cm=null,Vr(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}},Ci(e);var Go=e.defaults={},Ko=e.optionHandlers={},Xo=e.Init={toString:function(){return"CodeMirror.Init"}};Fn("value","",function(e,t){e.setValue(t)},!0),Fn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),Fn("indentUnit",2,n,!0),Fn("indentWithTabs",!1),Fn("smartIndent",!0),Fn("tabSize",4,function(e){r(e),ot(e),qt(e)},!0),Fn("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()}),Fn("specialCharPlaceholder",Ir,function(e){e.refresh()},!0),Fn("electricChars",!0),Fn("inputStyle",wo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Fn("rtlMoveVisually",!So),Fn("wholeLineUpdateBefore",!0),Fn("theme","default",function(e){l(e),s(e)},!0),Fn("keyMap","default",function(t,n,r){var i=$n(n),o=r!=e.Init&&$n(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Fn("extraKeys",null),Fn("lineWrapping",!1,i,!0),Fn("gutters",[],function(e){p(e.options),s(e)},!0),Fn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Fn("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Fn("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Fn("lineNumbers",!1,function(e){p(e.options),s(e)},!0),Fn("firstLineNumber",1,s,!0),Fn("lineNumberFormatter",function(e){return e},s,!0),Fn("showCursorWhenSelecting",!1,Oe,!0),Fn("resetSelectionOnContextMenu",!0),Fn("lineWiseCopyCut",!0),Fn("readOnly",!1,function(e,t){"nocursor"==t?(hn(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),Fn("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Fn("dragDrop",!0,Ft),Fn("cursorBlinkRate",530),Fn("cursorScrollMargin",0),Fn("cursorHeight",1,Oe,!0),Fn("singleCursorHeightPerLine",!0,Oe,!0),Fn("workTime",100),Fn("workDelay",100),Fn("flattenSpans",!0,r,!0),Fn("addModeClass",!1,r,!0),Fn("pollInterval",100),Fn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Fn("historyEventDelay",1250),Fn("viewportMargin",10,function(e){e.refresh()},!0),Fn("maxHighlightLength",1e4,r,!0),Fn("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Fn("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Fn("autofocus",null);var Zo=e.modes={},Yo=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)),Zo[t]=n},e.defineMIME=function(e,t){Yo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Yo.hasOwnProperty(t))t=Yo[t];else if(t&&"string"==typeof t.name&&Yo.hasOwnProperty(t.name)){var n=Yo[t.name];"string"==typeof n&&(n={name:n}),t=Oi(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=Zo[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]={};qi(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){va.prototype[e]=t},e.defineOption=Fn;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(Eo(e.firstLine(),0),Eo(e.lastLine()),Aa)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Aa)},killLine:function(e){jn(e,function(t){if(t.empty()){var n=Gr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Eo(t.head.line+1,0)}:{from:t.head,to:Eo(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){jn(e,function(t){return{from:Eo(t.from().line,0),to:me(e.doc,Eo(t.to().line+1,0))}})},delLineLeft:function(e){jn(e,function(e){return{from:Eo(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){jn(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){jn(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(Eo(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Eo(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")},Ea)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Ea)},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},Ea)},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=Oa(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){Lt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r].head,o=Gr(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Eo(i.line,i.ch-1)),i.ch>0)i=new Eo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Eo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Gr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),Eo(i.line-1,a.length-1),Eo(i.line,1),"+transpose")}n.push(new fe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){Lt(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),Nn(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"]=Co?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=zi(n.split(" "),Hn),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=$n(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:Za[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=Za[e.keyCode],r=n;return null==r||e.altGraphKey?!1:(e.altKey&&"Alt"!=n&&(r="Alt-"+r),(Lo?e.metaKey:e.ctrlKey)&&"Ctrl"!=n&&(r="Ctrl-"+r),(Lo?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?qi(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=Fi();n.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(wa(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&&(Ca(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=Oa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Oa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Oa(this.string,null,this.tabSize)-(this.lineStart?Oa(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};Ci(ua),ua.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&yt(e),wi(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=Zn(a.markedSpans,this);e&&!this.collapsed?Nt(e,Yr(a),"text"):e&&(null!=l.to&&(i=Yr(a)),null!=l.from&&(r=Yr(a))),a.markedSpans=Yn(a.markedSpans,l),null==l.from&&this.collapsed&&!yr(this.doc,a)&&e&&Zr(a,gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=hr(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&&qt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(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=Zn(o.markedSpans,this);if(null!=a.from&&(n=Eo(t?o:Yr(o),a.from),-1==e))return n;if(null!=a.to&&(r=Eo(t?o:Yr(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&&Lt(n,function(){var r=e.line,i=Yr(e.line),o=Ye(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=_r(t)-a;l&&Zr(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!=Ai(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ua.prototype.detachLine=function(e){if(this.lines.splice(Ai(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};Ci(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};Ci(da),da.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Yr(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=_r(this);Zr(n,Math.max(0,n.height-o)),e&&Lt(e,function(){xr(e,n,-o),Nt(e,r,"widget")})}},da.prototype.changed=function(){var e=this.height,t=this.doc.cm,n=this.line;this.height=null;var r=_r(this)-e;r&&(Zr(n,n.height+r),t&&Lt(t,function(){t.curOp.forceUpdate=!0,xr(t,n,r)}))};var pa=e.Line=function(e,t,n){this.text=e,ar(this,t),this.height=n?n(this):1};Ci(pa),pa.prototype.lineNo=function(){return Yr(this)};var ha={},ma={};$r.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,Cr(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}},Br.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 $r))){var l=[];this.collapse(l),this.children=[new $r(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 $r(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 Br(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Ai(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Br(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),Br.call(this,[new $r([new pa("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=Eo(n,0);this.sel=pe(r),this.history=new ti(null),this.id=++ga,this.modeOption=t,"string"==typeof e&&(e=Va(e)),Hr(this,{from:r,to:r,text:e}),Me(this,pe(r),Aa)};va.prototype=Oi(Br.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:zt(function(e){var t=Eo(this.first,0),n=this.first+this.size-1;kn(this,{from:t,to:Eo(n,Gr(this,n).text.length),text:Va(e),origin:"setValue",full:!0},!0),Me(this,pe(t))}),replaceRange:function(e,t,n,r){t=me(this,t),n=n?me(this,n):t,Tn(this,e,t,n,r)},getRange:function(e,t,n){var r=Kr(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)?Gr(this,e):void 0},getLineNumber:function(e){return Yr(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Gr(this,e)),hr(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:zt(function(e,t,n){we(this,me(this,"number"==typeof e?Eo(e,t||0):e),null,n)}),setSelection:zt(function(e,t,n){we(this,me(this,e),me(this,t||e),n)}),extendSelection:zt(function(e,t,n){xe(this,me(this,e),t&&me(this,t),n)}),extendSelections:zt(function(e,t){_e(this,ye(this,e,t))}),extendSelectionsBy:zt(function(e,t){_e(this,zi(this.sel.ranges,e),t)}),setSelections:zt(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:zt(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=Kr(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=Kr(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:zt(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:Va(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?Se(this,l):this.cm&&Nn(this.cm)}),undo:zt(function(){Cn(this,"undo")}),redo:zt(function(){Cn(this,"redo")}),undoSelection:zt(function(){Cn(this,"undo",!0)}),redoSelection:zt(function(){Cn(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:zt(function(e,t,n){return Dn(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(Hi(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:zt(function(e,t,n){return Dn(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(Hi(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:zt(function(e,t,n){return kr(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(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),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=me(this,e);var t=[],n=Gr(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,Eo(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}],Gn(r,Vn(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),Kn(Vn(this));break}}if(t.history==this.history){var i=[t.id];Ur(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){Ur(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)&&Ai(ya,ba)<0&&(e.prototype[ba]=function(e){return function(){return e.apply(this.doc,arguments)}}(va.prototype[ba]));Ci(va);var xa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},_a=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},ka=e.e_stop=function(e){xa(e),_a(e)},wa=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)}},Ca=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}}},Sa=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,La=30,Ta=e.Pass={toString:function(){return"CodeMirror.Pass"}},Aa={scroll:!1},za={origin:"*mouse"},Ea={origin:"+move"};Si.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Oa=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}},qa=[""],Na=function(e){e.select()};ko?Na=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:po&&(Na=function(e){try{e.select()}catch(t){}});var Ia,Pa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Da=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Pa.test(e))},ja=/[\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]/;Ia=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 Ra=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)};po&&11>ho&&(Fi=function(){try{return document.activeElement}catch(e){return document.body}});var Wa,Fa,Ha=e.rmClass=function(e,t){var n=e.className,r=Hi(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:"")}},$a=e.addClass=function(e,t){var n=e.className;Hi(t).test(n)||(e.className+=(n?" ":"")+t)},Ba=!1,Ua=function(){if(po&&9>ho)return!1;var e=ji("div");return"draggable"in e||"dragDrop"in e}(),Va=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/)},Ga=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},Ka=function(){var e=ji("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Xa=null,Za={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=Za,function(){for(var e=0;10>e;e++)Za[e+48]=Za[e+96]=String(e);for(var e=65;90>=e;e++)Za[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Za[e+111]=Za[e+63235]="F"+e}();var Ya,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,p=c;u>d;++d){var r=f[d];"m"==r?f[d]=p:p=r}for(var d=0,h=c;u>d;++d){var r=f[d];"1"==r&&"r"==h?f[d]="n":a.test(r)&&(h=r,"r"==r&&(f[d]="R"))}for(var d=1,p=f[0];u-1>d;++d){var r=f[d];"+"==r&&"1"==p&&"1"==f[d+1]?f[d]="1":","!=r||p!=f[d+1]||"1"!=p&&"n"!=p||(f[d]=p),p=r}for(var d=0;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,h=c;u>d;++d){var r=f[d];"L"==h&&"1"==r?f[d]="L":a.test(r)&&(h=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,_=[],d=0;u>d;)if(l.test(f[d])){var k=d;for(++d;u>d&&l.test(f[d]);++d);_.push(new t(0,k,d))}else{var w=d,C=_.length;for(++d;u>d&&"L"!=f[d];++d);for(var v=w;d>v;)if(s.test(f[v])){v>w&&_.splice(C,0,new t(1,w,v));var S=v;for(++v;d>v&&s.test(f[v]);++v);_.splice(C,0,new t(2,S,v)),w=v}else++v;d>w&&_.splice(C,0,new t(1,w,d))}return 1==_[0].level&&(x=n.match(/^\s+/))&&(_[0].from=x[0].length,_.unshift(new t(0,0,x[0].length))),1==Ti(_).level&&(x=n.match(/\s+$/))&&(Ti(_).to-=x[0].length,_.push(new t(0,u-x[0].length,u))),2==_[0].level&&_.unshift(new t(1,_[0].to,_[0].to)),_[0].level!=Ti(_).level&&_.push(new t(_[0].level,u,u)),_}}();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,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+"in simple mode")}function n(e,t){if(!e)return/(?:)/;var n="";return e instanceof RegExp?(e.ignoreCase&&(n="i"),e=e.source):e=String(e),new RegExp((t===!1?"":"^")+"(?:"+e+")",n)}function r(e){if(!e)return null;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g," "));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function o(e,t){return function(n,r){if(r.pending){var i=r.pending.shift();return 0==r.pending.length&&(r.pending=null),n.pos+=i.text.length,i.token}if(r.local){if(r.local.end&&n.match(r.local.end)){var o=r.local.endToken||null;return r.local=r.localState=null,o}var a,o=r.local.mode.token(n,r.localState);return r.local.endScan&&(a=r.local.endScan.exec(n.current()))&&(n.pos=n.start+a.index),o}for(var s=e[r.state],c=0;c<s.length;c++){var u=s[c],f=(!u.data.sol||n.sol())&&n.match(u.regex);if(f){if(u.data.next?r.state=u.data.next:u.data.push?((r.stack||(r.stack=[])).push(r.state),r.state=u.data.push):u.data.pop&&r.stack&&r.stack.length&&(r.state=r.stack.pop()),u.data.mode&&l(t,r,u.data.mode,u.token),u.data.indent&&r.indent.push(n.indentation()+t.indentUnit),u.data.dedent&&r.indent.pop(),f.length>2){r.pending=[];for(var d=2;d<f.length;d++)f[d]&&r.pending.push({text:f[d],token:u.token[d-1]});return n.backUp(f[0].length-(f[1]?f[1].length:0)),u.token[0]}return u.token&&u.token.join?u.token[0]:u.token}}return n.next(),null}}function a(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var r in e)if(e.hasOwnProperty(r)){if(!t.hasOwnProperty(r)||!a(e[r],t[r]))return!1;n++}for(var r in t)t.hasOwnProperty(r)&&n--;return 0==n}function l(t,r,i,o){var l;if(i.persistent)for(var s=r.persistentStates;s&&!l;s=s.next)(i.spec?a(i.spec,s.spec):i.mode==s.mode)&&(l=s);var c=l?l.mode:i.mode||e.getMode(t,i.spec),u=l?l.state:e.startState(c);i.persistent&&!l&&(r.persistentStates={mode:c,spec:i.spec,state:u,next:r.persistentStates}),r.localState=u,r.local={mode:c,end:i.end&&n(i.end),endScan:i.end&&i.forceEnd!==!1&&n(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function s(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}function c(t,n){return function(r,i,o){if(r.local&&r.local.mode.indent)return r.local.mode.indent(r.localState,i,o);if(null==r.indent||r.local||n.dontIndentStates&&s(r.state,n.dontIndentStates)>-1)return e.Pass;var a=r.indent.length-1,l=t[r.state];e:for(;;){for(var c=0;c<l.length;c++){var u=l[c];if(u.data.dedent&&u.data.dedentIfLineStart!==!1){var f=u.regex.exec(i);if(f&&f[0]){a--,(u.next||u.push)&&(l=t[u.next||u.push]),i=i.slice(f[0].length);continue e}}}break}return 0>a?0:r.indent[a]}}e.defineSimpleMode=function(t,n){e.defineMode(t,function(t){return e.simpleMode(t,n)})},e.simpleMode=function(n,r){t(r,"start");var a={},l=r.meta||{},s=!1;for(var u in r)if(u!=l&&r.hasOwnProperty(u))for(var f=a[u]=[],d=r[u],p=0;p<d.length;p++){var h=d[p];f.push(new i(h,r)),(h.indent||h.dedent)&&(s=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:s?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var r=t.persistentStates;r;r=r.next)n.persistentStates={mode:r.mode,spec:r.spec,state:r.state==t.localState?n.localState:e.copyState(r.mode,r.state),next:n.persistentStates};return n},token:o(a,n),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:c(a,l)};if(l)for(var g in l)l.hasOwnProperty(g)&&(m[g]=l[g]);return m}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.multiplexingMode=function(t){function n(e,t,n,r){if("string"==typeof t){var i=e.indexOf(t,n);return r&&i>-1?i+t.length:i}var o=t.exec(n?e.slice(n):e);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,l=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var s=a.close?n(l,a.close,i.pos,a.parseDelimiters):-1;if(s==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle;s>-1&&(i.string=l.slice(0,s));var c=a.mode.token(i,o.inner);return s>-1&&(i.string=l),s==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,l=i.string,f=0;f<r.length;++f){var d=r[f],s=n(l,d.open,i.pos);if(s==i.pos)return d.parseDelimiters||i.match(d.open),o.innerActive=d,o.inner=e.startState(d.mode,t.indent?t.indent(o.outer,""):0),d.delimStyle;-1!=s&&u>s&&(u=s)}u!=1/0&&(i.string=l.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=l),p},indent:function(n,r){var i=n.innerActive?n.innerActive.mode:t;return i.indent?i.indent(n.innerActive?n.inner:n.outer,r):e.Pass},blankLine:function(n){var i=n.innerActive?n.innerActive.mode:t;if(i.blankLine&&i.blankLine(n.innerActive?n.inner:n.outer),n.innerActive)"\n"===n.innerActive.close&&(n.innerActive=n.inner=null);else for(var o=0;o<r.length;++o){var a=r[o];"\n"===a.open&&(n.innerActive=a,n.inner=e.startState(a.mode,i.indent?i.indent(n.outer,""):0))}},electricChars:t.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:t}}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a)}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 p=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:p,to:r(a,c[i].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var r=Math.min(n,e.length);;){var i=e.slice(0,r).toLowerCase().length;if(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,p,"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,h,"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 p='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>',h='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],p=u||t(d.from,!0)*r,h=t(d.to,!1)*r;f<o.length-1&&(u=t(o[f+1].from,!0)*r,!(u>h+.9));)d=o[++f],h=t(d.to,!1)*r;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(2*n.display.barWidth,2)+"px; top: "+(p+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 p=s[d];!function(t){e.on(p,"click",function(n){e.e_preventDefault(n),a(),t&&t(u)})}(i[d]),e.on(p,"blur",function(){--f,setTimeout(function(){0>=f&&a()},200)}),e.on(p,"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 p=e.getLine(d);if(p){var h=n>0?0:p.length-1,m=n>0?p.length:-1;if(!(p.length>o))for(d==t.line&&(h=t.ch-(0>n?1:0));h!=m;h+=n){var g=p.charAt(h);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(d,h+1))==r)){var v=l[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(d,h),ch:g};c.pop()}}}}}return d-n==(n>0?e.lastLine():e.firstLine())?!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),"+delete")}}function o(n){var i=r(n),o=i&&t(i,"explode");if(!o||n.getOption("disableInput"))return e.Pass;for(var a=n.listSelections(),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,"+input"),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,p=t(o,"triples"),h=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(!h&&g||d!=i)if(h&&x.ch>1&&p.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(h){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=p.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 _=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]=_+t[e]+k;n.replaceSelections(t,"around","+input")}else"both"==u?(n.replaceSelection(_+k,null,"+input"),n.execCommand("goCharLeft")):"addFour"==u&&(n.replaceSelection(_+_+_+_,"before","+input"),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(p),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(p))});for(var d=u.pairs+"`",p={Backspace:i,Enter:o},h=0;h<d.length;h++)p["'"+d.charAt(h)+"'"]=n(d.charAt(h))}),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 p=t.getOption("autoCloseTags"),h="html"==f.mode.configuration,m="object"==typeof p&&p.dontCloseTags||h&&a,g="object"==typeof p&&p.indentTags||h&&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 _=t.listSelections().slice(0);_[s]={head:x.newPos,anchor:x.newPos},t.setSelections(_),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\]\s|\[x\]\s|\s*)/,n=/^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\[\s\]\s*|\[x\]\s|\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],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),p=t.exec(d);if(!o[l].empty()||!u&&!f||!p)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 h=p[1],m=p[4],g=r.test(p[2])||p[2].indexOf(">")>=0?p[2]:parseInt(p[3],10)+1+".";a[l]="\n"+h+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,p=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),h=n.length;(p||r.test(s))&&(s.slice(0,h)!=n&&(h=t(s)),l.replaceRange(n+c+d,i(o,0),i(o,h)))}else for(var o=e.line;f>o;++o)(p||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 p=e.line+1;u>=p;++p)(p!=u||n)&&a.replaceRange(d+f,i(p,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=[],p=null==o.padding?" ":o.padding;e:if(f){for(var h=u;c>=h;++h){var m=l.getLine(h),g=m.indexOf(f);if(g>-1&&!/comment/.test(l.getTokenTypeAt(i(h,g+1)))&&(g=-1),-1==g&&(h!=c||h==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+p.length)==p&&(r+=p.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),_=c==u?x:l.getLine(c),k=x.indexOf(v),w=_.lastIndexOf(y);if(-1==w&&u!=c&&(_=l.getLine(--c),w=_.lastIndexOf(y)),-1==k||-1==w||!/comment/.test(l.getTokenTypeAt(i(u,k+1)))||!/comment/.test(l.getTokenTypeAt(i(c,w+1))))return!1;var C=x.lastIndexOf(v,e.ch),S=-1==C?-1:x.slice(0,e.ch).indexOf(y,C+v.length);if(-1!=C&&-1!=S&&S+y.length!=e.ch)return!1;S=_.indexOf(y,t.ch);var M=_.slice(t.ch).lastIndexOf(v,S-t.ch);return C=-1==S||-1==M?-1:t.ch+M,-1!=S&&-1!=C&&C!=t.ch?!1:(l.operation(function(){l.replaceRange("",i(c,w-(p&&_.slice(w-p.length,w)==p?p.length:0)),i(c,w+y.length));var e=k+v.length;if(p&&x.slice(e,e+p.length)==p&&(e+=p.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;p&&n.slice(a,a+p.length)==p&&(a+=p.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){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r,i=t.listSelections(),o=[],a=0;a<i.length;a++){var l=i[a].head,s=t.getTokenAt(l);if("comment"!=s.type)return e.Pass;var c=e.innerMode(t.getMode(),s.state).mode;if(r){if(r!=c)return e.Pass}else r=c;var u=null;if(r.blockCommentStart&&r.blockCommentContinue){var f,d=s.string.indexOf(r.blockCommentEnd),p=t.getRange(e.Pos(l.line,0),e.Pos(l.line,s.end));if(-1!=d&&d==s.string.length-r.blockCommentEnd.length&&l.ch>=d);else if(0==s.string.indexOf(r.blockCommentStart)){if(u=p.slice(0,s.start),!/^\s*$/.test(u)){u="";for(var h=0;h<s.start;++h)u+=" "}}else-1!=(f=p.indexOf(r.blockCommentContinue))&&f+r.blockCommentContinue.length>s.start&&/^\s*$/.test(p.slice(0,f))&&(u=p.slice(0,f));null!=u&&(u+=r.blockCommentContinue)}if(null==u&&r.lineComment&&n(t)){var m=t.getLine(l.line),f=m.indexOf(r.lineComment);f>-1&&(u=m.slice(0,f),/\S/.test(u)?u=null:u+=r.lineComment+m.slice(f+r.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[a]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+input")})}function n(e){var t=e.getOption("continueComments");return t&&"object"==typeof t?t.continueLineComment!==!1:!0}for(var r=["clike","css","javascript"],i=0;i<r.length;++i)e.extendMode(r[i],{blockCommentContinue:" * "});e.defineOption("continueComments",null,function(n,r,i){if(i&&i!=e.Init&&n.removeKeyMap("continueComment"),r){var o="Enter";"string"==typeof r?o=r:"object"==typeof r&&r.key&&(o=r.key);var a={name:"continueComment"};a[o]=t,n.addKeyMap(a)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){for(var r=n.paragraphStart||e.getHelper(t,"paragraphStart"),i=t.line,o=e.firstLine();i>o;--i){var a=e.getLine(i);if(r&&r.test(a))break;if(!/\S/.test(a)){++i;break}}for(var 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,p=t.getRange(r,o,!1);if(!p.length)return null;for(var h=p[0].match(/^[ \t]*/)[0],m=0;m<p.length;++m){var g=p[m],v=f.length,y=0;f&&g&&!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&&h==b&&n(f,l,s,c);x&&x.from==v&&x.to==v+y?(f=h+g,++d):u.push({text:[y?" ":""],from:i(d,v),to:i(d+1,b.length)})}for(;f.length>l;){var _=n(f,l,s,c);u.push({text:["",h],from:i(d,_.from),to:i(d,_.to)}),f=h+f.slice(_.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,p=t.lastLine();e:for(var h=a;p>=h;++h)for(var m=t.getLine(h),g=h==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(h,g+1))==o)if(g==v)++d;else if(!--d){u=h,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,p="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",h=p+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+p+"]["+h+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var r=new n(e,t.line,0);;){var i,o=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),p=s&&l(o);if(s&&p&&!(t(o,r)>0)){var h={from:d(o.line,o.ch),to:c,tag:p[2]};return"selfClose"==s?{open:h,close:null,at:"open"}:p[1]?{open:f(o,p[2]),close:h,at:"close"}:(o=new n(e,c.line,c.ch,i),{open:h,close:u(o,p[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,r){for(var i=new n(e,t.line,t.ch,r);;){var o=f(i);if(!o)break;var a=new n(e,t.line,t.ch,r),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"):(w=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,w=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return w="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,(S.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,!S.contextGrabbers.hasOwnProperty(n)||!S.contextGrabbers[n].hasOwnProperty(t))return;c(e)}}function f(e,t,n){return"openTag"==e?(n.tagStart=t.column(),d):"closeTag"==e?p:f}function d(e,t,n){return"word"==e?(n.tagName=t.current(),C="tag",g):(C="error",d)}function p(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&S.implicitlyClosed.hasOwnProperty(n.context.tagName)&&c(n),n.context&&n.context.tagName==r?(C="tag",h):(C="tag error",m)}return C="error",m}function h(e,t,n){return"endTag"!=e?(C="error",h):(c(n),f)}function m(e,t,n){return C="error",h(e,t,n)}function g(e,t,n){if("word"==e)return C="attribute",v;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||S.autoSelfClosers.hasOwnProperty(r)?u(n,r):(u(n,r),n.context=new s(n,r,i==n.indented)),f}return C="error",g}function v(e,t,n){return"equals"==e?y:(S.allowMissing||(C="error"),g(e,t,n))}function y(e,t,n){return"string"==e?b:"word"==e&&S.allowUnquoted?(C="string",g):(C="error",g(e,t,n))}function b(e,t,n){return"string"==e?b:g(e,t,n)}var x=t.indentUnit,_=n.multilineTagIndentFactor||1,k=n.multilineTagIndentPastTag;null==k&&(k=!0);var w,C,S=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;w=null;var n=t.tokenize(e,t);return(n||w)&&"comment"!=n&&(C=null,t.state=t.state(w||n,e,t),C&&(n="error"==C?n+" error":C)),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*_;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(!S.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(l)for(;a;){var s=S.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,_||e.f!=s||(e.f=p,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(),S;if(e.eatSpace())return null;if(l=e.match(B))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(U)))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(W,!0))return z;if((!t.prevLineHasContent||a)&&(e.match(F,!1)||e.match(H,!1))){var s=null;return e.match(F,!0)?s="ul":(e.match(H,!0),s="ol"),t.indentation+=4,t.list=!0,t.listDepth++,n.taskLists&&e.match($,!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(_&&null===t.htmlState.tagStart&&!t.htmlState.context||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=p,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(),S)}function u(e,t){e.match("```"),t.block=l,t.f=p,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(O),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(O+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(O+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&t.push(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?O+"-"+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(P),t.length?t.join(" "):null;if(e.strong&&t.push(j),e.em&&t.push(D),e.strikethrough&&t.push(R),e.linkText&&t.push(I),e.code&&t.push(S),e.header&&(t.push(C),t.push(C+"-"+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?T:A:L)}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(V,!0)?f(t):void 0}function p(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($,!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 p="^\\s*(?:[^"+d+"\\\\]+|\\\\\\\\|\\\\.)"+d;if(t.match(new RegExp(p),!0))return P}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===w?(r.code=!1,v):(r.formatting=g,f(r)):(w=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,E;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=h,n.highlightFormatting&&(r.formatting="link");var u=f(r);return u?u+=" ":u="",u+q}if("<"===c&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link");var u=f(r);return u?u+=" ":u="",u+N}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 _=!1;if(!n.underscoresBreakWords&&"_"===c&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var C=t.pos-2;if(C>=0){var S=t.string.charAt(C);"_"!==S&&S.match(/(\w)/,!1)&&(_=!0)}}if("*"===c||"_"===c&&!_)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 h(e,t){var r=e.next();if(">"===r){t.f=t.inline=p,n.highlightFormatting&&(t.formatting="link");var i=f(t);return i?i+=" ":i="",i+q}return e.match(/^[^>]+/,!0),q}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=p,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,p)}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),I}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=p,P)}function x(e){return G[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),G[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),G[e]}var _=e.modes.hasOwnProperty("xml"),k=e.getMode(t,_?{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 w=0,C="header",S="comment",M="quote",L="variable-2",T="variable-3",A="keyword",z="hr",E="tag",O="formatting",q="link",N="link",I="link",P="string",D="em",j="strong",R="strikethrough",W=/^([*\-=_])(?:\s*\1){2,}\s*$/,F=/^[*\-+]\s+/,H=/^[0-9]+\.\s+/,$=/^\[(x| )\](?=\s)/,B=/^#+ ?/,U=/^(?:\={1,}|-{1,})$/,V=/^[^#!\[\]*_\\<>` "'(~]+/,G=[],K={startState:function(){return{f:l,prevLineHasContent:!1,thisLineHasContent:!1,block:l,htmlState:null,indentation:0,inline:p,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:K}},blankLine:a,getType:f,fold:"markdown"};return K},"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(Se),i("operator","operator",e.current()));if("`"==n)return t.tokenize=s,s(e,t);if("#"==n)return e.skipToEnd(),i("error","error");if(Se.test(n))return e.eatWhile(Se),i("operator","operator",e.current());if(we.test(n)){e.eatWhile(we);var o=e.current(),c=Ce.propertyIsEnumerable(o)&&Ce[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=Le.indexOf(a);if(l>=0&&3>l){if(!r){++o;break}if(0==--r)break}else if(l>=3&&6>l)++r;else if(we.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(Ae.state=e,Ae.stream=i,Ae.marked=null,Ae.cc=o,Ae.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():_e?k:_;if(a(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Ae.marked?Ae.marked:"variable"==n&&f(e,r)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)Ae.cc.push(arguments[e])}function h(){return p.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=Ae.state;if(r.context){if(Ae.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(){Ae.state.context={prev:Ae.state.context,vars:Ae.state.localVars},Ae.state.localVars=ze}function v(){Ae.state.localVars=Ae.state.context.vars,Ae.state.context=Ae.state.context.prev}function y(e,t){var n=function(){var n=Ae.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,Ae.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function b(){var e=Ae.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?h():";"==e?p():h(t)}return t}function _(e,t){return"var"==e?h(y("vardef",t.length),$,x(";"),b):"keyword a"==e?h(y("form"),k,_,b):"keyword b"==e?h(y("form"),_,b):"{"==e?h(y("}"),W,b):";"==e?h():"if"==e?("else"==Ae.state.lexical.info&&Ae.state.cc[Ae.state.cc.length-1]==b&&Ae.state.cc.pop()(),h(y("form"),k,_,b,K)):"function"==e?h(ee):"for"==e?h(y("form"),X,_,b):"variable"==e?h(y("stat"),q):"switch"==e?h(y("form"),k,y("}","switch"),x("{"),W,b,b):"case"==e?h(k,x(":")):"default"==e?h(x(":")):"catch"==e?h(y("form"),g,x("("),te,x(")"),_,b,v):"module"==e?h(y("form"),g,ae,v,b):"class"==e?h(y("form"),ne,b):"export"==e?h(y("form"),le,b):"import"==e?h(y("form"),se,b):p(y("stat"),k,x(";"),b)}function k(e){return C(e,!1)}function w(e){return C(e,!0)}function C(e,t){if(Ae.state.fatArrowAt==Ae.stream.start){var n=t?O:E;if("("==e)return h(g,y(")"),j(B,")"),b,x("=>"),n,v);if("variable"==e)return p(g,B,x("=>"),n,v)}var r=t?T:L;return Te.hasOwnProperty(e)?h(r):"function"==e?h(ee,r):"keyword c"==e?h(t?M:S):"("==e?h(y(")"),S,he,x(")"),b,r):"operator"==e||"spread"==e?h(t?w:k):"["==e?h(y("]"),de,b,r):"{"==e?R(I,"}",null,r):"quasi"==e?p(A,r):h()}function S(e){return e.match(/[;\}\)\],]/)?p():p(k)}function M(e){return e.match(/[;\}\)\],]/)?p():p(w)}function L(e,t){return","==e?h(k):T(e,t,!1)}function T(e,t,n){var r=0==n?L:T,i=0==n?k:w;return"=>"==e?h(g,n?O:E,v):"operator"==e?/\+\+|--/.test(t)?h(r):"?"==t?h(k,x(":"),i):h(i):"quasi"==e?p(A,r):";"!=e?"("==e?R(w,")","call",r):"."==e?h(N,r):"["==e?h(y("]"),S,x("]"),b,r):void 0:void 0}function A(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?h(A):h(k,z)}function z(e){return"}"==e?(Ae.marked="string-2",Ae.state.tokenize=s,h(A)):void 0}function E(e){return c(Ae.stream,Ae.state),p("{"==e?_:k)}function O(e){return c(Ae.stream,Ae.state),p("{"==e?_:w)}function q(e){return":"==e?h(b,_):p(L,x(";"),b)}function N(e){return"variable"==e?(Ae.marked="property",h()):void 0}function I(e,t){return"variable"==e||"keyword"==Ae.style?(Ae.marked="property",h("get"==t||"set"==t?P:D)):"number"==e||"string"==e?(Ae.marked=xe?"property":Ae.style+" property",h(D)):"jsonld-keyword"==e?h(D):"["==e?h(k,x("]"),D):void 0}function P(e){return"variable"!=e?p(D):(Ae.marked="property",h(ee))}function D(e){return":"==e?h(w):"("==e?p(ee):void 0}function j(e,t){function n(r){if(","==r){var i=Ae.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),h(e,n)}return r==t?h():h(x(t))}return function(r){return r==t?h():p(e,n)}}function R(e,t,n){for(var r=3;r<arguments.length;r++)Ae.cc.push(arguments[r]);return h(y(t,n),j(e,t),b)}function W(e){return"}"==e?h():p(_,W)}function F(e){return ke&&":"==e?h(H):void 0}function H(e){return"variable"==e?(Ae.marked="variable-3",h()):void 0}function $(){return p(B,F,V,G)}function B(e,t){return"variable"==e?(m(t),h()):"["==e?R(B,"]"):"{"==e?R(U,"}"):void 0}function U(e,t){return"variable"!=e||Ae.stream.match(/^\s*:/,!1)?("variable"==e&&(Ae.marked="property"),h(x(":"),B,V)):(m(t),h(V))}function V(e,t){return"="==t?h(w):void 0}function G(e){return","==e?h($):void 0}function K(e,t){return"keyword b"==e&&"else"==t?h(y("form","else"),_,b):void 0}function X(e){return"("==e?h(y(")"),Z,x(")"),b):void 0}function Z(e){return"var"==e?h($,x(";"),Q):";"==e?h(Q):"variable"==e?h(Y):p(k,x(";"),Q)}function Y(e,t){return"in"==t||"of"==t?(Ae.marked="keyword",h(k)):h(L,Q)}function Q(e,t){return";"==e?h(J):"in"==t||"of"==t?(Ae.marked="keyword",h(k)):p(k,x(";"),J)}function J(e){")"!=e&&h(k)}function ee(e,t){return"*"==t?(Ae.marked="keyword",h(ee)):"variable"==e?(m(t),h(ee)):"("==e?h(g,y(")"),j(te,")"),b,_,v):void 0}function te(e){return"spread"==e?h(te):p(B,F)}function ne(e,t){return"variable"==e?(m(t),h(re)):void 0}function re(e,t){return"extends"==t?h(k,re):"{"==e?h(y("}"),ie,b):void 0}function ie(e,t){return"variable"==e||"keyword"==Ae.style?"static"==t?(Ae.marked="keyword",h(ie)):(Ae.marked="property","get"==t||"set"==t?h(oe,ee,ie):h(ee,ie)):"*"==t?(Ae.marked="keyword",h(ie)):";"==e?h(ie):"}"==e?h():void 0}function oe(e){return"variable"!=e?p():(Ae.marked="property",h())}function ae(e,t){return"string"==e?h(_):"variable"==e?(m(t),h(fe)):void 0}function le(e,t){return"*"==t?(Ae.marked="keyword",h(fe,x(";"))):"default"==t?(Ae.marked="keyword",h(k,x(";"))):p(_)}function se(e){return"string"==e?h():p(ce,fe)}function ce(e,t){return"{"==e?R(ce,"}"):("variable"==e&&m(t),"*"==t&&(Ae.marked="keyword"),h(ue))}function ue(e,t){return"as"==t?(Ae.marked="keyword",h(ce)):void 0}function fe(e,t){return"from"==t?(Ae.marked="keyword",h(k)):void 0}function de(e){return"]"==e?h():p(w,pe)}function pe(e){return"for"==e?p(he,x("]")):","==e?h(j(M,"]")):p(j(w,"]"))}function he(e){return"for"==e?h(X,he):"if"==e?h(k,he):void 0}function me(e,t){return"operator"==e.lastType||","==e.lastType||Se.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var ge,ve,ye=t.indentUnit,be=n.statementIndent,xe=n.jsonld,_e=n.json||xe,ke=n.typescript,we=n.wordCharacters||/[\w$\xa1-\uffff]/,Ce=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}(),Se=/[+\-*&%=<>!?|~^]/,Me=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Le="([{}])",Te={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Ae={state:null,column:null,marked:null,cc:null},ze={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!=K)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:_e?null:"/*",blockCommentEnd:_e?null:"*/",lineComment:_e?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:_e?"json":"javascript",jsonldMode:xe,jsonMode:_e}}),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 p=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 L[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();h=S.hasOwnProperty(t)?"atom":C.hasOwnProperty(t)?"keyword":"variable"}n.propertyKeywords||(n=e.resolveMode("text/css"));var p,h,m=t.indentUnit,g=n.tokenHooks,v=n.documentTypes||{},y=n.mediaTypes||{},b=n.mediaFeatures||{},x=n.propertyKeywords||{},_=n.nonStandardPropertyKeywords||{},k=n.fontProperties||{},w=n.counterDescriptors||{},C=n.colorKeywords||{},S=n.valueKeywords||{},M=n.allowNested,L={};return L.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)h="builtin";else if("word"==e)h="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},L.block=function(e,t,n){if("word"==e){var r=t.current().toLowerCase();return x.hasOwnProperty(r)?(h="property","maybeprop"):_.hasOwnProperty(r)?(h="string-2","maybeprop"):M?(h=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(h+=" error","maybeprop")}return"meta"==e?"block":M||"hash"!=e&&"qualifier"!=e?L.top(e,t,n):(h="error","block")},L.maybeprop=function(e,t,n){return":"==e?s(n,t,"prop"):u(e,t,n)},L.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 h+=" error";return"prop"},L.propBlock=function(e,t,n){return"}"==e?c(n):"word"==e?(h="property","maybeprop"):n.context.type},L.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")},L.pseudo=function(e,t,n){return"word"==e?(h="variable-3",n.context.type):u(e,t,n)},L.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();h="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":_.hasOwnProperty(r)?"string-2":S.hasOwnProperty(r)?"atom":"error"}return n.context.type},L.atBlock_parens=function(e,t,n){return")"==e?c(n):"{"==e||"}"==e?f(e,t,n,2):L.atBlock(e,t,n)},L.restricted_atBlock_before=function(e,t,n){return"{"==e?s(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(h="variable","restricted_atBlock_before"):u(e,t,n)},L.restricted_atBlock=function(e,t,n){return"}"==e?(n.stateArg=null,c(n)):"word"==e?(h="@font-face"==n.stateArg&&!k.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!w.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},L.keyframes=function(e,t,n){return"word"==e?(h="variable","keyframes"):"{"==e?s(n,t,"top"):u(e,t,n)},L.at=function(e,t,n){return";"==e?c(n):"{"==e||"}"==e?f(e,t,n):("word"==e?h="tag":"hash"==e&&(h="builtin"),"at")},L.interpolation=function(e,t,n){return"}"==e?c(n):"{"==e||";"==e?f(e,t,n):("word"==e?h="variable":"variable"!=e&&(h="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&&(p=n[1],n=n[0]),h=n,t.state=L[t.state](p,e,t),h},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"],p=t(d),h=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(h),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"],_=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:p,fontProperties:m,counterDescriptors:v,colorKeywords:b,valueKeywords:_,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:p,colorKeywords:b,valueKeywords:_,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:p,colorKeywords:b,valueKeywords:_,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"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlembedded",function(t,n){return e.multiplexingMode(e.getMode(t,"htmlmixed"),{open:n.open||n.scriptStartRegex||"<%",close:n.close||n.scriptEndRegex||"%>",mode:e.getMode(t,n.scriptingModeSpec)})},"htmlmixed"),e.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),e.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),e.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),e.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){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 p.propertyIsEnumerable(a)?(m.propertyIsEnumerable(a)&&(c="newstatement"),"keyword"):h.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,p=n.keywords||{},h=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",p="bracket",h="keyword",m="variable",g=e.indentUnit||2,v=e.indentUnit||2,y=t("true false nil"),b=t("defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),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->>"),_=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 w,C=!1;null!=(w=e.next());){if('"'==w&&!C){t.mode=!1;break}C=!C&&"\\"==w}n=c;break;default:var S=e.next();if('"'==S)t.mode="string",n=c;else if("\\"==S)a(e),n=u;else if("'"!=S||k.digit_or_colon.test(e.peek()))if(";"==S)e.skipToEnd(),n=s;else if(o(S,e))n=d;else if("("==S||"["==S||"{"==S){var M,L="",T=e.column();if("("==S)for(;null!=(M=e.eat(k.keyword_char));)L+=M;L.length>0&&(_.propertyIsEnumerable(L)||/^(?:def|with)/.test(L))?r(t,T+g,S):(e.eatSpace(),e.eol()||";"==e.peek()?r(t,T+v,S):r(t,T+e.current().length,S)),e.backUp(e.current().length-1),n=p}else if(")"==S||"]"==S||"}"==S)n=p,null!=t.indentStack&&t.indentStack.type==(")"==S?"(":"]"==S?"[":"{")&&i(t);else{if(":"==S)return e.eatWhile(k.symbol),f;e.eatWhile(k.symbol),n=b&&b.propertyIsEnumerable(e.current())?h: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 h="string",m=!0;e.eat("s")?h="atom":e.eat(/[WQ]/)?h="string":e.eat(/[r]/)?h="string-2":e.eat(/[wxq]/)&&(h="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(p.propertyIsEnumerable(g)&&(g=p[g]),n(a(g,h,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return n(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"]),p={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[r],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){e.sol()&&(t.indented=e.indentation());var n,r=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==r){var o=e.current();r="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==r&&(i=o,f.propertyIsEnumerable(o)?n="indent":d.propertyIsEnumerable(o)?n="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented<t.indented&&(n="indent"):n="indent")}return(c||r&&"comment"!=r)&&(t.lastTok=i),"|"==c&&(t.varList=!t.varList),"indent"==n||/[\(\[\{]/.test(c)?t.context={prev:t.context,type:c||r,indented:t.indented}:("dedent"==n||/[\)\]\}]/.test(c))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==c||"operator"==r),r},indent:function(t,n){if(t.tokenize[t.tokenize.length-1]!=r)return 0;var i=n&&n.charAt(0),o=t.context,a=o.type==p[i]||"keyword"==o.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(n);return o.indented+(a?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricChars:"}de",lineComment:"#"}}),e.defineMIME("text/x-ruby","ruby")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e){return e.scopes[e.scopes.length-1]}var r=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],o=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"],a={builtins:["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"],keywords:["exec","print"]},l={builtins:["ascii","bytes","exec","print"],
keywords:["nonlocal","False","True","None"]};e.registerHelper("hintWords","python",i.concat(o)),e.defineMode("python",function(s,c){function u(e,t){if(e.sol()&&"py"==n(t).type){var r=n(t).offset;if(e.eatSpace()){var i=e.indentation();return i>r?p(e,t,"py"):r>i&&h(e,t)&&(t.errorToken=!0),null}var o=f(e,t);return r>0&&h(e,t)&&(o+=" "+g),o}return f(e,t)}function f(e,t){if(e.eatSpace())return null;var n=e.peek();if("#"==n)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^\d+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f]+/i)&&(o=!0),e.match(/^0b[01]+/i)&&(o=!0),e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(M)?(t.tokenize=d(e.current()),t.tokenize(e,t)):e.match(x)||e.match(b)?null:e.match(y)||e.match(_)?"operator":e.match(v)?null:e.match(L)||e.match(r)?"keyword":e.match(T)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(k)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),g)}function d(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),n&&t.eol())return r}else{if(t.match(e))return i.tokenize=u,r;t.eat(/['"]/)}if(n){if(c.singleLineStringErrors)return g;i.tokenize=u}return r}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,r="string";return t.isString=!0,t}function p(e,t,r){var i=0,o=null;if("py"==r)for(;"py"!=n(t).type;)t.scopes.pop();i=n(t).offset+("py"==r?s.indentUnit:w),"py"==r||e.match(/^(\s|#.*)*$/,!1)||(o=e.column()+1),t.scopes.push({offset:i,type:r,align:o})}function h(e,t){for(var r=e.indentation();n(t).offset>r;){if("py"!=n(t).type)return!0;t.scopes.pop()}return n(t).offset!=r}function m(e,t){var r=t.tokenize(e,t),i=e.current();if("."==i)return r=e.match(k,!1)?null:g,null==r&&"meta"==t.lastStyle&&(r="meta"),r;if("@"==i)return c.version&&3==parseInt(c.version,10)?e.match(k,!1)?"meta":"operator":e.match(k,!1)?"meta":g;"variable"!=r&&"builtin"!=r||"meta"!=t.lastStyle||(r="meta"),("pass"==i||"return"==i)&&(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=n(t).type||p(e,t,"py");var o=1==i.length?"[({".indexOf(i):-1;if(-1!=o&&p(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),-1!=o){if(n(t).type!=i)return g;t.scopes.pop()}return t.dedent>0&&e.eol()&&"py"==n(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),r}var g="error",v=c.singleDelimiters||new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),y=c.doubleOperators||new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),b=c.doubleDelimiters||new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),x=c.tripleDelimiters||new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");if(c.version&&3==parseInt(c.version,10))var _=c.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"),k=c.identifiers||new RegExp("^[_A-Za-z¡-￿][_A-Za-z0-9¡-￿]*");else var _=c.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"),k=c.identifiers||new RegExp("^[_A-Za-z][_A-Za-z0-9]*");var w=c.hangingIndent||s.indentUnit,C=i,S=o;if(void 0!=c.extra_keywords&&(C=C.concat(c.extra_keywords)),void 0!=c.extra_builtins&&(S=S.concat(c.extra_builtins)),c.version&&3==parseInt(c.version,10)){C=C.concat(l.keywords),S=S.concat(l.builtins);var M=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}else{C=C.concat(a.keywords),S=S.concat(a.builtins);var M=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var L=t(C),T=t(S),A={startState:function(e){return{tokenize:u,scopes:[{offset:e||0,type:"py",align:null}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=m(e,t);t.lastStyle=r;var i=e.current();return i&&r&&(t.lastToken=i),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+g:r},indent:function(t,r){if(t.tokenize!=u)return t.tokenize.isString?e.Pass:0;var i=n(t),o=r&&r.charAt(0)==i.type;return null!=i.align?i.align-(o?1:0):o&&t.scopes.length>1?t.scopes[t.scopes.length-2].offset:i.offset},closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return A}),e.defineMIME("text/x-python","python");var s=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:s("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var n=t.split(" "),r=0;r<n.length;r++)i[n[r]]=e}function t(e,t){if(e.eatSpace())return null;var a=e.sol(),l=e.next();if("\\"===l)return e.next(),null;if("'"===l||'"'===l||"`"===l)return t.tokens.unshift(n(l)),r(e,t);if("#"===l)return a&&e.eat("!")?(e.skipToEnd(),"meta"):(e.skipToEnd(),"comment");if("$"===l)return t.tokens.unshift(o),r(e,t);if("+"===l||"="===l)return"operator";if("-"===l)return e.eat("-"),e.eatWhile(/\w/),"attribute";if(/\d/.test(l)&&(e.eatWhile(/\d/),e.eol()||!/\w/.test(e.peek())))return"number";e.eatWhile(/[\w-]/);var s=e.current();return"="===e.peek()&&/\w+/.test(s)?"def":i.hasOwnProperty(s)?i[s]:null}function n(e){return function(t,n){for(var r,i=!1,a=!1;null!=(r=t.next());){if(r===e&&!a){i=!0;break}if("$"===r&&!a&&"'"!==e){a=!0,t.backUp(1),n.tokens.unshift(o);break}a=!a&&"\\"===r}return(i||!a)&&n.tokens.shift(),"`"===e||")"===e?"quote":"string"}}function r(e,n){return(n.tokens[0]||t)(e,n)}var i={};e("atom","true false"),e("keyword","if then do else elif while until for in esac fi fin fil done exit set unset export function"),e("builtin","ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep kill killall ln ls make mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo tee telnet top touch vi vim wall wc wget who write yes zsh");var o=function(e,t){t.tokens.length>1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=n(")"),r(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return r(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t){return 0==e.length?r(t):function(i,o){for(var a=e[0],l=0;l<a.length;l++)if(i.match(a[l][0]))return o.tokenize=n(e.slice(1),t),a[l][1];return o.tokenize=r(t),"string"}}function r(e){return function(t,n){return i(t,n,e)}}function i(e,t,r){if(e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=n([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],r)),e.match(/\-\>\w/,!1)&&(t.tokenize=n([[["->",null]],[[/[\w]+/,"variable"]]],r)),"variable-2";for(var i=!1;!e.eol()&&(i||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(r)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",l="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,l].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var s={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),atoms:t(a),builtin:t(l),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){if(e.match(/<</)){e.eatWhile(/[\w\.]/);var n=e.current().slice(3);if(n)return(t.tokStack||(t.tokStack=[])).push(n,0),t.tokenize=r(n),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=r('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=r(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,n){function r(e,t){var n=t.curMode==o;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),n)return n&&null==t.php.tokenize&&e.match("?>")?(t.curMode=i,t.curState=t.html,"meta"):o.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=o,t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var r="string"}else if(t.pending&&e.pos<t.pending.end){e.pos=t.pending.end;var r=t.pending.style}else var r=i.token(e,t.curState);t.pending&&(t.pending=null);var a,l=e.current(),s=l.search(/<\?/);return-1!=s&&("string"==r&&(a=l.match(/[\'\"]$/))&&!/\?>/.test(l)?t.pending=a[0]:t.pending={end:e.pos,style:r},e.backUp(l.length-s)),r}var i=e.getMode(t,"text/html"),o=e.getMode(t,s);return{startState:function(){var t=e.startState(i),r=e.startState(o);return{html:t,php:r,curMode:n.startOpen?o:i,curState:n.startOpen?r:t,pending:null}},copyState:function(t){var n,r=t.html,a=e.copyState(i,r),l=t.php,s=e.copyState(o,l);return n=t.curMode==i?a:s,{html:a,php:s,curMode:t.curMode,curState:n,pending:t.pending}},token:r,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",s)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,n){function r(e,t){var n=e.next();if(h[n]){var r=h[n](e,t);if(r!==!1)return r}if(1==p.hexNumber&&("0"==n&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==n||"X"==n)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==n||"B"==n)&&e.match(/^'[01]+'/)||"0"==n&&e.match(/^b[01]+/)))return"number";if(n.charCodeAt(0)>47&&n.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==n&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==n||'"'==n&&p.doubleQuote)return t.tokenize=i(n),t.tokenize(e,t);if((1==p.nCharCast&&("n"==n||"N"==n)||1==p.charsetCast&&"_"==n&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(n))return null;if(p.commentSlashSlash&&"/"==n&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==n||"-"==n&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==n&&e.eat("*"))return t.tokenize=o,t.tokenize(e,t);if("."!=n){if(d.test(n))return e.eatWhile(d),null;if("{"==n&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return m.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(a)?"atom":u.hasOwnProperty(a)?"builtin":f.hasOwnProperty(a)?"keyword":s.hasOwnProperty(a)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function i(e){return function(t,n){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){n.tokenize=r;break}o=!o&&"\\"==i}return"string"}}function o(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=r;break}}return"comment"}function a(e,t,n){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:n}}function l(e){e.indent=e.context.indent,e.context=e.context.prev}var s=n.client||{},c=n.atoms||{"false":!0,"true":!0,"null":!0},u=n.builtin||{},f=n.keywords||{},d=n.operatorChars||/^[*+\-%<>!=&|~^]/,p=n.support||{},h=n.hooks||{},m=n.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:r,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var n=t.tokenize(e,t);if("comment"==n)return n;t.context&&null==t.context.align&&(t.context.align=!0);var r=e.current();return"("==r?a(e,t,")"):"["==r?a(e,t,"]"):t.context&&t.context.type==r&&l(t),n},indent:function(n,r){var i=n.context;if(!i)return e.Pass;var o=r.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function n(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function r(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function i(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}var o="alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where ";e.defineMIME("text/x-sql",{name:"sql",keywords:i(o+"begin"),builtin:i("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:i("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":n}}),e.defineMIME("text/x-mysql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":r}}),e.defineMIME("text/x-mariadb",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":r}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:i("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:i("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")})}()}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(e,t){function n(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function r(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var n=t.scope.offset;if(e.eatSpace()){var r=e.indentation();return r>n&&"coffee"==t.scope.type?"indent":n>r?"dedent":null}n>0&&l(e,t)}if(e.eatSpace())return null;var a=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===a)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var s=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(s=!0),e.match(/^-?\d+\.\d*/)&&(s=!0),e.match(/^-?\.\d+/)&&(s=!0),s)return"."==e.peek()&&e.backUp(1),"number";var m=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(m=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^-?0(?![\dx])/i)&&(m=!0),m)return"number"}if(e.match(y))return t.tokenize=i(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(b)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=i(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(u)||e.match(h)?"operator":e.match(f)?"punctuation":e.match(_)?"atom":e.match(v)?"keyword":e.match(d)?"variable":e.match(p)?"property":(e.next(),c)}function i(e,n,i){return function(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return i}else{if(o.match(e))return a.tokenize=r,i;o.eat(/['"\/]/)}return n&&(t.singleLineStringErrors?i=c:a.tokenize=r),i}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=r;break}e.eatWhile("#")}return"comment"}function a(t,n,r){r=r||"coffee";for(var i=0,o=!1,a=null,l=n.scope;l;l=l.prev)if("coffee"===l.type||"}"==l.type){i=l.offset+e.indentUnit;break}"coffee"!==r?(o=null,a=t.column()+t.current().length):n.scope.align&&(n.scope.align=!1),n.scope={offset:i,type:r,prev:n.scope,align:o,alignOffset:a}}function l(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var n=e.indentation(),r=!1,i=t.scope;i;i=i.prev)if(n===i.offset){r=!0;break}if(!r)return!0;for(;t.scope.prev&&t.scope.offset!==n;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function s(e,t){var n=t.tokenize(e,t),r=e.current();if("."===r)return n=t.tokenize(e,t),r=e.current(),/^\.[\w$]+$/.test(r)?"variable":c;"return"===r&&(t.dedent=!0),("->"!==r&&"=>"!==r||t.lambda||e.peek())&&"indent"!==n||a(e,t);var i="[({".indexOf(r);if(-1!==i&&a(e,t,"])}".slice(i,i+1)),m.exec(r)&&a(e,t),"then"==r&&l(e,t),"dedent"===n&&l(e,t))return c;if(i="])}".indexOf(r),-1!==i){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==r&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),n}var c="error",u=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,f=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,d=/^[_A-Za-z$][_A-Za-z$0-9]*/,p=/^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/,h=n(["and","or","not","is","isnt","in","instanceof","typeof"]),m=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],v=n(m.concat(g));m=n(m);var y=/^('{3}|\"{3}|['\"])/,b=/^(\/{3}|\/)/,x=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],_=n(x),k={startState:function(e){return{tokenize:r,scope:{offset:e||0,type:"coffee",prev:null,align:!1},lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=null===t.scope.align&&t.scope;n&&e.sol()&&(n.align=!1);var r=s(e,t);return n&&r&&"comment"!=r&&(n.align=!0),t.lastToken={style:r,content:e.current()},e.eol()&&e.lambda&&(t.lambda=!1),r},indent:function(e,t){if(e.tokenize!=r)return 0;var n=e.scope,i=t&&"])}".indexOf(t.charAt(0))>-1;if(i)for(;"coffee"==n.type&&n.prev;)n=n.prev;var o=i&&n.type===t.charAt(0);return n.align?n.alignOffset-(o?1:0):(o?n.prev:n).offset},lineComment:"#",fold:"indent"};return k}),e.defineMIME("text/x-coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,n){var r=e.peek(),i=n.escaped;if(n.escaped=!1,"#"==r&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(n.literal&&e.indentation()>n.keyCol)return e.skipToEnd(),"string";if(n.literal&&(n.literal=!1),e.sol()){if(n.keyCol=0,n.pair=!1,n.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==r?n.inlinePairs++:"}"==r?n.inlinePairs--:"["==r?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&","==r)return e.next(),"meta";if(n.inlinePairs>0&&!i&&","==r)return n.keyCol=0,n.pair=!1,n.pairStart=!1,e.next(),"meta";if(n.pairStart){if(e.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==n.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!n.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(n.pair=!0,n.keyCol=e.indentation(),"atom"):n.pair&&e.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped="\\"==r,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),e.defineMIME("text/x-yaml","yaml")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jade",function(t){function n(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=Y.startState(),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function r(e,t){if(e.sol()&&(t.javaScriptLine=!1,t.javaScriptLineExcludesColon=!1),t.javaScriptLine){if(t.javaScriptLineExcludesColon&&":"===e.peek())return t.javaScriptLine=!1,void(t.javaScriptLineExcludesColon=!1);var n=Y.token(e,t.jsState);return e.eol()&&(t.javaScriptLine=!1),n||!0}}function i(e,t){if(t.javaScriptArguments){if(0===t.javaScriptArgumentsDepth&&"("!==e.peek())return void(t.javaScriptArguments=!1);if("("===e.peek()?t.javaScriptArgumentsDepth++:")"===e.peek()&&t.javaScriptArgumentsDepth--,0===t.javaScriptArgumentsDepth)return void(t.javaScriptArguments=!1);var n=Y.token(e,t.jsState);return n||!0}}function o(e){return e.match(/^yield\b/)?"keyword":void 0}function a(e){return e.match(/^(?:doctype) *([^\n]+)?/)?G:void 0}function l(e,t){return e.match("#{")?(t.isInterpolating=!0,t.interpolationNesting=0,"punctuation"):void 0}function s(e,t){if(t.isInterpolating){if("}"===e.peek()){if(t.interpolationNesting--,t.interpolationNesting<0)return e.next(),t.isInterpolating=!1,"puncutation"}else"{"===e.peek()&&t.interpolationNesting++;return Y.token(e,t.jsState)||!0}}function c(e,t){return e.match(/^case\b/)?(t.javaScriptLine=!0,V):void 0}function u(e,t){return e.match(/^when\b/)?(t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,V):void 0}function f(e){return e.match(/^default\b/)?V:void 0}function d(e,t){return e.match(/^extends?\b/)?(t.restOfLine="string",V):void 0}function p(e,t){return e.match(/^append\b/)?(t.restOfLine="variable",V):void 0}function h(e,t){return e.match(/^prepend\b/)?(t.restOfLine="variable",V):void 0}function m(e,t){return e.match(/^block\b *(?:(prepend|append)\b)?/)?(t.restOfLine="variable",V):void 0}function g(e,t){return e.match(/^include\b/)?(t.restOfLine="string",V):void 0}function v(e,t){return e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match("include")?(t.isIncludeFiltered=!0,V):void 0}function y(e,t){if(t.isIncludeFiltered){var n=L(e,t);return t.isIncludeFiltered=!1,t.restOfLine="string",n}}function b(e,t){return e.match(/^mixin\b/)?(t.javaScriptLine=!0,V):void 0}function x(e,t){return e.match(/^\+([-\w]+)/)?(e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),"variable"):e.match(/^\+#{/,!1)?(e.next(),t.mixinCallAfter=!0,l(e,t)):void 0}function _(e,t){return t.mixinCallAfter?(t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0):void 0}function k(e,t){return e.match(/^(if|unless|else if|else)\b/)?(t.javaScriptLine=!0,V):void 0}function w(e,t){return e.match(/^(- *)?(each|for)\b/)?(t.isEach=!0,V):void 0}function C(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,V;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return"variable"}}}function S(e,t){return e.match(/^while\b/)?(t.javaScriptLine=!0,V):void 0}function M(e,t){var n;return(n=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))?(t.lastTag=n[1].toLowerCase(),"script"===t.lastTag&&(t.scriptType="application/javascript"),"tag"):void 0}function L(n,r){if(n.match(/^:([\w\-]+)/)){var i;return t&&t.innerModes&&(i=t.innerModes(n.current().substring(1))),i||(i=n.current().substring(1)),"string"==typeof i&&(i=e.getMode(t,i)),W(n,r,i),"atom"}}function T(e,t){return e.match(/^(!?=|-)/)?(t.javaScriptLine=!0,"punctuation"):void 0}function A(e){return e.match(/^#([\w-]+)/)?K:void 0}function z(e){return e.match(/^\.([\w-]+)/)?X:void 0}function E(e,t){return"("==e.peek()?(e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue="",t.attributeIsType=!1,"punctuation"):void 0}function O(e,t){if(t.isAttrs){if(Z[e.peek()]&&t.attrsNest.push(Z[e.peek()]),t.attrsNest[t.attrsNest.length-1]===e.peek())t.attrsNest.pop();else if(e.eat(")"))return t.isAttrs=!1,"punctuation";if(t.inAttributeName&&e.match(/^[^=,\)!]+/))return("="===e.peek()||"!"===e.peek())&&(t.inAttributeName=!1,t.jsState=Y.startState(),"script"===t.lastTag&&"type"===e.current().trim().toLowerCase()?t.attributeIsType=!0:t.attributeIsType=!1),"attribute";var n=Y.token(e,t.jsState);if(t.attributeIsType&&"string"===n&&(t.scriptType=e.current().toString()),0===t.attrsNest.length&&("string"===n||"variable"===n||"keyword"===n))try{return Function("","var x "+t.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),t.inAttributeName=!0,t.attrValue="",e.backUp(e.current().length),O(e,t)}catch(r){}return t.attrValue+=e.current(),n||!0}}function q(e,t){return e.match(/^&attributes\b/)?(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,"keyword"):void 0}function N(e){return e.sol()&&e.eatSpace()?"indent":void 0}function I(e,t){return e.match(/^ *\/\/(-)?([^\n]*)/)?(t.indentOf=e.indentation(),t.indentToken="comment","comment"):void 0}function P(e){return e.match(/^: */)?"colon":void 0}function D(e,t){return e.match(/^(?:\| ?| )([^\n]+)/)?"string":e.match(/^(<[^\n]*)/,!1)?(W(e,t,"htmlmixed"),t.innerModeForLine=!0,F(e,t,!0)):void 0}function j(e,t){if(e.eat(".")){var n=null;return"script"===t.lastTag&&-1!=t.scriptType.toLowerCase().indexOf("javascript")?n=t.scriptType.toLowerCase().replace(/"|'/g,""):"style"===t.lastTag&&(n="css"),W(e,t,n),"dot"}}function R(e){return e.next(),null}function W(n,r,i){i=e.mimeModes[i]||i,i=t.innerModes?t.innerModes(i)||i:i,i=e.mimeModes[i]||i,i=e.getMode(t,i),r.indentOf=n.indentation(),i&&"null"!==i.name?r.innerMode=i:r.indentToken="string"}function F(e,t,n){return e.indentation()>t.indentOf||t.innerModeForLine&&!e.sol()||n?t.innerMode?(t.innerState||(t.innerState=t.innerMode.startState?t.innerMode.startState(e.indentation()):{}),e.hideFirstChars(t.indentOf+2,function(){return t.innerMode.token(e,t.innerState)||!0})):(e.skipToEnd(),t.indentToken):void(e.sol()&&(t.indentOf=1/0,t.indentToken=null,t.innerMode=null,t.innerState=null))}function H(e,t){if(e.sol()&&(t.restOfLine=""),t.restOfLine){e.skipToEnd();var n=t.restOfLine;return t.restOfLine="",n}}function $(){return new n}function B(e){return e.copy()}function U(e,t){var n=F(e,t)||H(e,t)||s(e,t)||y(e,t)||C(e,t)||O(e,t)||r(e,t)||i(e,t)||_(e,t)||o(e,t)||a(e,t)||l(e,t)||c(e,t)||u(e,t)||f(e,t)||d(e,t)||p(e,t)||h(e,t)||m(e,t)||g(e,t)||v(e,t)||b(e,t)||x(e,t)||k(e,t)||w(e,t)||S(e,t)||M(e,t)||L(e,t)||T(e,t)||A(e,t)||z(e,t)||E(e,t)||q(e,t)||N(e,t)||D(e,t)||I(e,t)||P(e,t)||j(e,t)||R(e,t);return n===!0?null:n}var V="keyword",G="meta",K="builtin",X="qualifier",Z={"{":"}","(":")","[":"]"},Y=e.getMode(t,"javascript");return n.prototype.copy=function(){var t=new n;return t.javaScriptLine=this.javaScriptLine,t.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,t.javaScriptArguments=this.javaScriptArguments,t.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,t.isInterpolating=this.isInterpolating,t.interpolationNesting=this.intpolationNesting,t.jsState=e.copyState(Y,this.jsState),t.innerMode=this.innerMode,this.innerMode&&this.innerState&&(t.innerState=e.copyState(this.innerMode,this.innerState)),t.restOfLine=this.restOfLine,t.isIncludeFiltered=this.isIncludeFiltered,t.isEach=this.isEach,t.lastTag=this.lastTag,t.scriptType=this.scriptType,t.isAttrs=this.isAttrs,t.attrsNest=this.attrsNest.slice(),t.inAttributeName=this.inAttributeName,t.attributeIsType=this.attributeIsType,t.attrValue=this.attrValue,t.indentOf=this.indentOf,t.indentToken=this.indentToken,t.innerModeForLine=this.innerModeForLine,t},{startState:$,copyState:B,token:U}}),e.defineMIME("text/x-jade","jade")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("lua",function(e,t){function n(e){return new RegExp("^(?:"+e.join("|")+")","i")}function r(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function i(e){for(var t=0;e.eat("=");)++t;return e.eat("["),t}function o(e,t){var n=e.next();return"-"==n&&e.eat("-")?e.eat("[")&&e.eat("[")?(t.cur=a(i(e),"comment"))(e,t):(e.skipToEnd(),"comment"):'"'==n||"'"==n?(t.cur=l(n))(e,t):"["==n&&/[\[=]/.test(e.peek())?(t.cur=a(i(e),"string"))(e,t):/\d/.test(n)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(n)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function a(e,t){return function(n,r){for(var i,a=null;null!=(i=n.next());)if(null==a)"]"==i&&(a=0);else if("="==i)++a;else{if("]"==i&&a==e){r.cur=o;break}a=null}return t}}function l(e){return function(t,n){for(var r,i=!1;null!=(r=t.next())&&(r!=e||i);)i=!i&&"\\"==r;return i||(n.cur=o),"string"}}var s=e.indentUnit,c=r(t.specials||[]),u=r(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),f=r(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),d=r(["function","if","repeat","do","\\(","{"]),p=r(["end","until","\\)","}"]),h=n(["end","until","\\)","}","else","elseif"]);return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:o}},token:function(e,t){if(e.eatSpace())return null;var n=t.cur(e,t),r=e.current();return"variable"==n&&(f.test(r)?n="keyword":u.test(r)?n="builtin":c.test(r)&&(n="variable-2")),"comment"!=n&&"string"!=n&&(d.test(r)?++t.indentDepth:p.test(r)&&--t.indentDepth),n},indent:function(e,t){var n=h.test(t);return e.basecol+s*(e.indentDepth-(n?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),e.defineMIME("text/x-lua","lua")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("cmake",function(){function e(e,t){for(var n,r,i=!1;!e.eol()&&(n=e.next())!=t.pending;){if("$"===n&&"\\"!=r&&'"'==t.pending){i=!0;break}r=n}return i&&e.backUp(1),n==t.pending?t.continueString=!1:t.continueString=!0,"string"}function t(t,r){var i=t.next();return"$"===i?t.match(n)?"variable-2":"variable":r.continueString?(t.backUp(1),e(t,r)):t.match(/(\s+)?\w+\(/)||t.match(/(\s+)?\w+\ \(/)?(t.backUp(1),"def"):"#"==i?(t.skipToEnd(),"comment"):"'"==i||'"'==i?(r.pending=i,e(t,r)):"("==i||")"==i?"bracket":i.match(/[0-9]/)?"number":(t.eatWhile(/[\w-]/),null)}var n=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var e={};return e.inDefinition=!1,e.inInclude=!1,e.continueString=!1,e.pending=!1,e},token:function(e,n){return e.eatSpace()?null:t(e,n)}}}),e.defineMIME("text/x-cmake","cmake")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t){return l=t,e}function r(e,t){e.eatWhile(/[\w\$_]/);var r=e.current();if(s.propertyIsEnumerable(r))return"keyword";if(c.propertyIsEnumerable(r))return"variable-2";if(u.propertyIsEnumerable(r))return"string-2";var l=e.next();return"@"==l?(e.eatWhile(/[\w\\\-]/),n("meta",e.current())):"/"==l&&e.eat("*")?(t.tokenize=i,i(e,t)):"<"==l&&e.eat("!")?(t.tokenize=o,o(e,t)):"="!=l?"~"!=l&&"|"!=l||!e.eat("=")?'"'==l||"'"==l?(t.tokenize=a(l),t.tokenize(e,t)):"#"==l?(e.skipToEnd(),n("comment","comment")):"!"==l?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(l)?(e.eatWhile(/[\w.%]/),n("number","unit")):/[,.+>*\/]/.test(l)?n(null,"select-op"):/[;{}:\[\]]/.test(l)?n(null,l):(e.eatWhile(/[\w\\\-]/),n("variable","variable")):n(null,"compare"):void n(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=r;break}o="*"==i}return n("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=r;break}o="-"==i?o+1:0}return n("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=r),n("string","string")}}var l,s=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),c=t("http mail events server types location upstream charset_map limit_except if geo map"),u=t("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),f=e.indentUnit;
return{startState:function(e){return{tokenize:r,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;l=null;var n=t.tokenize(e,t),r=t.stack[t.stack.length-1];return"hash"==l&&"rule"==r?n="atom":"variable"==n&&("rule"==r?n="number":r&&"@media{"!=r||(n="tag")),"rule"==r&&/^[\{\};]$/.test(l)&&t.stack.pop(),"{"==l?"@media"==r?t.stack[t.stack.length-1]="@media{":t.stack.push("{"):"}"==l?t.stack.pop():"@media"==l?t.stack.push("@media"):"{"==r&&"comment"!=l&&t.stack.push("rule"),n},indent:function(e,t){var n=e.stack.length;return/^\}/.test(t)&&(n-="rule"==e.stack[e.stack.length-1]?2:1),e.baseIndent+n*f},electricChars:"}"}}),e.defineMIME("text/nginx","text/x-nginx-conf")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.string.charAt(e.pos+(t||0))}function n(e,t){if(t){var n=e.pos-t;return e.string.substr(n>=0?n:0,t)}return e.string.substr(0,e.pos-1)}function r(e,t){var n=e.string.length,r=n-e.pos+1;return e.string.substr(e.pos,t&&n>t?t:r)}function i(e,t){var n,r=e.pos+t;0>=r?e.pos=0:r>=(n=e.string.length-1)?e.pos=n:e.pos=r}e.defineMode("perl",function(){function e(e,t,n,r,i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e,t){for(var o,l=!1,s=0;o=e.next();){if(o===n[s]&&!l)return void 0!==n[++s]?(t.chain=n[s],t.style=r,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,r;l=!l&&"\\"==o}return r},t.tokenize(e,t)}function o(e,t,n){return t.tokenize=function(e,t){return e.string==n&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var f=a.next();if('"'==f||"'"==f){if(n(a,3)=="<<"+f){var d=a.pos;a.eatWhile(/\w/);var p=a.current().substr(1);if(p&&a.eat(f))return o(a,u,p);a.pos=d}return e(a,u,[f],"string")}if("q"==f){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],s,c);if("["==h)return i(a,2),e(a,u,["]"],s,c);if("{"==h)return i(a,2),e(a,u,["}"],s,c);if("<"==h)return i(a,2),e(a,u,[">"],s,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],s,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],s,c);if("["==h)return i(a,2),e(a,u,["]"],s,c);if("{"==h)return i(a,2),e(a,u,["}"],s,c);if("<"==h)return i(a,2),e(a,u,[">"],s,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],s,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==f){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],s,c);if("("==h)return e(a,u,[")"],s,c);if("["==h)return e(a,u,["]"],s,c);if("{"==h)return e(a,u,["}"],s,c);if("<"==h)return e(a,u,[">"],s,c)}}if("s"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],s,c):"{"==h?e(a,u,["}","}"],s,c):"<"==h?e(a,u,[">",">"],s,c):"("==h?e(a,u,[")",")"],s,c):e(a,u,[h,h],s,c)}if("y"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],s,c):"{"==h?e(a,u,["}","}"],s,c):"<"==h?e(a,u,[">",">"],s,c):"("==h?e(a,u,[")",")"],s,c):e(a,u,[h,h],s,c)}if("t"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat("r"),h&&(h=a.eat(/[(\[{<\^'"!~\/]/))))return"["==h?e(a,u,["]","]"],s,c):"{"==h?e(a,u,["}","}"],s,c):"<"==h?e(a,u,[">",">"],s,c):"("==h?e(a,u,[")",")"],s,c):e(a,u,[h,h],s,c)}if("`"==f)return e(a,u,[f],"variable-2");if("/"==f)return/~\s*$/.test(n(a))?e(a,u,[f],s,c):"operator";if("$"==f){var d=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=d}if(/[$@%]/.test(f)){var d=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(t(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var h=a.current();if(l[h])return"variable-2"}a.pos=d}if(/[$@%&]/.test(f)&&(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}"))){var h=a.current();return l[h]?"variable-2":"variable"}if("#"==f&&"$"!=t(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(f)){var d=a.pos;if(a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),l[a.current()])return"operator";a.pos=d}if("_"==f&&1==a.pos){if("_END__"==r(a,6))return e(a,u,["\x00"],"comment");if("_DATA__"==r(a,7))return e(a,u,["\x00"],"variable-2");if("_C__"==r(a,7))return e(a,u,["\x00"],"string")}if(/\w/.test(f)){var d=a.pos;if("{"==t(a,-2)&&("}"==t(a,0)||a.eatWhile(/\w/)&&"}"==t(a,0)))return"string";a.pos=d}if(/[A-Z]/.test(f)){var m=t(a,-2),d=a.pos;if(a.eatWhile(/[A-Z_]/),!/[\da-z]/.test(t(a,0))){var h=l[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}a.pos=d}if(/[a-zA-Z_]/.test(f)){var m=t(a,-2);a.eatWhile(/\w/);var h=l[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}return null}var l={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},s="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:a,chain:null,style:null,tail:null}},token:function(e,t){return(t.tokenize||a)(e,t)},lineComment:"#"}}),e.registerHelper("wordChars","perl",/[\w$]/),e.defineMIME("text/x-perl","perl")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sass",function(e){function t(e){return new RegExp("^"+e.join("|"))}function n(e,t){var n=e.peek();return")"===n?(e.next(),t.tokenizer=s,"operator"):"("===n?(e.next(),e.eatSpace(),"operator"):"'"===n||'"'===n?(t.tokenizer=i(e.next()),"string"):(t.tokenizer=i(")",!1),"string")}function r(e,t){return function(n,r){return n.sol()&&n.indentation()<=e?(r.tokenizer=s,s(n,r)):(t&&n.skipTo("*/")?(n.next(),n.next(),r.tokenizer=s):n.skipToEnd(),"comment")}}function i(e,t){function n(r,i){var a=r.next(),l=r.peek(),c=r.string.charAt(r.pos-2),u="\\"!==a&&l===e||a===e&&"\\"!==c;return u?(a!==e&&t&&r.next(),i.tokenizer=s,"string"):"#"===a&&"{"===l?(i.tokenizer=o(n),r.next(),"operator"):"string"}return null==t&&(t=!0),n}function o(e){return function(t,n){return"}"===t.peek()?(t.next(),n.tokenizer=e,"operator"):s(t,n)}}function a(t){if(0==t.indentCount){t.indentCount++;var n=t.scopes[0].offset,r=n+e.indentUnit;t.scopes.unshift({offset:r})}}function l(e){1!=e.scopes.length&&e.scopes.shift()}function s(e,t){var c=e.peek();if(e.match("/*"))return t.tokenizer=r(e.indentation(),!0),t.tokenizer(e,t);if(e.match("//"))return t.tokenizer=r(e.indentation(),!1),t.tokenizer(e,t);if(e.match("#{"))return t.tokenizer=o(s),"operator";if('"'===c||"'"===c)return e.next(),t.tokenizer=i(c),"string";if(t.cursorHalf){if("#"===c&&(e.next(),e.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^-?[0-9\.]+/))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^(px|em|in)\b/))return e.peek()||(t.cursorHalf=0),"unit";if(e.match(f))return e.peek()||(t.cursorHalf=0),"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=n,e.peek()||(t.cursorHalf=0),"atom";if("$"===c)return e.next(),e.eatWhile(/[\w-]/),e.peek()||(t.cursorHalf=0),"variable-3";if("!"===c)return e.next(),e.peek()||(t.cursorHalf=0),e.match(/^[\w]+/)?"keyword":"operator";if(e.match(p))return e.peek()||(t.cursorHalf=0),"operator";if(e.eatWhile(/[\w-]/))return e.peek()||(t.cursorHalf=0),"attribute";if(!e.peek())return t.cursorHalf=0,null}else{if("."===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("#"===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("$"===c)return e.next(),e.eatWhile(/[\w-]/),"variable-2";if(e.match(/^-?[0-9\.]+/))return"number";if(e.match(/^(px|em|in)\b/))return"unit";if(e.match(f))return"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=n,"atom";if("="===c&&e.match(/^=[\w-]+/))return a(t),"meta";if("+"===c&&e.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&e.match(/@extend/)&&(e.match(/\s*[\w]/)||l(t)),e.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(t),"meta";if("@"===c)return e.next(),e.eatWhile(/[\w-]/),"meta";if(e.eatWhile(/[\w-]/))return e.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":e.match(/ *:/,!1)?(a(t),t.cursorHalf=1,"atom"):e.match(/ *,/,!1)?"atom":(a(t),"atom");if(":"===c)return e.match(h)?"keyword":(e.next(),t.cursorHalf=1,"operator")}return e.match(p)?"operator":(e.next(),null)}function c(t,n){t.sol()&&(n.indentCount=0);var r=n.tokenizer(t,n),i=t.current();if(("@return"===i||"}"===i)&&l(n),null!==r){for(var o=t.pos-i.length,a=o+e.indentUnit*n.indentCount,s=[],c=0;c<n.scopes.length;c++){var u=n.scopes[c];u.offset<=a&&s.push(u)}n.scopes=s}return r}var u=["true","false","null","auto"],f=new RegExp("^"+u.join("|")),d=["\\(","\\)","=",">","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],p=t(d),h=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:s,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(e,t){var n=c(e,t);return t.lastToken={style:n,content:e.current()},n},indent:function(e){return e.scopes[0].offset}}}),e.defineMIME("text/x-sass","sass")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),n={},r=0;r<t.length;++r)n[t[r]]=!0;return n}function n(e,t){a=null;var n=e.next();if("#"==n)return e.skipToEnd(),"comment";if("0"==n&&e.eat("x"))return e.eatWhile(/[\da-f]/i),"number";if("."==n&&e.eat(/\d/))return e.match(/\d*(?:e[+\-]?\d+)?/),"number";if(/\d/.test(n))return e.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/),"number";if("'"==n||'"'==n)return t.tokenize=r(n),"string";if("."==n&&e.match(/.[.\d]+/))return"keyword";if(/[\w\.]/.test(n)&&"_"!=n){e.eatWhile(/[\w\.]/);var i=e.current();return l.propertyIsEnumerable(i)?"atom":c.propertyIsEnumerable(i)?(u.propertyIsEnumerable(i)&&!e.match(/\s*if(\s+|$)/,!1)&&(a="block"),"keyword"):s.propertyIsEnumerable(i)?"builtin":"variable"}return"%"==n?(e.skipTo("%")&&e.next(),"variable-2"):"<"==n&&e.eat("-")?"arrow":"="==n&&t.ctx.argList?"arg-is":f.test(n)?"$"==n?"dollar":(e.eatWhile(f),"operator"):/[\(\){}\[\];]/.test(n)?(a=n,";"==n?"semi":null):null}function r(e){return function(t,r){if(t.eat("\\")){var i=t.next();return"x"==i?t.match(/^[a-f0-9]{2}/i):("u"==i||"U"==i)&&t.eat("{")&&t.skipTo("}")?t.next():"u"==i?t.match(/^[a-f0-9]{4}/i):"U"==i?t.match(/^[a-f0-9]{8}/i):/[0-7]/.test(i)&&t.match(/^[0-7]{1,2}/),"string-2"}for(var o;null!=(o=t.next());){if(o==e){r.tokenize=n;break}if("\\"==o){t.backUp(1);break}}return"string"}}function i(e,t,n){e.ctx={type:t,indent:e.indent,align:null,column:n.column(),prev:e.ctx}}function o(e){e.indent=e.ctx.indent,e.ctx=e.ctx.prev}var a,l=t("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"),s=t("list quote bquote eval return call parse deparse"),c=t("if else repeat while function for in next break"),u=t("if else repeat while function for"),f=/[+\-*\/^<>=!&|~$:]/;return{startState:function(){return{tokenize:n,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var n=t.tokenize(e,t);"comment"!=n&&null==t.ctx.align&&(t.ctx.align=!0);var r=t.ctx.type;return";"!=a&&"{"!=a&&"}"!=a||"block"!=r||o(t),"{"==a?i(t,"}",e):"("==a?(i(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==a?i(t,"]",e):"block"==a?i(t,"block",e):a==r&&o(t),t.afterIdent="variable"==n||"keyword"==n,n},indent:function(t,r){if(t.tokenize!=n)return 0;var i=r&&r.charAt(0),o=t.ctx,a=i==o.type;return"block"==o.type?o.indent+("{"==i?0:e.indentUnit):o.align?o.column+(a?0:1):o.indent+(a?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],e):e(CodeMirror)}(function(e){"use strict";var t=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],n="("+t.join("|")+")",r=new RegExp(n+"\\s*$","i"),i=new RegExp(n+"(\\s+)","i");e.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:r,token:"variable-2"},{regex:i,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}]}),e.defineMIME("text/x-dockerfile","dockerfile")}),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,p=e.keyMap["default"]==e.keyMap.macDefault,h=p?"Cmd-":"Ctrl-";f[u["Alt-Left"]="goSubwordLeft"]=function(e){n(e,-1)},f[u["Alt-Right"]="goSubwordRight"]=function(e){n(e,1)},f[u[h+"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[h+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},f[u["Shift-"+h+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)for(var i=t[r].from(),o=t[r].to(),a=i.line;a<=o.line;++a)o.line>i.line&&a==o.line&&0==o.ch||n.push({anchor:a==i.line?i:d(a,0),head:a==o.line?o:d(a)});e.setSelections(n,0)},u["Shift-Tab"]="indentLess",f[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},f[u[h+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r];n.push({anchor:d(i.from().line,0),head:d(i.to().line+1,0)})}e.setSelections(n)},u["Shift-"+h+"K"]="deleteLine",f[u[h+"Enter"]="insertLineAfter"]=function(e){r(e,!1)},f[u["Shift-"+h+"Enter"]="insertLineBefore"]=function(e){r(e,!0)},f[u[h+"D"]="selectNextOccurrence"]=function(t){var n=t.getCursor("from"),r=t.getCursor("to"),o=t.state.sublimeFindFullWord==t.doc.sel;if(0==e.cmpPos(n,r)){var a=i(t,n);if(!a.word)return;t.setSelection(a.from,a.to),o=!0}else{var 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-"+h+"Space"]="selectScope"]=function(e){o(e)||e.execCommand("selectAll")},f[u["Shift-"+h+"M"]="selectBetweenBrackets"]=function(t){return o(t)?void 0:e.Pass},f[u[h+"M"]="goToBracket"]=function(t){t.extendSelectionsBy(function(n){var r=t.scanForBracket(n.head,1);if(r&&0!=e.cmpPos(r.pos,n.head))return r.pos;var i=t.scanForBracket(n.head,-1);return i&&d(i.pos.line,i.pos.ch+1)||n.head})};var g=p?"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[h+"/"]="toggleComment",f[u[h+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){for(var i=t[r],o=i.from(),a=o.line,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-"+h+"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[h+"T"]="transposeChars",f[u.F9="sortLines"]=function(e){a(e,!0)},f[u[h+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},f[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),r=n.find();if(r)return t.push(n),e.setSelection(r.from,r.to)}},f[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(n)return e.setSelection(n.from,n.to);t.pop()}},f[u[h+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),r=0;r<t.length;r++){for(var i=t[r].from(),o=t[r].to(),a=e.findMarks(i,o),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-"+h+"F2"]="clearBookmarks"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},f[u["Alt-F2"]="selectBookmarks"]=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var r=0;r<t.length;r++){var i=t[r].find();i?n.push({anchor:i.from,head:i.to}):t.splice(r--,0)}n.length&&e.setSelections(n,0)},u["Alt-Q"]="wrapLines";var v=h+"K ";u[v+h+"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+h+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange("",t[n].anchor,d(t[n].to().line),"+delete");e.scrollIntoView()})},f[u[v+h+"U"]="upcaseAtCursor"]=function(e){l(e,function(e){return e.toUpperCase()})},f[u[v+h+"L"]="downcaseAtCursor"]=function(e){l(e,function(e){return e.toLowerCase()})},f[u[v+h+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},f[u[v+h+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},f[u[v+h+"W"]="deleteToSublimeMark"]=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),i=n;if(e.cmpPos(r,i)>0){var o=i;i=r,r=o}t.state.sublimeKilled=t.getRange(r,i),t.replaceRange("",r,i,"+delete")}},f[u[v+h+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},f[u[v+h+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[v+h+"G"]="clearBookmarks",f[u[v+h+"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[h+"F3"]="findUnder"]=function(e){c(e,!0)},f[u["Shift-"+h+"F3"]="findUnderPrevious"]=function(e){c(e,!1)},f[u["Alt-F3"]="findAllUnder"]=function(e){var t=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-"+h+"["]="fold",u["Shift-"+h+"]"]="unfold",u[v+h+"0"]=u[v+h+"j"]="unfoldAll",u[h+"I"]="findIncremental",u["Shift-"+h+"I"]="findIncrementalReverse",u[h+"H"]="replace",u.F3="findNext",u["Shift-F3"]="findPrev",e.normalizeKeyMap(u)});