Ray's changes for css and js
This commit is contained in:
1 parent
408bebaa4b
commit
fe82427baa
306 files changed
+20659
-607
No files matched your search
@@ -0,0 +1,44 @@
|
||||
(function(){function r(p,b){return(new z(p,b)).beautify()}function z(p,b){var m,V,t,e,ba,w,r,Q,u,H,C,I,A,v,c,o,W,R;function ea(a,f){return{mode:f,last_text:a?a.last_text:"",last_word:a?a.last_word:"",var_line:!1,var_line_tainted:!1,var_line_reindented:!1,in_html_comment:!1,multiline_array:!1,if_block:!1,do_block:!1,do_while:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:a?a.indentation_level+(a.var_line&&a.var_line_reindented?1:0):0,ternary_depth:0}}function fa(a){for(a=void 0===
|
||||
a?!1:a;n.length&&(" "===n[n.length-1]||n[n.length-1]===D||n[n.length-1]===S||a&&("\n"===n[n.length-1]||"\r"===n[n.length-1]));)n.pop()}function J(a){return a.replace(/^\s\s*|\s\s*$/,"")}function E(){return n.length&&"\n"===n[n.length-1]}function X(a){if(a=void 0===a?!1:a,m&&!a){var f="",d=0,c;a:{c=n.length-1;0>c&&(c+=n.length);c>n.length-1&&(c=n.length-1);for(c++;0<c--;)if(c in n&&"\n"===n[c])break a;c=-1}c+=1;c<n.length&&(f=n.slice(c).join(""),d=f.length+k.length+(h?1:0),d>=m&&(a=!0))}(V&&F||a)&&
|
||||
!E()&&(g(!1,!0),T=!0,F=!1)}function g(d,f){if(T=!1,h=!1,!f&&";"!==a.last_text)for(;a.mode===v&&!a.if_block;)K();(a.mode===c&&(a.multiline_array=!0),n.length)&&(d||!E())&&n.push("\n")}function ca(d){if(void 0===d?d=1:"number"!=typeof d&&(d=d?1:0),""!==a.last_text)for(var f=0;f<d;f+=1)n.push(D)}function i(d){d=d||k;E()&&(t&&a.mode===c&&L.length?n.push(L.join("")+""):(S&&n.push(S),ca(a.indentation_level),ca(a.var_line&&a.var_line_reindented),ca(T)));T=!1;if(h&&n.length){var f=n[n.length-1];E()||" "===
|
||||
f||f===D||n.push(" ")}h=!1;n.push(d)}function G(d){a?($.push(a),B=a):B=ea(null,d);a=ea(B,d)}function Y(a){return q(a,[o,W,R])}function K(){0<$.length&&(B=a,a=$.pop())}function z(){var d;"do"===a.last_text||"else"===a.last_text&&"if"!==k||"TK_END_EXPR"===j&&(B.mode===W||B.mode===R)?(X(),G(v),a.indentation_level+=1,d=(T=!1,!0)):d=!1;return d}function U(a){return q(a,"case return do if throw else".split(" "))}function q(a,d){for(var c=0;c<d.length;c+=1)if(d[c]===a)return!0;return!1}function ga(a){for(var f=
|
||||
d,c=l.charAt(f);q(c,da)&&c!==a;){if(f++,f>=s)return!1;c=l.charAt(f)}return c===a}function ha(){var c,f,b,o,g;if(y=0,d>=s)return["","TK_EOF"];F=!1;L=[];f=l.charAt(d);for(d+=1;q(f,da);){if("\n"===f?(y+=1,L=[]):y&&(f===D?L.push(D):"\r"!==f&&L.push(" ")),d>=s)return["","TK_EOF"];f=l.charAt(d);d+=1}if(q(f,aa)){if(d<s)for(;q(l.charAt(d),aa)&&!(f+=l.charAt(d),d+=1,d===s););return d!==s&&f.match(/^[0-9]+[Ee]$/)&&("-"===l.charAt(d)||"+"===l.charAt(d))?(b=l.charAt(d),d+=1,o=ha(),f+=b+o[0],[f,"TK_WORD"]):"in"===
|
||||
f?[f,"TK_OPERATOR"]:[f,"TK_WORD"]}if("("===f||"["===f)return[f,"TK_START_EXPR"];if(")"===f||"]"===f)return[f,"TK_END_EXPR"];if("{"===f)return[f,"TK_START_BLOCK"];if("}"===f)return[f,"TK_END_BLOCK"];if(";"===f)return[f,"TK_SEMICOLON"];if("/"===f){if(b="",o=!0,"*"===l.charAt(d)){if(d+=1,d<s)for(;d<s&&!("*"===l.charAt(d)&&l.charAt(d+1)&&"/"===l.charAt(d+1))&&!(f=l.charAt(d),b+=f,("\n"===f||"\r"===f)&&(o=!1),d+=1,d>=s););return d+=2,o&&0===y?["/*"+b+"*/","TK_INLINE_COMMENT"]:["/*"+b+"*/","TK_BLOCK_COMMENT"]}if("/"===
|
||||
l.charAt(d)){for(b=f;"\r"!==l.charAt(d)&&"\n"!==l.charAt(d)&&!(b+=l.charAt(d),d+=1,d>=s););return[b,"TK_COMMENT"]}}if("'"===f||'"'===f||("/"===f||e&&"<"===f&&l.slice(d-1).match(/^<[a-zA-Z:0-9]+\s*([a-zA-Z:0-9]+="[^"]*"\s*)*\/?\s*>/))&&("TK_WORD"===j&&U(a.last_text)||"TK_END_EXPR"===j&&q(B.mode,[R,W])||q(j,"TK_COMMENT TK_START_EXPR TK_START_BLOCK TK_END_BLOCK TK_OPERATOR TK_EQUALS TK_EOF TK_SEMICOLON TK_COMMA".split(" ")))){b=f;var i=o=!1;if(c=f,d<s)if("/"===b)for(g=!1;o||g||l.charAt(d)!==b;){if(c+=
|
||||
l.charAt(d),o?o=!1:(o="\\"===l.charAt(d),"["===l.charAt(d)?g=!0:"]"===l.charAt(d)&&(g=!1)),d+=1,d>=s)return[c,"TK_STRING"]}else if(e&&"<"===b){f=/<(\/?)([a-zA-Z:0-9]+)\s*([a-zA-Z:0-9]+="[^"]*"\s*)*(\/?)\s*>/g;o=l.slice(d-1);var h=f.exec(o);if(h&&0===h.index){b=h[2];for(c=0;h;){var i=!!h[1],k=!!h[h.length-1];if(h[2]!==b||k||(i?--c:++c),0>=c)break;h=f.exec(o)}return g=h?h.index+h[0].length:o.length,d+=g-1,[o.slice(0,g),"TK_STRING"]}}else for(;o||l.charAt(d)!==b;)if(c+=l.charAt(d),o?(("x"===l.charAt(d)||
|
||||
"u"===l.charAt(d))&&(i=!0),o=!1):o="\\"===l.charAt(d),d+=1,d>=s)return[c,"TK_STRING"];d+=1;c+=b;if(i&&ba){a:{g=c;f=!1;o="";h=0;c="";for(i=0;f||h<g.length;)if(k=g.charAt(h),h++,f){if(f=!1,"x"===k)c=g.substr(h,2),h+=2;else if("u"===k)c=g.substr(h,4),h+=4;else{o+="\\"+k;continue}if(!c.match(/^[0123456789abcdefABCDEF]+$/))break a;if(i=parseInt(c,16),0<=i&&32>i)o+="x"===k?"\\x"+c:"\\u"+c;else if(34===i||39===i||92===i)o+="\\"+String.fromCharCode(i);else{if("x"===k&&126<i&&255>=i)break a;o+=String.fromCharCode(i)}}else"\\"===
|
||||
k?f=!0:o+=k;g=o}c=g}if("/"===b)for(;d<s&&q(l.charAt(d),aa);)c+=l.charAt(d),d+=1;return[c,"TK_STRING"]}if("#"===f){if(0===n.length&&"!"===l.charAt(d)){for(c=f;d<s&&"\n"!==f;)f=l.charAt(d),c+=f,d+=1;return[J(c)+"\n","TK_UNKNOWN"]}if(b="#",d<s&&q(l.charAt(d),ia)){do f=l.charAt(d),b+=f,d+=1;while(d<s&&"#"!==f&&"="!==f);return"#"===f||("["===l.charAt(d)&&"]"===l.charAt(d+1)?(b+="[]",d+=2):"{"===l.charAt(d)&&"}"===l.charAt(d+1)&&(b+="{}",d+=2)),[b,"TK_WORD"]}}if("<"===f&&"<\!--"===l.substring(d-1,d+3)){d+=
|
||||
3;for(f="<\!--";"\n"!==l.charAt(d)&&d<s;)f+=l.charAt(d),d++;return a.in_html_comment=!0,[f,"TK_COMMENT"]}if("-"===f&&a.in_html_comment&&"--\>"===l.substring(d-1,d+2))return a.in_html_comment=!1,d+=2,["--\>","TK_COMMENT"];if("."===f)return[f,"TK_DOT"];if(q(f,M)){for(;d<s&&q(f+l.charAt(d),M)&&!(f+=l.charAt(d),d+=1,d>=s););return","===f?[f,"TK_COMMA"]:"="===f?[f,"TK_EQUALS"]:[f,"TK_OPERATOR"]}return[f,"TK_UNKNOWN"]}var l,n,k,N,j,O,D,a,B,$,da,aa,M,d,P,ia,x,Z,F,T,h,s,y,L,ja,S="";da=["\n","\r","\t"," "];
|
||||
aa="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$".split("");ia="0123456789".split("");M="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::";M+=" <%= <% %> <?= <? ?>";M=M.split(" ");P="continue try throw return var if switch case default for while break function".split(" ");v="Statement";c="ArrayLiteral";W="ForInitializer";R="Conditional";o="Expression";ja={TK_START_EXPR:function(){if(z(),"["===k){if("TK_WORD"===j||
|
||||
")"===a.last_text){q(a.last_text,P)&&(h=!0);G(o);i();w&&(h=!0);return}a.mode===c&&("["===a.last_text||","===a.last_text&&("]"===O||"}"===O))&&(t||g())}else"for"===a.last_text?G(W):q(a.last_text,["if","while"])?G(R):G(o);";"===a.last_text||"TK_START_BLOCK"===j?g():"TK_END_EXPR"===j||"TK_START_EXPR"===j||"TK_END_BLOCK"===j||"."===a.last_text?F&&g():"TK_WORD"!==j&&"TK_OPERATOR"!==j?h=!0:"function"===a.last_word||"typeof"===a.last_word?r&&(h=!0):(q(a.last_text,P)||"catch"===a.last_text)&&Q&&(h=!0);"("===
|
||||
k&&("TK_EQUALS"===j||"TK_OPERATOR"===j)&&"ObjectLiteral"!==a.mode&&X();i();w&&(h=!0);"["===k&&(G(c),a.indentation_level+=1);Z&&(Z=!1,a.indentation_level+=1)},TK_END_EXPR:function(){for(;a.mode===v;)K();"]"===k&&a.mode===c&&a.multiline_array&&!t&&g();K();w&&(h=!0);i();a.do_while&&B.mode===R&&(B.mode=o,a.do_block=!1,a.do_while=!1)},TK_START_BLOCK:function(){G("BlockStatement");var d=ga("}")&&"function"===a.last_word&&"TK_END_EXPR"===j;"expand"===u?"TK_OPERATOR"!==j&&(d||"TK_EQUALS"===j||U(a.last_text)&&
|
||||
"else"!==a.last_text)?h=!0:g():"TK_OPERATOR"!==j&&"TK_START_EXPR"!==j?"TK_START_BLOCK"===j?g():h=!0:B.mode===c&&","===a.last_text&&("}"===O?h=!0:g());i();a.indentation_level+=1},TK_END_BLOCK:function(){for(;a.mode===v;)K();K();var d="TK_START_BLOCK"===j;"expand"===u?d||g():d||(a.mode===c&&t?(t=!1,g(),t=!0):g());i()},TK_WORD:function(){if(z()||F&&!Y(a.mode)&&("TK_OPERATOR"!==j||"--"===a.last_text||"++"===a.last_text)&&"TK_EQUALS"!==j&&(V||"var"!==a.last_text)&&g(),a.do_block&&!a.do_while){if("while"===
|
||||
k){h=!0;i();h=!0;a.do_while=!0;return}g();a.do_block=!1}if(Z&&U(k)&&(Z=!1),a.if_block&&"else"!==k){for(;a.mode===v;)K();a.if_block=!1}"function"===k?(a.var_line&&"TK_EQUALS"!==j&&(a.var_line_reindented=!0),(E()||";"===a.last_text||"}"===a.last_text)&&"{"!==a.last_text&&a.mode!==c&&(E()||g(!0),E()&&0<n.length-1&&"\n"===n[n.length-2]||g(!0)),"TK_WORD"===j?"get"===a.last_text||"set"===a.last_text||"new"===a.last_text||"return"===a.last_text?h=!0:g():"TK_OPERATOR"===j||"="===a.last_text?h=!0:Y(a.mode)||
|
||||
g(),i(),a.last_word=k):"case"===k||"default"===k&&a.in_case_statement?(g(),(a.case_body||r)&&(a.indentation_level--,a.case_body=!1),i(),a.in_case=!0,a.in_case_statement=!0):(x="NONE","TK_END_BLOCK"===j?q(k,["else","catch","finally"])?"expand"===u||"end-expand"===u?x="NEWLINE":(x="SPACE",h=!0):x="NEWLINE":"TK_SEMICOLON"===j&&"BlockStatement"===a.mode?x="NEWLINE":"TK_SEMICOLON"===j&&Y(a.mode)?x="SPACE":"TK_STRING"===j?x="NEWLINE":"TK_WORD"===j?x="SPACE":"TK_START_BLOCK"===j?x="NEWLINE":"TK_END_EXPR"===
|
||||
j&&(h=!0,x="NEWLINE"),q(k,P)&&")"!==a.last_text&&(x="else"===a.last_text?"SPACE":"NEWLINE"),("TK_COMMA"===j||"TK_START_EXPR"===j||"TK_EQUALS"===j||"TK_OPERATOR"===j)&&"ObjectLiteral"!==a.mode&&X(),q(k,["else","catch","finally"])?"TK_END_BLOCK"!==j||"expand"===u||"end-expand"===u?g():(fa(!0),"}"!==n[n.length-1]&&g(),h=!0):"NEWLINE"===x?U(a.last_text)?h=!0:"TK_END_EXPR"!==j?("TK_START_EXPR"!==j||"var"!==k)&&":"!==a.last_text&&("if"===k&&"else"===a.last_word&&"{"!==a.last_text?h=!0:(a.var_line=!1,a.var_line_reindented=
|
||||
!1,g())):q(k,P)&&")"!==a.last_text&&(a.var_line=!1,a.var_line_reindented=!1,g()):a.mode===c&&","===a.last_text&&"}"===O?g():"SPACE"===x&&(h=!0),i(),a.last_word=k,"var"===k&&(a.var_line=!0,a.var_line_reindented=!1,a.var_line_tainted=!1),"do"===k&&(a.do_block=!0),"if"===k&&(a.if_block=!0))},TK_SEMICOLON:function(){for(;a.mode===v&&!a.if_block;)K();i();a.var_line=!1;a.var_line_reindented=!1;"ObjectLiteral"===a.mode&&(a.mode="BlockStatement")},TK_STRING:function(){z()?h=!0:"TK_WORD"===j?h=!0:"TK_COMMA"===
|
||||
j||"TK_START_EXPR"===j||"TK_EQUALS"===j||"TK_OPERATOR"===j?"ObjectLiteral"!==a.mode&&X():g();i()},TK_EQUALS:function(){a.var_line&&(a.var_line_tainted=!0);h=!0;i();h=!0},TK_OPERATOR:function(){var c=!0,d=!0;U(a.last_text)?(h=!0,i()):"*"===k&&"TK_DOT"===j&&!O.match(/^\d+$/)?i():":"===k&&a.in_case?(a.case_body=!0,a.indentation_level+=1,i(),g(),a.in_case=!1):"::"===k?i():(F&&("--"===k||"++"===k)&&g(),q(k,["--","++","!"])||q(k,["-","+"])&&(q(j,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||
|
||||
q(a.last_text,P)||","===a.last_text)?(c=!1,d=!1,";"===a.last_text&&Y(a.mode)&&(c=!0),"TK_WORD"===j&&q(a.last_text,P)&&(c=!0),("BlockStatement"===a.mode||a.mode===v)&&("{"===a.last_text||";"===a.last_text)&&g()):":"===k?0===a.ternary_depth?("BlockStatement"===a.mode&&(a.mode="ObjectLiteral"),c=!1):a.ternary_depth-=1:"?"===k&&(a.ternary_depth+=1),h=h||c,i(),h=d)},TK_COMMA:function(){a.var_line?((Y(a.mode)||"TK_END_BLOCK"===j)&&(a.var_line_tainted=!1),a.var_line&&(a.var_line_reindented=!0),i(),a.var_line_tainted?
|
||||
(a.var_line_tainted=!1,g()):h=!0):"TK_END_BLOCK"===j&&a.mode!==o?(i(),"ObjectLiteral"===a.mode&&"}"===a.last_text?g():h=!0):"ObjectLiteral"===a.mode?(i(),g()):(i(),h=!0)},TK_BLOCK_COMMENT:function(){var a;a=k;a=a.replace(/\x0d/g,"");for(var c=[],d=a.indexOf("\n");-1!==d;)c.push(a.substring(0,d)),a=a.substring(d+1),d=a.indexOf("\n");a=(a.length&&c.push(a),c);var b;a:{c=a.slice(1);for(d=0;d<c.length;d++)if(b=J(c[d]),"*"!==b.charAt(0)){b=!1;break a}b=!0}if(b){g(!1,!0);i(a[0]);for(b=1;b<a.length;b++)g(!1,
|
||||
!0),i(" "+J(a[b]))}else{1<a.length?g(!1,!0):"TK_END_BLOCK"===j?g(!1,!0):h=!0;i(a[0]);n.push("\n");for(b=1;b<a.length;b++)n.push(a[b]),n.push("\n")}ga("\n")||g(!1,!0)},TK_INLINE_COMMENT:function(){h=!0;i();h=!0},TK_COMMENT:function(){F?g(!1,!0):fa(!0);h=!0;i();g(!1,!0)},TK_DOT:function(){U(a.last_text)?h=!0:X(")"===a.last_text&&H);E()&&(Z=!0);i()},TK_UNKNOWN:function(){i();"\n"===k[k.length-1]&&g()}};b=b?b:{};A=I=C=H=u=Q=r=w=ba=e=t=V=m=void 0;void 0!==b.space_after_anon_function&&void 0===b.jslint_happy&&
|
||||
(b.jslint_happy=b.space_after_anon_function);void 0!==b.braces_on_own_line&&(u=b.braces_on_own_line?"expand":"collapse");u=b.brace_style?b.brace_style:u?u:"collapse";"expand-strict"===u&&(u="expand");C=b.indent_size?parseInt(b.indent_size,10):4;I=b.indent_char?b.indent_char:" ";V=void 0===b.preserve_newlines?!0:b.preserve_newlines;H=void 0===b.break_chained_methods?!1:b.break_chained_methods;A=void 0===b.max_preserve_newlines?0:parseInt(b.max_preserve_newlines,10);w=void 0===b.space_in_paren?!1:b.space_in_paren;
|
||||
r=void 0===b.jslint_happy?!1:b.jslint_happy;t=void 0===b.keep_array_indentation?!1:b.keep_array_indentation;Q=void 0===b.space_before_conditional?!0:b.space_before_conditional;ba=void 0===b.unescape_strings?!1:b.unescape_strings;m=void 0===b.wrap_line_length?0:parseInt(b.wrap_line_length,10);e=void 0===b.e4x?!1:b.e4x;for(D="";0<C;)D+=I,C-=1;for(;p&&(" "===p.charAt(0)||"\t"===p.charAt(0));)S+=p.charAt(0),p=p.substring(1);l=p;s=p.length;j="TK_START_BLOCK";O="";n=[];h=T=!1;L=[];$=[];G("BlockStatement");
|
||||
d=0;this.beautify=function(){for(var d,f,b;!(d=ha(),k=d[0],N=d[1],"TK_EOF"===N);){if(b=t&&a.mode===c,b)for(f=0;f<y;f+=1)g(!0);else if(F=0<y,A&&y>A&&(y=A),V&&1<y){g();for(f=1;f<y;f+=1)g(!0)}ja[N]();"TK_INLINE_COMMENT"!==N&&"TK_COMMENT"!==N&&"TK_UNKNOWN"!==N&&(O=a.last_text,j=N,a.last_text=k)}return S+n.join("").replace(/[\r\n ]+$/,"")}}"function"==typeof define?define(function(p,b){b.js_beautify=r}):"undefined"!=typeof exports?exports.js_beautify=r:"undefined"!=typeof window?window.js_beautify=r:"undefined"!=
|
||||
typeof global&&(global.js_beautify=r)})();
|
||||
(function(){function r(b,m,r,t){var e,p,w,z,Q,u,H,C,I,A,v,m=m||{};p=m.indent_size||4;w=m.indent_char||" ";Q=m.brace_style||"collapse";z=0===m.max_char?Infinity:m.max_char||250;u=m.unformatted||"a span bdo em strong dfn code samp kbd var cite abbr acronym q sub sup tt i b big small u s strike font ins del pre address dt h1 h2 h3 h4 h5 h6".split(" ");e=new function(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=
|
||||
this.last_token=this.last_text=this.token_type="",this.Utils={whitespace:["\n","\r","\t"," "],single_token:"br input link meta !doctype basefont base area hr wbr param img isindex ?xml embed ?php ? ?=".split(" "),extra_liners:["head","body","/html"],in_array:function(c,b){for(var e=0;e<b.length;e++)if(c===b[e])return!0;return!1}},this.get_content=function(){for(var c="",b=[],e=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return b.length?b.join(""):["","TK_EOF"];if(c=this.input.charAt(this.pos),
|
||||
this.pos++,this.line_char_count++,this.Utils.in_array(c,this.Utils.whitespace))b.length&&(e=!0),this.line_char_count--;else{if(e){if(this.line_char_count>=this.max_char){b.push("\n");for(e=0;e<this.indent_level;e++)b.push(this.indent_string);this.line_char_count=0}else b.push(" "),this.line_char_count++;e=!1}b.push(c)}}return b.length?b.join(""):""},this.get_contents_to=function(c){var b,e;if(this.pos===this.input.length)return["","TK_EOF"];c=RegExp("</"+c+"\\s*>","igm");return c.lastIndex=this.pos,
|
||||
b=c.exec(this.input),e=b?b.index:this.input.length,this.pos<e&&(this.input.substring(this.pos,e),this.pos=e),""},this.record_tag=function(c){this.tags[c+"count"]?(this.tags[c+"count"]++,this.tags[c+this.tags[c+"count"]]=this.indent_level):(this.tags[c+"count"]=1,this.tags[c+this.tags[c+"count"]]=this.indent_level);this.tags[c+this.tags[c+"count"]+"parent"]=this.tags.parent;this.tags.parent=c+this.tags[c+"count"]},this.retrieve_tag=function(c){if(this.tags[c+"count"]){for(var b=this.tags.parent;b&&
|
||||
c+this.tags[c+"count"]!==b;)b=this.tags[b+"parent"];b&&(this.indent_level=this.tags[c+this.tags[c+"count"]],this.tags.parent=this.tags[b+"parent"]);delete this.tags[c+this.tags[c+"count"]+"parent"];delete this.tags[c+this.tags[c+"count"]];1===this.tags[c+"count"]?delete this.tags[c+"count"]:this.tags[c+"count"]--}},this.get_tag=function(c){var b="",e=[],m="",p=!1,r,J,t=this.pos,v=this.line_char_count,g,w,i,c=void 0!==c?c:!1;do{if(this.pos>=this.input.length)return c&&(this.pos=t,this.line_char_count=
|
||||
v),e.length?e.join(""):["","TK_EOF"];(b=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(b,this.Utils.whitespace))?(p=!0,this.line_char_count--):(("'"===b||'"'===b)&&(e[1]&&"!"===e[1]||(b+=this.get_unformatted(b),p=!0)),"="===b&&(p=!1),e.length&&"="!==e[e.length-1]&&">"!==b&&p&&(this.line_char_count>=this.max_char?(this.print_newline(!1,e),this.line_char_count=0):(e.push(" "),this.line_char_count++),p=!1),"<"===b&&(r=this.pos-1),e.push(b))}while(">"!==b);return g=
|
||||
e.join(""),w=-1!==g.indexOf(" ")?g.indexOf(" "):g.indexOf(">"),i=g.substring(1,w).toLowerCase(),"/"===g.charAt(g.length-2)||this.Utils.in_array(i,this.Utils.single_token)?c||(this.tag_type="SINGLE"):"script"===i?c||(this.record_tag(i),this.tag_type="SCRIPT"):"style"===i?c||(this.record_tag(i),this.tag_type="STYLE"):this.is_unformatted(i,u)?(m=this.get_unformatted("</"+i+">",g),e.push(m),0<r&&this.Utils.in_array(this.input.charAt(r-1),this.Utils.whitespace)&&e.splice(0,0,this.input.charAt(r-1)),J=
|
||||
this.pos-1,this.Utils.in_array(this.input.charAt(J+1),this.Utils.whitespace)&&e.push(this.input.charAt(J+1)),this.tag_type="SINGLE"):"!"===i.charAt(0)?-1!==i.indexOf("[if")?(-1!==g.indexOf("!IE")&&(m=this.get_unformatted("--\>",g),e.push(m)),c||(this.tag_type="START")):-1!==i.indexOf("[endif")?(this.tag_type="END",this.unindent()):-1!==i.indexOf("[cdata[")?(m=this.get_unformatted("]]\>",g),e.push(m),c||(this.tag_type="SINGLE")):(m=this.get_unformatted("--\>",g),e.push(m),this.tag_type="SINGLE"):c||
|
||||
("/"===i.charAt(0)?(this.retrieve_tag(i.substring(1)),this.tag_type="END"):(this.record_tag(i),this.tag_type="START"),this.Utils.in_array(i,this.Utils.extra_liners)&&this.print_newline(!0,this.output)),c&&(this.pos=t,this.line_char_count=v),e.join("")},this.get_unformatted=function(c,b){if(b&&-1!==b.toLowerCase().indexOf(c))return"";var e="",m="",p=!0;do{if(this.pos>=this.input.length)break;if(e=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(e,this.Utils.whitespace)){if(!p){this.line_char_count--;
|
||||
continue}if("\n"===e||"\r"===e){m+="\n";this.line_char_count=0;continue}}m+=e;this.line_char_count++;p=!0}while(-1===m.toLowerCase().indexOf(c));return m},this.get_token=function(){var c,b,e;return"TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token?(b=this.last_token.substr(7),c=this.get_contents_to(b),"string"!=typeof c)?c:[c,"TK_"+b]:"CONTENT"===this.current_mode?(c=this.get_content(),"string"!=typeof c?c:[c,"TK_CONTENT"]):"TAG"===this.current_mode?(c=this.get_tag(),"string"!=typeof c?
|
||||
c:(e="TK_TAG_"+this.tag_type,[c,e])):void 0},this.get_full_indent=function(c){return(c=this.indent_level+c||0,1>c)?"":Array(c+1).join(this.indent_string)},this.is_unformatted=function(c,b){if(!this.Utils.in_array(c,b))return!1;if("a"!==c.toLowerCase()||!this.Utils.in_array("a",b))return!0;var e=(this.get_tag(!0)||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!e||this.Utils.in_array(e,b)?!0:!1},this.printer=function(c,b,e,m,p){this.input=c||"";this.output=[];this.indent_character=b;this.indent_string=
|
||||
"";this.indent_size=e;this.brace_style=p;this.indent_level=0;this.max_char=m;for(c=this.line_char_count=0;c<this.indent_size;c++)this.indent_string+=this.indent_character;this.print_newline=function(c,b){if(this.line_char_count=0,b&&b.length){if(!c)for(;this.Utils.in_array(b[b.length-1],this.Utils.whitespace);)b.pop();b.push("\n");for(var e=0;e<this.indent_level;e++)b.push(this.indent_string)}};this.print_token=function(b){this.output.push(b)};this.indent=function(){this.indent_level++};this.unindent=
|
||||
function(){0<this.indent_level&&this.indent_level--}},this};for(e.printer(b,w,p,z,Q);!(H=e.get_token(),e.token_text=H[0],e.token_type=H[1],"TK_EOF"===e.token_type);){switch(e.token_type){case "TK_TAG_START":e.print_newline(!1,e.output);e.print_token(e.token_text);e.indent();e.current_mode="CONTENT";break;case "TK_TAG_STYLE":case "TK_TAG_SCRIPT":e.print_newline(!1,e.output);e.print_token(e.token_text);e.current_mode="CONTENT";break;case "TK_TAG_END":"TK_CONTENT"===e.last_token&&""===e.last_text&&(C=
|
||||
e.token_text.match(/\w+/)[0],I=e.output[e.output.length-1].match(/<\s*(\w+)/),(null===I||I[1]!==C)&&e.print_newline(!0,e.output));e.print_token(e.token_text);e.current_mode="CONTENT";break;case "TK_TAG_SINGLE":(b=e.token_text.match(/^\s*<([a-z]+)/i))&&e.Utils.in_array(b[1],u)||e.print_newline(!1,e.output);e.print_token(e.token_text);e.current_mode="CONTENT";break;case "TK_CONTENT":""!==e.token_text&&e.print_token(e.token_text);e.current_mode="TAG";break;case "TK_STYLE":case "TK_SCRIPT":""!==e.token_text&&
|
||||
((e.output.push("\n"),b=e.token_text,v=1,"TK_SCRIPT"===e.token_type?A="function"==typeof r&&r:"TK_STYLE"===e.token_type&&(A="function"==typeof t&&t),"keep"===m.indent_scripts?v=0:"separate"===m.indent_scripts&&(v=-e.indent_level),p=e.get_full_indent(v),A)?b=A(b.replace(/^\s*/,p),m):(w=b.match(/^\s*/)[0].match(/[^\n\r]*$/)[0].split(e.indent_string).length-1,w=e.get_full_indent(v-w),b=b.replace(/^\s*/,p).replace(/\r\n|\r|\n/g,"\n"+w).replace(/\s*$/,"")),b&&(e.print_token(b),e.print_newline(!0,e.output))),
|
||||
e.current_mode="TAG"}e.last_token=e.token_type;e.last_text=e.token_text}return e.output.join("")}if("function"==typeof define)define(function(b,m){var p=b("./beautify.js").js_beautify,t=b("./beautify-css.js").css_beautify;m.html_beautify=function(b,m){return r(b,m,p,t)}});else if("undefined"!=typeof exports){var z=require("./beautify.js").js_beautify,p=require("./beautify-css.js").css_beautify;exports.html_beautify=function(b,m){return r(b,m,z,p)}}else"undefined"!=typeof window?window.html_beautify=
|
||||
function(b,m){return r(b,m,window.js_beautify,window.css_beautify)}:"undefined"!=typeof global&&(global.html_beautify=function(b,m){return r(b,m,global.js_beautify,global.css_beautify)})})();
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
(function(){function k(c){for(var e={name:"autoCloseBrackets",Backspace:function(a){if(a.somethingSelected())return CodeMirror.Pass;var f=a.getCursor(),b=a.getLine(f.line);if(f.ch&&f.ch<b.length&&0==c.indexOf(b.slice(f.ch-1,f.ch+1))%2)a.replaceRange("",CodeMirror.Pos(f.line,f.ch-1),CodeMirror.Pos(f.line,f.ch+1));else return CodeMirror.Pass}},b="",a=0;a<c.length;a+=2)(function(a,f){function c(a){var b=a.getCursor();if(a.getRange(b,CodeMirror.Pos(b.line,b.ch+1))!=f||a.somethingSelected())return CodeMirror.Pass;
|
||||
a.execCommand("goCharRight")}a!=f&&(b=b+f);e["'"+a+"'"]=function(e){if(a=="'"&&e.getTokenAt(e.getCursor()).type=="comment")return CodeMirror.Pass;if(e.somethingSelected()){var l=e.getSelection();e.replaceSelection(a+l+f)}else if(a!=f||c(e)==CodeMirror.Pass){var l=e.getCursor(),h=CodeMirror.Pos(l.line,l.ch+1),m=e.getLine(l.line),n=m.charAt(l.ch);if(m.length==l.ch||b.indexOf(n)>=0||g.test(n))e.replaceSelection(a+f,{head:h,anchor:h});else return CodeMirror.Pass}};a!=f&&(e["'"+f+"'"]=c)})(c.charAt(a),
|
||||
c.charAt(a+1));return e}var g=/\s/;CodeMirror.defineOption("autoCloseBrackets",!1,function(c,e,b){b=b&&b!=CodeMirror.Init;e&&!b?c.addKeyMap(k(typeof e=="string"?e:"()[]{}''\"\"")):!e&&b&&c.removeKeyMap("autoCloseBrackets")})})();
|
||||
(function(){function k(b,a){var d=b.getCursor(),f=b.getTokenAt(d),j=CodeMirror.innerMode(b.getMode(),f.state),i=j.state,l,h;if("xml"!=j.mode.name)return CodeMirror.Pass;var m=b.getOption("autoCloseTags"),n="html"==j.mode.configuration,j="object"==typeof m&&m.dontCloseTags||n&&c,m="object"==typeof m&&m.indentTags||n&&e;if(">"==a&&i.tagName){if(h=i.tagName,f.end>d.ch&&(h=h.slice(0,h.length-f.end+d.ch)),l=h.toLowerCase(),"tag"==f.type&&"closeTag"==i.type||f.string.indexOf("/")==f.string.length-1||j&&
|
||||
-1<g(j,l))return CodeMirror.Pass;i=(f=m&&-1<g(m,l))?CodeMirror.Pos(d.line+1,0):CodeMirror.Pos(d.line,d.ch+1);b.replaceSelection(">"+(f?"\n\n":"")+"</"+h+">",{head:i,anchor:i});f&&(b.indentLine(d.line+1),b.indentLine(d.line+2))}else if("/"==a&&"<"==f.string)(h=i.context&&i.context.tagName)&&b.replaceSelection("/"+h+">","end");else return CodeMirror.Pass}function g(b,a){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;++d)if(b[d]==a)return d;return-1}CodeMirror.defineOption("autoCloseTags",
|
||||
!1,function(b,a,d){if(a&&(d==CodeMirror.Init||!d)){d={name:"autoCloseTags"};(typeof a!="object"||a.whenClosing)&&(d["'/'"]=function(a){return k(a,"/")});(typeof a!="object"||a.whenOpening)&&(d["'>'"]=function(a){return k(a,">")});b.addKeyMap(d)}else!a&&d!=CodeMirror.Init&&d&&b.removeKeyMap("autoCloseTags")});var c="area base br col command embed hr img input keygen link meta param source track wbr".split(" "),e="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".split(" ")})();
|
||||
(function(){function k(e){var b=e.getCursor(),a=e.getTokenAt(b),d=CodeMirror.innerMode(e.getMode(),a.state).mode,f,c,i,l;if("comment"==a.type&&d.blockCommentStart&&(c=a.string.indexOf(d.blockCommentEnd),i=e.getRange(CodeMirror.Pos(b.line,0),CodeMirror.Pos(b.line,a.end)),-1==c||c!=a.string.length-d.blockCommentEnd.length))if(0==a.string.indexOf(d.blockCommentStart)){if(f=i.slice(0,a.start),!/^\s*$/.test(f)){f="";for(b=0;b<a.start;++b)f+=" "}}else-1!=(l=i.indexOf(d.blockCommentContinue))&&l+d.blockCommentContinue.length>
|
||||
a.start&&/^\s*$/.test(i.slice(0,l))&&(f=i.slice(0,l));if(null!=f)e.replaceSelection("\n"+f+d.blockCommentContinue,"end");else return CodeMirror.Pass}for(var g=["clike","css","javascript"],c=0;c<g.length;++c)CodeMirror.extendMode(g[c],{blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * "});CodeMirror.defineOption("continueComments",null,function(e,b,a){a&&a!=CodeMirror.Init&&e.removeKeyMap("continueComment");a={name:"continueComment"};a["string"==typeof b?b:"Enter"]=k;e.addKeyMap(a)})})();
|
||||
(function(){function k(f){function d(c,g,l){var j,h,m,k,n;if(c.text){if(j=q?0:c.text.length-1,h=q?c.text.length:-1,c.text.length>e)return null;m=1E3>c.text.length;for(null!=l&&(j=l+r);j!=h;j+=r)if(k=c.text.charAt(j),t.test(k)&&(!m||f.getTokenAt(b(g,j+1)).type==u))if(n=a[k],">"==n.charAt(1)==q)s.push(k);else{if(s.pop()!=n.charAt(0))return{pos:j,match:!1};if(!s.length)return{pos:j,match:!0}}}}var e=f.state._matchBrackets.maxScanLineLength||1E4,c=f.getCursor(),g=f.getLineHandle(c.line),m=c.ch-1,n=0<=
|
||||
m&&a[g.text.charAt(m)]||a[g.text.charAt(++m)],k,p;if(!n)return null;var q=">"==n.charAt(1),r=q?1:-1,u=f.getTokenAt(b(c.line,m+1)).type,s=[g.text.charAt(m)],t=/[(){}[\]]/,n=c.line;for(p=q?Math.min(n+100,f.lineCount()):Math.max(-1,n-100);n!=p&&!(k=n==c.line?d(g,n,m):d(f.getLineHandle(n),n),k);n+=r);return{from:b(c.line,m),to:k&&b(n,k.pos),match:k&&k.match}}function g(a,d){var c=a.state._matchBrackets.maxHighlightLineLength||1E3,g=k(a);if(g&&!(a.getLine(g.from.line).length>c)&&(!g.to||!(a.getLine(g.to.line).length>
|
||||
c))){var c=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",h=a.markText(g.from,b(g.from.line,g.from.ch+1),{className:c}),m=g.to&&a.markText(g.to,b(g.to.line,g.to.ch+1),{className:c});if(e&&a.state.focused&&a.display.input.focus(),g=function(){a.operation(function(){h.clear();m&&m.clear()})},d)setTimeout(g,800);else return g}}function c(a){a.operation(function(){d&&(d(),d=null);a.somethingSelected()||(d=g(a,!1))})}var e=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||
|
||||
8>document.documentMode),b=CodeMirror.Pos,a={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},d=null;CodeMirror.defineOption("matchBrackets",!1,function(a,b,d){if(d&&d!=CodeMirror.Init&&a.off("cursorActivity",c),b){a.state._matchBrackets=typeof b=="object"?b:{};a.on("cursorActivity",c)}});CodeMirror.defineExtension("matchBrackets",function(){g(this,!0)});CodeMirror.defineExtension("findMatchingBracket",function(){return k(this)})})();
|
||||
CodeMirror.newFoldFunction=function(k,g){if(null==g&&(g="↔"),"string"==typeof g){var c=document.createTextNode(g),g=document.createElement("span");g.appendChild(c);g.className="CodeMirror-foldmarker"}return function(c,b){var a,d,f,j,i;if("number"==typeof b&&(b=CodeMirror.Pos(b,0)),a=k(c,b),a){d=c.findMarksAt(a.from);for(j=f=0;j<d.length;++j)d[j].__isFold&&(++f,d[j].clear());f||(d=g.cloneNode(!0),CodeMirror.on(d,"mousedown",function(){i.clear()}),i=c.markText(a.from,a.to,{replacedWith:d,clearOnEnter:!0,
|
||||
__isFold:!0}))}}};
|
||||
CodeMirror.braceRangeFinder=function(k,g){for(var c=g.line,e=k.getLine(c),b=e.length,a,d,f,j,i,l,h,m,n;0<b;){i=e.lastIndexOf("{",b);var o="{",p="}";if(i<g.ch){if(i=e.lastIndexOf("[",b),i<g.ch)break;o="[";p="]"}if(d=k.getTokenAt(CodeMirror.Pos(c,i+1)).type,!/^(comment|string)/.test(d)){a=i;break}b=i-1}if(null!=a&&!(e.lastIndexOf(o)>a)){e=1;b=k.lineCount();i=c+1;a:for(;i<b;++i){l=k.getLine(i);for(h=0;!(m=l.indexOf(o,h),n=l.indexOf(p,h),0>m&&(m=l.length),0>n&&(n=l.length),h=Math.min(m,n),h==l.length);){if(k.getTokenAt(CodeMirror.Pos(i,
|
||||
h+1)).type==d)if(h==m)++e;else if(!--e){f=i;j=h;break a}++h}}if(null!=f&&f!=c+1)return{from:CodeMirror.Pos(c,a+1),to:CodeMirror.Pos(f,j)}}};
|
||||
CodeMirror.tagRangeFinder=function(){var k=RegExp("<(/?)([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][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-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");return function(g,c){function e(){if(!(d>=g.lastLine()))return f=
|
||||
0,j=g.getLine(++d),!0}function b(){for(var a,b,d;;){if(a=j.indexOf(">",f),-1==a)if(e())continue;else break;return b=j.lastIndexOf("/",a),d=-1<b&&/^\s*$/.test(j.slice(b+1,a)),f=a+1,d?"selfClose":"regular"}}function a(){for(;;){k.lastIndex=f;var a=k.exec(j);if(!a)if(e())continue;else break;return f=a.index+a[0].length,a}}for(var d=c.line,f=c.ch,j=g.getLine(d),i=[],l,h,m;;){if(h=a(),!h||d!=c.line||!(m=b()))return;if(!h[1]&&"selfClose"!=m){i.push(h[2]);l=f;break}}for(;;){var n=a(),o=d,p=f-(n?n[0].length:
|
||||
0);if(!n||!(m=b()))break;if("selfClose"!=m)if(n[1]){for(h=i.length-1;0<=h;--h)if(i[h]==n[2]){i.length=h;break}if(!i.length)return{from:CodeMirror.Pos(c.line,l),to:CodeMirror.Pos(o,p)}}else i.push(n[2])}}}();
|
||||
(function(){CodeMirror.defineExtension("autoFormatAll",function(k,g){for(var c=this,e=c.getMode(),b=c.getRange(k,g).split("\n"),a=CodeMirror.copyState(e,c.getTokenAt(k).state),d=c.getOption("tabSize"),f="",j=0,i=0==k.ch,l,h=0;h<b.length;++h){for(l=new CodeMirror.StringStream(b[h],d);!l.eol();){var m=CodeMirror.innerMode(e,a),n=e.token(l,a),o=l.current();l.start=l.pos;(!i||/\S/.test(o))&&(f+=o,i=!1);if(!i&&m.mode.newlineAfterToken&&m.mode.newlineAfterToken(n,o,l.string.slice(l.pos)||b[h+1]||"",m.state))f+=
|
||||
"\n",i=!0,++j}!l.pos&&e.blankLine&&e.blankLine(a);!i&&h<b.length-1&&(f+="\n",i=!0,++j)}c.operation(function(){c.replaceRange(f,k,g);for(var a=k.line+1,b=k.line+j;a<=b;++a)c.indentLine(a,"smart");c.setCursor({line:0,ch:0})})})})();
|
||||
(function(){function k(g){for(var c=[/for\s*?\((.*?)\)/g,/&#?[a-z0-9]+;[\s\S]/g,/\"(.*?)((\")|$)/g,/\/\*(.*?)(\*\/|$)/g,/^\/\/.*/g],e=[],b,a,d=0;d<c.length;d++)for(b=0;b<g.length;)if(a=g.substr(b).match(c[d]),null!=a)e.push({start:b+a.index,end:b+a.index+a[0].length}),b+=a.index+Math.max(1,a[0].length);else break;return e.sort(function(a,b){return a.start-b.start}),e}CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(g,c){return/^[;{}]$/.test(c)}});CodeMirror.extendMode("javascript",
|
||||
{commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(g){var c=0,e=this.jsonMode?function(a){return a.replace(/([,{])/g,"$1\n").replace(/}/g,"\n}")}:function(a){return a.replace(/(;|\{|\})([^\r\n;])/g,"$1\n$2")},b=k(g),a="",d;if(null!=b){for(d=0;d<b.length;d++)b[d].start>c&&(a+=e(g.substring(c,b[d].start)),c=b[d].start),b[d].start<=c&&b[d].end>=c&&(a+=g.substring(c,b[d].end),c=b[d].end);c<g.length&&(a+=e(g.substr(c)))}else a=e(g);return a.replace(/^\n*|\n*$/,
|
||||
"")}});CodeMirror.extendMode("xml",{commentStart:"<\!--",commentEnd:"--\>",noBreak:!1,noBreakEmpty:null,tagType:"",tagName:"",isXML:!1,newlineAfterToken:function(g,c,e){var b=!1,a=null,d="",f;if(this.isXML="xml"==this.configuration?!0:!1,"comment"==g||/<\!--/.test(e))return!1;if("tag"==g){if(0==c.indexOf("<")&&0==!c.indexOf("</")&&(this.tagType="open",a=c.match(/^<\s*?([\w]+?)$/i),this.tagName=null!=a?a[1]:"",d=this.tagName.toLowerCase(),-1!="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+
|
||||
d+"|")&&(this.noBreak=!0)),0==c.indexOf(">")&&"open"==this.tagType)return(this.tagType="",f=this.isXML?"[^<]*?":"",RegExp("^"+f+"</s*?"+this.tagName+"s*?>","i").test(e))?(this.noBreak=!1,this.isXML||(this.tagName=""),!1):(b=this.noBreak,this.noBreak=!1,b?!1:!0);if(0==c.indexOf("</")&&(this.tagType="close",a=c.match(/^<\/\s*?([\w]+?)$/i),null!=a&&(d=a[1].toLowerCase()),-1!="|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+d+"|")&&(this.noBreak=!0)),
|
||||
0==c.indexOf(">")&&"close"==this.tagType)return(this.tagType="",0==e.indexOf("<")&&(a=e.match(/^<\/?\s*?([\w]+?)(\s|>)/i),d=null!=a?a[1].toLowerCase():"",-1=="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+d+"|")))?(this.noBreak=!1,!0):(b=this.noBreak,this.noBreak=!1,b?!1:!0)}return 0==e.indexOf("<")?(this.noBreak=!1,this.isXML&&""!=this.tagName)?(this.tagName="",!1):(a=e.match(/^<\/?\s*?([\w]+?)(\s|>)/i),d=null!=
|
||||
a?a[1].toLowerCase():"",-1!="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+d+"|")?!1:!0):!1}});CodeMirror.defineExtension("commentRange",function(g,c,e){var b=this,a=CodeMirror.innerMode(b.getMode(),b.getTokenAt(c).state).mode;b.operation(function(){if(g)b.replaceRange(a.commentEnd,e),b.replaceRange(a.commentStart,c),c.line==e.line&&c.ch==e.ch&&b.setCursor(c.line,c.ch+a.commentStart.length);else{var d=b.getRange(c,
|
||||
e),f=d.indexOf(a.commentStart),j=d.lastIndexOf(a.commentEnd);-1<f&&-1<j&&j>f&&(d=d.substr(0,f)+d.substring(f+a.commentStart.length,j)+d.substr(j+a.commentEnd.length));b.replaceRange(d,c,e)}})});CodeMirror.defineExtension("autoIndentRange",function(g,c){var e=this;this.operation(function(){for(var b=g.line;b<=c.line;b++)e.indentLine(b,"smart")})});CodeMirror.defineExtension("autoFormatRange",function(g,c){for(var e=this,b=e.getMode(),a=e.getRange(g,c).split("\n"),d=CodeMirror.copyState(b,e.getTokenAt(g).state),
|
||||
f=e.getOption("tabSize"),j="",i=0,l=0==g.ch,h,m=0;m<a.length;++m){for(h=new CodeMirror.StringStream(a[m],f);!h.eol();){var k=CodeMirror.innerMode(b,d),o=b.token(h,d),p=h.current();h.start=h.pos;(!l||/\S/.test(p))&&(j+=p,l=!1);if(!l&&k.mode.newlineAfterToken&&k.mode.newlineAfterToken(o,p,h.string.slice(h.pos)||a[m+1]||"",k.state))j+="\n",l=!0,++i}!h.pos&&b.blankLine&&b.blankLine(d);!l&&m<a.length-1&&(j+="\n",l=!0,++i)}e.operation(function(){e.replaceRange(j,g,c);for(var a=g.line+1,b=g.line+i;a<=b;++a)e.indentLine(a,
|
||||
"smart");e.setSelection(g,e.getCursor(!1))})})})();
|
||||
(function(){function k(a){this.minChars="object"==typeof a&&a.minChars||e;this.style="object"==typeof a&&a.style||b;this.overlay=null}function g(a){a.operation(function(){var b=a.state.matchHighlighter,f;(b.overlay&&(a.removeOverlay(b.overlay),b.overlay=null),a.somethingSelected())&&((f=a.getSelection().replace(/^\s+|\s+$/g,""),f.length<b.minChars)||a.addOverlay(b.overlay=c(f,b.style)))})}function c(a,b){return{token:function(c){if(c.match(a))return b;c.next();c.skipTo(a.charAt(0))||c.skipToEnd()}}}
|
||||
var e=2,b="matchhighlight";CodeMirror.defineOption("highlightSelectionMatches",!1,function(a,b,c){var c=c&&c!=CodeMirror.Init,e;if(b&&!c){a.state.matchHighlighter=new k(b);a.on("cursorActivity",g)}else!b&&c&&(e=a.state.matchHighlighter.overlay,e&&a.removeOverlay(e),a.state.matchHighlighter=null,a.off("cursorActivity",g))})})();
|
||||
@@ -0,0 +1,197 @@
|
||||
window.CodeMirror=function(){function l(a,b){if(!(this instanceof l))return new l(a,b);this.options=b=b||{};for(var c in Hb)!b.hasOwnProperty(c)&&Hb.hasOwnProperty(c)&&(b[c]=Hb[c]);Ib(b);c=this.display=Fd(a,"string"==typeof b.value?0:b.value.first);c.wrapper.CodeMirror=this;Ac(this);b.autofocus&&!Jb&&G(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Kb};Bc(this);b.lineWrapping&&(this.display.wrapper.className+=
|
||||
" CodeMirror-wrap");var d=b.value;"string"==typeof d&&(d=new F(b.value,b.mode));p(this,Cc)(this,d);B&&setTimeout(K(W,this,!0),20);Gd(this);var e;try{e=document.activeElement==c.input}catch(f){}e||b.autofocus&&!Jb?setTimeout(K($,this),20):Lb(this);p(this,function(){for(var a in ia)if(ia.propertyIsEnumerable(a))ia[a](this,b[a],Dc);for(a=0;a<Mb.length;++a)Mb[a](this)})()}function Fd(a,b){var c={},d=c.input=n("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");
|
||||
L?d.style.width="1000px":d.setAttribute("wrap","off");Ba&&(d.style.border="1px solid black");d.setAttribute("autocorrect","off");d.setAttribute("autocapitalize","off");d.setAttribute("spellcheck","false");c.inputDiv=n("div",[d],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");c.scrollbarH=n("div",[n("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");c.scrollbarV=n("div",[n("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");c.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler");
|
||||
c.gutterFiller=n("div",null,"CodeMirror-gutter-filler");c.lineDiv=n("div",null,"CodeMirror-code");c.selectionDiv=n("div",null,null,"position: relative; z-index: 1");c.cursor=n("div"," ","CodeMirror-cursor");c.otherCursor=n("div"," ","CodeMirror-cursor CodeMirror-secondarycursor");c.measure=n("div",null,"CodeMirror-measure");c.lineSpace=n("div",[c.measure,c.selectionDiv,c.lineDiv,c.cursor,c.otherCursor],null,"position: relative; outline: none");c.mover=n("div",[n("div",[c.lineSpace],"CodeMirror-lines")],
|
||||
null,"position: relative");c.sizer=n("div",[c.mover],"CodeMirror-sizer");c.heightForcer=n("div",null,null,"position: absolute; height: "+ja+"px; width: 1px;");c.gutters=n("div",null,"CodeMirror-gutters");c.lineGutter=null;c.scroller=n("div",[c.sizer,c.heightForcer,c.gutters],"CodeMirror-scroll");c.scroller.setAttribute("tabIndex","-1");c.wrapper=n("div",[c.inputDiv,c.scrollbarH,c.scrollbarV,c.scrollbarFiller,c.gutterFiller,c.scroller],"CodeMirror");ka&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=
|
||||
0);a.appendChild?a.appendChild(c.wrapper):a(c.wrapper);Ba&&(d.style.width="0px");L||(c.scroller.draggable=!0);Nb?(c.inputDiv.style.height="1px",c.inputDiv.style.position="absolute"):ka&&(c.scrollbarH.style.minWidth=c.scrollbarV.style.minWidth="18px");c.viewOffset=c.lastSizeC=0;c.showingFrom=c.showingTo=b;c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null;c.prevInput="";c.alignWidgets=!1;c.pollingFast=!1;c.poll=new Kb;c.cachedCharWidth=c.cachedTextHeight=null;c.measureLineCache=[];c.measureLineCachePos=
|
||||
0;c.inaccurateSelection=!1;c.maxLine=null;c.maxLineLength=0;c.maxLineChanged=!1;c.wheelDX=c.wheelDY=c.wheelStartX=c.wheelStartY=null;return c}function Ca(a){a.doc.mode=l.getMode(a.options,a.doc.modeOption);a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;$a(a,100);a.state.modeGen++;a.curOp&&u(a)}function Ec(a){var b=Da(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Fc(a.display)-3);return function(e){return aa(a.doc,
|
||||
e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function Gc(a){var b=a.doc,c=Ec(a);b.iter(function(a){var b=c(a);b!=a.height&&M(a,b)})}function Bc(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");la(a)}function Ea(a){Ac(a);u(a);setTimeout(function(){Ob(a)},20)}function Ac(a){var b=a.display.gutters,c=a.options.gutters;ab(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(n("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==
|
||||
e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function bb(a,b){if(0==b.height)return 0;for(var c=b.text.length,d,e=b;d=ba(e,-1);)d=d.find(),e=q(a,d.from.line),c+=d.from.ch-d.to.ch;for(e=b;d=Fa(e);)d=d.find(),c-=e.text.length-d.from.ch,e=q(a,d.to.line),c+=e.text.length-d.to.ch;return c}function Pb(a){var b=a.display,c=a.doc;b.maxLine=q(c,c.first);b.maxLineLength=bb(c,b.maxLine);b.maxLineChanged=!0;c.iter(function(a){var e=bb(c,a);e>b.maxLineLength&&
|
||||
(b.maxLineLength=e,b.maxLine=a)})}function Ib(a){for(var b=!1,c=0;c<a.gutters.length;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers?b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function Qb(a){var b=a.display,c=a.doc.height+(b.mover.offsetHeight-b.lineSpace.offsetHeight);b.sizer.style.minHeight=b.heightForcer.style.top=c+"px";b.gutters.style.height=Math.max(c,b.scroller.clientHeight-ja)+"px";var c=Math.max(c,b.scroller.scrollHeight),d=b.scroller.scrollWidth>
|
||||
b.scroller.clientWidth,e=c>b.scroller.clientHeight;e?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=d?Ga(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=c-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):b.scrollbarV.style.display="";d?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=e?Ga(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):b.scrollbarH.style.display="";d&&e?
|
||||
(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=Ga(b.measure)+"px"):b.scrollbarFiller.style.display="";d&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=Ga(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="";Hd&&0===Ga(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=Id?"18px":"12px")}function Rb(a,
|
||||
b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top);d=Math.floor(d-a.lineSpace.offsetTop);a=Math.ceil(d+e);return{from:cb(b,d),to:cb(b,a)}}function Ob(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=Sb(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.options.fixedGutter&&
|
||||
(b.gutters.style.left=c+d+"px")}}function Jd(a){if(!a.options.lineNumbers)return!1;var b=a.doc,b=""+a.options.lineNumberFormatter(b.first+b.size-1+a.options.firstLineNumber),a=a.display;if(b.length!=a.lineNumChars){var c=a.measure.appendChild(n("div",[n("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),d=c.firstChild.offsetWidth,c=c.offsetWidth-d;a.lineGutter.style.width="";a.lineNumInnerWidth=Math.max(d,a.lineGutter.offsetWidth-c);a.lineNumWidth=a.lineNumInnerWidth+c;a.lineNumChars=a.lineNumInnerWidth?
|
||||
b.length:-1;a.lineGutter.style.width=a.lineNumWidth+"px";return!0}return!1}function Sb(a){return y(a.scroller).left-y(a.sizer).left}function db(a,b,c){for(var d=a.display.showingFrom,e=a.display.showingTo,f,g=Rb(a.display,a.doc,c);Kd(a,b,g);){f=!0;Tb(a);Qb(a);c&&(c=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,"number"==typeof c?c:c.top));g=Rb(a.display,a.doc,c);if(g.from>=a.display.showingFrom&&g.to<=a.display.showingTo)break;b=[]}f&&(O(a,"update",a),(a.display.showingFrom!=
|
||||
d||a.display.showingTo!=e)&&O(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo));return f}function Kd(a,b,c){var d=a.display,e=a.doc;if(d.wrapper.clientWidth){if(!(0==b.length&&c.from>d.showingFrom&&c.to<d.showingTo)){Jd(a)&&(b=[{from:e.first,to:e.first+e.size}]);var f=d.sizer.style.marginLeft=d.gutters.offsetWidth+"px";d.scrollbarH.style.left=a.options.fixedGutter?f:"0";var g=Infinity;if(a.options.lineNumbers)for(f=0;f<b.length;++f)if(b[f].diff){g=b[f].from;break}var f=e.first+e.size,
|
||||
h=Math.max(c.from-a.options.viewportMargin,e.first),c=Math.min(f,c.to+a.options.viewportMargin);d.showingFrom<h&&20>h-d.showingFrom&&(h=Math.max(e.first,d.showingFrom));d.showingTo>c&&20>d.showingTo-c&&(c=Math.min(f,d.showingTo));if(Ha)for(h=H(ma(e,q(e,h)));c<f&&aa(e,q(e,c));)++c;var i=[{from:Math.max(d.showingFrom,e.first),to:Math.min(d.showingTo,f)}],i=i[0].from>=i[0].to?[]:Ld(i,b);if(Ha)for(f=0;f<i.length;++f)for(var b=i[f],j;j=Fa(q(e,b.to-1));)if(j=j.find().from.line,j>b.from)b.to=j;else{i.splice(f--,
|
||||
1);break}for(f=e=0;f<i.length;++f)b=i[f],b.from<h&&(b.from=h),b.to>c&&(b.to=c),b.from>=b.to?i.splice(f--,1):e+=b.to-b.from;if(e==c-h&&h==d.showingFrom&&c==d.showingTo)Hc(a);else{i.sort(function(a,b){return a.from-b.from});try{var k=document.activeElement}catch(m){}e<0.7*(c-h)&&(d.lineDiv.style.display="none");Md(a,h,c,i,g);d.lineDiv.style.display="";k&&(document.activeElement!=k&&k.offsetHeight)&&k.focus();if(h!=d.showingFrom||c!=d.showingTo||d.lastSizeC!=d.wrapper.clientHeight)d.lastSizeC=d.wrapper.clientHeight;
|
||||
d.showingFrom=h;d.showingTo=c;$a(a,100);k=d.lineDiv.offsetTop;for(e=d.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj&&(ka?(g=e.offsetTop+e.offsetHeight,f=g-k,k=g):(f=y(e),f=f.bottom-f.top),g=e.lineObj.height-f,2>f&&(f=Da(d)),0.001<g||-0.001>g))if(M(e.lineObj,f),g=e.lineObj.widgets)for(f=0;f<g.length;++f)g[f].height=g[f].node.offsetHeight;Hc(a);return!0}}}else d.showingFrom=d.showingTo=e.first,d.viewOffset=0}function Hc(a){var b=a.display.viewOffset=na(a,q(a.doc,a.display.showingFrom));a.display.mover.style.top=
|
||||
b+"px"}function Ld(a,b){for(var c=0,d=b.length||0;c<d;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;h<i;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function Nd(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:Sb(b),
|
||||
gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function Md(a,b,c,d,e){function f(b){var c=b.nextSibling;L&&oa&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b);return c}var g=Nd(a),h=a.display,i=a.options.lineNumbers;!d.length&&(!L||!a.display.currentWheelTarget)&&ab(h.lineDiv);var j=h.lineDiv,k=j.firstChild,m=d.shift(),s=b;for(a.doc.iter(b,c,function(b){m&&m.to==s&&(m=d.shift());if(aa(a.doc,
|
||||
b)){if(0!=b.height&&M(b,0),b.widgets&&k.previousSibling)for(var c=0;c<b.widgets.length;++c)if(b.widgets[c].showIfHidden){var h=k.previousSibling;if(/pre/i.test(h.nodeName)){var l=n("div",null,null,"position: relative");h.parentNode.replaceChild(l,h);l.appendChild(h);h=l}l=h.appendChild(n("div",[b.widgets[c].node],"CodeMirror-linewidget"));Ub(b.widgets[c],l,h,g)}}else if(m&&m.from<=s&&m.to>s){for(;k.lineObj!=b;)k=f(k);i&&(e<=s&&k.lineNumber)&&Ic(k.lineNumber,""+a.options.lineNumberFormatter(s+a.options.firstLineNumber));
|
||||
k=k.nextSibling}else{if(b.widgets)for(var o=0,q=k;q&&20>o;++o,q=q.nextSibling)if(q.lineObj==b&&/div/i.test(q.nodeName)){c=q;break}var o=a,r=s,I=c,q=Vb(o,b),p=b.gutterMarkers,Od=o.display;if(!o.options.lineNumbers&&!p&&!b.bgClass&&!b.wrapClass&&!b.widgets)h=q;else{if(I){I.alignable=null;for(var t=!0,v=0,w=I.firstChild,x;w;w=x)if(x=w.nextSibling,/\bCodeMirror-linewidget\b/.test(w.className)){for(var y=0,B=!0;y<b.widgets.length;++y){var u=b.widgets[y],z=!1;u.above||(z=B,B=!1);if(u.node==w.firstChild){Ub(u,
|
||||
w,I,g);++v;z&&I.insertBefore(q,w);break}}if(y==b.widgets.length){t=!1;break}}else I.removeChild(w);t&&v==b.widgets.length&&(h=I,I.className=b.wrapClass||"")}h||(h=n("div",null,b.wrapClass,"position: relative"),h.appendChild(q));b.bgClass&&h.insertBefore(n("div",null,b.bgClass+" CodeMirror-linebackground"),h.firstChild);if(o.options.lineNumbers||p){l=h.insertBefore(n("div",null,null,"position: absolute; left: "+(o.options.fixedGutter?g.fixedPos:-g.gutterTotalWidth)+"px"),h.firstChild);o.options.fixedGutter&&
|
||||
(h.alignable||(h.alignable=[])).push(l);if(o.options.lineNumbers&&(!p||!p["CodeMirror-linenumbers"]))h.lineNumber=l.appendChild(n("div",""+o.options.lineNumberFormatter(r+o.options.firstLineNumber),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+g.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+Od.lineNumInnerWidth+"px"));if(p)for(y=0;y<o.options.gutters.length;++y)u=o.options.gutters[y],(r=p.hasOwnProperty(u)&&p[u])&&l.appendChild(n("div",[r],"CodeMirror-gutter-elt","left: "+g.gutterLeft[u]+
|
||||
"px; width: "+g.gutterWidth[u]+"px"))}ka&&(h.style.zIndex=2);if(b.widgets&&h!=I){y=0;for(I=b.widgets;y<I.length;++y)u=I[y],p=n("div",[u.node],"CodeMirror-linewidget"),Ub(u,p,h,g),u.above?h.insertBefore(p,o.options.lineNumbers&&0!=b.height?l:q):h.appendChild(p),O(u,"redraw")}}if(h!=c)j.insertBefore(h,k);else{for(;k!=c;)k=f(k);k=k.nextSibling}h.lineObj=b}++s});k;)k=f(k)}function Ub(a,b,c,d){a.noHScroll&&((c.alignable||(c.alignable=[])).push(b),c=d.wrapperWidth,b.style.left=d.fixedPos+"px",a.coverGutter||
|
||||
(c-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=c+"px");a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function Tb(a){var b=a.display,c=w(a.doc.sel.from,a.doc.sel.to);if(c||a.options.showCursorWhenSelecting){var d=a.display,e=P(a,a.doc.sel.head,"div");d.cursor.style.left=e.left+"px";d.cursor.style.top=e.top+"px";d.cursor.style.height=Math.max(0,e.bottom-e.top)*a.options.cursorHeight+"px";d.cursor.style.display=
|
||||
"";e.other?(d.otherCursor.style.display="",d.otherCursor.style.left=e.other.left+"px",d.otherCursor.style.top=e.other.top+"px",d.otherCursor.style.height=0.85*(e.other.bottom-e.other.top)+"px"):d.otherCursor.style.display="none"}else b.cursor.style.display=b.otherCursor.style.display="none";c?b.selectionDiv.style.display="none":Pd(a);a.options.moveInputWithCursor&&(a=P(a,a.doc.sel.head,"div"),c=y(b.wrapper),d=y(b.lineDiv),b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+d.top-
|
||||
c.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+d.left-c.left))+"px")}function Pd(a){function b(a,b,c,d){0>b&&(b=0);g.appendChild(n("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?h-a:c)+"px; height: "+(d-b)+"px"))}function c(c,d,f,g){var j=q(e,c),k=j.text.length,m=g?Infinity:-Infinity;Qd(Q(j),d||0,null==f?k:f,function(e,s,l){var q=eb(a,o(c,e),"div",j),n,p;e==s?(n=q,l=p=q.left):(n=eb(a,o(c,s-1),"div",j),"rtl"==
|
||||
l&&(l=q,q=n,n=l),l=q.left,p=n.right);3<n.top-q.top&&(b(l,q.top,null,q.bottom),l=i,q.bottom<n.top&&b(l,q.bottom,null,n.top));null==f&&s==k&&(p=h);null==d&&0==e&&(l=i);m=g?Math.min(n.top,m):Math.max(n.bottom,m);l<i+1&&(l=i);b(l,n.top,p-l,n.bottom)});return m}var d=a.display,e=a.doc,f=a.doc.sel,g=document.createDocumentFragment(),h=d.lineSpace.offsetWidth,i=R(a.display.measure,n("pre",null,null,"text-align: left")).appendChild(n("span","x")).offsetLeft;if(f.from.line==f.to.line)c(f.from.line,f.from.ch,
|
||||
f.to.ch);else{for(var j=q(e,f.from.line),k=j,m=[f.from.line,f.from.ch],s;k=Fa(k);){k=k.find();m.push(k.from.ch,k.to.line,k.to.ch);if(k.to.line==f.to.line){m.push(f.to.ch);s=!0;break}k=q(e,k.to.line)}if(s)for(f=0;f<m.length;f+=3)c(m[f],m[f+1],m[f+2]);else m=q(e,f.to.line),j=f.from.ch?c(f.from.line,f.from.ch,null,!1):na(a,j)-d.viewOffset,f=f.to.ch?c(f.to.line,ba(m,-1)?null:0,f.to.ch,!0):na(a,m)-d.viewOffset,j<f&&b(i,j,null,f)}R(d.selectionDiv,g);d.selectionDiv.style.display=""}function fb(a){if(a.state.focused){var b=
|
||||
a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="";b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate)}}function $a(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.showingTo&&a.state.highlight.set(b,K(Rd,a))}function Rd(a){var b=a.doc;b.frontier<b.first&&(b.frontier=b.first);if(!(b.frontier>=a.display.showingTo)){var c=+new Date+a.options.workTime,d=pa(b.mode,
|
||||
Ia(a,b.frontier)),e=[],f;b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Lc(a,g,d);for(var i=!h||h.length!=g.styles.length,j=0;!i&&j<h.length;++j)i=h[j]!=g.styles[j];i&&(f&&f.end==b.frontier?f.end++:e.push(f={start:b.frontier,end:b.frontier+1}));g.stateAfter=pa(b.mode,d)}else{Mc(a,g,d);g.stateAfter=b.frontier%5==0?pa(b.mode,d):null}++b.frontier;if(+new Date>c){$a(a,a.options.workDelay);return true}});e.length&&
|
||||
p(a,function(){for(var a=0;a<e.length;++a)u(this,e[a].start,e[a].end)})()}}function Sd(a,b){for(var c,d,e=a.doc,f=b,g=b-100;f>g;--f){if(f<=e.first)return e.first;var h=q(e,f-1);if(h.stateAfter)return f;h=qa(h.text,null,a.options.tabSize);if(null==d||c>h)d=f-1,c=h}return d}function Ia(a,b){var c=a.doc,d=a.display;if(!c.mode.startState)return!0;var e=Sd(a,b),f=e>c.first&&q(c,e-1).stateAfter,f=f?pa(c.mode,f):Nc(c.mode);c.iter(e,b,function(g){Mc(a,g,f);g.stateAfter=e==b-1||0==e%5||e>=d.showingFrom&&e<
|
||||
d.showingTo?pa(c.mode,f):null;++e});return f}function Wb(a,b,c,d){for(var e=-1,d=d||Xb(a,b),a=c;;a+=e){var f=d[a];if(f)break;0>e&&0==a&&(e=1)}return{left:a<c?f.right:f.left,right:a>c?f.left:f.right,top:f.top,bottom:f.bottom}}function Yb(a,b){for(var c=a.display.measureLineCache,d=0;d<c.length;++d){var e=c[d];if(e.text==b.text&&e.markedSpans==b.markedSpans&&a.display.scroller.clientWidth==e.width&&e.classes==b.textClass+"|"+b.bgClass+"|"+b.wrapClass)return e}}function Td(a,b){var c=Yb(a,b);c&&(c.text=
|
||||
c.measure=c.markedSpans=null)}function Xb(a,b){var c=Yb(a,b);if(c)return c.measure;var d=a.display,e=Oc(b.text.length),f=Vb(a,b,e);if(B&&!ka&&!a.options.lineWrapping&&100<f.childNodes.length){for(var g=document.createDocumentFragment(),h=f.childNodes.length,c=0,i=Math.ceil(h/10);c<i;++c){for(var j=n("div",null,null,"display: inline-block"),k=0;10>k&&h;++k)j.appendChild(f.firstChild),--h;g.appendChild(j)}f.appendChild(g)}R(d.measure,f);i=y(d.lineDiv);h=[];g=Oc(b.text.length);j=f.offsetHeight;J&&d.measure.first!=
|
||||
f&&R(d.measure,f);for(c=0;c<e.length;++c)if(d=e[c]){for(var f=y(d),m=Math.max(0,f.top-i.top),s=Math.min(f.bottom-i.top,j),k=0;k<h.length;k+=2){var C=h[k],l=h[k+1];if(!(C>s||l<m))if(C<=m&&l>=s||m<=C&&s>=l||Math.min(s,l)-Math.max(m,C)>=s-m>>1){h[k]=Math.min(m,C);h[k+1]=Math.max(s,l);break}}k==h.length&&h.push(m,s);m=f.right;d.measureRight&&(m=y(d.measureRight).left);g[c]={left:f.left-i.left,right:m-i.left,top:k}}for(c=0;c<g.length;++c)if(d=g[c])e=d.top,d.top=h[e],d.bottom=h[e+1];c=a.display.measureLineCache;
|
||||
e={text:b.text,width:a.display.scroller.clientWidth,markedSpans:b.markedSpans,measure:g,classes:b.textClass+"|"+b.bgClass+"|"+b.wrapClass};16==c.length?c[++a.display.measureLineCachePos%16]=e:c.push(e);return g}function la(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0;a.display.cachedCharWidth=a.display.cachedTextHeight=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Pc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=
|
||||
gb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=na(a,b);"local"!=d&&(b-=a.display.viewOffset);"page"==d&&(a=y(a.display.lineSpace),b+=a.top+(window.pageYOffset||(document.documentElement||document.body).scrollTop),a=a.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=a,c.right+=a);c.top+=b;c.bottom+=b;return c}function eb(a,b,c,d){d||(d=q(a.doc,b.line));return Pc(a,d,Wb(a,d,b.ch),c)}function P(a,b,c,d,e){function f(b,f){var g=Wb(a,
|
||||
d,b,e);f?g.left=g.right:g.right=g.left;return Pc(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;a==(c.level%2?c.to:c.from)&&b&&c.level<h[b-1].level?(c=h[--b],a=Zb(c)-(c.level%2?0:1),d=!0):a==Zb(c)&&(b<h.length-1&&c.level<h[b+1].level)&&(c=h[++b],a=(c.level%2?c.to:c.from)-c.level%2,d=!1);return d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||q(a.doc,b.line);e||(e=Xb(a,d));var h=Q(d),b=b.ch;if(!h)return f(b);var i=$b(h,b),i=g(b,i);null!=ra&&(i.other=g(b,ra));return i}function hb(a,b,c){a=new o(a,b);c&&(a.outside=
|
||||
!0);return a}function ac(a,b,c){var d=a.doc,c=c+a.display.viewOffset;if(0>c)return hb(d.first,0,!0);var e=cb(d,c),f=d.first+d.size-1;if(e>f)return hb(d.first+d.size-1,q(d,f).text.length,!0);for(0>b&&(b=0);;){var f=q(d,e),e=Ud(a,f,e,b,c),g=(f=Fa(f))&&f.find();if(f&&e.ch>=g.from.ch)e=g.to.line;else return e}}function Ud(a,b,c,d,e){function f(d){d=P(a,o(c,d),"line",b,j);h=!0;if(g>d.bottom)return d.left-i;if(g<d.top)return d.left+i;h=!1;return d.left}var g=e-na(a,b),h=!1,i=2*a.display.wrapper.clientWidth,
|
||||
j=Xb(a,b),k=Q(b),m=b.text.length,s=ib(b),C=jb(b),l=f(s),e=h,q=f(C),n=h;if(d>q)return hb(c,C,n);for(;;){if(k?C==s||C==bc(b,s,1):1>=C-s){for(s=(d=d-l<q-d)?s:C;cc.test(b.text.charAt(s));)++s;e=hb(c,s,d?e:n);e.after=d;return e}var p=Math.ceil(m/2),r=s+p;if(k)for(var r=s,t=0;t<p;++t)r=bc(b,r,1);t=f(r);if(t>d){C=r;q=t;if(n=h)q+=1E3;m=p}else s=r,l=t,e=h,m-=p}}function Da(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==ca){ca=n("pre");for(var b=0;49>b;++b)ca.appendChild(document.createTextNode("x")),
|
||||
ca.appendChild(n("br"));ca.appendChild(document.createTextNode("x"))}R(a.measure,ca);b=ca.offsetHeight/50;3<b&&(a.cachedTextHeight=b);ab(a.measure);return b||1}function Fc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=n("span","x"),c=n("pre",[b]);R(a.measure,c);b=b.offsetWidth;2<b&&(a.cachedCharWidth=b);return b||10}function sa(a){a.curOp={changes:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Vd};
|
||||
kb++||(X=[])}function ta(a){var b=a.curOp,c=a.doc,d=a.display;a.curOp=null;b.updateMaxLine&&Pb(a);if(d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e;e=d.maxLine;var f=!1;if(e.markedSpans)for(var g=0;g<e.markedSpans;++g){var h=e.markedSpans[g];if(h.collapsed&&(null==h.to||h.to==e.text.length))f=!0}(f=!f&&Yb(a,e))?e=Wb(a,e,e.text.length,f.measure).right:(e=Vb(a,e),f=e.appendChild(lb(a.display.measure)),R(a.display.measure,e),e=y(f).right-y(a.display.lineDiv).left);d.sizer.style.minWidth=
|
||||
Math.max(0,e+3+ja)+"px";d.maxLineChanged=!1;e=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);e<c.scrollLeft&&!b.updateScrollPos&&ua(a,Math.min(d.scroller.scrollLeft,e),!0)}var i,j;b.updateScrollPos?i=b.updateScrollPos:b.selectionChanged&&d.scroller.clientHeight&&(i=P(a,c.sel.head),i=mb(a,i.left,i.top,i.left,i.bottom));if(b.changes.length||i&&null!=i.scrollTop)j=db(a,b.changes,i&&i.scrollTop),a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop);
|
||||
!j&&b.selectionChanged&&Tb(a);if(b.updateScrollPos)d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=i.scrollTop,d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=i.scrollLeft,Ob(a),b.scrollToPos&&Qc(a,r(a.doc,b.scrollToPos),b.scrollToPosMargin);else if(i&&(c=Qc(a,a.doc.sel.head,a.options.cursorScrollMargin),a.state.focused)){d=a.display;i=y(d.sizer);j=null;e=a.display.lineSpace.offsetTop;if(0>c.top+e+i.top)j=!0;else if(c.bottom+e+i.top>(window.innerHeight||document.documentElement.clientHeight))j=
|
||||
!1;if(null!=j&&!Wd){if(i="none"==d.cursor.style.display)d.cursor.style.display="",d.cursor.style.left=c.left+"px",d.cursor.style.top=c.top-d.viewOffset+"px";d.cursor.scrollIntoView(j);i&&(d.cursor.style.display="none")}}b.selectionChanged&&fb(a);a.state.focused&&b.updateInput&&W(a,b.userSelChange);c=b.maybeHiddenMarkers;d=b.maybeUnhiddenMarkers;if(c)for(j=0;j<c.length;++j)c[j].lines.length||D(c[j],"hide");if(d)for(j=0;j<d.length;++j)d[j].lines.length&&D(d[j],"unhide");var k;--kb||(k=X,X=null);b.textChanged&&
|
||||
D(a,"change",a,b.textChanged);b.cursorActivity&&D(a,"cursorActivity",a);if(k)for(j=0;j<k.length;++j)k[j]()}function p(a,b){return function(){var c=a||this,d=!c.curOp;d&&sa(c);try{var e=b.apply(c,arguments)}finally{d&&ta(c)}return e}}function Ja(a){return function(){var b=this.cm&&!this.cm.curOp,c;b&&sa(this.cm);try{c=a.apply(this,arguments)}finally{b&&ta(this.cm)}return c}}function dc(a,b){var c=!a.curOp,d;c&&sa(a);try{d=b()}finally{c&&ta(a)}return d}function u(a,b,c,d){null==b&&(b=a.doc.first);null==
|
||||
c&&(c=a.doc.first+a.doc.size);a.curOp.changes.push({from:b,to:c,diff:d})}function nb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){ec(a);a.state.focused&&nb(a)})}function Ka(a){function b(){!ec(a)&&!c?(c=!0,a.display.poll.set(60,b)):(a.display.pollingFast=!1,nb(a))}var c=!1;a.display.pollingFast=!0;a.display.poll.set(20,b)}function ec(a){var b=a.display.input,c=a.display.prevInput,d=a.doc,e=d.sel;if(!a.state.focused||Xd(b)||La(a))return!1;var f=b.value;if(f==c&&w(e.from,
|
||||
e.to))return!1;if(B&&!J&&a.display.inputHasSelection===f)return W(a,!0),!1;var g=!a.curOp;g&&sa(a);e.shift=!1;for(var h=0,i=Math.min(c.length,f.length);h<i&&c.charCodeAt(h)==f.charCodeAt(h);)++h;i=e.from;e=e.to;h<c.length?i=o(i.line,i.ch-(c.length-h)):a.state.overwrite&&(w(i,e)&&!a.state.pasteIncoming)&&(e=o(e.line,Math.min(q(d,e.line).text.length,e.ch+(f.length-h))));c=a.curOp.updateInput;va(a.doc,{from:i,to:e,text:da(f.slice(h)),origin:a.state.pasteIncoming?"paste":"+input"},"end");a.curOp.updateInput=
|
||||
c;1E3<f.length||-1<f.indexOf("\n")?b.value=a.display.prevInput="":a.display.prevInput=f;g&&ta(a);a.state.pasteIncoming=!1;return!0}function W(a,b){var c,d,e=a.doc;w(e.sel.from,e.sel.to)?b&&(a.display.prevInput=a.display.input.value="",B&&!J&&(a.display.inputHasSelection=null)):(a.display.prevInput="",d=(c=Rc&&(100<e.sel.to.line-e.sel.from.line||1E3<(d=a.getSelection()).length))?"-":d||a.getSelection(),a.display.input.value=d,a.state.focused&&Sc(a.display.input),B&&!J&&(a.display.inputHasSelection=
|
||||
d));a.display.inaccurateSelection=c}function G(a){"nocursor"!=a.options.readOnly&&(!Jb||document.activeElement!=a.display.input)&&a.display.input.focus()}function La(a){return a.options.readOnly||a.doc.cantEdit}function Gd(a){function b(){a.state.focused&&setTimeout(K(G,a),0)}function c(){g.cachedCharWidth=g.cachedTextHeight=null;la(a);dc(a,K(u,a))}function d(){for(var a=g.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(d,5E3):T(window,"resize",c)}function e(b){(!a.options.onDragEvent||
|
||||
!a.options.onDragEvent(a,Ma(b)))&&Na(b)}function f(){g.inaccurateSelection&&(g.prevInput="",g.inaccurateSelection=!1,g.input.value=a.getSelection(),Sc(g.input))}var g=a.display;t(g.scroller,"mousedown",p(a,Yd));B?t(g.scroller,"dblclick",p(a,function(b){var c=wa(a,b);c&&(!Tc(a,b)&&!ea(a.display,b))&&(z(b),b=fc(q(a.doc,c.line).text,c),A(a.doc,b.from,b.to))})):t(g.scroller,"dblclick",z);t(g.lineSpace,"selectstart",function(a){ea(g,a)||z(a)});gc||t(g.scroller,"contextmenu",function(b){Uc(a,b)});t(g.scroller,
|
||||
"scroll",function(){g.scroller.clientHeight&&(Oa(a,g.scroller.scrollTop),ua(a,g.scroller.scrollLeft,!0),D(a,"scroll",a))});t(g.scrollbarV,"scroll",function(){g.scroller.clientHeight&&Oa(a,g.scrollbarV.scrollTop)});t(g.scrollbarH,"scroll",function(){g.scroller.clientHeight&&ua(a,g.scrollbarH.scrollLeft)});t(g.scroller,"mousewheel",function(b){Vc(a,b)});t(g.scroller,"DOMMouseScroll",function(b){Vc(a,b)});t(g.scrollbarH,"mousedown",b);t(g.scrollbarV,"mousedown",b);t(g.wrapper,"scroll",function(){g.wrapper.scrollTop=
|
||||
g.wrapper.scrollLeft=0});t(window,"resize",c);setTimeout(d,5E3);t(g.input,"keyup",p(a,function(b){if((!a.options.onKeyEvent||!a.options.onKeyEvent(a,Ma(b)))&&16==b.keyCode)a.doc.sel.shift=!1}));t(g.input,"input",K(Ka,a));t(g.input,"keydown",p(a,Wc));t(g.input,"keypress",p(a,Zd));t(g.input,"focus",K($,a));t(g.input,"blur",K(Lb,a));a.options.dragDrop&&(t(g.scroller,"dragstart",function(b){var c=a;if(B&&!c.state.draggingText)Na(b);else if(!ea(c.display,b)){var d=c.getSelection();b.dataTransfer.setData("Text",
|
||||
d);b.dataTransfer.setDragImage&&(d=n("img",null,null,"position: fixed; left: 0; top: 0;"),S&&(d.width=d.height=1,c.display.wrapper.appendChild(d),d._top=d.offsetTop),hc&&(c.display.dragImg?d=c.display.dragImg:(c.display.dragImg=d,d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c.display.wrapper.appendChild(d))),b.dataTransfer.setDragImage(d,0,0),S&&d.parentNode.removeChild(d))}}),t(g.scroller,"dragenter",e),t(g.scroller,"dragover",e),t(g.scroller,"drop",p(a,$d)));
|
||||
t(g.scroller,"paste",function(b){if(!ea(g,b)){G(a);Ka(a)}});t(g.input,"paste",function(){a.state.pasteIncoming=true;Ka(a)});t(g.input,"cut",f);t(g.input,"copy",f);Nb&&t(g.sizer,"mouseup",function(){document.activeElement==g.input&&g.input.blur();G(a)})}function ea(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||/\bCodeMirror-(?:line)?widget\b/.test(c.className)||c.parentNode==a.sizer&&c!=a.mover)return!0}function wa(a,b,c){var d=a.display;if(!c&&(c=b.target||b.srcElement,
|
||||
c==d.scrollbarH||c==d.scrollbarH.firstChild||c==d.scrollbarV||c==d.scrollbarV.firstChild||c==d.scrollbarFiller||c==d.gutterFiller))return null;var e,f,d=y(d.lineSpace);try{e=b.clientX,f=b.clientY}catch(g){return null}return ac(a,e-d.left,f-d.top)}function Yd(a){function b(a){if(!w(n,a))if(n=a,"single"==k)A(e.doc,r(g,i),a);else if(C=r(g,C),l=r(g,l),"double"==k){var b=fc(q(g,a.line).text,a);x(a,C)?A(e.doc,b.from,l):A(e.doc,C,b.to)}else"triple"==k&&(x(a,C)?A(e.doc,l,r(g,o(a.line,0))):A(e.doc,C,r(g,o(a.line+
|
||||
1,0))))}function c(a){var d=++u,h=wa(e,a,!0);if(h)if(w(h,m)){var i=a.clientY<v.top?-20:a.clientY>v.bottom?20:0;i&&setTimeout(p(e,function(){u==d&&(f.scroller.scrollTop+=i,c(a))}),50)}else{e.state.focused||$(e);m=h;b(h);var j=Rb(f,g);(h.line>=j.to||h.line<j.from)&&setTimeout(p(e,function(){u==d&&c(a)}),150)}}function d(a){u=Infinity;var c=wa(e,a);c&&b(c);z(a);G(e);T(document,"mousemove",Jc);T(document,"mouseup",Kc)}var e=this,f=e.display,g=e.doc,h=g.sel;h.shift=a.shiftKey;if(ea(f,a))L||(f.scroller.draggable=
|
||||
!1,setTimeout(function(){f.scroller.draggable=!0},100));else if(!Tc(e,a)){var i=wa(e,a);switch(Xc(a)){case 3:gc&&Uc.call(e,e,a);return;case 2:i&&A(e.doc,i);setTimeout(K(G,e),20);z(a);return}if(i){e.state.focused||$(e);var j=+new Date,k="single";ob&&ob.time>j-400&&w(ob.pos,i)?(k="triple",z(a),setTimeout(K(G,e),20),ae(e,i.line)):pb&&pb.time>j-400&&w(pb.pos,i)?(k="double",ob={time:j,pos:i},z(a),j=fc(q(g,i.line).text,i),A(e.doc,j.from,j.to)):pb={time:j,pos:i};var m=i;if(e.options.dragDrop&&be&&!La(e)&&
|
||||
!w(h.from,h.to)&&!x(i,h.from)&&!x(h.to,i)&&"single"==k){var s=p(e,function(b){if(L)f.scroller.draggable=false;e.state.draggingText=false;T(document,"mouseup",s);T(f.scroller,"drop",s);if(Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10){z(b);A(e.doc,i);G(e)}});L&&(f.scroller.draggable=!0);e.state.draggingText=s;f.scroller.dragDrop&&f.scroller.dragDrop();t(document,"mouseup",s);t(f.scroller,"drop",s)}else{z(a);"single"==k&&A(e.doc,r(g,i));var C=h.from,l=h.to,n=i,v=y(f.wrapper),u=0,Jc=
|
||||
p(e,function(a){!B&&!Xc(a)?d(a):c(a)}),Kc=p(e,d);t(document,"mousemove",Jc);t(document,"mouseup",Kc)}}else(a.target||a.srcElement)==f.scroller&&z(a)}}function $d(a){var b=this;if(!(ea(b.display,a)||b.options.onDragEvent&&b.options.onDragEvent(b,Ma(a)))){z(a);var c=wa(b,a,!0),d=a.dataTransfer.files;if(c&&!La(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,a=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result;++g==e&&(c=r(b.doc,c),va(b.doc,{from:c,
|
||||
to:c,text:da(f.join("\n")),origin:"paste"},"around"))};h.readAsText(a)},h=0;h<e;++h)a(d[h],h);else if(b.state.draggingText&&!x(c,b.doc.sel.from)&&!x(b.doc.sel.to,c))b.state.draggingText(a),setTimeout(K(G,b),20);else try{if(f=a.dataTransfer.getData("Text")){var h=b.doc.sel.from,i=b.doc.sel.to;Y(b.doc,c,c);b.state.draggingText&&Z(b.doc,"",h,i,"paste");b.replaceSelection(f,null,"paste");G(b);$(b)}}catch(j){}}}function Tc(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(f){return!1}if(d>=Math.floor(y(c.gutters).right))return!1;
|
||||
z(b);if(!xa(a,"gutterClick"))return!0;var g=y(c.lineDiv);if(e>g.bottom)return!0;e-=g.top-c.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=c.gutters.childNodes[g];if(h&&y(h).right>=d){c=cb(a.doc,e);O(a,"gutterClick",a,c,a.options.gutters[g],b);break}}return!0}function Oa(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,ya||db(a,[],b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),ya&&db(a,[]))}
|
||||
function ua(a,b,c){if(!(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b)))if(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,Ob(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b)a.display.scrollbarH.scrollLeft=b}function Vc(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&(b.detail&&b.axis==b.HORIZONTAL_AXIS)&&(c=b.detail);null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);
|
||||
var e=a.display,f=e.scroller;if(c&&f.scrollWidth>f.clientWidth||d&&f.scrollHeight>f.clientHeight){if(d&&oa&&L)for(var g=b.target;g!=f;g=g.parentNode)if(g.lineObj){a.display.currentWheelTarget=g;break}if(c&&!ya&&!S&&null!=N)d&&Oa(a,Math.max(0,Math.min(f.scrollTop+d*N,f.scrollHeight-f.clientHeight))),ua(a,Math.max(0,Math.min(f.scrollLeft+c*N,f.scrollWidth-f.clientWidth))),z(b),e.wheelStartX=null;else{if(d&&null!=N){var g=d*N,h=a.doc.scrollTop,i=h+e.wrapper.clientHeight;0>g?h=Math.max(0,h+g-50):i=Math.min(a.doc.height,
|
||||
i+g+50);db(a,[],{top:h,bottom:i})}20>qb&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(e.wheelStartX!=null){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;if(a){N=(N*qb+a)/(qb+1);++qb}}},200)):(e.wheelDX+=c,e.wheelDY+=d))}}}function rb(a,b,c){if("string"==typeof b&&(b=ic[b],!b))return!1;a.display.pollingFast&&ec(a)&&(a.display.pollingFast=
|
||||
!1);var d=a.doc,e=d.sel.shift,f=!1;try{La(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=Yc}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function Zc(a){var b=a.state.keyMaps.slice(0);a.options.extraKeys&&b.push(a.options.extraKeys);b.push(a.options.keyMap);return b}function $c(a,b){var c=jc(a.options.keyMap),d=c.auto;clearTimeout(ad);d&&!bd(b)&&(ad=setTimeout(function(){jc(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d)},50));var e=cd(b,!0),f=!1;if(!e)return!1;
|
||||
f=Zc(a);f=b.shiftKey?Pa("Shift-"+e,f,function(b){return rb(a,b,!0)})||Pa(e,f,function(b){if("string"==typeof b&&/^go[A-Z]/.test(b))return rb(a,b)}):Pa(e,f,function(b){return rb(a,b)});"stop"==f&&(f=!1);f&&(z(b),fb(a),J&&(b.oldKeyCode=b.keyCode,b.keyCode=0));return f}function ce(a,b,c){if(c=Pa("'"+c+"'",Zc(a),function(b){return rb(a,b,!0)}))z(b),fb(a);return c}function Wc(a){this.state.focused||$(this);B&&27==a.keyCode&&(a.returnValue=!1);if(!this.options.onKeyEvent||!this.options.onKeyEvent(this,
|
||||
Ma(a))){var b=a.keyCode;this.doc.sel.shift=16==b||a.shiftKey;var c=$c(this,a);S&&(kc=c?b:null,!c&&(88==b&&!Rc&&(oa?a.metaKey:a.ctrlKey))&&this.replaceSelection(""))}}function Zd(a){var b=this;if(!b.options.onKeyEvent||!b.options.onKeyEvent(b,Ma(a))){var c=a.keyCode,d=a.charCode;if(S&&c==kc)kc=null,z(a);else if(!(S&&(!a.which||10>a.which)||Nb)||!$c(b,a))c=String.fromCharCode(null==d?c:d),this.options.electricChars&&(this.doc.mode.electricChars&&this.options.smartIndent&&!La(this)&&-1<this.doc.mode.electricChars.indexOf(c))&&
|
||||
setTimeout(p(b,function(){sb(b,b.doc.sel.to.line,"smart")}),75),ce(b,a,c)||(B&&!J&&(b.display.inputHasSelection=null),Ka(b))}}function $(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(D(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),W(a,!0)),nb(a),fb(a))}function Lb(a){a.state.focused&&(D(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused",
|
||||
""));clearInterval(a.display.blinker);setTimeout(function(){if(!a.state.focused)a.doc.sel.shift=false},150)}function Uc(a,b){function c(){if(null!=e.input.selectionStart){var a=e.input.value=" "+(w(f.from,f.to)?"":e.input.value);e.prevInput=" ";e.input.selectionStart=1;e.input.selectionEnd=a.length}}function d(){e.inputDiv.style.position="relative";e.input.style.cssText=i;J&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h);nb(a);if(null!=e.input.selectionStart){(!B||J)&&c();clearTimeout(lc);var b=
|
||||
0,d=function(){e.prevInput==" "&&e.input.selectionStart==0?p(a,ic.selectAll)(a):b++<10?lc=setTimeout(d,500):W(a)};lc=setTimeout(d,200)}}var e=a.display,f=a.doc.sel;if(!ea(e,b)){var g=wa(a,b),h=e.scroller.scrollTop;if(g&&!S){(w(f.from,f.to)||x(g,f.from)||!x(g,f.to))&&p(a,Y)(a.doc,g,g);var i=e.input.style.cssText;e.inputDiv.style.position="absolute";e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";
|
||||
G(a);W(a,!0);w(f.from,f.to)&&(e.input.value=e.prevInput=" ");B&&!J&&c();if(gc){Na(b);var j=function(){T(window,"mouseup",j);setTimeout(d,20)};t(window,"mouseup",j)}else setTimeout(d,50)}}}function mc(a){return!a.text?a.to:o(a.from.line+a.text.length-1,E(a.text).length+(1==a.text.length?a.from.ch:0))}function dd(a,b,c){if(!x(b.from,c))return r(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d)return b=c.line-d,d=a.first+a.size-1,b>d?o(d,q(a,d).text.length):tb(c,q(a,b).text.length);
|
||||
if(c.line==b.to.line+d)return tb(c,E(b.text).length+(1==b.text.length?b.from.ch:0)+q(a,b.to.line).text.length-b.to.ch);a=c.line-b.from.line;return tb(c,b.text[a].length+(a?0:b.from.ch))}function nc(a,b,c){if(c&&"object"==typeof c)return{anchor:dd(a,b,c.anchor),head:dd(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=mc(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};c=function(a){if(x(a,b.from))return a;if(!x(b.to,a))return d;var c=a.line+b.text.length-
|
||||
(b.to.line-b.from.line)-1,g=a.ch;a.line==b.to.line&&(g+=d.ch-b.to.ch);return o(c,g)};return{anchor:c(a.sel.anchor),head:c(a.sel.head)}}function de(a,b){var c={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,update:function(b,c,f,g){b&&(this.from=r(a,b));c&&(this.to=r(a,c));f&&(this.text=f);void 0!==g&&(this.origin=g)},cancel:function(){this.canceled=!0}};D(a,"beforeChange",a,c);a.cm&&D(a.cm,"beforeChange",a.cm,c);return c.canceled?null:{from:c.from,to:c.to,text:c.text,origin:c.origin}}
|
||||
function va(a,b,c,d){if(a.cm){if(!a.cm.curOp)return p(a.cm,va)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(xa(a,"beforeChange")||a.cm&&xa(a.cm,"beforeChange"))if(b=de(a,b),!b)return;if(d=ed&&!d&&ee(a,b.from,b.to)){for(var e=d.length-1;1<=e;--e)oc(a,{from:d[e].from,to:d[e].to,text:[""]});d.length&&oc(a,{from:d[0].from,to:d[0].to,text:b.text},c)}else oc(a,b,c)}function oc(a,b,c){c=nc(a,b,c);fd(a,b,c,a.cm?a.cm.curOp.id:NaN);Qa(a,b,c,pc(a,b));var d=[];za(a,function(a,c){!c&&-1==U(d,a.history)&&(gd(a.history,
|
||||
b),d.push(a.history));Qa(a,b,null,pc(a,b))})}function hd(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){c.dirtyCounter+="undo"==b?-1:1;var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore};("undo"==b?c.undone:c.done).push(e);for(c=d.changes.length-1;0<=c;--c){var f=d.changes[c];f.origin=b;e.changes.push(qc(a,f));var g=c?nc(a,f,null):{anchor:d.anchorBefore,head:d.headBefore};Qa(a,f,
|
||||
g,id(a,f));var h=[];za(a,function(a,b){!b&&-1==U(h,a.history)&&(gd(a.history,f),h.push(a.history));Qa(a,f,null,id(a,f))})}}}}function jd(a,b){function c(a){return o(a.line+b,a.ch)}a.first+=b;a.cm&&u(a.cm,a.first,a.first,b);a.sel.head=c(a.sel.head);a.sel.anchor=c(a.sel.anchor);a.sel.from=c(a.sel.from);a.sel.to=c(a.sel.to)}function Qa(a,b,c,d){if(a.cm&&!a.cm.curOp)return p(a.cm,Qa)(a,b,c,d);if(b.to.line<a.first)jd(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<
|
||||
a.first){var e=b.text.length-1-(a.first-b.from.line);jd(a,e);b={from:o(a.first,0),to:o(b.to.line+e,b.to.ch),text:[E(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:o(e,q(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=rc(a,b.from,b.to);c||(c=nc(a,b,null));a.cm?fe(a.cm,b,d,c):sc(a,b,d,c)}}function fe(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=H(ma(e,q(e,g.line))),e.iter(j,h.line+1,function(a){if(a==f.maxLine)return i=
|
||||
!0}));!x(e.sel.head,b.from)&&!x(b.to,e.sel.head)&&(a.curOp.cursorActivity=!0);sc(e,b,c,d,Ec(a));a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=bb(e,a);if(b>f.maxLineLength){f.maxLine=a;f.maxLineLength=b;f.maxLineChanged=true;i=false}}),i&&(a.curOp.updateMaxLine=!0));e.frontier=Math.min(e.frontier,g.line);$a(a,400);u(a,g.line,h.line+1,b.text.length-(h.line-g.line)-1);if(xa(a,"change"))if(b={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin},a.curOp.textChanged){for(a=
|
||||
a.curOp.textChanged;a.next;a=a.next);a.next=b}else a.curOp.textChanged=b}function Z(a,b,c,d,e){d||(d=c);if(x(d,c))var f=d,d=c,c=f;"string"==typeof b&&(b=da(b));va(a,{from:c,to:d,text:b,origin:e},null)}function o(a,b){if(!(this instanceof o))return new o(a,b);this.line=a;this.ch=b}function w(a,b){return a.line==b.line&&a.ch==b.ch}function x(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function fa(a){return o(a.line,a.ch)}function r(a,b){if(b.line<a.first)return o(a.first,0);var c=a.first+a.size-
|
||||
1;return b.line>c?o(c,q(a,c).text.length):tb(b,q(a,b.line).text.length)}function tb(a,b){var c=a.ch;return null==c||c>b?o(a.line,b):0>c?o(a.line,0):a}function Aa(a,b){return b>=a.first&&b<a.first+a.size}function A(a,b,c,d){if(a.sel.shift||a.sel.extend){var e=a.sel.anchor;if(c){var f=x(b,e);f!=x(c,e)?(e=b,b=c):f!=x(b,c)&&(b=c)}Y(a,e,b,d)}else Y(a,b,c||b,d);a.cm&&(a.cm.curOp.userSelChange=!0)}function Y(a,b,c,d,e){if(!e&&xa(a,"beforeSelectionChange")||a.cm&&xa(a.cm,"beforeSelectionChange"))b={anchor:b,
|
||||
head:c},D(a,"beforeSelectionChange",a,b),a.cm&&D(a.cm,"beforeSelectionChange",a.cm,b),b.anchor=r(a,b.anchor),b.head=r(a,b.head),c=b.head,b=b.anchor;var f=a.sel;f.goalColumn=null;if(e||!w(b,f.anchor))b=ub(a,b,d,"push"!=e);if(e||!w(c,f.head))c=ub(a,c,d,"push"!=e);if(!w(f.anchor,b)||!w(f.head,c))f.anchor=b,f.head=c,d=x(c,b),f.from=d?c:b,f.to=d?b:c,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),O(a,"cursorActivity",a)}function kd(a){Y(a.doc,a.doc.sel.from,a.doc.sel.to,
|
||||
null,"push")}function ub(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=q(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(D(k,"beforeCursorEnter"),k.explicitlyCleared))if(h.markedSpans){--i;continue}else break;if(k.atomic){i=k.find()[0>g?"from":"to"];if(w(i,f)&&(i.ch+=g,0>i.ch?i=i.line>a.first?r(a,o(i.line-1)):
|
||||
null:i.ch>h.text.length&&(i=i.line<a.first+a.size-1?o(i.line+1,0):null),!i)){if(e){if(!d)return ub(a,b,c,!0);a.cantEdit=!0;return o(a.first,0)}e=!0;i=b;g=-g}f=i;continue a}}}return f}}function Qc(a,b,c){for(null==c&&(c=0);;){var d=!1,e=P(a,b),f=mb(a,e.left,e.top-c,e.left,e.bottom+c),g=a.doc.scrollTop,h=a.doc.scrollLeft;null!=f.scrollTop&&(Oa(a,f.scrollTop),1<Math.abs(a.doc.scrollTop-g)&&(d=!0));null!=f.scrollLeft&&(ua(a,f.scrollLeft),1<Math.abs(a.doc.scrollLeft-h)&&(d=!0));if(!d)return e}}function mb(a,
|
||||
b,c,d,e){var f=a.display,g=f.lineSpace.offsetTop,c=c+g,e=e+g;0>c&&(c=0);var h=f.scroller.clientHeight-ja,i=f.scroller.scrollTop,j={},a=a.doc.height+(f.mover.offsetHeight-f.lineSpace.offsetHeight),k=c<g+10,g=e+g>a-10;c<i?j.scrollTop=k?0:c:e>i+h&&(c=Math.min(c,(g?a:e)-h),c!=i&&(j.scrollTop=c));i=f.scroller.clientWidth-ja;c=f.scroller.scrollLeft;b+=f.gutters.offsetWidth;d+=f.gutters.offsetWidth;f=f.gutters.offsetWidth;e=b<f+10;b<c+f||e?(e&&(b=0),j.scrollLeft=Math.max(0,b-10-f)):d>i+c-3&&(j.scrollLeft=
|
||||
d+10-i);return j}function vb(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function ld(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),a=a.display.scroller;d.scrollTop=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,d.scrollTop+c));d.scrollLeft=Math.max(0,Math.min(a.scrollWidth-a.clientWidth,d.scrollLeft+b))}function sb(a,b,c,d){var e=a.doc;c||(c="add");if("smart"==
|
||||
c)if(a.doc.mode.indent)var f=Ia(a,b);else c="prev";var g=a.options.tabSize,h=q(e,b),i=qa(h.text,null,g),j=h.text.match(/^\s*/)[0],k;if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==Yc)){if(!d)return;c="prev"}"prev"==c?k=b>e.first?qa(q(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c&&(k=i-a.options.indentUnit);k=Math.max(0,k);c="";d=0;if(a.options.indentWithTabs)for(e=Math.floor(k/g);e;--e)d+=g,c+="\t";d<k&&(c+=md(k-d));c!=j&&Z(a.doc,c,o(b,0),o(b,j.length),
|
||||
"+input");h.stateAfter=null}function wb(a,b,c){var d=b,e=b,f=a.doc;"number"==typeof b?e=q(f,Math.max(f.first,Math.min(b,f.first+f.size-1))):d=H(b);if(null!=d&&c(e,d))u(a,d,d+1);else return null;return e}function tc(a,b,c,d,e){function f(b){var d=(e?bc:nd)(i,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+a.size?b=j=!1:(g=b,b=i=q(a,b));if(b)h=e?(0>c?jb:ib)(i):0>c?i.text.length:0;else return j=!1}else h=d;return!0}var g=b.line,h=b.ch,b=c,i=q(a,g),j=!0;if("char"==d)f();else if("column"==d)f(!0);
|
||||
else if("word"==d||"group"==d)for(var k=null,d="group"==d,m=!0;!(0>c)||f(!m);m=!1){var s=i.text.charAt(h)||"\n",s=xb(s)?"w":!d?null:/\s/.test(s)?null:"p";if(k&&k!=s){0>c&&(c=1,f());break}s&&(k=s);if(0<c&&!f(!m))break}b=ub(a,o(g,h),b,!0);j||(b.hitSide=!0);return b}function od(a,b,c,d){var e=a.doc,f=b.left,g;"page"==d?(d=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),g=b.top+c*(d-(0>c?1.5:0.5)*Da(a.display))):"line"==d&&(g=0<c?b.bottom+3:b.top-3);
|
||||
for(;;){var h=ac(a,f,g);if(!h.outside)break;if(0>c?0>=g:g>=e.height){h.hitSide=!0;break}g+=5*c}return h}function fc(a,b){var c=b.ch,d=b.ch;if(a){!1===b.after||d==a.length?--c:++d;for(var e=a.charAt(c),e=xb(e)?xb:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!xb(a)};0<c&&e(a.charAt(c-1));)--c;for(;d<a.length&&e(a.charAt(d));)++d}return{from:o(b.line,c),to:o(b.line,d)}}function ae(a,b){A(a.doc,o(b,0),r(a.doc,o(b+1,0)))}function v(a,b,c,d){l.defaults[a]=b;c&&(ia[a]=d?
|
||||
function(a,b,d){d!=Dc&&c(a,b,d)}:c)}function pa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c}function Nc(a,b,c){return a.startState?a.startState(b,c):!0}function jc(a){return"string"==typeof a?V[a]:a}function Pa(a,b,c){function d(b){var b=jc(b),e=b[a];if(!1===e)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return d(b);
|
||||
for(var e=0,f=b.length;e<f;++e){var j=d(b[e]);if(j)return j}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return f}}function bd(a){a=ga[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function cd(a,b){if(S&&34==a.keyCode&&a["char"])return!1;var c=ga[a.keyCode];if(null==c||a.altGraphKey)return!1;a.altKey&&(c="Alt-"+c);if(pd?a.metaKey:a.ctrlKey)c="Ctrl-"+c;if(pd?a.ctrlKey:a.metaKey)c="Cmd-"+c;!b&&a.shiftKey&&(c="Shift-"+c);return c}function Ra(a,b){this.pos=this.start=0;this.string=
|
||||
a;this.tabSize=b||8;this.lastColumnPos=this.lastColumnValue=0}function ha(a,b){this.lines=[];this.type=b;this.doc=a}function Sa(a,b,c,d,e){if(d&&d.shared)return ge(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return p(a.cm,Sa)(a,b,c,d,e);var f=new ha(a,e);if("range"==e&&!x(b,c))return f;d&&yb(d,f);f.replacedWith&&(f.collapsed=!0,f.replacedWith=n("span",[f.replacedWith],"CodeMirror-widget"));f.collapsed&&(Ha=!0);f.addToHistory&&fd(a,{from:b,to:c,origin:"markText"},{head:a.sel.head,anchor:a.sel.anchor},NaN);var g=
|
||||
b.line,h=0,i,j,k=a.cm,m;a.iter(g,c.line+1,function(d){k&&(f.collapsed&&!k.options.lineWrapping&&ma(a,d)==k.display.maxLine)&&(m=true);var e={from:null,to:null,marker:f};h=h+d.text.length;if(g==b.line){e.from=b.ch;h=h-b.ch}if(g==c.line){e.to=c.ch;h=h-(d.text.length-c.ch)}if(f.collapsed){g==c.line&&(j=ba(d,c.ch));g==b.line?i=ba(d,b.ch):M(d,0)}d.markedSpans=d.markedSpans?d.markedSpans.concat([e]):[e];e.marker.attachLine(d);++g});f.collapsed&&a.iter(b.line,c.line+1,function(b){aa(a,b)&&M(b,0)});f.clearOnEnter&&
|
||||
t(f,"beforeCursorEnter",function(){f.clear()});f.readOnly&&(ed=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());if(f.collapsed){if(i!=j)throw Error("Inserting collapsed marker overlapping an existing one");f.size=h;f.atomic=!0}k&&(m&&(k.curOp.updateMaxLine=!0),(f.className||f.startStyle||f.endStyle||f.collapsed)&&u(k,b.line,c.line+1),f.atomic&&kd(k));return f}function zb(a,b){this.markers=a;this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,t(a[c],"clear",function(){d.clear()})}
|
||||
function ge(a,b,c,d,e){d=yb(d);d.shared=!1;var f=[Sa(a,b,c,d,e)],g=f[0],h=d.replacedWith;za(a,function(a){h&&(d.replacedWith=h.cloneNode(!0));f.push(Sa(a,r(a,b),r(a,c),d,e));for(var j=0;j<a.linked.length;++j)if(a.linked[j].isParent)return;g=E(f)});return new zb(f,g)}function Ta(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function pc(a,b){var c=Aa(a,b.from.line)&&q(a,b.from.line).markedSpans,d=Aa(a,b.to.line)&&q(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,
|
||||
f=b.to.ch,g=w(b.from,b.to);if(c)for(var h=0,i;h<c.length;++h){var j=c[h],k=j.marker;if(null==j.from||(k.inclusiveLeft?j.from<=e:j.from<e)||"bookmark"==k.type&&j.from==e&&(!g||!j.marker.insertLeft)){var m=null==j.to||(k.inclusiveRight?j.to>=e:j.to>e);(i||(i=[])).push({from:j.from,to:m?null:j.to,marker:k})}}c=i;if(d)for(var h=0,s;h<d.length;++h)if(i=d[h],j=i.marker,null==i.to||(j.inclusiveRight?i.to>=f:i.to>f)||"bookmark"==j.type&&i.from==f&&(!g||i.marker.insertLeft))k=null==i.from||(j.inclusiveLeft?
|
||||
i.from<=f:i.from<f),(s||(s=[])).push({from:k?null:i.from-f,to:null==i.to?null:i.to-f,marker:j});d=s;g=1==b.text.length;s=E(b.text).length+(g?e:0);if(c)for(f=0;f<c.length;++f)h=c[f],null==h.to&&((i=Ta(d,h.marker))?g&&(h.to=null==i.to?null:i.to+s):h.to=e);if(d)for(f=0;f<d.length;++f)(h=d[f],null!=h.to&&(h.to+=s),null==h.from)?(i=Ta(c,h.marker),i||(h.from=s,g&&(c||(c=[])).push(h))):(h.from+=s,g&&(c||(c=[])).push(h));e=[c];if(!g){var g=b.text.length-2,l;if(0<g&&c)for(f=0;f<c.length;++f)null==c[f].to&&
|
||||
(l||(l=[])).push({from:null,to:null,marker:c[f].marker});for(f=0;f<g;++f)e.push(l);e.push(d)}return e}function id(a,b){var c;if(c=b["spans_"+a.id]){for(var d=0,e=[];d<b.text.length;++d)e.push(he(c[d]));c=e}else c=null;d=pc(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){var h=0;a:for(;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}}else g&&(c[e]=g)}return c}function ee(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=
|
||||
0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;if(c.readOnly&&(!d||-1==U(d,c)))(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b)for(var c=d[b],e=c.find(),f=0;f<a.length;++f){var g=a[f];if(!x(g.to,e.from)&&!x(e.to,g.from)){var h=[f,1];(x(g.from,e.from)||!c.inclusiveLeft&&w(g.from,e.from))&&h.push({from:g.from,to:e.from});(x(e.to,g.to)||!c.inclusiveRight&&w(g.to,e.to))&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-1}}return a}function ba(a,
|
||||
b){var c=Ha&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)if(e=c[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!d||d.width<e.marker.width))d=e.marker;return d}function Fa(a){return ba(a,a.text.length+1)}function ma(a,b){for(var c;c=ba(b,-1);)b=q(a,c.find().from.line);return b}function aa(a,b){var c=Ha&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||0==d.from&&d.marker.inclusiveLeft&&uc(a,b,d)))return!0}function uc(a,b,c){if(null==
|
||||
c.to)return b=c.marker.find().to,b=q(a,b.line),uc(a,b,Ta(b.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&d.from==c.to&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&uc(a,b,d))return!0}function qd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function rd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=
|
||||
b}}function sd(a){return function(){var b=!this.cm.curOp;b&&sa(this.cm);try{var c=a.apply(this,arguments)}finally{b&&ta(this.cm)}return c}}function gb(a){if(null!=a.height)return a.height;(!a.node.parentNode||1!=a.node.parentNode.nodeType)&&R(a.cm.display.measure,n("div",[a.node],null,"position: relative"));return a.height=a.node.offsetHeight}function ie(a,b,c,d){var e=new vc(a,c,d);e.noHScroll&&(a.display.alignWidgets=!0);wb(a,b,function(b){(b.widgets||(b.widgets=[])).push(e);e.line=b;if(!aa(a.doc,
|
||||
b)||e.showIfHidden){var c=na(a,b)<a.display.scroller.scrollTop;M(b,b.height+gb(e));c&&ld(a,0,e.height)}return true});return e}function Ua(a,b,c){a={text:a};rd(a,b);a.height=c?c(a):1;return a}function td(a,b,c,d,e){var f=c.flattenSpans;null==f&&(f=a.options.flattenSpans);var g="",h=null,i=new Ra(b,a.options.tabSize),j;for(""==b&&c.blankLine&&c.blankLine(d);!i.eol();){i.pos>a.options.maxHighlightLength?(f=!1,i.pos=Math.min(b.length,i.start+5E4),j=null):j=c.token(i,d);var k=i.current();i.start=i.pos;
|
||||
!f||h!=j?(g&&e(g,h),g=k,h=j):g+=k}g&&e(g,h)}function Lc(a,b,c){var d=[a.state.modeGen];td(a,b.text,a.doc.mode,c,function(a,b){d.push(a,b)});for(c=0;c<a.state.overlays.length;++c){var e=a.state.overlays[c],f=1;td(a,b.text,e.mode,!0,function(a,b){for(var c=f,j=a.length;j;){var k=d[f],m=k.length;if(m<=j)j=j-m;else{d.splice(f,1,k.slice(0,j),d[f+1],k.slice(j));j=0}f=f+2}if(b)if(e.opaque){d.splice(c,f-c,a,b);f=c+2}else for(;c<f;c=c+2){k=d[c+1];d[c+1]=k?k+" "+b:b}})}return d}function Mc(a,b,c){var d=a.doc.mode,
|
||||
e=new Ra(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos}function ud(a){return!a?null:vd[a]||(vd[a]="cm-"+a.replace(/ +/g," cm-"))}function Vb(a,b,c){for(var d,e=b,f,g,h=!0;d=ba(e,-1);)h=!1,e=q(a.doc,d.find().from.line),f||(f=e);d={pre:n("pre"),col:0,pos:0,display:!c,measure:null,addedOne:!1,cm:a};e.textClass&&(d.pre.className=e.textClass);do{d.measure=e==b&&c;d.pos=0;d.addToken=d.measure?je:wd;if((B||
|
||||
L)&&a.getOption("lineWrapping"))d.addToken=ke(d.addToken);c&&(g&&e!=b&&!d.addedOne)&&(c[0]=d.pre.appendChild(lb(a.display.measure)),d.addedOne=!0);var i=e;g=d;var j=e;if(!j.styles||j.styles[0]!=a.state.modeGen)j.styles=Lc(a,j,j.stateAfter=Ia(a,H(j)));a:{var k=i,j=j.styles;if(i=k.markedSpans)for(var k=k.text.length,m=0,s=1,l="",o=void 0,p=0,r=void 0,t=void 0,v=void 0,u=void 0;;){if(p==m){for(var r=t=v="",u=null,p=Infinity,w=null,y=0;y<i.length;++y){var x=i[y],z=x.marker;if(x.from<=m&&(null==x.to||
|
||||
x.to>m)){if(null!=x.to&&p>x.to&&(p=x.to,t=""),z.className&&(r+=" "+z.className),z.startStyle&&x.from==m&&(v+=" "+z.startStyle),z.endStyle&&x.to==p&&(t+=" "+z.endStyle),z.collapsed&&(!u||u.marker.width<z.width))u=x}else x.from>m&&p>x.from&&(p=x.from);"bookmark"==z.type&&(x.from==m&&z.replacedWith)&&(w=z.replacedWith)}if(u&&(u.from||0)==m)if(xd(g,(null==u.to?k:u.to)-m,null!=u.from&&u.marker.replacedWith),null==u.to){j=u.marker.find();break a}w&&!u&&xd(g,0,w)}if(m>=k)break;for(w=Math.min(k,p);;){if(l){y=
|
||||
m+l.length;u||(x=y>w?l.slice(0,w-m):l,g.addToken(g,x,o?o+r:r,v,m+x.length==p?t:""));if(y>=w){l=l.slice(w-m);m=w;break}m=y;v=""}l=j[s++];o=ud(j[s++])}}else for(var s=1;s<j.length;s+=2)g.addToken(g,j[s],ud(j[s+1]));j=void 0}g=e==f;j&&(e=q(a.doc,j.to.line),h=!1)}while(j);c&&!d.addedOne&&(c[0]=d.pre.appendChild(h?n("span"," "):lb(a.display.measure)));!d.pre.firstChild&&!aa(a.doc,b)&&d.pre.appendChild(document.createTextNode(" "));var A;if(c&&B&&(A=Q(e)))if(f=A.length-1,A[f].from==A[f].to&&--f,e=A[f],
|
||||
A=A[f-1],e.from+1==e.to&&(A&&e.level<A.level)&&(c=c[d.pos-1]))c.parentNode.insertBefore(c.measureRight=lb(a.display.measure),c.nextSibling);D(a,"renderLine",a,b,d.pre);return d.pre}function wd(a,b,c,d,e){if(b){if(wc.test(b))for(var f=document.createDocumentFragment(),g=0;;){wc.lastIndex=g;var h=wc.exec(b),i=h?h.index-g:b.length-g;i&&(f.appendChild(document.createTextNode(b.slice(g,g+i))),a.col+=i);if(!h)break;g+=i+1;"\t"==h[0]?(h=a.cm.options.tabSize,h-=a.col%h,f.appendChild(n("span",md(h),"cm-tab")),
|
||||
a.col+=h):(i=n("span","•","cm-invalidchar"),i.title="\\u"+h[0].charCodeAt(0).toString(16),f.appendChild(i),a.col+=1)}else{a.col+=b.length;var f=document.createTextNode(b)}if(c||d||e||a.measure)return b=c||"",d&&(b+=d),e&&(b+=e),a.pre.appendChild(n("span",[f],b));a.pre.appendChild(f)}}function je(a,b,c,d,e){for(var f=a.cm.options.lineWrapping,g=0;g<b.length;++g){var h=b.charAt(g),i=0==g;"\ud800"<=h&&"\udbff">h&&g<b.length-1?(h=b.slice(g,g+2),++g):g&&(f&&Ab(b,g))&&a.pre.appendChild(n("wbr"));i=a.measure[a.pos]=
|
||||
wd(a,h,c,i&&d,g==b.length-1&&e);B&&(f&&" "==h&&g&&!/\s/.test(b.charAt(g-1))&&g<b.length-1&&!/\s/.test(b.charAt(g+1)))&&(i.style.whiteSpace="normal");a.pos+=h.length}b.length&&(a.addedOne=!0)}function ke(a){function b(a){for(var b=" ",e=0;e<a.length-2;++e)b+=e%2?" ":" ";return b+" "}return function(c,d,e,f,g){return a(c,d.replace(/ {3,}/,b),e,f,g)}}function xd(a,b,c){c&&(a.display||(c=c.cloneNode(!0)),a.pre.appendChild(c),a.measure&&b&&(a.measure[a.pos]=c,a.addedOne=!0));a.pos+=b}function sc(a,b,c,
|
||||
d,e){function f(a){return c?c[a]:null}function g(a,c,d){var f=e;a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);qd(a);rd(a,d);c=f?f(a):1;c!=a.height&&M(a,c);O(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=q(a,h.line),m=q(a,i.line),s=E(j),l=f(j.length-1),o=i.line-h.line;if(0==h.ch&&0==i.ch&&""==s){for(var n=0,p=j.length-1,r=[];n<p;++n)r.push(Ua(j[n],f(n),e));g(m,m.text,l);o&&a.remove(h.line,o);r.length&&a.insert(h.line,r)}else if(k==m)if(1==j.length)g(k,
|
||||
k.text.slice(0,h.ch)+s+k.text.slice(i.ch),l);else{r=[];n=1;for(p=j.length-1;n<p;++n)r.push(Ua(j[n],f(n),e));r.push(Ua(s+k.text.slice(i.ch),l,e));g(k,k.text.slice(0,h.ch)+j[0],f(0));a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+m.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0));g(m,s+m.text.slice(i.ch),l);n=1;p=j.length-1;for(r=[];n<p;++n)r.push(Ua(j[n],f(n),e));1<o&&a.remove(h.line+1,o-1);a.insert(h.line+1,r)}O(a,"change",a,b);Y(a,d.anchor,
|
||||
d.head,null,!0)}function Bb(a){this.lines=a;this.parent=null;for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function Va(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;d<e;++d){var f=a[d],b=b+f.chunkSize(),c=c+f.height;f.parent=this}this.size=b;this.height=c;this.parent=null}function za(a,b,c){function d(a,f,g){if(a.linked)for(var h=0;h<a.linked.length;++h){var i=a.linked[h];if(i.doc!=f){var j=g&&i.sharedHist;if(!c||j)b(i.doc,j),d(i.doc,a,j)}}}d(a,null,!0)}function Cc(a,
|
||||
b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;Gc(a);Ca(a);a.options.lineWrapping||Pb(a);a.options.mode=b.modeOption;u(a)}function q(a,b){for(b-=a.first;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function rc(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function xc(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});
|
||||
return d}function M(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function H(a){if(null==a.parent)return null;for(var b=a.parent,a=U(b.lines,a),c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}function cb(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.height;if(b<g){a=f;continue a}b-=g;c+=f.chunkSize()}return c}while(!a.lines);d=0;for(e=a.lines.length;d<e;++d){f=a.lines[d].height;if(b<f)break;
|
||||
b-=f}return c+d}function na(a,b){for(var b=ma(a.doc,b),c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;else c+=f.height}for(f=d.parent;f;d=f,f=d.parent)for(e=0;e<f.children.length;++e){var g=f.children[e];if(g==d)break;else c+=g.height}return c}function Q(a){var b=a.order;null==b&&(b=a.order=le(a.text));return b}function Cb(){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function yd(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,
|
||||
c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans);++f})}function qc(a,b){var c={from:b.from,to:mc(b),text:rc(a,b.from,b.to)};yd(a,c,b.from.line,b.to.line+1);za(a,function(a){yd(a,c,b.from.line,b.to.line+1)},!0);return c}function fd(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g=E(e.done);if(g&&(e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=
|
||||
E(g.changes);w(b.from,b.to)&&w(b.from,h.to)?h.to=mc(b):g.changes.push(qc(a,b));g.anchorAfter=c.anchor;g.headAfter=c.head}else{g={changes:[qc(a,b)],anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head};for(e.done.push(g);e.done.length>e.undoDepth;)e.done.shift();0>e.dirtyCounter?e.dirtyCounter=NaN:e.dirtyCounter++}e.lastTime=f;e.lastOp=d;e.lastOrigin=b.origin}function he(a){if(!a)return null;for(var b=0,c;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,
|
||||
b)):c&&c.push(a[b]);return!c?a:c.length?c:null}function Db(a,b){for(var c=0,d=[];c<a.length;++c){var e=a[c],f=e.changes,g=[];d.push({changes:g,anchorBefore:e.anchorBefore,headBefore:e.headBefore,anchorAfter:e.anchorAfter,headAfter:e.headAfter});for(e=0;e<f.length;++e){var h=f[e],i;g.push({from:h.from,to:h.to,text:h.text});if(b)for(var j in h)if((i=j.match(/^spans_(\d+)$/))&&-1<U(b,Number(i[1])))E(g)[j]=h[j],delete h[j]}}return d}function Eb(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}
|
||||
function zd(a,b,c,d){for(var e=0;e<a.length;++e){for(var f=a[e],g=!0,h=0;h<f.changes.length;++h){var i=f.changes[h];f.copied||(i.from=fa(i.from),i.to=fa(i.to));if(c<i.from.line)i.from.line+=d,i.to.line+=d;else if(b<=i.to.line){g=!1;break}}f.copied||(f.anchorBefore=fa(f.anchorBefore),f.headBefore=fa(f.headBefore),f.anchorAfter=fa(f.anchorAfter),f.readAfter=fa(f.headAfter),f.copied=!0);g?(Eb(f.anchorBefore),Eb(f.headBefore),Eb(f.anchorAfter),Eb(f.headAfter)):(a.splice(0,e+1),e=0)}}function gd(a,b){var c=
|
||||
b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;zd(a.done,c,d,e);zd(a.undone,c,d,e)}function me(){Na(this)}function Ma(a){a.stop||(a.stop=me);return a}function z(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ad(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Na(a){z(a);Ad(a)}function Xc(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));oa&&(a.ctrlKey&&1==b)&&(b=3);return b}function t(a,b,c){a.addEventListener?a.addEventListener(b,c,
|
||||
!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),(a[b]||(a[b]=[])).push(c))}function T(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}}function D(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function O(a,b){function c(a){return function(){a.apply(null,
|
||||
e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2);X||(++kb,X=[],setTimeout(ne,0));for(var f=0;f<d.length;++f)X.push(c(d[f]))}}function ne(){--kb;var a=X;X=null;for(var b=0;b<a.length;++b)a[b]()}function xa(a,b){var c=a._handlers&&a._handlers[b];return c&&0<c.length}function Kb(){this.id=null}function qa(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;d<b;++d)"\t"==a.charAt(d)?e+=c-e%c:++e;return e}function md(a){for(;Fb.length<=
|
||||
a;)Fb.push(E(Fb)+" ");return Fb[a]}function E(a){return a[a.length-1]}function Sc(a){Ba?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function U(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function Bd(a,b){function c(){}c.prototype=a;var d=new c;b&&yb(b,d);return d}function yb(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function Oc(a){for(var b=[],c=0;c<a;++c)b.push(void 0);return b}function K(a){var b=
|
||||
Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function xb(a){return/\w/.test(a)||""<a&&(a.toUpperCase()!=a.toLowerCase()||oe.test(a))}function Cd(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function n(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)Ic(a,b);else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function ab(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);
|
||||
return a}function R(a,b){return ab(a).appendChild(b)}function Ic(a,b){J?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function y(a){return a.getBoundingClientRect()}function Ab(){return!1}function Ga(a){if(null!=Gb)return Gb;var b=n("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");R(a,b);b.offsetWidth&&(Gb=b.offsetHeight-b.clientHeight);return Gb||0}function lb(a){if(null==yc){var b=n("span","");R(a,n("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&
|
||||
(yc=1>=b.offsetWidth&&2<b.offsetHeight&&!ka)}return yc?n("span",""):n("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Qd(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=0;e<a.length;++e){var f=a[e];if(f.from<c&&f.to>b||b==c&&f.to==b)d(Math.max(f.from,b),Math.min(f.to,c),1==f.level?"rtl":"ltr")}}function Zb(a){return a.level%2?a.from:a.to}function ib(a){return(a=Q(a))?a[0].level%2?a[0].to:a[0].from:0}function jb(a){var b=Q(a);return!b?a.text.length:Zb(E(b))}function Dd(a,
|
||||
b){var c=q(a.doc,b),d=ma(a.doc,c);d!=c&&(b=H(d));c=Q(d);d=!c?0:c[0].level%2?jb(d):ib(d);return o(b,d)}function pe(a,b){for(var c,d;c=Fa(d=q(a.doc,b));)b=c.find().to.line;c=Q(d);d=!c?d.text.length:c[0].level%2?ib(d):jb(d);return o(b,d)}function $b(a,b){for(var c=0,d;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return ra=null,c;if(e.from==b||e.to==b)if(null==d)d=c;else{var e=e.level,f=a[d].level,g=a[0].level,e=e==g?!0:f==g?!1:e<f;if(e)return ra=d,c;ra=c;return d}}ra=null;return d}function zc(a,b,
|
||||
c,d){if(!d)return b+c;do b+=c;while(0<b&&cc.test(a.text.charAt(b)));return b}function bc(a,b,c,d){var e=Q(a);if(!e)return nd(a,b,c,d);for(var f=$b(e,b),g=e[f],b=zc(a,b,g.level%2?-c:c,d);;){if(b>g.from&&b<g.to)return b;if(b==g.from||b==g.to){if($b(e,b)==f)return b;g=e[f+c];return 0<c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?zc(a,g.to,-1,d):zc(a,g.from,1,d)}}function nd(a,b,c,d){b+=c;if(d)for(;0<b&&cc.test(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var ya=
|
||||
/gecko\/\d/i.test(navigator.userAgent),B=/MSIE \d/.test(navigator.userAgent),ka=B&&(null==document.documentMode||8>document.documentMode),J=B&&(null==document.documentMode||9>document.documentMode),L=/WebKit\//.test(navigator.userAgent),qe=L&&/Qt\/\d+\.\d+/.test(navigator.userAgent),re=/Chrome\//.test(navigator.userAgent),S=/Opera\//.test(navigator.userAgent),hc=/Apple Computer/.test(navigator.vendor),Nb=/KHTML\//.test(navigator.userAgent),Hd=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),
|
||||
Id=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Wd=/PhantomJS/.test(navigator.userAgent),Ba=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Jb=Ba||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),oa=Ba||/Mac/.test(navigator.platform),se=/windows/i.test(navigator.platform),Wa=S&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Wa&&(Wa=Number(Wa[1]));var pd=oa&&(qe||S&&(null==Wa||12.11>Wa)),gc=ya||B&&!J,ed=!1,Ha=!1,ca,
|
||||
Vd=0,pb,ob,qb=0,N=null;B?N=-0.53:ya?N=15:re?N=-0.7:hc&&(N=-1/3);var ad,kc=null,lc;l.Pos=o;l.prototype={constructor:l,focus:function(){window.focus();G(this);$(this);Ka(this)},setOption:function(a,b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,ia.hasOwnProperty(a)&&p(this,ia[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,
|
||||
c=0;c<b.length;++c)if(("string"==typeof a?b[c].name:b[c])==a)return b.splice(c,1),!0},addOverlay:p(null,function(a,b){var c=a.token?a:l.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.state.modeGen++;u(this)}),removeOverlay:p(null,function(a){for(var b=this.state.overlays,c=0;c<b.length;++c)if(b[c].modeSpec==a){b.splice(c,1);this.state.modeGen++;u(this);break}}),indentLine:p(null,function(a,
|
||||
b,c){"string"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");Aa(this.doc,a)&&sb(this,a,b,c)}),indentSelection:p(null,function(a){var b=this.doc.sel;if(w(b.from,b.to))return sb(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),b=b.from.line;b<=c;++b)sb(this,b,a)}),getTokenAt:function(a){for(var b=this.doc,a=r(b,a),c=Ia(this,a.line),d=this.doc.mode,b=q(b,a.line),b=new Ra(b.text,this.options.tabSize);b.pos<a.ch&&!b.eol();){b.start=b.pos;var e=d.token(b,c)}return{start:b.start,
|
||||
end:b.pos,string:b.current(),className:e||null,type:e||null,state:c}},getStateAfter:function(a){var b=this.doc,a=Math.max(b.first,Math.min(null==a?b.first+b.size-1:a,b.first+b.size-1));return Ia(this,a+1)},cursorCoords:function(a,b){var c;c=this.doc.sel;c=null==a?c.head:"object"==typeof a?r(this.doc,a):a?c.from:c.to;return P(this,c,b||"page")},charCoords:function(a,b){return eb(this,r(this.doc,a),b||"page")},coordsChar:function(a,b){var c=b||"page";if("div"!=c){var d=a.left,e=a.top;"page"==c&&(d-=
|
||||
window.pageXOffset||(document.documentElement||document.body).scrollLeft,e-=window.pageYOffset||(document.documentElement||document.body).scrollTop);var f=y(this.display.lineSpace),d=d-f.left,e=e-f.top;if("local"==c||!c)c=y(this.display.wrapper),d+=c.left,e+=c.top;a={left:d,top:e}}return ac(this,a.left,a.top)},defaultTextHeight:function(){return Da(this.display)},defaultCharWidth:function(){return Fc(this.display)},setGutterMarker:p(null,function(a,b,c){return wb(this,a,function(a){var e=a.gutterMarkers||
|
||||
(a.gutterMarkers={});e[b]=c;!c&&Cd(e)&&(a.gutterMarkers=null);return!0})}),clearGutter:p(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,u(b,d,d+1),Cd(c.gutterMarkers)&&(c.gutterMarkers=null));++d})}),addLineClass:p(null,function(a,b,c){return wb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[e]){if(RegExp("\\b"+c+"\\b").test(a[e]))return!1;a[e]+=" "+c}else a[e]=c;return!0})}),
|
||||
removeLineClass:p(null,function(a,b,c){return wb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",f=a[e];if(f)if(null==c)a[e]=null;else{var g=f.replace(RegExp("^"+c+"\\b\\s*|\\s*\\b"+c+"\\b"),"");if(g==f)return!1;a[e]=g||null}else return!1;return!0})}),addLineWidget:p(null,function(a,b,c){return ie(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Aa(this.doc,a))return null;var b=a,a=q(this.doc,a);if(!a)return null}else if(b=
|
||||
H(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display,a=P(this,r(this.doc,a)),g=a.bottom,h=a.left;b.style.position="absolute";f.sizer.appendChild(b);if("over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),
|
||||
j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom);h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+f.lineSpace.offsetTop+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px");c&&(a=mb(this,h,g,h+b.offsetWidth,g+b.offsetHeight),
|
||||
null!=a.scrollTop&&Oa(this,a.scrollTop),null!=a.scrollLeft&&ua(this,a.scrollLeft))},triggerOnKeyDown:p(null,Wc),execCommand:function(a){return ic[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,a=r(this.doc,a);f<b&&!(a=tc(this.doc,a,e,c,d),a.hitSide);++f);return a},moveH:p(null,function(a,b){var c=this.doc.sel,c=c.shift||c.extend||w(c.from,c.to)?tc(this.doc,c.head,a,b,this.options.rtlMoveVisually):0>a?c.from:c.to;A(this.doc,c,c,a)}),deleteH:p(null,function(a,b){var c=this.doc.sel;
|
||||
w(c.from,c.to)?Z(this.doc,"",c.from,tc(this.doc,c.head,a,b,!1),"+delete"):Z(this.doc,"",c.from,c.to,"+delete");this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,a=r(this.doc,a);f<b&&!(a=P(this,a,"div"),null==d?d=a.left:a.left=d,a=od(this,a,e,c),a.hitSide);++f);return a},moveV:p(null,function(a,b){var c=this.doc.sel,d=P(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=od(this,d,a,b);"page"==b&&ld(this,0,eb(this,e,"div").top-d.top);A(this.doc,
|
||||
e,e,a);c.goalColumn=d.left}),toggleOverwrite:function(a){null!=a&&a==this.state.overwrite||(this.display.cursor.className=(this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+" CodeMirror-overwrite":this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:p(null,function(a,b){vb(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=ja;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-
|
||||
b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:p(null,function(a,b){"number"==typeof a&&(a=o(a,0));b||(b=0);var c=a;if(!a||null!=a.line)this.curOp.scrollToPos=a?r(this.doc,a):this.doc.sel.head,this.curOp.scrollToPosMargin=b,c=P(this,this.curOp.scrollToPos);c=mb(this,c.left,c.top-b,c.right,c.bottom+b);vb(this,c.scrollLeft,c.scrollTop)}),setSize:function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(""+a)?a+"px":a}null!=a&&(this.display.wrapper.style.width=
|
||||
c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.refresh()},on:function(a,b){t(this,a,b)},off:function(a,b){T(this,a,b)},operation:function(a){return dc(this,a)},refresh:p(null,function(){la(this);vb(this,this.doc.scrollLeft,this.doc.scrollTop);u(this)}),swapDoc:p(null,function(a){var b=this.doc;b.cm=null;Cc(this,a);la(this);W(this,!0);vb(this,a.scrollLeft,a.scrollTop);return b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},
|
||||
getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};var ia=l.optionHandlers={},Hb=l.defaults={},Dc=l.Init={toString:function(){return"CodeMirror.Init"}};v("value","",function(a,b){a.setValue(b)},!0);v("mode",null,function(a,b){a.doc.modeOption=b;Ca(a)},!0);v("indentUnit",2,Ca,!0);v("indentWithTabs",!1);v("smartIndent",!0);v("tabSize",4,function(a){Ca(a);la(a);u(a)},!0);v("electricChars",!0);v("rtlMoveVisually",!se);v("theme","default",
|
||||
function(a){Bc(a);Ea(a)},!0);v("keyMap","default",function(a){var b=V[a.options.keyMap].style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")});v("extraKeys",null);v("onKeyEvent",null);v("onDragEvent",null);v("lineWrapping",!1,function(a){if(a.options.lineWrapping){a.display.wrapper.className=a.display.wrapper.className+" CodeMirror-wrap";a.display.sizer.style.minWidth=""}else{a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",
|
||||
"");Pb(a)}Gc(a);u(a);la(a);setTimeout(function(){Qb(a)},100)},!0);v("gutters",[],function(a){Ib(a.options);Ea(a)},!0);v("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?Sb(a.display)+"px":"0";a.refresh()},!0);v("coverGutterNextToScrollbar",!1,Qb,!0);v("lineNumbers",!1,function(a){Ib(a.options);Ea(a)},!0);v("firstLineNumber",1,Ea,!0);v("lineNumberFormatter",function(a){return a},Ea,!0);v("showCursorWhenSelecting",!1,Tb,!0);v("readOnly",!1,function(a,b){if(b=="nocursor"){Lb(a);a.display.input.blur()}else b||
|
||||
W(a,true)});v("dragDrop",!0);v("cursorBlinkRate",530);v("cursorScrollMargin",0);v("cursorHeight",1);v("workTime",100);v("workDelay",100);v("flattenSpans",!0);v("pollInterval",100);v("undoDepth",40,function(a,b){a.doc.history.undoDepth=b});v("historyEventDelay",500);v("viewportMargin",10,function(a){a.refresh()},!0);v("maxHighlightLength",1E4,function(a){Ca(a);a.refresh()},!0);v("moveInputWithCursor",!0,function(a,b){if(!b)a.display.inputDiv.style.top=a.display.inputDiv.style.left=0});v("tabindex",
|
||||
null,function(a,b){a.display.input.tabIndex=b||""});v("autofocus",null);var Ed=l.modes={},Xa=l.mimeModes={};l.defineMode=function(a,b){!l.defaults.mode&&"null"!=a&&(l.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Ed[a]=b};l.defineMIME=function(a,b){Xa[a]=b};l.resolveMode=function(a){if("string"==typeof a&&Xa.hasOwnProperty(a))a=Xa[a];else if(a&&"string"==typeof a.name&&Xa.hasOwnProperty(a.name)){var b=Xa[a.name],a=Bd(b,
|
||||
a);a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return l.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};l.getMode=function(a,b){var b=l.resolveMode(b),c=Ed[b.name];if(!c)return l.getMode(a,"text/plain");c=c(a,b);if(Ya.hasOwnProperty(b.name)){var d=Ya[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}c.name=b.name;return c};l.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});
|
||||
l.defineMIME("text/plain","null");var Ya=l.modeExtensions={};l.extendMode=function(a,b){var c=Ya.hasOwnProperty(a)?Ya[a]:Ya[a]={};yb(b,c)};l.defineExtension=function(a,b){l.prototype[a]=b};l.defineDocExtension=function(a,b){F.prototype[a]=b};l.defineOption=v;var Mb=[];l.defineInitHook=function(a){Mb.push(a)};l.copyState=pa;l.startState=Nc;l.innerMode=function(a,b){for(;a.innerMode;)var c=a.innerMode(b),b=c.state,a=c.mode;return c||{mode:a,state:b}};var ic=l.commands={selectAll:function(a){a.setSelection(o(a.firstLine(),
|
||||
0),o(a.lastLine()))},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!w(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,o(b.line+1,0),"+delete"):a.replaceRange("",b,d?c:o(b.line),"+delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",o(b,0),o(b),"+delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection(o(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(o(a.lastLine()))},goLineStart:function(a){a.extendSelection(Dd(a,
|
||||
a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=Dd(a,b.line),d=a.getLineHandle(c.line),e=Q(d);!e||0==e[0].level?(d=Math.max(0,d.text.search(/\S/)),a.extendSelection(o(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d))):a.extendSelection(c)},goLineEnd:function(a){a.extendSelection(pe(a,a.getCursor().line))},goLineRight:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div"))},goLineLeft:function(a){var b=
|
||||
a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:0,top:b},"div"))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,
|
||||
"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},
|
||||
insertTab:function(a){a.replaceSelection("\t","end","+input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection("\t","end","+input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);0<b.ch&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),o(b.line,b.ch-1),o(b.line,b.ch+1))},newlineAndIndent:function(a){p(a,function(){a.replaceSelection("\n","end","+input");a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},
|
||||
V=l.keyMap={};V.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};V.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd",
|
||||
"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",fallthrough:"basic"};V.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd",
|
||||
"Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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",fallthrough:["basic","emacsy"]};V["default"]=oa?V.macDefault:V.pcDefault;V.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"};l.lookupKey=Pa;l.isModifierKey=bd;l.keyName=cd;l.fromTextArea=function(a,b){function c(){a.value=j.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=
|
||||
a.tabindex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=document.body;try{d=document.activeElement}catch(e){}b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(t(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form,g=f.submit;try{var h=f.submit=function(){c();f.submit=g;f.submit();f.submit=h}}catch(i){}}a.style.display="none";var j=l(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);j.save=c;j.getTextArea=
|
||||
function(){return a};j.toTextArea=function(){c();a.parentNode.removeChild(j.getWrapperElement());a.style.display="";if(a.form){T(a.form,"submit",c);if(typeof a.form.submit=="function")a.form.submit=g}};return j};Ra.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);
|
||||
if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=
|
||||
qa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue},indentation:function(){return qa(this.string,null,this.tabSize)},match:function(a,b,c){if("string"==typeof a){var d=this.string.substr(this.pos,a.length);if((c?d.toLowerCase():d)==(c?a.toLowerCase():a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,
|
||||
this.pos)}};l.StringStream=Ra;l.TextMarker=ha;ha.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&sa(a);for(var c=null,d=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Ta(f.markedSpans,this);null!=g.to&&(d=H(f));for(var h=f,i=f.markedSpans,j=g,k=void 0,m=0;m<i.length;++m)i[m]!=j&&(k||(k=[])).push(i[m]);h.markedSpans=k;null!=g.from?c=H(f):this.collapsed&&(!aa(this.doc,f)&&a)&&M(f,Da(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<
|
||||
this.lines.length;++e)f=ma(a.doc,this.lines[e]),g=bb(a.doc,f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&u(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.collapsed&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&kd(a));b&&ta(a);O(this,"clear")}};ha.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=Ta(d.markedSpans,this);if(null!=e.from||null!=e.to)d=H(d),null!=e.from&&(a=o(d,e.from)),
|
||||
null!=e.to&&(b=o(d,e.to))}return"bookmark"==this.type?a:a&&{from:a,to:b}};ha.prototype.changed=function(){var a=this.find(),b=this.doc.cm;if(a&&b){var c=q(this.doc,a.from.line);Td(b,c);if(a.from.line>=b.display.showingFrom&&a.from.line<b.display.showingTo){for(a=b.display.lineDiv.firstChild;a;a=a.nextSibling)if(a.lineObj==c){a.offsetHeight!=c.height&&M(c,a.offsetHeight);break}dc(b,function(){b.curOp.selectionChanged=!0})}}};ha.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=
|
||||
this.doc.cm.curOp;if(!b.maybeHiddenMarkers||-1==U(b.maybeHiddenMarkers,this))(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};ha.prototype.detachLine=function(a){this.lines.splice(U(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};l.SharedTextMarker=zb;zb.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();
|
||||
O(this,"clear")}};zb.prototype.find=function(){return this.primary.find()};var vc=l.LineWidget=function(a,b,c){for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a;this.node=b};vc.prototype.clear=sd(function(){var a=this.line.widgets,b=H(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);a.length||(this.line.widgets=null);M(this.line,Math.max(0,this.line.height-gb(this)));u(this.cm,b,b+1)}});vc.prototype.changed=sd(function(){var a=this.height;this.height=null;
|
||||
if(a=gb(this)-a)M(this.line,this.line.height+a),a=H(this.line),u(this.cm,a,a+1)});var vd={},wc=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;Bb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;qd(f);O(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,
|
||||
a).concat(b).concat(this.lines.slice(a));a=0;for(c=b.length;a<c;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Va.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-
|
||||
b&&(c=[],this.collapse(c),this.children=[new Bb(c)],this.children[0].parent=this)},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<=g){f.insertInner(a,b,c);if(f.lines&&50<f.lines.length){for(;50<f.lines.length;)a=f.lines.splice(f.lines.length-25,25),a=new Bb(a),f.height-=a.height,this.children.splice(d+
|
||||
1,0,a),a.parent=this;this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Va(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=U(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Va(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],
|
||||
g=f.chunkSize();if(a<g){g=Math.min(b,g-a);if(f.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=g}}};var te=0,F=l.Doc=function(a,b,c){if(!(this instanceof F))return new F(a,b,c);null==c&&(c=0);Va.call(this,[new Bb([Ua("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.history=Cb();this.frontier=c;c=o(c,0);this.sel={from:c,to:c,head:c,anchor:c,shift:!1,extend:!1,goalColumn:null};this.id=++te;this.modeOption=b;"string"==typeof a&&(a=da(a));sc(this,{from:c,to:c,text:a},
|
||||
null,{head:c,anchor:c})};F.prototype=Bd(Va.prototype,{constructor:F,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0,e=b.length;d<e;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=xc(this,this.first,this.first+this.size);return!1===a?b:b.join(a||"\n")},setValue:function(a){var b=o(this.first,0),c=this.first+this.size-1;va(this,
|
||||
{from:b,to:o(c,q(this,c).text.length),text:da(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=r(this,b);c=c?r(this,c):b;Z(this,a,b,c,d)},getRange:function(a,b,c){a=rc(this,r(this,a),r(this,b));return!1===c?a:a.join(c||"\n")},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},setLine:function(a,b){Aa(this,a)&&Z(this,b,o(a,0),r(this,o(a)))},removeLine:function(a){a?Z(this,"",r(this,o(a-1)),r(this,o(a))):Z(this,"",o(0,0),r(this,o(1,0)))},getLineHandle:function(a){if(Aa(this,
|
||||
a))return q(this,a)},getLineNumber:function(a){return H(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return r(this,a)},getCursor:function(a){var b=this.sel;return fa(null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||!1===a?b.to:b.from)},somethingSelected:function(){return!w(this.sel.head,this.sel.anchor)},setCursor:Ja(function(a,b,c){a=r(this,"number"==typeof a?o(a,b||0):a);c?A(this,
|
||||
a):Y(this,a,a)}),setSelection:Ja(function(a,b){Y(this,r(this,a),r(this,b||a))}),extendSelection:Ja(function(a,b){A(this,r(this,a),b&&r(this,b))}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){va(this,{from:this.sel.from,to:this.sel.to,text:da(a),origin:c},b||"around")},undo:Ja(function(){hd(this,"undo")}),redo:Ja(function(){hd(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,
|
||||
redo:a.undone.length}},clearHistory:function(){this.history=Cb()},markClean:function(){this.history.dirtyCounter=0;this.history.lastOp=this.history.lastOrigin=null},isClean:function(){return 0==this.history.dirtyCounter},getHistory:function(){return{done:Db(this.history.done),undone:Db(this.history.undone)}},setHistory:function(a){var b=this.history=Cb();b.done=a.done.slice(0);b.undone=a.undone.slice(0)},markText:function(a,b,c){return Sa(this,r(this,a),r(this,b),c,"range")},setBookmark:function(a,
|
||||
b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft},a=r(this,a);return Sa(this,a,a,c,"bookmark")},findMarksAt:function(a){var a=r(this,a),b=[],c=q(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];if((null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch))b.push(e.marker.parent||e.marker)}return b},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,
|
||||
c=this.first;this.iter(function(d){d=d.text.length+1;if(d>a)return b=a,!0;a-=d;++c});return r(this,o(c,b))},indexFromPos:function(a){var a=r(this,a),b=a.ch;if(a.line<this.first||0>a.ch)return 0;this.iter(this.first,a.line,function(a){b+=a.text.length+1});return b},copy:function(a){var b=new F(xc(this,this.first,this.first+this.size),this.modeOption,this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,
|
||||
shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn};a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new F(xc(this,b,c),a.mode||this.modeOption,b);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];
|
||||
return b},unlinkDoc:function(a){a instanceof l&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);break}if(a.history==this.history){var c=[a.id];za(a,function(a){c.push(a.id)},!0);a.history=Cb();a.history.done=Db(this.history.done,c);a.history.undone=Db(this.history.undone,c)}},iterLinkedDocs:function(a){za(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});F.prototype.eachLine=F.prototype.iter;
|
||||
var ue=["iter","insert","remove","copy","getEditor"],Za;for(Za in F.prototype)F.prototype.hasOwnProperty(Za)&&0>U(ue,Za)&&(l.prototype[Za]=function(a){return function(){return a.apply(this.doc,arguments)}}(F.prototype[Za]));l.e_stop=Na;l.e_preventDefault=z;l.e_stopPropagation=Ad;var X,kb=0;l.on=t;l.off=T;l.signal=D;var ja=30,Yc=l.Pass={toString:function(){return"CodeMirror.Pass"}};Kb.prototype={set:function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)}};l.countColumn=qa;var Fb=[""],oe=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,
|
||||
cc=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;l.replaceGetRect=function(a){y=a};var be=function(){if(J)return!1;var a=n("div");return"draggable"in a||"dragDrop"in a}();ya?Ab=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:hc&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?Ab=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-
|
||||
1,b+1))}:L&&(Ab=function(a,b){return 1<b&&45==a.charCodeAt(b-1)&&/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b))?!0:/[~!#%&*)=+}\]|\"\.>,:;][({[<]|\?[\w~`@#$%\^&*(_=+{[|><]/.test(a.slice(b-1,b+1))});var Gb,yc,da=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};
|
||||
l.splitLines=da;var Xd=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:0!=b.compareEndPoints("StartToEnd",b)},Rc=function(){var a=n("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),ga={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:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};l.keyNames=ga;(function(){for(var a=0;10>a;a++)ga[a+48]=""+a;for(a=65;90>=a;a++)ga[a]=
|
||||
String.fromCharCode(a);for(a=1;12>=a;a++)ga[a+111]=ga[a+63235]="F"+a})();var ra,le=function(){function a(a){return 255>=a?b.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1791>=a?c.charAt(a-1536):1792<=a&&2220>=a?"r":"L"}var b="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",c="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",
|
||||
d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;return function(b){if(!d.test(b))return!1;for(var c=b.length,k=[],m=0,l;m<c;++m)k.push(a(b.charCodeAt(m)));for(var m=0,n="L";m<c;++m)l=k[m],"m"==l?k[m]=n:n=l;m=0;for(n="L";m<c;++m)l=k[m],"1"==l&&"r"==n?k[m]="n":f.test(l)&&(n=l,"r"==l&&(k[m]="R"));m=1;for(n=k[0];m<c-1;++m){l=k[m];if("+"==l&&"1"==n&&"1"==k[m+1])k[m]="1";else if(","==l&&n==k[m+1]&&("1"==n||"n"==n))k[m]=n;n=l}for(m=0;m<c;++m)if(l=k[m],","==l)k[m]="N";
|
||||
else if("%"==l){for(n=m+1;n<c&&"%"==k[n];++n);var o=m&&"!"==k[m-1]||n<c-1&&"1"==k[n]?"1":"N";for(l=m;l<n;++l)k[l]=o;m=n-1}m=0;for(n="L";m<c;++m)l=k[m],"L"==n&&"1"==l?k[m]="L":f.test(l)&&(n=l);for(m=0;m<c;++m)if(e.test(k[m])){for(n=m+1;n<c&&e.test(k[n]);++n);l="L"==(n<c-1?k[n]:"L");o="L"==(m?k[m-1]:"L")||l?"L":"R";for(l=m;l<n;++l)k[l]=o;m=n-1}for(var n=[],q,m=0;m<c;)if(g.test(k[m])){l=m;for(++m;m<c&&g.test(k[m]);++m);n.push({from:l,to:m,level:0})}else{var p=m,o=n.length;for(++m;m<c&&"L"!=k[m];++m);
|
||||
for(l=p;l<m;)if(h.test(k[l])){p<l&&n.splice(o,0,{from:p,to:l,level:1});p=l;for(++l;l<m&&h.test(k[l]);++l);n.splice(o,0,{from:p,to:l,level:2});p=l}else++l;p<m&&n.splice(o,0,{from:p,to:m,level:1})}if(1==n[0].level&&(q=b.match(/^\s+/)))n[0].from=q[0].length,n.unshift({from:0,to:q[0].length,level:0});if(1==E(n).level&&(q=b.match(/\s+$/)))E(n).to-=q[0].length,n.push({from:c-q[0].length,to:c,level:0});n[0].level!=E(n).level&&n.push({from:c,to:c,level:n[0].level});return n}}();l.version="3.13";return l}();
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
CodeMirror.defineMode("xml",function(l,e){function j(k,a){function b(d){return a.tokenize=d,d(k,a)}var d=k.next(),c;if("<"==d){if(k.eat("!"))return k.eat("[")?k.match("CDATA[")?b(r("atom","]]\>")):null:k.match("--")?b(r("comment","--\>")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),b(n(1))):null;if(k.eat("?"))return k.eatWhile(/[\w\._\-]/),a.tokenize=r("meta","?>"),"meta";d=k.eat("/");for(u="";c=k.eat(/[^\s\u00a0=<>\"\'\/?]/);)u+=c;return u?(w=d?"closeTag":"openTag",a.tokenize=o,"tag"):"error"}return"&"==
|
||||
d?(c=k.eat("#")?k.eat("x")?k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):k.eatWhile(/[\d]/)&&k.eat(";"):k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),c?"atom":"error"):(k.eatWhile(/[^&<]/),null)}function o(k,a){var b=k.next();return">"==b||"/"==b&&k.eat(">")?(a.tokenize=j,w=">"==b?"endTag":"selfcloseTag","tag"):"="==b?(w="equals",null):/[\'\"]/.test(b)?(a.tokenize=v(b),a.tokenize(k,a)):(k.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function v(a){return function(b,d){for(;!b.eol();)if(b.next()==a){d.tokenize=o;break}return"string"}}
|
||||
function r(a,b){return function(d,c){for(;!d.eol();){if(d.match(b)){c.tokenize=j;break}d.next()}return a}}function n(a){return function(b,d){for(var c;null!=(c=b.next());){if("<"==c)return d.tokenize=n(a+1),d.tokenize(b,d);if(">"==c)if(1==a){d.tokenize=j;break}else return d.tokenize=n(a-1),d.tokenize(b,d)}return"meta"}}function i(){for(var a=arguments.length-1;0<=a;a--)m.cc.push(arguments[a])}function f(){return i.apply(null,arguments),!0}function p(){m.context&&(m.context=m.context.prev)}function s(a){return"openTag"==
|
||||
a?(m.tagName=u,m.tagStart=y.column(),f(d,t(m.startOfLine))):"closeTag"==a?(a=!1,m.context?m.context.tagName!=u&&(x.implicitlyClosed.hasOwnProperty(m.context.tagName.toLowerCase())&&p(),a=!m.context||m.context.tagName!=u):a=!0,a&&(q="error"),f(c(a))):f()}function t(b){return function(d){var c=m.tagName;(m.tagName=m.tagStart=null,"selfcloseTag"==d||"endTag"==d&&x.autoSelfClosers.hasOwnProperty(c.toLowerCase()))?c=(a(c.toLowerCase()),f()):("endTag"==d&&(a(c.toLowerCase()),d=x.doNotIndent.hasOwnProperty(c)||
|
||||
m.context&&m.context.noIndent,m.context={prev:m.context,tagName:c,indent:m.indented,startOfLine:b,noIndent:d}),c=f());return c}}function c(a){return function(b){return(a&&(q="error"),"endTag"==b)?(p(),f()):(q="error",f(arguments.callee))}}function a(a){for(var b;m.context&&!(b=m.context.tagName.toLowerCase(),!x.contextGrabbers.hasOwnProperty(b)||!x.contextGrabbers[b].hasOwnProperty(a));)p()}function d(a){return"word"==a?(q="attribute",f(h,d)):"endTag"==a||"selfcloseTag"==a?i():(q="error",f(d))}function h(a){return"equals"==
|
||||
a?f(b,d):(x.allowMissing?"word"==a&&(q="attribute"):q="error","endTag"==a||"selfcloseTag"==a?i():f())}function b(a){return"string"==a?f(g):"word"==a&&x.allowUnquoted?(q="string",f()):(q="error","endTag"==a||"selfCloseTag"==a?i():f())}function g(a){return"string"==a?f(g):i()}var z=l.indentUnit,A=e.multilineTagIndentFactor||1,x=e.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},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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},B=e.alignCDATA,u,w,m,y,q;return{startState:function(){return{tokenize:j,cc:[],indented:0,startOfLine:!0,tagName:null,tagStart:null,context:null}},token:function(a,b){var d,c;if(!b.tagName&&a.sol()&&(b.startOfLine=!0,b.indented=a.indentation()),a.eatSpace())return null;if(q=w=u=null,
|
||||
d=b.tokenize(a,b),b.type=w,(d||w)&&"comment"!=d){m=b;for(y=a;!(c=b.cc.pop()||s,c(w||d)););}return b.startOfLine=!1,q||d},indent:function(a,b,d){var c=a.context;if(a.tokenize!=o&&a.tokenize!=j||c&&c.noIndent)return d?d.match(/^(\s*)/)[0].length:0;if(a.tagName)return a.tagStart+z*A;if(B&&/<!\[CDATA\[/.test(b))return 0;for(c&&/^<\//.test(b)&&(c=c.prev);c&&!c.startOfLine;)c=c.prev;return c?c.indent+z:0},electricChars:"/",blockCommentStart:"<\!--",blockCommentEnd:"--\>",configuration:e.htmlMode?"html":
|
||||
"xml"}});CodeMirror.defineMIME("text/xml","xml");CodeMirror.defineMIME("application/xml","xml");CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0});CodeMirror.defineMode("css",function(l){return CodeMirror.getMode(l,"text/css")});
|
||||
CodeMirror.defineMode("css-base",function(l,e){function j(d,c){var b=d.next(),g;if(n[b]&&(g=n[b](d,c),!1!==g))return g;if("@"==b)return d.eatWhile(/[\w\\\-]/),a=d.current(),"def";if("="==b)a="compare";else{if(("~"==b||"|"==b)&&d.eat("="))return a="compare",null;if('"'==b||"'"==b)return c.tokenize=o(b),c.tokenize(d,c);if("#"==b)return d.eatWhile(/[\w\\\-]/),a="hash","atom";if("!"==b)return d.match(/^\s*\w*/),a="important","keyword";if(/\d/.test(b))return d.eatWhile(/[\w.%]/),a="unit","number";if("-"===
|
||||
b){if(/\d/.test(d.peek()))return d.eatWhile(/[\w.%]/),a="unit","number";if(d.match(/^[^-]+-/))return a="meta","meta"}else return/[,+>*\/]/.test(b)?(a="select-op",null):"."==b&&d.match(/^-?[_a-z][_a-z0-9-]*/i)?(a="qualifier","qualifier"):":"==b?(a=b,"operator"):/[;{}\[\]\(\)]/.test(b)?(a=b,null):"u"==b&&d.match("rl(")?(d.backUp(1),c.tokenize=v,a="variable","property"):(d.eatWhile(/[\w\\\-]/),a="variable","property")}}function o(c,h){return function(b,g){for(var f=!1,i;null!=(i=b.next())&&(i!=c||f);)f=
|
||||
!f&&"\\"==i;return f||(h&&b.backUp(1),g.tokenize=j),a="string","string"}}function v(c,h){return c.next(),h.tokenize=c.match(/\s*[\"\']/,!1)?j:o(")",!0),a="(",null}var r=l.indentUnit,n=e.hooks||{},i=e.atMediaTypes||{},f=e.atMediaFeatures||{},p=e.propertyKeywords||{},s=e.colorKeywords||{},t=e.valueKeywords||{},c=!!e.allowNested,a=null;return{startState:function(a){return{tokenize:j,baseIndent:a||0,stack:[]}},token:function(d,h){var b,g,e,l,n;return(h.tokenize=h.tokenize||j,h.tokenize==j&&d.eatSpace())?
|
||||
null:(b=h.tokenize(d,h),b&&"string"!=typeof b&&(b=(a=b[1],b[0])),g=h.stack[h.stack.length-1],"variable"==b)?("variable-definition"==a&&h.stack.push("propertyValue"),"variable-2"):("property"==b?(e=d.current().toLowerCase(),"propertyValue"==g?b=t.hasOwnProperty(e)?"string-2":s.hasOwnProperty(e)?"keyword":"variable-2":"rule"==g?p.hasOwnProperty(e)||(b+=" error"):"block"==g?b=p.hasOwnProperty(e)?"property":s.hasOwnProperty(e)?"keyword":t.hasOwnProperty(e)?"string-2":"tag":g&&"@media{"!=g?"@media"==g?
|
||||
b=i[d.current()]?"attribute":/^(only|not)$/.test(e)?"keyword":"and"==e?"error":f.hasOwnProperty(e)?"error":"attribute error":"@mediaType"==g?b=i.hasOwnProperty(e)?"attribute":"and"==e?"operator":(/^(only|not)$/.test(e),"error"):"@mediaType("==g?p.hasOwnProperty(e)||(i.hasOwnProperty(e)?b="error":"and"==e?b="operator":/^(only|not)$/.test(e)?b="error":b+=" error"):b="@import"==g?"tag":"error":b="tag"):"atom"==b?g&&"@media{"!=g&&"block"!=g?"propertyValue"==g?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(d.current())||
|
||||
(b+=" error"):b="error":b="builtin":"@media"==g&&"{"==a&&(b="error"),"{"==a?"@media"==g||"@mediaType"==g?(h.stack.pop(),h.stack[h.stack.length-1]="@media{"):(l=c?"block":"rule",h.stack.push(l)):"}"==a?(n=h.stack[h.stack.length-1],"interpolation"==n&&(b="operator"),h.stack.pop(),"propertyValue"==g&&h.stack.pop()):"interpolation"==a?h.stack.push("interpolation"):"@media"==a?h.stack.push("@media"):"@import"==a?h.stack.push("@import"):"@media"==g&&/\b(keyword|attribute)\b/.test(b)?h.stack.push("@mediaType"):
|
||||
"@mediaType"==g&&","==d.current()?h.stack.pop():"@mediaType"==g&&"("==a?h.stack.push("@mediaType("):"@mediaType("==g&&")"==a?h.stack.pop():("rule"==g||"block"==g)&&":"==a?h.stack.push("propertyValue"):"propertyValue"==g&&";"==a?h.stack.pop():"@import"==g&&";"==a&&h.stack.pop(),b)},indent:function(a,c){var b=a.stack.length;return/^\}/.test(c)&&(b-="propertyValue"==a.stack[a.stack.length-1]?2:1),a.baseIndent+b*r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/"}});
|
||||
(function(){function l(i){for(var f={},e=0;e<i.length;++e)f[i[e]]=!0;return f}function e(e,f){for(var l=!1,j;null!=(j=e.next());){if(l&&"/"==j){f.tokenize=null;break}l="*"==j}return["comment","comment"]}var j=l("all aural braille handheld print projection screen tty tv embossed".split(" ")),o=l("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".split(" ")),
|
||||
v=l("align-content align-items align-self alignment-adjust alignment-baseline anchor-point animation animation-delay animation-direction animation-duration 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 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-cell grid-column grid-column-align grid-column-sizing grid-column-span grid-columns grid-flow grid-row grid-row-align grid-row-sizing grid-row-span grid-rows grid-template 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 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 rendering-intent resize rest rest-after rest-before richness right rotation rotation-point ruby-align ruby-overhang ruby-position ruby-span 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-shadow 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-profile 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 kerning text-anchor writing-mode".split(" ")),
|
||||
r=l("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 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 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".split(" ")),
|
||||
n=l("above absolute activeborder activecaption afar after-white-space ahead alias all all-scroll alternate always amharic amharic-abegede antialiased appworkspace arabic-indic armenian asterisks auto avoid background backwards baseline below bidi-override binary bengali blink block block-axis bold bolder border border-box both bottom break-all break-word button button-bevel buttonface buttonhighlight buttonshadow buttontext cambodian capitalize caps-lock-indicator caption captiontext caret cell center checkbox circle cjk-earthly-branch cjk-heavenly-stem cjk-ideographic clear clip close-quote col-resize collapse compact condensed contain content content-box context-menu continuous copy cover crop cross crosshair currentcolor cursive dashed decimal decimal-leading-zero default default-button destination-atop destination-in destination-out destination-over devanagari disc discard document dot-dash dot-dot-dash dotted double down e-resize ease ease-in ease-in-out ease-out element 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 ew-resize expanded extra-condensed extra-expanded fantasy fast fill fixed flat 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-table inset inside intrinsic invert italic justify kannada katakana katakana-iroha khmer landscape lao large larger left level lighter line-through linear 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 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 nw-resize nwse-resize oblique octal open-quote optimizeLegibility optimizeSpeed oriya oromo outset outside overlay overline padding padding-box painted paused persian plus-darker plus-lighter pointer portrait pre pre-line pre-wrap preserve-3d progress push-button radio read-only read-write read-write-plaintext-only relative repeat repeat-x repeat-y reset reverse rgb rgba ridge right round row-resize rtl run-in running s-resize sans-serif scroll scrollbar se-resize searchfield searchfield-cancel-button searchfield-decoration searchfield-results-button searchfield-results-decoration semi-condensed semi-expanded separate serif show sidama single 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 square square-button start static status-bar stretch stroke sub subpixel-antialiased super sw-resize table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group 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 transparent ultra-condensed ultra-expanded underline up upper-alpha upper-armenian upper-greek upper-hexadecimal upper-latin upper-norwegian upper-roman uppercase urdu url vertical vertical-text visible visibleFill visiblePainted visibleStroke visual w-resize wait wave wider window windowframe windowtext x-large x-small xor xx-large xx-small".split(" "));
|
||||
CodeMirror.defineMIME("text/css",{atMediaTypes:j,atMediaFeatures:o,propertyKeywords:v,colorKeywords:r,valueKeywords:n,hooks:{"<":function(e,f){function j(e,f){for(var c=0,a;null!=(a=e.next());){if(2<=c&&">"==a){f.tokenize=null;break}c="-"==a?c+1:0}return["comment","comment"]}if(e.eat("!"))return f.tokenize=j,j(e,f)},"/":function(i,f){return i.eat("*")?(f.tokenize=e,e(i,f)):!1}},name:"css-base"});CodeMirror.defineMIME("text/x-scss",{atMediaTypes:j,atMediaFeatures:o,propertyKeywords:v,colorKeywords:r,
|
||||
valueKeywords:n,allowNested:!0,hooks:{$:function(e){return(e.match(/^[\w-]+/),":"==e.peek())?["variable","variable-definition"]:["variable","variable"]},"/":function(i,f){return i.eat("/")?(i.skipToEnd(),["comment","comment"]):i.eat("*")?(f.tokenize=e,e(i,f)):["operator","operator"]},"#":function(e){return e.eat("{")?["operator","interpolation"]:(e.eatWhile(/[\w\\\-]/),["atom","hash"])}},name:"css-base"})})();
|
||||
CodeMirror.defineMode("htmlmixed",function(l,e){function j(c,a){var d=a.htmlState.tagName,e=n.token(c,a.htmlState),b,g;if("script"==d&&/\btag\b/.test(e)&&">"==c.current()){(d=(d=c.string.slice(Math.max(0,c.pos-100),c.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i))?d[1]:"")&&/[\"\']/.test(d.charAt(0))&&(d=d.slice(1,d.length-1));for(b=0;b<f.length;++b)if(g=f[b],"string"==typeof g.matches?d==g.matches:g.matches.test(d)){g.mode&&(a.token=v,a.localMode=g.mode,a.localState=g.mode.startState&&g.mode.startState(n.indent(a.htmlState,
|
||||
"")));break}}else"style"==d&&/\btag\b/.test(e)&&">"==c.current()&&(a.token=r,a.localMode=i,a.localState=i.startState(n.indent(a.htmlState,"")));return e}function o(c,a,d){var e=c.current(),b=e.search(a);return-1<b?c.backUp(e.length-b):e.match(/<\/?$/)&&(c.backUp(e.length),c.match(a,!1)||c.match(e[0])),d}function v(c,a){return c.match(/^<\/\s*script\s*>/i,!1)?(a.token=j,a.localState=a.localMode=null,j(c,a)):o(c,/<\/\s*script\s*>/,a.localMode.token(c,a.localState))}function r(c,a){return c.match(/^<\/\s*style\s*>/i,
|
||||
!1)?(a.token=j,a.localState=a.localMode=null,j(c,a)):o(c,/<\/\s*style\s*>/,i.token(c,a.localState))}var n=CodeMirror.getMode(l,{name:"xml",htmlMode:!0}),i=CodeMirror.getMode(l,"css"),f=[],p=e&&e.scriptTypes,s,t;if(f.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(l,"javascript")}),p)for(s=0;s<p.length;++s)t=p[s],f.push({matches:t.matches,mode:t.mode&&CodeMirror.getMode(l,t.mode)});return f.push({matches:/./,mode:CodeMirror.getMode(l,"text/plain")}),{startState:function(){var c=
|
||||
n.startState();return{token:j,localMode:null,localState:null,htmlState:c}},copyState:function(c){if(c.localState)var a=CodeMirror.copyState(c.localMode,c.localState);return{token:c.token,localMode:c.localMode,localState:a,htmlState:CodeMirror.copyState(n,c.htmlState)}},token:function(c,a){return a.token(c,a)},indent:function(c,a){return!c.localMode||/^\s*<\//.test(a)?n.indent(c.htmlState,a):c.localMode.indent?c.localMode.indent(c.localState,a):CodeMirror.Pass},electricChars:"/{}:",innerMode:function(c){return{state:c.localState||
|
||||
c.htmlState,mode:c.localMode||n}}}},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
(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<h.length;++a)b=h[a],function(a){CodeMirror.on(b,"click",function(b){CodeMirror.e_preventDefault(b);c();a&&a(i)})}(d[a]),CodeMirror.on(b,"blur",function(){--f;setTimeout(function(){0>=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: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>',
|
||||
e='Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>',n='With: <input type="text" style="width: 10em"/>',r="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";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<g&&g<i.length-1){if(n!=e)break}else return(m=a?n.lastIndexOf(e):n.indexOf(e)+e.length,a?m!=n.length-e.length:m!=e.length)?void 0:(o=h(b.line,l),p=h(c,m),{from:a?p:o,to:a?o:p})}}}var h=CodeMirror.Pos;l.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},
|
||||
find:function(d){function a(a){a=h(a,0);return c.pos={from:a,to:a},c.atOccurrence=!1,!1}for(var c=this,g=this.doc.clipPos(d?this.pos.from:this.pos.to),k;;){if(this.pos=this.matches(d,g))return this.pos.from&&this.pos.to||console.log(this.matches,this.pos),this.atOccurrence=!0,this.pos.match||!0;if(d){if(!g.line)return a(0);g=h(g.line-1,this.doc.getLine(g.line-1).length)}else{if(k=this.doc.lineCount(),g.line==k-1)return a(k);g=h(g.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},
|
||||
to:function(){if(this.atOccurrence)return this.pos.to},replace:function(d){this.atOccurrence&&(d=CodeMirror.splitLines(d),this.doc.replaceRange(d,this.pos.from,this.pos.to),this.pos.to=h(this.pos.from.line+d.length-1,d[d.length-1].length+(1==d.length?this.pos.from.ch:0)))}};CodeMirror.defineExtension("getSearchCursor",function(d,a,c){return new l(this.doc,d,a,c)});CodeMirror.defineDocExtension("getSearchCursor",function(d,a,c){return new l(this,d,a,c)})})();
|
||||
Reference in new issue
Block a user