(function(){function i(n){for(var r={name:"autoCloseBrackets",Backspace:function(t){if(t.somethingSelected())return CodeMirror.Pass;var i=t.getCursor(),r=t.getLine(i.line);if(i.ch&&i.ch=0||t.test(c))r.replaceSelection(n+i,{head:s,anchor:s});else return CodeMirror.Pass}},n!=i&&(r["'"+i+"'"]=f)})(n.charAt(i),n.charAt(i+1));return r}var n="()[]{}''\"\"",t=/\s/;CodeMirror.defineOption("autoCloseBrackets",!1,function(t,r,u){var f=u&&u!=CodeMirror.Init;r&&!f?t.addKeyMap(i(typeof r=="string"?r:n)):!r&&f&&t.removeKeyMap("autoCloseBrackets")})})(),function(){function n(n,u){var e=n.getCursor(),o=n.getTokenAt(e),l=CodeMirror.innerMode(n.getMode(),o.state),s=l.state,a,c,v,f;if(l.mode.name!="xml")return CodeMirror.Pass;var h=n.getOption("autoCloseTags"),y=l.mode.configuration=="html",p=typeof h=="object"&&h.dontCloseTags||y&&i,w=typeof h=="object"&&h.indentTags||y&&r;if(u==">"&&s.tagName){if(f=s.tagName,o.end>e.ch&&(f=f.slice(0,f.length-o.end+e.ch)),a=f.toLowerCase(),o.type=="tag"&&s.type=="closeTag"||o.string.indexOf("/")>-1||p&&t(p,a)>-1)return CodeMirror.Pass;c=w&&t(w,a)>-1,v=c?CodeMirror.Pos(e.line+1,0):CodeMirror.Pos(e.line,e.ch+1),n.replaceSelection(">"+(c?"\n\n":"")+"<\/"+f+">",{head:v,anchor:v}),c&&(n.indentLine(e.line+1),n.indentLine(e.line+2));return}if(u=="/"&&o.string=="<"){f=s.context&&s.context.tagName,f&&n.replaceSelection("/"+f+">","end");return}return CodeMirror.Pass}function t(n,t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;i'"]=function(t){return n(t,">")}),t.addKeyMap(u)}else!i&&r!=CodeMirror.Init&&r&&t.removeKeyMap("autoCloseTags")});var i=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],r=["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"]}(),function(){function i(n){var e=n.getCursor(),t=n.getTokenAt(e),i=CodeMirror.innerMode(n.getMode(),t.state).mode,r,o,u,f,s;if(t.type=="comment"&&i.blockCommentStart&&(o=t.string.indexOf(i.blockCommentEnd),u=n.getRange(CodeMirror.Pos(e.line,0),CodeMirror.Pos(e.line,t.end)),o==-1||o!=t.string.length-i.blockCommentEnd.length))if(t.string.indexOf(i.blockCommentStart)==0){if(r=u.slice(0,t.start),!/^\s*$/.test(r))for(r="",s=0;st.start&&/^\s*$/.test(u.slice(0,f))&&(r=u.slice(0,f));if(r!=null)n.replaceSelection("\n"+r+i.blockCommentContinue,"end");else return CodeMirror.Pass}for(var t=["clike","css","javascript"],n=0;n"==o)c.push(s);else{if(c.pop()!=l.charAt(0))return{pos:e,match:!1};if(!c.length)return{pos:e,match:!0}}}var f=t.getCursor(),s=t.getLineHandle(f.line),u=f.ch-1,l=u>=0&&i[s.text.charAt(u)]||i[s.text.charAt(++u)],r,e,v;if(!l)return null;var o=l.charAt(1)==">",h=o?1:-1,y=t.getTokenAt(n(f.line,u+1)).type,c=[s.text.charAt(u)],p=/[(){}[\]]/;for(r=f.line,v=o?Math.min(r+100,t.lineCount()):Math.max(-1,r-100);r!=v;r+=h)if(e=r==f.line?a(s,r,u):a(t.getLineHandle(r),r),e)break;return{from:n(f.line,u),to:e&&n(r,e.pos),match:e&&e.match}}function f(t,i){var f=u(t),e;if(f&&!(t.getLine(f.from.line).length>r)&&(!f.to||!(t.getLine(f.to.line).length>r))){var s=f.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",c=t.markText(f.from,n(f.from.line,f.from.ch+1),{className:s}),h=f.to&&t.markText(f.to,n(f.to.line,f.to.ch+1),{className:s});if(o&&t.state.focused&&t.display.input.focus(),e=function(){t.operation(function(){c.clear(),h&&h.clear()})},i)setTimeout(e,800);else return e}}function e(n){n.operation(function(){t&&(t(),t=null),n.somethingSelected()||(t=f(n,!1))})}var o=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),n=CodeMirror.Pos,r=1e3,i={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},t=null;CodeMirror.defineOption("matchBrackets",!1,function(n,t){if(t)n.on("cursorActivity",e);else n.off("cursorActivity",e)}),CodeMirror.defineExtension("matchBrackets",function(){f(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(){return u(this)})}(),CodeMirror.newFoldFunction=function(n,t){if(t==null&&(t="↔"),typeof t=="string"){var i=document.createTextNode(t);t=document.createElement("span"),t.appendChild(i),t.className="CodeMirror-foldmarker"}return function(i,r){var u,e,o,f,s,h;if(typeof r=="number"&&(r=CodeMirror.Pos(r,0)),u=n(i,r),u){for(e=i.findMarksAt(u.from),o=0,f=0;fs)){v=1,p=n.lineCount();n:for(r=f+1;r=n.lastLine()))return r=0,o=n.getLine(++e),!0}function a(){for(var n,t,i;;){if(n=o.indexOf(">",r),n==-1)if(l())continue;else return;return t=o.lastIndexOf("/",n),i=t>-1&&/^\s*$/.test(o.slice(t+1,n)),r=n+1,i?"selfClose":"regular"}}function v(){for(;;){t.lastIndex=r;var n=t.exec(o);if(!n)if(l())continue;else return;return r=n.index+n[0].length,n}}for(var e=i.line,r=i.ch,o=n.getLine(e),u=[],y,h,c,s;;){if(h=v(),!h||e!=i.line||!(c=a()))return;if(!h[1]&&c!="selfClose"){u.push(h[2]),y=r;break}}for(;;){var f=v(),c,p=e,w=r-(f?f[0].length:0);if(!f||!(c=a()))return;if(c!="selfClose")if(f[1]){for(s=u.length-1;s>=0;--s)if(u[s]==f[2]){u.length=s;break}if(!u.length)return{from:CodeMirror.Pos(i.line,y),to:CodeMirror.Pos(p,w)}}else u.push(f[2])}}}(),function(){CodeMirror.defineExtension("autoFormatAll",function(n,t){function v(){h+="\n",e=!0,++a}for(var r=this,f=r.getMode(),o=r.getRange(n,t).split("\n"),s=CodeMirror.copyState(f,r.getTokenAt(n).state),y=r.getOption("tabSize"),h="",a=0,e=n.ch==0,i,u=0;u",newlineAfterToken:function(t,i,r,u){var f=!1;return this.configuration=="html"&&(f=u.context?n.test(u.context.tagName):!1),!f&&(t=="tag"&&/>$/.test(i)&&u.context||/^-1&&o>-1&&o>e&&(f=f.substr(0,e)+f.substring(e+u.commentStart.length,o)+f.substr(o+u.commentEnd.length)),r.replaceRange(f,t,i)}})}),CodeMirror.defineExtension("autoIndentRange",function(n,t){var i=this;this.operation(function(){for(var r=n.line;r<=t.line;r++)i.indentLine(r,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(n,t){function v(){h+="\n",e=!0,++a}for(var i=this,f=i.getMode(),o=i.getRange(n,t).split("\n"),s=CodeMirror.copyState(f,i.getTokenAt(n).state),y=i.getOption("tabSize"),h="",a=0,e=n.ch==0,r,u=0;u