(function(){function l(h,d,a){var c;return c=h.getWrapperElement().appendChild(document.createElement("div")),c.className=a?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top",c.innerHTML=d,c}CodeMirror.defineExtension("openDialog",function(h,d,a){function c(){k||(k=!0,g.parentNode.removeChild(g))}var g=l(this,h,a&&a.bottom),k=!1,i=this,f=g.getElementsByTagName("input")[0];if(f){CodeMirror.on(f,"keydown",function(b){a&&a.onKeyDown&&a.onKeyDown(b,f.value,c)||(13== b.keyCode||27==b.keyCode)&&(CodeMirror.e_stop(b),c(),i.focus(),13==b.keyCode&&d(f.value))});if(a&&a.onKeyUp)CodeMirror.on(f,"keyup",function(b){a.onKeyUp(b,f.value,c)});a&&a.value&&(f.value=a.value);f.focus();CodeMirror.on(f,"blur",c)}else if(h=g.getElementsByTagName("button")[0])CodeMirror.on(h,"click",function(){c();i.focus()}),h.focus(),CodeMirror.on(h,"blur",c);return c});CodeMirror.defineExtension("openConfirm",function(h,d,a){function c(){k||(k=!0,g.parentNode.removeChild(g),i.focus())}var g= l(this,h,a&&a.bottom),h=g.getElementsByTagName("button"),k=!1,i=this,f=1,b;h[0].focus();for(a=0;a=f&&c()},200)}),CodeMirror.on(b,"focus",function(){++f})})})(); (function(){function l(m){return"string"==typeof m?{token:function(a){if(a.match(m))return"searching";a.next();a.skipTo(m.charAt(0))||a.skipToEnd()}}:{token:function(a){if(a.match(m))return"searching";for(;!a.eol()&&!(a.next(),a.match(m,!1)););}}}function h(){this.overlay=this.posFrom=this.posTo=this.query=null}function d(a){return a.state.search||(a.state.search=new h)}function a(a,b,d){return a.getSearchCursor(b,d,"string"==typeof b&&b==b.toLowerCase())}function c(a,b,d,f){a.openDialog?a.openDialog(b, f):f(prompt(d,""))}function g(a,b,d,f){a.openConfirm?a.openConfirm(b,f):confirm(d)&&f[0]()}function k(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);return b?RegExp(b[1],-1==b[2].indexOf("i")?"":"i"):a}function i(a,b){var e=d(a);if(e.query)return f(a,b);c(a,j,"Search for:",function(d){a.operation(function(){d&&!e.query&&(e.query=k(d),a.removeOverlay(e.overlay),e.overlay=l(d),a.addOverlay(e.overlay),e.posFrom=e.posTo=a.getCursor(),f(a,b))})})}function f(b,e){b.operation(function(){var f=d(b),c=a(b,f.query, e?f.posFrom:f.posTo);(c.find(e)||(c=a(b,f.query,e?CodeMirror.Pos(b.lastLine()):CodeMirror.Pos(b.firstLine(),0)),c.find(e)))&&(b.setSelection(c.from(),c.to()),f.posFrom=c.from(),f.posTo=c.to())})}function b(a){a.operation(function(){var b=d(a);b.query&&(b.query=null,a.removeOverlay(b.overlay))})}function q(f,d){c(f,e,"Replace:",function(e){e&&(e=k(e),c(f,n,"Replace with:",function(c){if(d)f.operation(function(){for(var b,d=a(f,e);d.findNext();)"string"!=typeof e?(b=f.getRange(d.from(),d.to()).match(e), d.replace(c.replace(/\$(\d)/,function(a,f){return b[f]}))):d.replace(c)});else{b(f);var h=a(f,e,f.getCursor()),j=function(){var b=h.from(),d;((d=h.findNext())||(h=a(f,e),(d=h.findNext())&&(!b||h.from().line!=b.line||h.from().ch!=b.ch)))&&(f.setSelection(h.from(),h.to()),g(f,r,"Replace?",[function(){i(d)},j]))},i=function(a){h.replace("string"==typeof e?c:c.replace(/\$(\d)/,function(b,f){return a[f]}));j()};j()}}))})}var j='Search: (Use /re/ syntax for regexp search)', e='Replace: (Use /re/ syntax for regexp search)',n='With: ',r="Replace? ";CodeMirror.commands.find=function(a){b(a);i(a)};CodeMirror.commands.findNext=i;CodeMirror.commands.findPrev=function(a){i(a,!0)};CodeMirror.commands.clearSearch=b;CodeMirror.commands.replace=q;CodeMirror.commands.replaceAll=function(a){q(a,!0)}})(); (function(){function l(d,a,c,g){if(this.atOccurrence=!1,this.doc=d,null==g&&"string"==typeof a&&(g=!1),c=c?d.clipPos(c):h(0,0),this.pos={from:c,to:c},"string"!=typeof a)a.global||(a=RegExp(a.source,a.ignoreCase?"ig":"g")),this.matches=function(f,b){var c,j,e,g,i;if(f){a.lastIndex=0;c=d.getLine(b.line).slice(0,b.ch);for(j=0;!(a.lastIndex=j,i=a.exec(c),!i)&&!(e=i,g=e.index,j=e.index+(e[0].length||1),j==c.length););(j=e&&e[0].length||0)||(0==g&&0==c.length?e=void 0:g!=d.getLine(b.line).length&&j++)}else a.lastIndex= b.ch,c=d.getLine(b.line),j=(e=a.exec(c))&&e[0].length||0,g=e&&e.index,g+j==c.length||j||(j=1);if(e&&j)return{from:h(b.line,g),to:h(b.line,g+j),match:e}};else{g&&(a=a.toLowerCase());var k=g?function(a){return a.toLowerCase()}:function(a){return a},i=a.split("\n");this.matches=1==i.length?a.length?function(f,b){var c=k(d.getLine(b.line)),g=a.length,e;if(f?b.ch>=g&&-1!=(e=c.lastIndexOf(a,b.ch-g)):-1!=(e=c.indexOf(a,b.ch)))return{from:h(b.line,e),to:h(b.line,e+g)}}:function(){}:function(a,b){var c=b.line, g=a?i.length-1:0,e=i[g],n=k(d.getLine(c)),l=a?n.indexOf(e)+e.length:n.lastIndexOf(e),m,o,p;if(!(a?l>=b.ch||l!=e.length:l<=b.ch||l!=n.length-e.length))for(;!(a?!c:c==d.lineCount()-1);)if(n=k(d.getLine(c+=a?-1:1)),e=i[a?--g:++g],0