text: cwf = {};
  Object.values||(Object.values=function(n){if(n!==Object(n))throw new TypeError("Object.values called on a non-object");var i=[],t;for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&i.push(n[t]);return i}),function(){function n(n,t){for(var i=0;i<t.length;i+=1)if(t[i]===n)return!0;return!1}function e(n){return n.replace(/^\s+|\s+$/g,"")}function s(n){return n.replace(/^\s+/g,"")}function u(n,t){"use strict";var i=new c(n,t);return i.beautify()}function h(t){t=t||r.before_newline;var i=Object.values(r);if(!n(t,i))throw new Error("Invalid Option Value: The option 'operator_position' must be one of the following values\n"+i+"\nYou passed in: '"+t+"'");return t}function c(u,f){"use strict";function dt(n,t){var i=0;return n&&(i=n.indentation_level,!w.just_added_newline()&&n.line_indent_level>i&&(i=n.line_indent_level)),{mode:t,parent:n,last_text:n?n.last_text:"",last_word:n?n.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:i,line_indent_level:n?n.line_indent_level:i,start_line_index:w.get_line_number(),ternary_depth:0}}function gt(n){var t=n.newlines,u=p.keep_array_indentation&&ft(c.mode),i,r;if(u)for(i=0;i<t;i+=1)b(i>0);else if(p.max_preserve_newlines&&t>p.max_preserve_newlines&&(t=p.max_preserve_newlines),p.preserve_newlines&&n.newlines>1)for(b(),r=1;r<t;r+=1)b(!0);l=n;bt[l.type]()}function ri(n){n=n.replace(i.allLineBreaks,"\n");for(var r=[],t=n.indexOf("\n");t!==-1;)r.push(n.substring(0,t)),n=n.substring(t+1),t=n.indexOf("\n");return n.length&&r.push(n),r}function nt(t){var i,r,u,f;if(t=t===undefined?!1:t,!w.just_added_newline())if(i=p.preserve_newlines&&l.wanted_newline||t,r=n(c.last_text,tt.positionable_operators)||n(l.text,tt.positionable_operators),r&&(u=n(c.last_text,tt.positionable_operators)&&n(p.operator_position,o)||n(l.text,tt.positionable_operators),i=i&&u),i)b(!1,!0);else if(p.wrap_line_length){if(y==="TK_RESERVED"&&n(c.last_text,ni))return;f=w.current_line.get_character_count()+l.text.length+(w.space_before_token?1:0);f>=p.wrap_line_length&&b(!1,!0)}}function b(n,i){if(!i&&c.last_text!==";"&&c.last_text!==","&&c.last_text!=="="&&y!=="TK_OPERATOR")while(c.mode===t.Statement&&!c.if_block&&!c.do_block)rt();w.add_new_line(n)&&(c.multiline_frame=!0)}function ti(){w.just_added_newline()&&(p.keep_array_indentation&&ft(c.mode)&&l.wanted_newline?(w.current_line.push(l.whitespace_before),w.space_before_token=!1):w.set_indent(c.indentation_level)&&(c.line_indent_level=c.indentation_level))}function k(n){if(w.raw){w.add_raw_token(l);return}if(p.comma_first&&y==="TK_COMMA"&&w.just_added_newline()&&w.previous_line.last()===","){var t=w.previous_line.pop();w.previous_line.is_empty()&&(w.previous_line.push(t),w.trim(!0),w.current_line.pop(),w.trim());ti();w.add_token(",");w.space_before_token=!0}n=n||l.text;ti();w.add_token(n)}function ht(){c.indentation_level+=1}function ui(){c.indentation_level>0&&(!c.parent||c.indentation_level>c.parent.indentation_level)&&(c.indentation_level-=1)}function ut(n){c?(at.push(c),d=c):d=dt(null,n);c=dt(d,n)}function ft(n){return n===t.ArrayLiteral}function ct(i){return n(i,[t.Expression,t.ForInitializer,t.Conditional])}function rt(){at.length>0&&(d=c,c=at.pop(),d.mode===t.Statement&&w.remove_redundant_indentation(d))}function vt(){return c.parent.mode===t.ObjectLiteral&&c.mode===t.Statement&&(c.last_text===":"&&c.ternary_depth===0||y==="TK_RESERVED"&&n(c.last_text,["get","set"]))}function et(){return y==="TK_RESERVED"&&n(c.last_text,["var","let","const"])&&l.type==="TK_WORD"||y==="TK_RESERVED"&&c.last_text==="do"||y==="TK_RESERVED"&&n(c.last_text,["return","throw"])&&!l.wanted_newline||y==="TK_RESERVED"&&c.last_text==="else"&&!(l.type==="TK_RESERVED"&&l.text==="if")||y==="TK_END_EXPR"&&(d.mode===t.ForInitializer||d.mode===t.Conditional)||y==="TK_WORD"&&c.mode===t.BlockStatement&&!c.in_case&&!(l.text==="--"||l.text==="++")&&it!=="function"&&l.type!=="TK_WORD"&&l.type!=="TK_RESERVED"||c.mode===t.ObjectLiteral&&(c.last_text===":"&&c.ternary_depth===0||y==="TK_RESERVED"&&n(c.last_text,["get","set"]))?(ut(t.Statement),ht(),y==="TK_RESERVED"&&n(c.last_text,["var","let","const"])&&l.type==="TK_WORD"&&(c.declaration_statement=!0),vt()||nt(l.type==="TK_RESERVED"&&n(l.text,["do","for","if","while"])),!0):!1}function fi(n,t){for(var r,i=0;i<n.length;i++)if(r=e(n[i]),r.charAt(0)!==t)return!1;return!0}function ei(n,t){for(var i=0,u=n.length,r;i<u;i++)if(r=n[i],r&&r.indexOf(t)!==0)return!1;return!0}function yt(t){return n(t,["case","return","do","if","throw","else"])}function st(n){var t=wt+(n||0);return t<0||t>=pt.length?null:pt[t]}function oi(){et();var i=t.Expression;if(l.text==="["){if(y==="TK_WORD"||c.last_text===")"){y==="TK_RESERVED"&&n(c.last_text,tt.line_starters)&&(w.space_before_token=!0);ut(i);k();ht();p.space_in_paren&&(w.space_before_token=!0);return}i=t.ArrayLiteral;ft(c.mode)&&(c.last_text==="["||c.last_text===","&&(it==="]"||it==="}"))&&(p.keep_array_indentation||b())}else y==="TK_RESERVED"&&c.last_text==="for"?i=t.ForInitializer:y==="TK_RESERVED"&&n(c.last_text,["if","while"])&&(i=t.Conditional);c.last_text===";"||y==="TK_START_BLOCK"?b():y==="TK_END_EXPR"||y==="TK_START_EXPR"||y==="TK_END_BLOCK"||c.last_text==="."?nt(l.wanted_newline):y==="TK_RESERVED"&&l.text==="("||y==="TK_WORD"||y==="TK_OPERATOR"?y==="TK_RESERVED"&&(c.last_word==="function"||c.last_word==="typeof")||c.last_text==="*"&&it==="function"?p.space_after_anon_function&&(w.space_before_token=!0):y==="TK_RESERVED"&&(n(c.last_text,tt.line_starters)||c.last_text==="catch")&&p.space_before_conditional&&(w.space_before_token=!0):w.space_before_token=!0;l.text==="("&&y==="TK_RESERVED"&&c.last_word==="await"&&(w.space_before_token=!0);l.text==="("&&(y==="TK_EQUALS"||y==="TK_OPERATOR")&&(vt()||nt());l.text==="("&&y!=="TK_WORD"&&y!=="TK_RESERVED"&&nt();ut(i);k();p.space_in_paren&&(w.space_before_token=!0);ht()}function si(){while(c.mode===t.Statement)rt();c.multiline_frame&&nt(l.text==="]"&&ft(c.mode)&&!p.keep_array_indentation);p.space_in_paren&&(y!=="TK_START_EXPR"||p.space_in_empty_paren?w.space_before_token=!0:(w.trim(),w.space_before_token=!1));l.text==="]"&&p.keep_array_indentation?(k(),rt()):(rt(),k());w.remove_redundant_indentation(d);c.do_while&&d.mode===t.Conditional&&(d.mode=t.Expression,c.do_block=!1,c.do_while=!1)}function hi(){var r=st(1),u=st(2),e,o,f,i;if(u&&(n(u.text,[":",","])&&n(r.type,["TK_STRING","TK_WORD","TK_RESERVED"])||n(r.text,["get","set"])&&n(u.type,["TK_WORD","TK_RESERVED"]))?n(it,["class","interface"])?ut(t.BlockStatement):ut(t.ObjectLiteral):y==="TK_OPERATOR"&&c.last_text==="=>"?ut(t.BlockStatement):n(y,["TK_EQUALS","TK_START_EXPR","TK_COMMA","TK_OPERATOR"])||y==="TK_RESERVED"&&n(c.last_text,["return","throw","import"])?ut(t.ObjectLiteral):ut(t.BlockStatement),e=!r.comments_before.length&&r.text==="}",o=e&&c.last_word==="function"&&y==="TK_END_EXPR",p.brace_style==="expand"||p.brace_style==="none"&&l.wanted_newline)y!=="TK_OPERATOR"&&(o||y==="TK_EQUALS"||y==="TK_RESERVED"&&yt(c.last_text)&&c.last_text!=="else")?w.space_before_token=!0:b(!1,!0);else{if(p.brace_style==="collapse-preserve-inline"){f=0;i=null;c.inline_frame=!0;do if(f+=1,i=st(f),i.wanted_newline){c.inline_frame=!1;break}while(i.type!=="TK_EOF"&&!(i.type==="TK_END_BLOCK"&&i.opened===l))}ft(d.mode)&&(y==="TK_START_EXPR"||y==="TK_COMMA")?((y==="TK_COMMA"||p.space_in_paren)&&(w.space_before_token=!0),p.brace_style==="collapse-preserve-inline"&&(y==="TK_COMMA"||y==="TK_START_EXPR"&&c.inline_frame)&&(nt(),d.multiline_frame=d.multiline_frame||c.multiline_frame,c.multiline_frame=!1)):y!=="TK_OPERATOR"&&y!=="TK_START_EXPR"&&(y==="TK_START_BLOCK"?b():w.space_before_token=!0)}k();ht()}function ci(){while(c.mode===t.Statement)rt();var n=y==="TK_START_BLOCK";p.brace_style==="expand"?n||b():n||(c.inline_frame?w.space_before_token=!0:ft(c.mode)&&p.keep_array_indentation?(p.keep_array_indentation=!1,b(),p.keep_array_indentation=!0):b());rt();k()}function ii(){var i,r;if(l.type==="TK_RESERVED"&&(n(l.text,["set","get"])&&c.mode!==t.ObjectLiteral?l.type="TK_WORD":n(l.text,["as","from"])&&!c.import_block?l.type="TK_WORD":c.mode===t.ObjectLiteral&&(i=st(1),i.text===":"&&(l.type="TK_WORD"))),et()||!l.wanted_newline||ct(c.mode)||y==="TK_OPERATOR"&&c.last_text!=="--"&&c.last_text!=="++"||y==="TK_EQUALS"||!p.preserve_newlines&&y==="TK_RESERVED"&&n(c.last_text,["var","let","const","set","get"])||b(),c.do_block&&!c.do_while){if(l.type==="TK_RESERVED"&&l.text==="while"){w.space_before_token=!0;k();w.space_before_token=!0;c.do_while=!0;return}b();c.do_block=!1}if(c.if_block)if(c.else_block||l.type!=="TK_RESERVED"||l.text!=="else"){while(c.mode===t.Statement)rt();c.if_block=!1;c.else_block=!1}else c.else_block=!0;if(l.type==="TK_RESERVED"&&(l.text==="case"||l.text==="default"&&c.in_case_statement)){b();(c.case_body||p.jslint_happy)&&(ui(),c.case_body=!1);k();c.in_case=!0;c.in_case_statement=!0;return}if(l.type==="TK_RESERVED"&&l.text==="function"&&((n(c.last_text,["}",";"])||w.just_added_newline()&&!n(c.last_text,["[","{",":","=",","]))&&(w.just_added_blankline()||l.comments_before.length||(b(),b(!0))),y==="TK_RESERVED"||y==="TK_WORD"?y==="TK_RESERVED"&&n(c.last_text,["get","set","new","return","export","async"])?w.space_before_token=!0:y==="TK_RESERVED"&&c.last_text==="default"&&it==="export"?w.space_before_token=!0:b():y==="TK_OPERATOR"||c.last_text==="="?w.space_before_token=!0:!c.multiline_frame&&(ct(c.mode)||ft(c.mode))||b()),(y==="TK_COMMA"||y==="TK_START_EXPR"||y==="TK_EQUALS"||y==="TK_OPERATOR")&&(vt()||nt()),l.type==="TK_RESERVED"&&n(l.text,["function","get","set"])){k();c.last_word=l.text;return}g="NONE";y==="TK_END_BLOCK"?l.type==="TK_RESERVED"&&n(l.text,["else","catch","finally","from"])?p.brace_style==="expand"||p.brace_style==="end-expand"||p.brace_style==="none"&&l.wanted_newline?g="NEWLINE":(g="SPACE",w.space_before_token=!0):g="NEWLINE":y==="TK_SEMICOLON"&&c.mode===t.BlockStatement?g="NEWLINE":y==="TK_SEMICOLON"&&ct(c.mode)?g="SPACE":y==="TK_STRING"?g="NEWLINE":y==="TK_RESERVED"||y==="TK_WORD"||c.last_text==="*"&&it==="function"?g="SPACE":y==="TK_START_BLOCK"?g=c.inline_frame?"SPACE":"NEWLINE":y==="TK_END_EXPR"&&(w.space_before_token=!0,g="NEWLINE");l.type==="TK_RESERVED"&&n(l.text,tt.line_starters)&&c.last_text!==")"&&(g=c.last_text==="else"||c.last_text==="export"?"SPACE":"NEWLINE");l.type==="TK_RESERVED"&&n(l.text,["else","catch","finally"])?y==="TK_END_BLOCK"&&d.mode===t.BlockStatement&&p.brace_style!=="expand"&&p.brace_style!=="end-expand"&&(p.brace_style!=="none"||!l.wanted_newline)?(w.trim(!0),r=w.current_line,r.last()!=="}"&&b(),w.space_before_token=!0):b():g==="NEWLINE"?y==="TK_RESERVED"&&yt(c.last_text)?w.space_before_token=!0:y!=="TK_END_EXPR"?y==="TK_START_EXPR"&&l.type==="TK_RESERVED"&&n(l.text,["var","let","const"])||c.last_text===":"||(l.type==="TK_RESERVED"&&l.text==="if"&&c.last_text==="else"?w.space_before_token=!0:b()):l.type==="TK_RESERVED"&&n(l.text,tt.line_starters)&&c.last_text!==")"&&b():c.multiline_frame&&ft(c.mode)&&c.last_text===","&&it==="}"?b():g==="SPACE"&&(w.space_before_token=!0);k();c.last_word=l.text;l.type==="TK_RESERVED"&&(l.text==="do"?c.do_block=!0:l.text==="if"?c.if_block=!0:l.text==="import"?c.import_block=!0:c.import_block&&l.type==="TK_RESERVED"&&l.text==="from"&&(c.import_block=!1))}function li(){for(et()&&(w.space_before_token=!1);c.mode===t.Statement&&!c.if_block&&!c.do_block;)rt();c.import_block&&(c.import_block=!1);k()}function ai(){et()?w.space_before_token=!0:y==="TK_RESERVED"||y==="TK_WORD"||c.inline_frame?w.space_before_token=!0:y==="TK_COMMA"||y==="TK_START_EXPR"||y==="TK_EQUALS"||y==="TK_OPERATOR"?vt()||nt():b();k()}function vi(){et();c.declaration_statement&&(c.declaration_assignment=!0);w.space_before_token=!0;k();w.space_before_token=!0}function yi(){k();w.space_before_token=!0;c.declaration_statement?(ct(c.parent.mode)&&(c.declaration_assignment=!1),c.declaration_assignment?(c.declaration_assignment=!1,b(!1,!0)):p.comma_first&&nt()):c.mode===t.ObjectLiteral||c.mode===t.Statement&&c.parent.mode===t.ObjectLiteral?(c.mode===t.Statement&&rt(),c.inline_frame||b()):p.comma_first&&nt()}function pi(){if(et(),y==="TK_RESERVED"&&yt(c.last_text)){w.space_before_token=!0;k();return}if(l.text==="*"&&y==="TK_DOT"){k();return}if(l.text==="::"){k();return}if(y==="TK_OPERATOR"&&n(p.operator_position,o)&&nt(),l.text===":"&&c.in_case){c.case_body=!0;ht();k();b();c.in_case=!1;return}var i=!0,u=!0,e=!1,h=l.text==="*"&&y==="TK_RESERVED"&&c.last_text==="function",a=n(l.text,["-","+"])&&(n(y,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||n(c.last_text,tt.line_starters)||c.last_text===",");if(l.text===":"?c.ternary_depth===0?i=!1:(c.ternary_depth-=1,e=!0):l.text==="?"&&(c.ternary_depth+=1),!a&&!h&&p.preserve_newlines&&n(l.text,tt.positionable_operators)){var f=l.text===":",v=f&&e,s=f&&!e;switch(p.operator_position){case r.before_newline:w.space_before_token=!s;k();(!f||v)&&nt();w.space_before_token=!0;return;case r.after_newline:w.space_before_token=!0;!f||v?st(1).wanted_newline?b(!1,!0):nt():w.space_before_token=!1;k();w.space_before_token=!0;return;case r.preserve_newline:s||nt();i=!(w.just_added_newline()||s);w.space_before_token=i;k();w.space_before_token=!0;return}}n(l.text,["--","++","!","~"])||a?(i=!1,u=!1,l.wanted_newline&&(l.text==="--"||l.text==="++")&&b(!1,!0),c.last_text===";"&&ct(c.mode)&&(i=!0),y==="TK_RESERVED"?i=!0:y==="TK_END_EXPR"?i=!(c.last_text==="]"&&(l.text==="--"||l.text==="++")):y==="TK_OPERATOR"&&(i=n(l.text,["--","-","++","+"])&&n(c.last_text,["--","-","++","+"]),n(l.text,["+","-"])&&n(c.last_text,["--","++"])&&(u=!0)),(c.mode!==t.BlockStatement||c.inline_frame)&&c.mode!==t.Statement||c.last_text!=="{"&&c.last_text!==";"||b()):h&&(i=!1,u=!1);w.space_before_token=w.space_before_token||i;k();w.space_before_token=u}function wi(){if(w.raw){w.add_raw_token(l);l.directives&&l.directives.preserve==="end"&&(w.raw=p.test_output_raw);return}if(l.directives){b(!1,!0);k();l.directives.preserve==="start"&&(w.raw=!0);b(!1,!0);return}if(!i.newline.test(l.text)&&!l.wanted_newline){w.space_before_token=!0;k();w.space_before_token=!0;return}var n=ri(l.text),t,r=!1,u=!1,f=l.whitespace_before,e=f.length;for(b(!1,!0),n.length>1&&(r=fi(n.slice(1),"*"),u=ei(n.slice(1),f)),k(n[0]),t=1;t<n.length;t++)b(!1,!0),r?k(" "+s(n[t])):u&&n[t].length>e?k(n[t].substring(e)):w.add_token(n[t]);b(!1,!0)}function bi(){l.wanted_newline?b(!1,!0):w.trim(!0);w.space_before_token=!0;k();b(!1,!0)}function ki(){et();y==="TK_RESERVED"&&yt(c.last_text)?w.space_before_token=!0:nt(c.last_text===")"&&p.break_chained_methods);k()}function di(){k();l.text[l.text.length-1]==="\n"&&b()}function gi(){while(c.mode===t.Statement)rt()}var w,pt=[],wt,tt,l,y,it,lt,c,d,at,g,bt,p,kt="",ot,ni;for(bt={TK_START_EXPR:oi,TK_END_EXPR:si,TK_START_BLOCK:hi,TK_END_BLOCK:ci,TK_WORD:ii,TK_RESERVED:ii,TK_SEMICOLON:li,TK_STRING:ai,TK_EQUALS:vi,TK_OPERATOR:pi,TK_COMMA:yi,TK_BLOCK_COMMENT:wi,TK_COMMENT:bi,TK_DOT:ki,TK_UNKNOWN:di,TK_EOF:gi},f=f?f:{},p={},f.braces_on_own_line!==undefined&&(p.brace_style=f.braces_on_own_line?"expand":"collapse"),p.brace_style=f.brace_style?f.brace_style:p.brace_style?p.brace_style:"collapse",p.brace_style==="expand-strict"&&(p.brace_style="expand"),p.indent_size=f.indent_size?parseInt(f.indent_size,10):4,p.indent_char=f.indent_char?f.indent_char:" ",p.eol=f.eol?f.eol:"auto",p.preserve_newlines=f.preserve_newlines===undefined?!0:f.preserve_newlines,p.break_chained_methods=f.break_chained_methods===undefined?!1:f.break_chained_methods,p.max_preserve_newlines=f.max_preserve_newlines===undefined?0:parseInt(f.max_preserve_newlines,10),p.space_in_paren=f.space_in_paren===undefined?!1:f.space_in_paren,p.space_in_empty_paren=f.space_in_empty_paren===undefined?!1:f.space_in_empty_paren,p.jslint_happy=f.jslint_happy===undefined?!1:f.jslint_happy,p.space_after_anon_function=f.space_after_anon_function===undefined?!1:f.space_after_anon_function,p.keep_array_indentation=f.keep_array_indentation===undefined?!1:f.keep_array_indentation,p.space_before_conditional=f.space_before_conditional===undefined?!0:f.space_before_conditional,p.unescape_strings=f.unescape_strings===undefined?!1:f.unescape_strings,p.wrap_line_length=f.wrap_line_length===undefined?0:parseInt(f.wrap_line_length,10),p.e4x=f.e4x===undefined?!1:f.e4x,p.end_with_newline=f.end_with_newline===undefined?!1:f.end_with_newline,p.comma_first=f.comma_first===undefined?!1:f.comma_first,p.operator_position=h(f.operator_position),p.test_output_raw=f.test_output_raw===undefined?!1:f.test_output_raw,p.jslint_happy&&(p.space_after_anon_function=!0),f.indent_with_tabs&&(p.indent_char="\t",p.indent_size=1),p.eol==="auto"&&(p.eol="\n",u&&i.lineBreak.test(u||"")&&(p.eol=u.match(i.lineBreak)[0])),p.eol=p.eol.replace(/\\r/,"\r").replace(/\\n/,"\n"),lt="";p.indent_size>0;)lt+=p.indent_char,p.indent_size-=1;if(ot=0,u&&u.length){while(u.charAt(ot)===" "||u.charAt(ot)==="\t")kt+=u.charAt(ot),ot+=1;u=u.substring(ot)}y="TK_START_BLOCK";it="";w=new a(lt,kt);w.raw=p.test_output_raw;at=[];ut(t.BlockStatement);this.beautify=function(){function r(){return n=st()}var n,t,i;for(tt=new v(u,p,lt),pt=tt.tokenize(),wt=0;r();){for(i=0;i<n.comments_before.length;i++)gt(n.comments_before[i]);gt(n);it=c.last_text;y=n.type;c.last_text=n.text;wt+=1}return t=w.get_code(),p.end_with_newline&&(t+="\n"),p.eol!=="\n"&&(t=t.replace(/[\n]/g,p.eol)),t};ni=["break","contiue","return","throw"]}function l(n){var i=0,r=-1,t=[],u=!0;this.set_indent=function(t){i=n.baseIndentLength+t*n.indent_length;r=t};this.get_character_count=function(){return i};this.is_empty=function(){return u};this.last=function(){return this._empty?null:t[t.length-1]};this.push=function(n){t.push(n);i+=n.length;u=!1};this.pop=function(){var n=null;return u||(n=t.pop(),i-=n.length,u=t.length===0),n};this.remove_indent=function(){r>0&&(r-=1,i-=n.indent_length)};this.trim=function(){while(this.last()===" ")t.pop(),i-=1;u=t.length===0};this.toString=function(){var i="";return this._empty||(r>=0&&(i=n.indent_cache[r]),i+=t.join("")),i}}function a(n,i){i=i||"";this.indent_cache=[i];this.baseIndentLength=i.length;this.indent_length=n.length;this.raw=!1;var r=[];this.baseIndentString=i;this.indent_string=n;this.previous_line=null;this.current_line=null;this.space_before_token=!1;this.add_outputline=function(){this.previous_line=this.current_line;this.current_line=new l(this);r.push(this.current_line)};this.add_outputline();this.get_line_number=function(){return r.length};this.add_new_line=function(n){return this.get_line_number()===1&&this.just_added_newline()?!1:n||!this.just_added_newline()?(this.raw||this.add_outputline(),!0):!1};this.get_code=function(){return r.join("\n").replace(/[\r\n\t ]+$/,"")};this.set_indent=function(n){if(r.length>1){while(n>=this.indent_cache.length)this.indent_cache.push(this.indent_cache[this.indent_cache.length-1]+this.indent_string);return this.current_line.set_indent(n),!0}return this.current_line.set_indent(0),!1};this.add_raw_token=function(n){for(var t=0;t<n.newlines;t++)this.add_outputline();this.current_line.push(n.whitespace_before);this.current_line.push(n.text);this.space_before_token=!1};this.add_token=function(n){this.add_space_before_token();this.current_line.push(n)};this.add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&this.current_line.push(" ");this.space_before_token=!1};this.remove_redundant_indentation=function(n){if(!n.multiline_frame&&n.mode!==t.ForInitializer&&n.mode!==t.Conditional)for(var i=n.start_line_index,u=r.length;i<u;)r[i].remove_indent(),i++};this.trim=function(t){for(t=t===undefined?!1:t,this.current_line.trim(n,i);t&&r.length>1&&this.current_line.is_empty();)r.pop(),this.current_line=r[r.length-1],this.current_line.trim();this.previous_line=r.length>1?r[r.length-2]:null};this.just_added_newline=function(){return this.current_line.is_empty()};this.just_added_blankline=function(){if(this.just_added_newline()){if(r.length===1)return!0;var n=r[r.length-2];return n.is_empty()}return!1}}function v(t,r){function ft(n){var i,t;if(!n.match(ut))return null;for(i={},y.lastIndex=0,t=y.exec(n);t;)i[t[1]]=t[2],t=y.exec(n);return i}function d(){var d,wt=[],ut,y,st,ht,bt,ri,kt,ei,dt,ni,yt,pt,ti;if(c=0,l="",u>=o)return["","TK_EOF"];for(ut=s.length?s[s.length-1]:new f("TK_START_BLOCK","{"),y=t.charAt(u),u+=1;n(y,g);){if(i.newline.test(y)?y==="\n"&&t.charAt(u-2)==="\r"||(c+=1,wt=[]):wt.push(y),u>=o)return["","TK_EOF"];y=t.charAt(u);u+=1}if(wt.length&&(l=wt.join("")),h.test(y)||y==="."&&h.test(t.charAt(u))){var vt=!0,gt=!0,ii=h;for(y==="0"&&u<o&&/[XxOoBb]/.test(t.charAt(u))?(vt=!1,gt=!1,ii=/[Bb]/.test(t.charAt(u))?nt:/[Oo]/.test(t.charAt(u))?tt:it,y+=t.charAt(u),u+=1):y==="."?vt=!1:(y="",u-=1);u<o&&ii.test(t.charAt(u));)y+=t.charAt(u),u+=1,vt&&u<o&&t.charAt(u)==="."?(y+=t.charAt(u),u+=1,vt=!1):gt&&u<o&&/[Ee]/.test(t.charAt(u))&&(y+=t.charAt(u),u+=1,u<o&&/[+-]/.test(t.charAt(u))&&(y+=t.charAt(u),u+=1),gt=!1,vt=!1);return[y,"TK_WORD"]}if(i.isIdentifierStart(t.charCodeAt(u-1))){if(u<o)while(i.isIdentifierChar(t.charCodeAt(u)))if(y+=t.charAt(u),u+=1,u===o)break;return!(ut.type==="TK_DOT"||ut.type==="TK_RESERVED"&&n(ut.text,["set","get"]))&&n(y,rt)?y==="in"?[y,"TK_OPERATOR"]:[y,"TK_RESERVED"]:[y,"TK_WORD"]}if(y==="("||y==="[")return[y,"TK_START_EXPR"];if(y===")"||y==="]")return[y,"TK_END_EXPR"];if(y==="{")return[y,"TK_START_BLOCK"];if(y==="}")return[y,"TK_END_BLOCK"];if(y===";")return[y,"TK_SEMICOLON"];if(y==="/"){if(st="",t.charAt(u)==="*")return u+=1,p.lastIndex=u,ht=p.exec(t),st="/*"+ht[0],u+=ht[0].length,bt=ft(st),bt&&bt.ignore==="start"&&(b.lastIndex=u,ht=b.exec(t),st+=ht[0],u+=ht[0].length),st=st.replace(i.allLineBreaks,"\n"),[st,"TK_BLOCK_COMMENT",bt];if(t.charAt(u)==="/")return u+=1,w.lastIndex=u,ht=w.exec(t),st="//"+ht[0],u+=ht[0].length,[st,"TK_COMMENT"]}if(ri=/^<([-a-zA-Z:0-9_.]+|{.+?}|!\[CDATA\[[\s\S]*?\]\])(\s+{.+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{.+?}))*\s*(\/?)\s*>/,y==="`"||y==="'"||y==='"'||(y==="/"||r.e4x&&y==="<"&&t.slice(u-1).match(ri))&&(ut.type==="TK_RESERVED"&&n(ut.text,["return","case","throw","else","do","typeof","yield"])||ut.type==="TK_END_EXPR"&&ut.text===")"&&ut.parent&&ut.parent.type==="TK_RESERVED"&&n(ut.parent.text,["if","while","for"])||n(ut.type,["TK_COMMENT","TK_START_EXPR","TK_START_BLOCK","TK_END_BLOCK","TK_OPERATOR","TK_EQUALS","TK_EOF","TK_SEMICOLON","TK_COMMA"]))){var lt=y,ct=!1,ui=!1;if(d=y,lt==="/")for(kt=!1;u<o&&(ct||kt||t.charAt(u)!==lt)&&!i.newline.test(t.charAt(u));)d+=t.charAt(u),ct?ct=!1:(ct=t.charAt(u)==="\\",t.charAt(u)==="["?kt=!0:t.charAt(u)==="]"&&(kt=!1)),u+=1;else if(r.e4x&&lt==="<"){var fi=/<(\/?)([-a-zA-Z:0-9_.]+|{.+?}|!\[CDATA\[[\s\S]*?\]\])(\s+{.+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{.+?}))*\s*(\/?)\s*>/g,at=t.slice(u-1),ot=fi.exec(at);if(ot&&ot.index===0){for(ei=ot[2],dt=0;ot;){var si=!!ot[1],oi=ot[2],hi=!!ot[ot.length-1]||oi.slice(0,8)==="![CDATA[";if(oi!==ei||hi||(si?--dt:++dt),dt<=0)break;ot=fi.exec(at)}return ni=ot?ot.index+ot[0].length:at.length,at=at.slice(0,ni),u+=ni-1,at=at.replace(i.allLineBreaks,"\n"),[at,"TK_STRING"]}}else yt=function(n,r,f){for(var e;u<o;){if(e=t.charAt(u),!(ct||e!==n&&(r||!i.newline.test(e))))break;(ct||r)&&i.newline.test(e)?(e==="\r"&&t.charAt(u+1)==="\n"&&(u+=1,e=t.charAt(u)),d+="\n"):d+=e;ct?((e==="x"||e==="u")&&(ui=!0),ct=!1):ct=e==="\\";u+=1;f&&d.indexOf(f,d.length-f.length)!==-1&&(n==="`"?yt("}",r,"`"):yt("`",r,"${"))}},lt==="`"?yt("`",!0,"${"):yt(lt);if(ui&&r.unescape_strings&&(d=et(d)),u<o&&t.charAt(u)===lt&&(d+=lt,u+=1,lt==="/"))while(u<o&&i.isIdentifierStart(t.charCodeAt(u)))d+=t.charAt(u),u+=1;return[d,"TK_STRING"]}if(y==="#"){if(s.length===0&&t.charAt(u)==="!"){for(d=y;u<o&&y!=="\n";)y=t.charAt(u),d+=y,u+=1;return[e(d)+"\n","TK_UNKNOWN"]}if(pt="#",u<o&&h.test(t.charAt(u))){do y=t.charAt(u),pt+=y,u+=1;while(u<o&&y!=="#"&&y!=="=");return y==="#"||(t.charAt(u)==="["&&t.charAt(u+1)==="]"?(pt+="[]",u+=2):t.charAt(u)==="{"&&t.charAt(u+1)==="}"&&(pt+="{}",u+=2)),[pt,"TK_WORD"]}}if(y==="<"&&(t.charAt(u)==="?"||t.charAt(u)==="%")&&(k.lastIndex=u-1,ti=k.exec(t),ti))return y=ti[0],u+=y.length-1,y=y.replace(i.allLineBreaks,"\n"),[y,"TK_STRING"];if(y==="<"&&t.substring(u-1,u+3)==="<!--"){for(u+=3,y="<!--";!i.newline.test(t.charAt(u))&&u<o;)y+=t.charAt(u),u++;return a=!0,[y,"TK_COMMENT"]}if(y==="-"&&a&&t.substring(u-1,u+2)==="-->")return a=!1,u+=2,["-->","TK_COMMENT"];if(y===".")return[y,"TK_DOT"];if(n(y,v)){while(u<o&&n(y+t.charAt(u),v))if(y+=t.charAt(u),u+=1,u>=o)break;return y===","?[y,"TK_COMMA"]:y==="="?[y,"TK_EQUALS"]:[y,"TK_OPERATOR"]}return[y,"TK_UNKNOWN"]}function et(n){for(var e=!1,u="",r=0,f="",t=0,i;e||r<n.length;)if(i=n.charAt(r),r++,e){if(e=!1,i==="x")f=n.substr(r,2),r+=2;else if(i==="u")f=n.substr(r,4),r+=4;else{u+="\\"+i;continue}if(!f.match(/^[0123456789abcdefABCDEF]+$/))return n;if(t=parseInt(f,16),t>=0&&t<32){u+=i==="x"?"\\x"+f:"\\u"+f;continue}else if(t===34||t===39||t===92)u+="\\"+String.fromCharCode(t);else{if(i==="x"&&t>126&&t<=255)return n;u+=String.fromCharCode(t)}}else i==="\\"?e=!0:u+=i;return u}var g="\n\r\t ".split(""),h=/[0-9]/,nt=/[01]/,tt=/[01234567]/,it=/[0123456789abcdefABCDEF]/,v;this.positionable_operators="!= !== % & && * ** + - / : < << <= == === > >= >> >>> ? ^ | ||".split(" ");v=this.positionable_operators.concat("! %= &= *= **= ++ += , -- -= /= :: <<= = => >>= >>>= ^= |= ~".split(" "));this.line_starters="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");var rt=this.line_starters.concat(["do","in","else","get","set","new","catch","finally","typeof","yield","async","await","from","as"]),p=/([\s\S]*?)((?:\*\/)|$)/g,w=/([^\n\r\u2028\u2029]*)/g,ut=/\/\* beautify( \w+[:]\w+)+ \*\//g,y=/ (\w+)[:](\w+)/g,b=/([\s\S]*?)((?:\/\*\sbeautify\signore:end\s\*\/)|$)/g,k=/((<\?php|<\?=)[\s\S]*?\?>)|(<%[\s\S]*?%>)/g,c,l,a,s,u,o;this.tokenize=function(){o=t.length;u=0;a=!1;s=[];for(var n,e,r,i=null,v=[],h=[];!(e&&e.type==="TK_EOF");){for(r=d(),n=new f(r[1],r[0],c,l);n.type==="TK_COMMENT"||n.type==="TK_BLOCK_COMMENT"||n.type==="TK_UNKNOWN";)n.type==="TK_BLOCK_COMMENT"&&(n.directives=r[2]),h.push(n),r=d(),n=new f(r[1],r[0],c,l);h.length&&(n.comments_before=h,h=[]);n.type==="TK_START_BLOCK"||n.type==="TK_START_EXPR"?(n.parent=e,v.push(i),i=n):(n.type==="TK_END_BLOCK"||n.type==="TK_END_EXPR")&&i&&(n.text==="]"&&i.text==="["||n.text===")"&&i.text==="("||n.text==="}"&&i.text==="{")&&(n.parent=i.parent,n.opened=i,i=v.pop());s.push(n);e=n}return s}}var i={},f;(function(n){var t="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ﬀ-ﬆﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼＡ-Ｚａ-ｚｦ-ﾾￂ-ￇￊ-ￏￒ-ￗￚ-ￜ",i=new RegExp("["+t+"]"),r=new RegExp("["+t+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏０-９＿]");n.newline=/[\n\r\u2028\u2029]/;n.lineBreak=new RegExp("\r\n|"+n.newline.source);n.allLineBreaks=new RegExp(n.lineBreak.source,"g");n.isIdentifierStart=function(n){return n<65?n===36||n===64:n<91?!0:n<97?n===95:n<123?!0:n>=170&&i.test(String.fromCharCode(n))};n.isIdentifierChar=function(n){return n<48?n===36:n<58?!0:n<65?!1:n<91?!0:n<97?n===95:n<123?!0:n>=170&&r.test(String.fromCharCode(n))}})(i);var r={before_newline:"before-newline",after_newline:"after-newline",preserve_newline:"preserve-newline"},o=[r.before_newline,r.preserve_newline],t={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};f=function(n,t,i,r,u){this.type=n;this.text=t;this.comments_before=[];this.newlines=i||0;this.wanted_newline=i>0;this.whitespace_before=r||"";this.parent=u||null;this.opened=null;this.directives=null};typeof define=="function"&&define.amd?define([],function(){return{js_beautify:u}}):typeof exports!="undefined"?exports.js_beautify=u:typeof window!="undefined"?window.js_beautify=u:typeof global!="undefined"&&(global.js_beautify=u)}(),function(){function t(){return cwf.Formatter=new n,cwf.Formatter}var n;n=function(){function n(){_this=this;this.initialize()}return n.prototype={initialize:function(){_this.txtArea=CodeMirror.fromTextArea($(".text1")[0],{theme:"default",lineNumbers:!0,lineWrapping:!0});$(".btn-load-web-inline").click(function(){cwf.UploaderSaver.loadWebDocument(null,function(n){_this.txtArea.setValue(n)})});window.OnLoadDocument=function(n){_this.txtArea.setValue(n)};$(".btn-load-web-inline-example").click(function(){$("#file_url").val("http://countwordsfree.com/example.js");$(".btn-load-web-inline").click()});$(".formatter").click(function(){var n=_this.txtArea.getValue();n.length>0&&(n=js_beautify(n,{indent_size:$("#indent-size option:selected").text(),indent_char:$("#indent-symbol option:selected").val()==""?" ":"\t",preserve_newlines:$("#preserve-newline option:selected").val()}),_this.txtArea.setValue(n))})},txtArea:null},n}();$(document).ready(t)}.call(),function(n){if(typeof exports=="object"&&typeof module=="object")module.exports=n();else{if(typeof define=="function"&&define.amd)return define([],n);(this||window).CodeMirror=n()}}(function(){"use strict";function t(n,i){var r,h,u,o,f,e;if(!(this instanceof t))return new t(n,i);this.options=i=i?pt(i):{};pt(ry,i,!1);os(i);r=i.value;typeof r=="string"&&(r=new it(r,i.mode,null,i.lineSeparator));this.doc=r;h=new t.inputStyles[i.inputStyle](this);u=this.display=new kw(n,r,h);u.wrapper.CodeMirror=this;ol(this);el(this);i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");i.autofocus&&!hu&&u.input.focus();sl(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new or,keySeq:null,specialChars:null};o=this;s&&a<11&&setTimeout(function(){o.display.input.reset(!0)},20);fk(this);hg();pr(this);this.curOp.forceUpdate=!0;hp(this,r);i.autofocus&&!hu||o.hasFocus()?setTimeout(te(vh,this),20):rf(this);for(f in tr)tr.hasOwnProperty(f)&&tr[f](this,i[f],bh);for(cl(this),i.finishInit&&i.finishInit(this),e=0;e<oo.length;++e)oo[e](this);wr(this);w&&i.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}function kw(n,t,r){var u=this;this.input=r;u.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler");u.scrollbarFiller.setAttribute("cm-not-content","true");u.gutterFiller=i("div",null,"CodeMirror-gutter-filler");u.gutterFiller.setAttribute("cm-not-content","true");u.lineDiv=i("div",null,"CodeMirror-code");u.selectionDiv=i("div",null,null,"position: relative; z-index: 1");u.cursorDiv=i("div",null,"CodeMirror-cursors");u.measure=i("div",null,"CodeMirror-measure");u.lineMeasure=i("div",null,"CodeMirror-measure");u.lineSpace=i("div",[u.measure,u.lineMeasure,u.selectionDiv,u.cursorDiv,u.lineDiv],null,"position: relative; outline: none");u.mover=i("div",[i("div",[u.lineSpace],"CodeMirror-lines")],null,"position: relative");u.sizer=i("div",[u.mover],"CodeMirror-sizer");u.sizerWidth=null;u.heightForcer=i("div",null,null,"position: absolute; height: "+dp+"px; width: 1px;");u.gutters=i("div",null,"CodeMirror-gutters");u.lineGutter=null;u.scroller=i("div",[u.sizer,u.heightForcer,u.gutters],"CodeMirror-scroll");u.scroller.setAttribute("tabIndex","-1");u.wrapper=i("div",[u.scrollbarFiller,u.gutterFiller,u.scroller],"CodeMirror");s&&a<8&&(u.gutters.style.zIndex=-1,u.scroller.style.paddingRight=0);w||hi&&hu||(u.scroller.draggable=!0);n&&(n.appendChild?n.appendChild(u.wrapper):n(u.wrapper));u.viewFrom=u.viewTo=t.first;u.reportedViewFrom=u.reportedViewTo=t.first;u.view=[];u.renderedView=null;u.externalMeasured=null;u.viewOffset=0;u.lastWrapHeight=u.lastWrapWidth=0;u.updateLineNumbers=null;u.nativeBarWidth=u.barHeight=u.barWidth=0;u.scrollbarsClipped=!1;u.lineNumWidth=u.lineNumInnerWidth=u.lineNumChars=null;u.alignWidgets=!1;u.cachedCharWidth=u.cachedTextHeight=u.cachedPaddingH=null;u.maxLine=null;u.maxLineLength=0;u.maxLineChanged=!1;u.wheelDX=u.wheelDY=u.wheelStartX=u.wheelStartY=null;u.shift=!1;u.selForContextMenu=null;u.activeTouch=null;r.init(u)}function rs(n){n.doc.mode=t.getMode(n.options,n.doc.modeOption);cu(n)}function cu(n){n.doc.iter(function(n){n.stateAfter&&(n.stateAfter=null);n.styles&&(n.styles=null)});n.doc.frontier=n.doc.first;bu(n,100);n.state.modeGen++;n.curOp&&tt(n)}function dw(n){n.options.lineWrapping?(su(n.display.wrapper,"CodeMirror-wrap"),n.display.sizer.style.minWidth="",n.display.sizerWidth=null):(ou(n.display.wrapper,"CodeMirror-wrap"),es(n));us(n);tt(n);du(n);setTimeout(function(){ar(n)},100)}function fl(n){var t=ki(n.display),i=n.options.lineWrapping,r=i&&Math.max(5,n.display.scroller.clientWidth/gu(n.display)-3);return function(u){var e,f;if(rr(n.doc,u))return 0;if(e=0,u.widgets)for(f=0;f<u.widgets.length;f++)u.widgets[f].height&&(e+=u.widgets[f].height);return i?e+(Math.ceil(u.text.length/r)||1)*t:e+t}}function us(n){var t=n.doc,i=fl(n);t.iter(function(n){var t=i(n);t!=n.height&&kt(n,t)})}function el(n){n.display.wrapper.className=n.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+n.options.theme.replace(/(^|\s)\s*/g," cm-s-");du(n)}function lu(n){ol(n);tt(n);setTimeout(function(){ls(n)},20)}function ol(n){var r=n.display.gutters,e=n.options.gutters,t,u,f;for(cr(r),t=0;t<e.length;++t)u=e[t],f=r.appendChild(i("div",null,"CodeMirror-gutter "+u)),u=="CodeMirror-linenumbers"&&(n.display.lineGutter=f,f.style.width=(n.display.lineNumWidth||1)+"px");r.style.display=t?"":"none";fs(n)}function fs(n){var t=n.display.gutters.offsetWidth;n.display.sizer.style.marginLeft=t+"px"}function fe(n){var r,u,i,t;if(n.height==0)return 0;for(r=n.text.length,i=n;u=ay(i);)t=u.find(0,!0),i=t.from.line,r+=t.from.ch-t.to.ch;for(i=n;u=af(i);)t=u.find(0,!0),r-=i.text.length-t.from.ch,i=t.to.line,r+=i.text.length-t.to.ch;return r}function es(n){var t=n.display,i=n.doc;t.maxLine=r(i,i.first);t.maxLineLength=fe(t.maxLine);t.maxLineChanged=!0;i.iter(function(n){var i=fe(n);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=n)})}function os(n){var t=g(n.gutters,"CodeMirror-linenumbers");t==-1&&n.lineNumbers?n.gutters=n.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!n.lineNumbers&&(n.gutters=n.gutters.slice(0),n.gutters.splice(t,1))}function au(n){var t=n.display,i=t.gutters.offsetWidth,r=Math.round(n.doc.height+uh(n.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:n.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+wt(n)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function ss(n,t,r){this.cm=r;var f=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n(f);n(e);u(f,"scroll",function(){f.clientHeight&&t(f.scrollTop,"vertical")});u(e,"scroll",function(){e.clientWidth&&t(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;s&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function hs(){}function sl(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&ou(n.display.wrapper,n.display.scrollbars.addClass));n.display.scrollbars=new t.scrollbarModel[n.options.scrollbarStyle](function(t){n.display.wrapper.insertBefore(t,n.display.scrollbarFiller);u(t,"mousedown",function(){n.state.focused&&setTimeout(function(){n.display.input.focus()},0)});t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?br(n,t):nf(n,t)},n);n.display.scrollbars.addClass&&su(n.display.wrapper,n.display.scrollbars.addClass)}function ar(n,t){var i,r,u;for(t||(t=au(n)),i=n.display.barWidth,r=n.display.barHeight,hl(n,t),u=0;u<4&&i!=n.display.barWidth||r!=n.display.barHeight;u++)i!=n.display.barWidth&&n.options.lineWrapping&&oe(n),hl(n,au(n)),i=n.display.barWidth,r=n.display.barHeight}function hl(n,t){var i=n.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px";i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px";i.heightForcer.style.borderBottom=r.bottom+"px solid transparent";r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="";r.bottom&&n.options.coverGutterNextToScrollbar&&n.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}function cs(n,t,i){var f=i&&i.top!=null?Math.max(0,i.top):n.scroller.scrollTop,o,s;f=Math.floor(f-ye(n));var h=i&&i.bottom!=null?i.bottom:f+n.wrapper.clientHeight,u=er(t,f),e=er(t,h);return i&&i.ensure&&(o=i.ensure.from.line,s=i.ensure.to.line,o<u?(u=o,e=er(t,si(r(t,o))+n.wrapper.clientHeight)):Math.min(s,t.lastLine())>=e&&(u=er(t,si(r(t,s))-n.wrapper.clientHeight),e=s)),{from:u,to:Math.max(e,u+1)}}function ls(n){var t=n.display,r=t.view,i,u,f;if(t.alignWidgets||t.gutters.firstChild&&n.options.fixedGutter){var e=vs(t)-t.scroller.scrollLeft+n.doc.scrollLeft,s=t.gutters.offsetWidth,o=e+"px";for(i=0;i<r.length;i++)if(!r[i].hidden&&(n.options.fixedGutter&&r[i].gutter&&(r[i].gutter.style.left=o),u=r[i].alignable,u))for(f=0;f<u.length;f++)u[f].style.left=o;n.options.fixedGutter&&(t.gutters.style.left=e+s+"px")}}function cl(n){if(!n.options.lineNumbers)return!1;var u=n.doc,r=as(n.options,u.first+u.size-1),t=n.display;if(r.length!=t.lineNumChars){var f=t.measure.appendChild(i("div",[i("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=f.firstChild.offsetWidth,o=f.offsetWidth-e;return t.lineGutter.style.width="",t.lineNumInnerWidth=Math.max(e,t.lineGutter.offsetWidth-o)+1,t.lineNumWidth=t.lineNumInnerWidth+o,t.lineNumChars=t.lineNumInnerWidth?r.length:-1,t.lineGutter.style.width=t.lineNumWidth+"px",fs(n),!0}return!1}function as(n,t){return String(n.lineNumberFormatter(t+n.firstLineNumber))}function vs(n){return n.scroller.getBoundingClientRect().left-n.sizer.getBoundingClientRect().left}function ee(n,t,i){var r=n.display;this.viewport=t;this.visible=cs(r,n.doc,t);this.editorIsHidden=!r.wrapper.offsetWidth;this.wrapperHeight=r.wrapper.clientHeight;this.wrapperWidth=r.wrapper.clientWidth;this.oldDisplayWidth=wi(n);this.force=i;this.dims=bs(n);this.events=[]}function gw(n){var t=n.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=wt(n)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=wt(n)+"px",t.scrollbarsClipped=!0)}function ys(n,t){var i=n.display,o=n.doc,h,s,e;if(t.editorIsHidden)return li(n),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&ov(n)==0)return!1;cl(n)&&(li(n),t.dims=bs(n));var c=o.first+o.size,u=Math.max(t.visible.from-n.options.viewportMargin,o.first),f=Math.min(c,t.visible.to+n.options.viewportMargin);return(i.viewFrom<u&&u-i.viewFrom<20&&(u=Math.max(o.first,i.viewFrom)),i.viewTo>f&&i.viewTo-f<20&&(f=Math.min(c,i.viewTo)),ci&&(u=gh(n.doc,u),f=yy(n.doc,f)),h=u!=i.viewFrom||f!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth,uk(n,u,f),i.viewOffset=si(r(n.doc,i.viewFrom)),n.display.mover.style.top=i.viewOffset+"px",s=ov(n),!h&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))?!1:(e=ni(),s>4&&(i.lineDiv.style.display="none"),nb(n,i.updateLineNumbers,t.dims),s>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,e&&ni()!=e&&e.offsetHeight&&e.focus(),cr(i.cursorDiv),cr(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,h&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,bu(n,400)),i.updateLineNumbers=null,!0)}function ll(n,t){for(var i=t.viewport,u,r=!0;;r=!1){if((!r||!n.options.lineWrapping||t.oldDisplayWidth==wi(n))&&(i&&i.top!=null&&(i={top:Math.min(n.doc.height+uh(n.display)-fh(n),i.top)}),t.visible=cs(n.display,n.doc,i),t.visible.from>=n.display.viewFrom&&t.visible.to<=n.display.viewTo))break;if(!ys(n,t))break;oe(n);u=au(n);wu(n);ar(n,u);ws(n,u)}t.signal(n,"update",n);(n.display.viewFrom!=n.display.reportedViewFrom||n.display.viewTo!=n.display.reportedViewTo)&&(t.signal(n,"viewportChange",n,n.display.viewFrom,n.display.viewTo),n.display.reportedViewFrom=n.display.viewFrom,n.display.reportedViewTo=n.display.viewTo)}function ps(n,t){var i=new ee(n,t),r;ys(n,i)&&(oe(n),ll(n,i),r=au(n),wu(n),ar(n,r),ws(n,r),i.finish())}function ws(n,t){n.display.sizer.style.minHeight=t.docHeight+"px";n.display.heightForcer.style.top=t.docHeight+"px";n.display.gutters.style.height=t.docHeight+n.display.barHeight+wt(n)+"px"}function oe(n){for(var r=n.display,c=r.lineDiv.offsetTop,t,i,e,o,h,f,u=0;u<r.view.length;u++)if((t=r.view[u],!t.hidden)&&(s&&a<8?(e=t.node.offsetTop+t.node.offsetHeight,i=e-c,c=e):(o=t.node.getBoundingClientRect(),i=o.bottom-o.top),h=t.line.height-i,i<2&&(i=ki(r)),(h>.001||h<-.001)&&(kt(t.line,i),al(t.line),t.rest)))for(f=0;f<t.rest.length;f++)al(t.rest[f])}function al(n){if(n.widgets)for(var t=0;t<n.widgets.length;++t)n.widgets[t].height=n.widgets[t].node.parentNode.offsetHeight}function bs(n){for(var i=n.display,u={},f={},e=i.gutters.clientLeft,t=i.gutters.firstChild,r=0;t;t=t.nextSibling,++r)u[n.options.gutters[r]]=t.offsetLeft+t.clientLeft+e,f[n.options.gutters[r]]=t.clientWidth;return{fixedPos:vs(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:u,gutterWidth:f,wrapperWidth:i.wrapper.clientWidth}}function nb(n,t,i){function c(t){var i=t.nextSibling;return w&&lt&&n.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var o=n.display,v=n.options.lineNumbers,s=o.lineDiv,u=s.firstChild,l=o.view,f=o.viewFrom,r,a,h,e=0;e<l.length;e++){if(r=l[e],!r.hidden)if(r.node&&r.node.parentNode==s){while(u!=r.node)u=c(u);h=v&&t!=null&&t<=f&&r.lineNumber;r.changes&&(g(r.changes,"gutter")>-1&&(h=!1),vl(n,r,f,i));h&&(cr(r.lineNumber),r.lineNumber.appendChild(document.createTextNode(as(n.options,f))));u=r.node.nextSibling}else a=ub(n,r,f,i),s.insertBefore(a,u);f+=r.size}while(u)u=c(u)}function vl(n,t,i,r){for(var u,f=0;f<t.changes.length;f++)u=t.changes[f],u=="text"?ib(n,t):u=="gutter"?pl(n,t,i,r):u=="class"?ks(t):u=="widget"&&rb(n,t,r);t.changes=null}function vu(n){return n.node==n.text&&(n.node=i("div",null,null,"position: relative"),n.text.parentNode&&n.text.parentNode.replaceChild(n.node,n.text),n.node.appendChild(n.text),s&&a<8&&(n.node.style.zIndex=2)),n.node}function tb(n){var t=n.bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass,r;t&&(t+=" CodeMirror-linebackground");n.background?t?n.background.className=t:(n.background.parentNode.removeChild(n.background),n.background=null):t&&(r=vu(n),n.background=r.insertBefore(i("div",null,t),r.firstChild))}function yl(n,t){var i=n.display.externalMeasured;return i&&i.line==t.line?(n.display.externalMeasured=null,t.measure=i.measure,i.built):up(n,t)}function ib(n,t){var r=t.text.className,i=yl(n,t);t.text==t.node&&(t.node=i.pre);t.text.parentNode.replaceChild(i.pre,t.text);t.text=i.pre;i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ks(t)):r&&(t.text.className=r)}function ks(n){tb(n);n.line.wrapClass?vu(n).className=n.line.wrapClass:n.node!=n.text&&(n.node.className="");var t=n.textClass?n.textClass+" "+(n.line.textClass||""):n.line.textClass;n.text.className=t||""}function pl(n,t,r,u){var f,o,e,h,s,c;if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=vu(t),t.gutterBackground=i("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(n.options.fixedGutter?u.fixedPos:-u.gutterTotalWidth)+"px; width: "+u.gutterTotalWidth+"px"),o.insertBefore(t.gutterBackground,t.text)),f=t.line.gutterMarkers,(n.options.lineNumbers||f)&&(o=vu(t),e=t.gutter=i("div",null,"CodeMirror-gutter-wrapper","left: "+(n.options.fixedGutter?u.fixedPos:-u.gutterTotalWidth)+"px"),n.display.input.setUneditable(e),o.insertBefore(e,t.text),t.line.gutterClass&&(e.className+=" "+t.line.gutterClass),!n.options.lineNumbers||f&&f["CodeMirror-linenumbers"]||(t.lineNumber=e.appendChild(i("div",as(n.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+u.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+n.display.lineNumInnerWidth+"px"))),f))for(h=0;h<n.options.gutters.length;++h)s=n.options.gutters[h],c=f.hasOwnProperty(s)&&f[s],c&&e.appendChild(i("div",[c],"CodeMirror-gutter-elt","left: "+u.gutterLeft[s]+"px; width: "+u.gutterWidth[s]+"px"))}function rb(n,t,i){var r,u;for(t.alignable&&(t.alignable=null),r=t.node.firstChild;r;r=u)u=r.nextSibling,r.className=="CodeMirror-linewidget"&&t.node.removeChild(r);wl(n,t,i)}function ub(n,t,i,r){var u=yl(n,t);return t.text=t.node=u.pre,u.bgClass&&(t.bgClass=u.bgClass),u.textClass&&(t.textClass=u.textClass),ks(t),pl(n,t,i,r),wl(n,t,r),t.node}function wl(n,t,i){if(bl(n,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)bl(n,t.rest[r],t,i,!1)}function bl(n,t,r,u,f){var h,s,c,e,o;if(t.widgets)for(h=vu(r),s=0,c=t.widgets;s<c.length;++s)e=c[s],o=i("div",[e.node],"CodeMirror-linewidget"),e.handleMouseEvents||o.setAttribute("cm-ignore-events","true"),fb(e,o,r,u),n.display.input.setUneditable(o),f&&e.above?h.insertBefore(o,r.gutter||r.text):h.appendChild(o),ut(e,"redraw")}function fb(n,t,i,r){if(n.noHScroll){(i.alignable||(i.alignable=[])).push(t);var u=r.wrapperWidth;t.style.left=r.fixedPos+"px";n.coverGutter||(u-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px");t.style.width=u+"px"}n.coverGutter&&(t.style.zIndex=5,t.style.position="relative",n.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ds(t){return n(t.line,t.ch)}function se(n,t){return e(n,t)<0?t:n}function he(n,t){return e(n,t)<0?n:t}function kl(n){n.state.focused||(n.display.input.focus(),vh(n))}function ce(t,i,u,f,e){var l=t.doc,o,b,w;t.display.shift=!1;f||(f=l.sel);var a=t.state.pasteIncoming||e=="paste",v=l.splitLines(i),s=null;if(a&&f.ranges.length>1)if(et&&et.join("\n")==i){if(f.ranges.length%et.length==0)for(s=[],o=0;o<et.length;o++)s.push(l.splitLines(et[o]))}else v.length==f.ranges.length&&(s=wo(v,function(n){return[n]}));for(o=f.ranges.length-1;o>=0;o--){var p=f.ranges[o],y=p.from(),c=p.to();p.empty()&&(u&&u>0?y=n(y.line,y.ch-u):t.state.overwrite&&!a&&(c=n(c.line,Math.min(r(l,c.line).text.length,c.ch+h(v).length))));b=t.curOp.updateInput;w={from:y,to:c,text:s?s[o%s.length]:v,origin:e||(a?"paste":t.state.cutIncoming?"cut":"+input")};kr(t.doc,w);ut(t,"inputRead",t,w)}i&&!a&&gl(t,i);gr(t);t.curOp.updateInput=b;t.curOp.typing=!0;t.state.pasteIncoming=t.state.cutIncoming=!1}function dl(n,t){var i=n.clipboardData&&n.clipboardData.getData("text/plain");if(i)return n.preventDefault(),t.isReadOnly()||t.options.disableInput||ot(t,function(){ce(t,i,0,null,"paste")}),!0}function gl(n,t){var e,u,i,f,o,s;if(n.options.electricChars&&n.options.smartIndent)for(e=n.doc.sel,u=e.ranges.length-1;u>=0;u--)if(i=e.ranges[u],!(i.head.ch>100)&&(!u||e.ranges[u-1].head.line!=i.head.line)){if(f=n.getModeAt(i.head),o=!1,f.electricChars){for(s=0;s<f.electricChars.length;s++)if(t.indexOf(f.electricChars.charAt(s))>-1){o=ff(n,i.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(r(n.doc,i.head.line).text.slice(0,i.head.ch))&&(o=ff(n,i.head.line,"smart"));o&&ut(n,"electricInput",n,i.head.line)}}function na(t){for(var f=[],e=[],u,r,i=0;i<t.doc.sel.ranges.length;i++)u=t.doc.sel.ranges[i].head.line,r={anchor:n(u,0),head:n(u+1,0)},e.push(r),f.push(t.getRange(r.anchor,r.head));return{text:f,ranges:e}}function ta(n){n.setAttribute("autocorrect","off");n.setAttribute("autocapitalize","off");n.setAttribute("spellcheck","false")}function gs(n){this.cm=n;this.prevInput="";this.pollingFast=!1;this.polling=new or;this.inaccurateSelection=!1;this.hasSelection=!1;this.composing=null}function ia(){var n=i("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=i("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return w?n.style.width="1000px":n.setAttribute("wrap","off"),lr&&(n.style.border="1px solid black"),ta(n),t}function nh(n){this.cm=n;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new or;this.gracePeriod=!1}function ra(n,t){var u=eh(n,t.line),s,i;if(!u||u.hidden)return null;var f=r(n.doc,t.line),h=wa(u,f,t.line),e=vt(f),o="left";return e&&(s=ts(e,t.ch),o=s%2?"right":"left"),i=da(h.map,t.ch,o),i.offset=i.collapse=="right"?i.end:i.start,i}function vr(n,t){return t&&(n.bad=!0),n}function le(t,i,r){var u,f,e;if(i==t.display.lineDiv){if(u=t.display.lineDiv.childNodes[r],!u)return vr(t.clipPos(n(t.display.viewTo-1)),!0);i=null;r=0}else for(u=i;;u=u.parentNode){if(!u||u==t.display.lineDiv)return null;if(u.parentNode&&u.parentNode==t.display.lineDiv)break}for(f=0;f<t.display.view.length;f++)if(e=t.display.view[f],e.node==u)return eb(e,i,r)}function eb(t,i,r){function b(i,r,u){for(var o,e,s,l,h,f=-1;f<(y?y.length:0);f++)for(o=f<0?w.map:y[f],e=0;e<o.length;e+=3)if(s=o[e+2],s==i||s==r)return l=c(f<0?t.line:t.rest[f]),h=o[e]+u,(u<0||s!=i)&&(h=o[e+(u?1:0)]),n(l,h)}var v=t.text.firstChild,a=!1,p,e,o,w,y,u,f,l,s;if(!i||!ko(v,i))return vr(n(c(t.line),0),!0);if(i==v&&(a=!0,i=v.childNodes[r],r=0,!i))return p=t.rest?h(t.rest):t.line,vr(n(c(p),p.text.length),a);for(e=i.nodeType==3?i:null,o=i,e||i.childNodes.length!=1||i.firstChild.nodeType!=3||(e=i.firstChild,r&&(r=e.nodeValue.length));o.parentNode!=v;)o=o.parentNode;if(w=t.measure,y=w.maps,u=b(e,o,r),u)return vr(u,a);for(f=o.nextSibling,s=e?e.nodeValue.length-r:0;f;f=f.nextSibling){if(u=b(f,f.firstChild,0),u)return vr(n(u.line,u.ch-s),a);s+=f.textContent.length}for(l=o.previousSibling,s=r;l;l=l.previousSibling){if(u=b(l,l.firstChild,-1),u)return vr(n(u.line,u.ch+s),a);s+=f.textContent.length}}function ob(t,i,r,u,f){function c(n){return function(t){return t.id==n}}function h(i){var r,a,v,y,l,p;if(i.nodeType==1){if(r=i.getAttribute("cm-text"),r!=null){r==""&&(r=i.textContent.replace(/\u200b/g,""));e+=r;return}if(a=i.getAttribute("cm-marker"),a){y=t.findMarks(n(u,0),n(f+1,0),c(+a));y.length&&(v=y[0].find())&&(e+=fr(t.doc,v.from,v.to).join(s));return}if(i.getAttribute("contenteditable")=="false")return;for(l=0;l<i.childNodes.length;l++)h(i.childNodes[l]);/^(pre|div|p)$/i.test(i.nodeName)&&(o=!0)}else if(i.nodeType==3){if(p=i.nodeValue,!p)return;o&&(e+=s,o=!1);e+=p}}for(var e="",o=!1,s=t.doc.lineSeparator();;){if(h(i),i==r)break;i=i.nextSibling}return e}function ti(n,t){this.ranges=n;this.primIndex=t}function l(n,t){this.anchor=n;this.head=t}function at(n,t){var h=n[t],i,u,r;for(n.sort(function(n,t){return e(n.from(),t.from())}),t=g(n,h),i=1;i<n.length;i++)if(u=n[i],r=n[i-1],e(r.to(),u.from())>=0){var f=he(r.from(),u.from()),o=se(r.to(),u.to()),s=r.empty()?u.from()==u.head:r.from()==r.head;i<=t&&--t;n.splice(--i,2,new l(s?o:f,s?f:o))}return new ti(n,t)}function ii(n,t){return new ti([new l(n,t||n)],0)}function ua(n,t){return Math.max(n.first,Math.min(t,n.first+n.size-1))}function o(t,i){if(i.line<t.first)return n(t.first,0);var u=t.first+t.size-1;return i.line>u?n(u,r(t,u).text.length):sb(i,r(t,i.line).text.length)}function sb(t,i){var r=t.ch;return r==null||r>i?n(t.line,i):r<0?n(t.line,0):t}function yu(n,t){return t>=n.first&&t<n.first+n.size}function fa(n,t){for(var r=[],i=0;i<t.length;i++)r[i]=o(n,t[i]);return r}function pu(n,t,i,r){var u,f;return n.cm&&n.cm.display.shift||n.extend?(u=t.anchor,r&&(f=e(i,u)<0,f!=e(r,u)<0?(u=i,i=r):f!=e(i,r)<0&&(i=r)),new l(u,i)):new l(r||i,i)}function ae(n,t,i,r){b(n,new ti([pu(n,n.sel.primary(),t,i)],0),r)}function ea(n,t,i){for(var f,u=[],r=0;r<n.sel.ranges.length;r++)u[r]=pu(n,n.sel.ranges[r],t[r],null);f=at(u,n.sel.primIndex);b(n,f,i)}function th(n,t,i,r){var u=n.sel.ranges.slice(0);u[t]=i;b(n,at(u,n.sel.primIndex),r)}function oa(n,t,i,r){b(n,ii(t,i),r)}function hb(n,t,i){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var i=0;i<t.length;i++)this.ranges[i]=new l(o(n,t[i].anchor),o(n,t[i].head))},origin:i&&i.origin};return y(n,"beforeSelectionChange",n,r),n.cm&&y(n.cm,"beforeSelectionChange",n.cm,r),r.ranges!=t.ranges?at(r.ranges,r.ranges.length-1):t}function sa(n,t,i){var r=n.history.done,u=h(r);u&&u.ranges?(r[r.length-1]=t,ve(n,t,i)):b(n,t,i)}function b(n,t,i){ve(n,t,i);fg(n,n.sel,n.cm?n.cm.curOp.id:NaN,i)}function ve(n,t,i){(ht(n,"beforeSelectionChange")||n.cm&&ht(n.cm,"beforeSelectionChange"))&&(t=hb(n,t,i));var r=i&&i.bias||(e(t.primary().head,n.sel.primary().head)<0?-1:1);ha(n,la(n,t,r,!0));i&&i.scroll===!1||!n.cm||gr(n.cm)}function ha(n,t){t.equals(n.sel)||(n.sel=t,n.cm&&(n.cm.curOp.updateInput=n.cm.curOp.selectionChanged=!0,kp(n.cm)),ut(n,"cursorActivity",n))}function ca(n){ha(n,la(n,n.sel,null,!1),gt)}function la(n,t,i,r){for(var f,u=0;u<t.ranges.length;u++){var e=t.ranges[u],o=t.ranges.length==n.sel.ranges.length&&n.sel.ranges[u],s=ih(n,e.anchor,o&&o.anchor,i,r),h=ih(n,e.head,o&&o.head,i,r);(f||s!=e.anchor||h!=e.head)&&(f||(f=t.ranges.slice(0,u)),f[u]=new l(s,h))}return f?at(f,t.primIndex):t}function yr(n,t,i,u,f){var c=r(n,t.line),a,h,o,s,v,l;if(c.markedSpans)for(a=0;a<c.markedSpans.length;++a)if(h=c.markedSpans[a],o=h.marker,(h.from==null||(o.inclusiveLeft?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(o.inclusiveRight?h.to>=t.ch:h.to>t.ch))){if(f&&(y(o,"beforeCursorEnter"),o.explicitlyCleared))if(c.markedSpans){--a;continue}else break;if(!o.atomic)continue;return i&&(s=o.find(u<0?1:-1),(u<0?o.inclusiveRight:o.inclusiveLeft)&&(s=aa(n,s,-u,s&&s.line==t.line?c:null)),s&&s.line==t.line&&(v=e(s,i))&&(u<0?v<0:v>0))?yr(n,s,t,u,f):(l=o.find(u<0?-1:1),(u<0?o.inclusiveLeft:o.inclusiveRight)&&(l=aa(n,l,u,l.line==t.line?c:null)),l?yr(n,l,t,u,f):null)}return t}function ih(t,i,r,u,f){var e=u||1,o=yr(t,i,r,e,f)||!f&&yr(t,i,r,e,!0)||yr(t,i,r,-e,f)||!f&&yr(t,i,r,-e,!0);return o?o:(t.cantEdit=!0,n(t.first,0))}function aa(t,i,u,f){return u<0&&i.ch==0?i.line>t.first?o(t,n(i.line-1)):null:u>0&&i.ch==(f||r(t,i.line)).text.length?i.line<t.first+t.size-1?n(i.line+1,0):null:new n(i.line,i.ch+u)}function wu(n){n.display.input.showSelection(n.display.input.prepareSelection())}function va(n,t){for(var u=n.doc,f={},o=f.cursors=document.createDocumentFragment(),s=f.selection=document.createDocumentFragment(),i,e,r=0;r<u.sel.ranges.length;r++)(t!==!1||r!=u.sel.primIndex)&&((i=u.sel.ranges[r],i.from().line>=n.display.viewTo||i.to().line<n.display.viewFrom)||(e=i.empty(),(e||n.options.showCursorWhenSelecting)&&ya(n,i.head,o),e||cb(n,i,s)));return f}function ya(n,t,r){var u=ri(n,t,"div",null,null,!n.options.singleCursorHeightPerLine),e=r.appendChild(i("div"," ","CodeMirror-cursor")),f;e.style.left=u.left+"px";e.style.top=u.top+"px";e.style.height=Math.max(0,u.bottom-u.top)*n.options.cursorHeight+"px";u.other&&(f=r.appendChild(i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor")),f.style.display="",f.style.left=u.other.left+"px",f.style.top=u.other.top+"px",f.style.height=(u.other.bottom-u.other.top)*.85+"px")}function cb(t,u,f){function o(n,t,r,u){t<0&&(t=0);t=Math.round(t);u=Math.round(u);w.appendChild(i("div",null,"CodeMirror-selected","position: absolute; left: "+n+"px; top: "+t+"px; width: "+(r==null?k-n:r)+"px; height: "+(u-t)+"px"))}function v(i,u,f){function v(r,u){return hh(t,n(i,r),"div",c,u)}var c=r(a,i),l=c.text.length,e,s;return wg(vt(c),u||0,f==null?l:f,function(n,t,i){var r=v(n,"left"),c,a,y,p;n==t?(c=r,a=y=r.left):(c=v(t-1,"right"),i=="rtl"&&(p=r,r=c,c=p),a=r.left,y=c.right);u==null&&n==0&&(a=h);c.top-r.top>3&&(o(a,r.top,null,r.bottom),a=h,r.bottom<c.top&&o(a,r.bottom,null,c.top));f==null&&t==l&&(y=k);(!e||r.top<e.top||r.top==e.top&&r.left<e.left)&&(e=r);(!s||c.bottom>s.bottom||c.bottom==s.bottom&&c.right>s.right)&&(s=c);a<h+1&&(a=h);o(a,c.top,y-a,c.bottom)}),{start:e,end:s}}var p=t.display,a=t.doc,w=document.createDocumentFragment(),b=pa(t.display),h=b.left,k=Math.max(p.sizerWidth,wi(t)-p.sizer.offsetLeft)-b.right,c=u.from(),l=u.to();if(c.line==l.line)v(c.line,c.ch,l.ch);else{var d=r(a,c.line),g=r(a,l.line),y=bt(d)==bt(g),e=v(c.line,c.ch,y?d.text.length+1:null).end,s=v(l.line,y?0:null,l.ch).start;y&&(e.top<s.top-2?(o(e.right,e.top,null,e.bottom),o(h,s.top,s.left,s.bottom)):o(e.right,e.top,s.left-e.right,e.bottom));e.bottom<s.top&&o(h,e.bottom,null,s.top)}f.appendChild(w)}function rh(n){var t,i;n.state.focused&&(t=n.display,clearInterval(t.blinker),i=!0,t.cursorDiv.style.visibility="",n.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},n.options.cursorBlinkRate):n.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function bu(n,t){n.doc.mode.startState&&n.doc.frontier<n.display.viewTo&&n.state.highlight.set(t,te(lb,n))}function lb(n){var t=n.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=n.display.viewTo)){var u=+new Date+n.options.workTime,i=ei(t.mode,ku(n,t.frontier)),r=[];t.iter(t.frontier,Math.min(t.first+t.size,n.display.viewTo+500),function(f){var o,e,c,s;if(t.frontier>=n.display.viewFrom){var h=f.styles,l=f.text.length>n.options.maxHighlightLength,a=gy(n,f,l?ei(t.mode,i):i,!0);for(f.styles=a.styles,o=f.styleClasses,e=a.classes,e?f.styleClasses=e:o&&(f.styleClasses=null),c=!h||h.length!=f.styles.length||o!=e&&(!o||!e||o.bgClass!=e.bgClass||o.textClass!=e.textClass),s=0;!c&&s<h.length;++s)c=h[s]!=f.styles[s];c&&r.push(t.frontier);f.stateAfter=l?i:ei(t.mode,i)}else f.text.length<=n.options.maxHighlightLength&&ic(n,f.text,i),f.stateAfter=t.frontier%5==0?ei(t.mode,i):null;return++t.frontier,+new Date>u?(bu(n,n.options.workDelay),!0):void 0});r.length&&ot(n,function(){for(var t=0;t<r.length;t++)ui(n,r[t],"text")})}}function ab(n,t,i){for(var h,e,f=n.doc,c=i?-1:t-(n.doc.mode.innerMode?1e3:100),o,s,u=t;u>c;--u){if(u<=f.first)return f.first;if(o=r(f,u-1),o.stateAfter&&(!i||u<=f.frontier))return u;s=yt(o.text,null,n.options.tabSize);(e==null||h>s)&&(e=u-1,h=s)}return e}function ku(n,t,i){var f=n.doc,o=n.display,u,e;return f.mode.startState?(u=ab(n,t,i),e=u>f.first&&r(f,u-1).stateAfter,e=e?ei(f.mode,e):uy(f.mode),f.iter(u,t,function(i){ic(n,i.text,e);var r=u==t-1||u%5==0||u>=o.viewFrom&&u<o.viewTo;i.stateAfter=r?ei(f.mode,e):null;++u}),i&&(f.frontier=u),e):!0}function ye(n){return n.lineSpace.offsetTop}function uh(n){return n.mover.offsetHeight-n.lineSpace.offsetHeight}function pa(n){if(n.cachedPaddingH)return n.cachedPaddingH;var r=st(n.measure,i("pre","x")),u=window.getComputedStyle?window.getComputedStyle(r):r.currentStyle,t={left:parseInt(u.paddingLeft),right:parseInt(u.paddingRight)};return isNaN(t.left)||isNaN(t.right)||(n.cachedPaddingH=t),t}function wt(n){return dp-n.display.nativeBarWidth}function wi(n){return n.display.scroller.clientWidth-wt(n)-n.display.barWidth}function fh(n){return n.display.scroller.clientHeight-wt(n)-n.display.barHeight}function vb(n,t,i){var f=n.options.lineWrapping,h=f&&wi(n),e,u,r,o,s;if(!t.measure.heights||f&&t.measure.width!=h){if(e=t.measure.heights=[],f)for(t.measure.width=h,u=t.text.firstChild.getClientRects(),r=0;r<u.length-1;r++)o=u[r],s=u[r+1],Math.abs(o.bottom-s.bottom)>2&&e.push((o.bottom+s.top)/2-i.top);e.push(i.bottom-i.top)}}function wa(n,t,i){var r;if(n.line==t)return{map:n.measure.map,cache:n.measure.cache};for(r=0;r<n.rest.length;r++)if(n.rest[r]==t)return{map:n.measure.maps[r],cache:n.measure.caches[r]};for(r=0;r<n.rest.length;r++)if(c(n.rest[r])>i)return{map:n.measure.maps[r],cache:n.measure.caches[r],before:!0}}function yb(n,t){var r,i,u;return t=bt(t),r=c(t),i=n.display.externalMeasured=new ev(n.doc,t,r),i.lineN=r,u=i.built=up(n,i),i.text=u.pre,st(n.display.lineMeasure,u.pre),i}function ba(n,t,i,r){return ka(n,oh(n,t),i,r)}function eh(n,t){if(t>=n.display.viewFrom&&t<n.display.viewTo)return n.display.view[gi(n,t)];var i=n.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function oh(n,t){var u=c(t),i=eh(n,u),r;return i&&!i.text?i=null:i&&i.changes&&(vl(n,i,u,bs(n)),n.curOp.forceUpdate=!0),i||(i=yb(n,t)),r=wa(i,t,u),{line:t,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function ka(n,t,i,r,u){t.before&&(i=-1);var e=i+(r||""),f;return t.cache.hasOwnProperty(e)?f=t.cache[e]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(vb(n,t.view,t.rect),t.hasHeights=!0),f=pb(n,t,i,r),f.bogus||(t.cache[e]=f)),{left:f.left,right:f.right,top:u?f.rtop:f.top,bottom:u?f.rbottom:f.bottom}}function da(n,t,i){for(var s,u,h,o,e,f,r=0;r<n.length;r+=3)if(e=n[r],f=n[r+1],t<e?(u=0,h=1,o="left"):t<f?(u=t-e,h=u+1):(r==n.length-3||t==f&&n[r+3]>t)&&(h=f-e,u=h-1,t>=f&&(o="right")),u!=null){if(s=n[r+2],e==f&&i==(s.insertLeft?"left":"right")&&(o=i),i=="left"&&u==0)while(r&&n[r-2]==n[r-3]&&n[r-1].insertLeft)s=n[(r-=3)+2],o="left";if(i=="right"&&u==f-e)while(r<n.length-3&&n[r+3]==n[r+4]&&!n[r+5].insertLeft)s=n[(r+=3)+2],o="right";break}return{node:s,start:u,end:h,collapse:o,coverStart:e,coverEnd:f}}function pb(n,t,i,r){var o=da(t.map,i,r),h=o.node,f=o.start,c=o.end,y=o.collapse,u,l,v,e;if(h.nodeType==3){for(e=0;e<4;e++){while(f&&ie(t.line.text.charAt(o.coverStart+f)))--f;while(o.coverStart+c<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+c)))++c;if(s&&a<9&&f==0&&c==o.coverEnd-o.coverStart?u=h.parentNode.getBoundingClientRect():s&&n.options.lineWrapping?(l=hr(h,f,c).getClientRects(),u=l.length?l[r=="right"?l.length-1:0]:pe):u=hr(h,f,c).getBoundingClientRect()||pe,u.left||u.right||f==0)break;c=f;f=f-1;y="right"}s&&a<11&&(u=wb(n.display.measure,u))}else f>0&&(y=r="right"),u=n.options.lineWrapping&&(l=h.getClientRects()).length>1?l[r=="right"?l.length-1:0]:h.getBoundingClientRect();s&&a<9&&!f&&(!u||!u.left&&!u.right)&&(v=h.parentNode.getClientRects()[0],u=v?{left:v.left,right:v.left+gu(n.display),top:v.top,bottom:v.bottom}:pe);var b=u.top-t.rect.top,k=u.bottom-t.rect.top,d=(b+k)/2,p=t.view.measure.heights;for(e=0;e<p.length-1;e++)if(d<p[e])break;var g=e?p[e-1]:0,nt=p[e],w={left:(y=="right"?u.right:u.left)-t.rect.left,right:(y=="left"?u.left:u.right)-t.rect.left,top:g,bottom:nt};return u.left||u.right||(w.bogus=!0),n.options.singleCursorHeightPerLine||(w.rtop=b,w.rbottom=k),w}function wb(n,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!pg(n))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function ga(n){if(n.measure&&(n.measure.cache={},n.measure.heights=null,n.rest))for(var t=0;t<n.rest.length;t++)n.measure.caches[t]={}}function nv(n){n.display.externalMeasure=null;cr(n.display.lineMeasure);for(var t=0;t<n.display.view.length;t++)ga(n.display.view[t])}function du(n){nv(n);n.display.cachedCharWidth=n.display.cachedTextHeight=n.display.cachedPaddingH=null;n.options.lineWrapping||(n.display.maxLineChanged=!0);n.display.lineNumChars=null}function tv(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function iv(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function sh(n,t,i,r){var f,e,u,o,s;if(t.widgets)for(f=0;f<t.widgets.length;++f)t.widgets[f].above&&(e=yf(t.widgets[f]),i.top+=e,i.bottom+=e);return r=="line"?i:(r||(r="local"),u=si(t),r=="local"?u+=ye(n.display):u-=n.display.viewOffset,(r=="page"||r=="window")&&(o=n.display.lineSpace.getBoundingClientRect(),u+=o.top+(r=="window"?0:iv()),s=o.left+(r=="window"?0:tv()),i.left+=s,i.right+=s),i.top+=u,i.bottom+=u,i)}function rv(n,t,i){var r,u,f,e;return i=="div"?t:(r=t.left,u=t.top,i=="page"?(r-=tv(),u-=iv()):i!="local"&&i||(f=n.display.sizer.getBoundingClientRect(),r+=f.left,u+=f.top),e=n.display.lineSpace.getBoundingClientRect(),{left:r-e.left,top:u-e.top})}function hh(n,t,i,u,f){return u||(u=r(n.doc,t.line)),sh(n,u,ba(n,u,t.ch,f),i)}function ri(n,t,i,u,f,e){function h(t,r){var o=ka(n,f,t,r?"right":"left",e);return r?o.left=o.right:o.right=o.left,sh(n,u,o,i)}function l(n,t){var i=o[t],r=i.level%2;return(n==wc(i)&&t&&i.level<o[t-1].level?(i=o[--t],n=bc(i)-(i.level%2?0:1),r=!0):n==bc(i)&&t<o.length-1&&i.level<o[t+1].level&&(i=o[++t],n=wc(i)-i.level%2,r=!1),r&&n==i.to&&n>i.from)?h(n-1):h(n,r)}var o,s,a,c;return(u=u||r(n.doc,t.line),f||(f=oh(n,u)),o=vt(u),s=t.ch,!o)?h(s):(a=ts(o,s),c=l(s,a),ue!=null&&(c.other=l(s,ue)),c)}function uv(n,t){var i=0,t=o(n.doc,t),u,f;return n.options.lineWrapping||(i=gu(n.display)*t.ch),u=r(n.doc,t.line),f=si(u)+ye(n.display),{left:i,right:i,top:f,bottom:f+u.height}}function we(t,i,r,u){var f=n(t,i);return f.xRel=u,r&&(f.outside=!0),f}function ch(n,t,i){var u=n.doc,f,s,e;if(i+=n.display.viewOffset,i<0)return we(u.first,0,!0,-1);if(f=er(u,i),s=u.first+u.size-1,f>s)return we(u.first+u.size-1,r(u,s).text.length,!0,1);for(t<0&&(t=0),e=r(u,f);;){var o=bb(n,e,f,t,i),h=af(e),l=h&&h.find(0,!0);if(h&&(o.ch>l.from.ch||o.ch==l.from.ch&&o.xRel>0))f=c(e=l.to.line);else return o}}function bb(t,i,r,u,f){function p(u){var f=ri(t,n(r,u),"line",i,rt);return(h=!0,g>f.bottom)?f.left-nt:g<f.top?f.left+nt:(h=!1,f.left)}var g=f-si(i),h=!1,nt=2*t.display.wrapper.clientWidth,rt=oh(t,i),tt=vt(i),w=i.text.length,e=go(i),o=ns(i),v=p(e),it=h,l=p(o),b=h,c,k,a,s,d,y;if(u>l)return we(r,o,b,1);for(;;){if(tt?o==e||o==dc(i,e,1):o-e<=1){for(c=u<v||u-v<=l-u?e:o,k=u-(c==e?v:l);ie(i.text.charAt(c));)++c;return we(r,c,c==e?it:b,k<-1?-1:k>1?1:0)}if(a=Math.ceil(w/2),s=e+a,tt)for(s=e,d=0;d<a;++d)s=dc(i,s,1);y=p(s);y>u?(o=s,l=y,(b=h)&&(l+=1e3),w=a):(e=s,v=y,it=h,w-=a)}}function ki(n){var r,t;if(n.cachedTextHeight!=null)return n.cachedTextHeight;if(bi==null){for(bi=i("pre"),r=0;r<49;++r)bi.appendChild(document.createTextNode("x")),bi.appendChild(i("br"));bi.appendChild(document.createTextNode("x"))}return st(n.measure,bi),t=bi.offsetHeight/50,t>3&&(n.cachedTextHeight=t),cr(n.measure),t||1}function gu(n){var r,f,u,t;return n.cachedCharWidth!=null?n.cachedCharWidth:(r=i("span","xxxxxxxxxx"),f=i("pre",[r]),st(n.measure,f),u=r.getBoundingClientRect(),t=(u.right-u.left)/10,t>2&&(n.cachedCharWidth=t),t||10)}function pr(n){n.curOp={cm:n,viewChanged:!1,startHeight:n.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++fv};di?di.ops.push(n.curOp):n.curOp.ownsGroup=di={ops:[n.curOp],delayedCallbacks:[]}}function kb(n){var u=n.delayedCallbacks,i=0,r,t;do{for(;i<u.length;i++)u[i].call(null);for(r=0;r<n.ops.length;r++)if(t=n.ops[r],t.cursorActivityHandlers)while(t.cursorActivityCalled<t.cursorActivityHandlers.length)t.cursorActivityHandlers[t.cursorActivityCalled++].call(null,t.cm)}while(i<u.length)}function wr(n){var r=n.curOp,t=r.ownsGroup,i;if(t)try{kb(t)}finally{for(di=null,i=0;i<t.ops.length;i++)t.ops[i].cm.curOp=null;db(t)}}function db(n){for(var i=n.ops,t=0;t<i.length;t++)gb(i[t]);for(t=0;t<i.length;t++)nk(i[t]);for(t=0;t<i.length;t++)tk(i[t]);for(t=0;t<i.length;t++)ik(i[t]);for(t=0;t<i.length;t++)rk(i[t])}function gb(n){var t=n.cm,i=t.display;gw(t);n.updateMaxLine&&es(t);n.mustUpdate=n.viewChanged||n.forceUpdate||n.scrollTop!=null||n.scrollToPos&&(n.scrollToPos.from.line<i.viewFrom||n.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping;n.update=n.mustUpdate&&new ee(t,n.mustUpdate&&{top:n.scrollTop,ensure:n.scrollToPos},n.forceUpdate)}function nk(n){n.updatedDisplay=n.mustUpdate&&ys(n.cm,n.update)}function tk(n){var t=n.cm,i=t.display;n.updatedDisplay&&oe(t);n.barMeasure=au(t);i.maxLineChanged&&!t.options.lineWrapping&&(n.adjustWidthTo=ba(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=n.adjustWidthTo,n.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+n.adjustWidthTo+wt(t)+t.display.barWidth),n.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+n.adjustWidthTo-wi(t)));(n.updatedDisplay||n.selectionChanged)&&(n.preparedSelection=i.input.prepareSelection())}function ik(n){var t=n.cm;n.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=n.adjustWidthTo+"px",n.maxScrollLeft<t.doc.scrollLeft&&br(t,Math.min(t.display.scroller.scrollLeft,n.maxScrollLeft),!0),t.display.maxLineChanged=!1);n.preparedSelection&&t.display.input.showSelection(n.preparedSelection);(n.updatedDisplay||n.startHeight!=t.doc.height)&&ar(t,n.barMeasure);n.updatedDisplay&&ws(t,n.barMeasure);n.selectionChanged&&rh(t);t.state.focused&&n.updateInput&&t.display.input.reset(n.typing);n.focus&&n.focus==ni()&&(!document.hasFocus||document.hasFocus())&&kl(n.cm)}function rk(n){var r=n.cm,t=r.display,u=r.doc,s,f,e,i;if(n.updatedDisplay&&ll(r,n.update),t.wheelStartX!=null&&(n.scrollTop!=null||n.scrollLeft!=null||n.scrollToPos)&&(t.wheelStartX=t.wheelStartY=null),n.scrollTop!=null&&(t.scroller.scrollTop!=n.scrollTop||n.forceScroll)&&(u.scrollTop=Math.max(0,Math.min(t.scroller.scrollHeight-t.scroller.clientHeight,n.scrollTop)),t.scrollbars.setScrollTop(u.scrollTop),t.scroller.scrollTop=u.scrollTop),n.scrollLeft!=null&&(t.scroller.scrollLeft!=n.scrollLeft||n.forceScroll)&&(u.scrollLeft=Math.max(0,Math.min(t.scroller.scrollWidth-t.scroller.clientWidth,n.scrollLeft)),t.scrollbars.setScrollLeft(u.scrollLeft),t.scroller.scrollLeft=u.scrollLeft,ls(r)),n.scrollToPos&&(s=id(r,o(u,n.scrollToPos.from),o(u,n.scrollToPos.to),n.scrollToPos.margin),n.scrollToPos.isCursor&&r.state.focused&&td(r,s)),f=n.maybeHiddenMarkers,e=n.maybeUnhiddenMarkers,f)for(i=0;i<f.length;++i)f[i].lines.length||y(f[i],"hide");if(e)for(i=0;i<e.length;++i)e[i].lines.length&&y(e[i],"unhide");t.wrapper.offsetHeight&&(u.scrollTop=r.display.scroller.scrollTop);n.changeObjs&&y(r,"changes",r,n.changeObjs);n.update&&n.update.finish()}function ot(n,t){if(n.curOp)return t();pr(n);try{return t()}finally{wr(n)}}function v(n,t){return function(){if(n.curOp)return t.apply(n,arguments);pr(n);try{return t.apply(n,arguments)}finally{wr(n)}}}function k(n){return function(){if(this.curOp)return n.apply(this,arguments);pr(this);try{return n.apply(this,arguments)}finally{wr(this)}}}function nt(n){return function(){var t=this.cm;if(!t||t.curOp)return n.apply(this,arguments);pr(t);try{return n.apply(this,arguments)}finally{wr(t)}}}function ev(n,t,i){this.line=t;this.rest=pd(t);this.size=this.rest?c(h(this.rest))-i+1:1;this.node=this.text=null;this.hidden=rr(n,t)}function be(n,t,i){for(var e=[],o,f,u=t;u<i;u=o)f=new ev(n.doc,r(n.doc,u),u),o=u+f.size,e.push(f);return e}function tt(n,t,i,r){var u,f,o,s,e;t==null&&(t=n.doc.first);i==null&&(i=n.doc.first+n.doc.size);r||(r=0);u=n.display;r&&i<u.viewTo&&(u.updateLineNumbers==null||u.updateLineNumbers>t)&&(u.updateLineNumbers=t);n.curOp.viewChanged=!0;t>=u.viewTo?ci&&gh(n.doc,t)<u.viewTo&&li(n):i<=u.viewFrom?ci&&yy(n.doc,i+r)>u.viewFrom?li(n):(u.viewFrom+=r,u.viewTo+=r):t<=u.viewFrom&&i>=u.viewTo?li(n):t<=u.viewFrom?(f=ke(n,i,i+r,1),f?(u.view=u.view.slice(f.index),u.viewFrom=f.lineN,u.viewTo+=r):li(n)):i>=u.viewTo?(f=ke(n,t,t,-1),f?(u.view=u.view.slice(0,f.index),u.viewTo=f.lineN):li(n)):(o=ke(n,t,t,-1),s=ke(n,i,i+r,1),o&&s?(u.view=u.view.slice(0,o.index).concat(be(n,o.lineN,s.lineN)).concat(u.view.slice(s.index)),u.viewTo+=r):li(n));e=u.externalMeasured;e&&(i<e.lineN?e.lineN+=r:t<e.lineN+e.size&&(u.externalMeasured=null))}function ui(n,t,i){var r,u,f,e;(n.curOp.viewChanged=!0,r=n.display,u=n.display.externalMeasured,u&&t>=u.lineN&&t<u.lineN+u.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)||(f=r.view[gi(n,t)],f.node!=null)&&(e=f.changes||(f.changes=[]),g(e,i)==-1&&e.push(i))}function li(n){n.display.viewFrom=n.display.viewTo=n.doc.first;n.display.view=[];n.display.viewOffset=0}function gi(n,t){var r,i;if(t>=n.display.viewTo||(t-=n.display.viewFrom,t<0))return null;for(r=n.display.view,i=0;i<r.length;i++)if(t-=r[i].size,t<0)return i}function ke(n,t,i,r){var u=gi(n,t),o,f=n.display.view,s,e;if(!ci||i==n.doc.first+n.doc.size)return{index:u,lineN:i};for(s=0,e=n.display.viewFrom;s<u;s++)e+=f[s].size;if(e!=t){if(r>0){if(u==f.length-1)return null;o=e+f[u].size-t;u++}else o=e-t;t+=o;i+=o}while(gh(n.doc,i)!=i){if(u==(r<0?0:f.length-1))return null;i+=r*f[u-(r<0?1:0)].size;u+=r}return{index:u,lineN:i}}function uk(n,t,i){var r=n.display,u=r.view;u.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=be(n,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=be(n,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(gi(n,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(be(n,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,gi(n,i))));r.viewTo=i}function ov(n){for(var r=n.display.view,u=0,i,t=0;t<r.length;t++)i=r[t],i.hidden||i.node&&!i.changes||++u;return u}function fk(t){function h(){i.activeTouch&&(e=setTimeout(function(){i.activeTouch=null},1e3),f=i.activeTouch,f.end=+new Date)}function w(n){if(n.touches.length!=1)return!1;var t=n.touches[0];return t.radiusX<=1&&t.radiusY<=1}function c(n,t){if(t.left==null)return!0;var i=t.left-n.left,r=t.top-n.top;return i*i+r*r>400}var i=t.display,e,f,r;u(i.scroller,"mousedown",v(t,sk));s&&a<11?u(i.scroller,"dblclick",v(t,function(n){var i,r;p(t,n)||(i=nr(t,n),!i||hv(t,n)||fi(t.display,n))||(d(n),r=t.findWordAt(i),ae(t.doc,r.anchor,r.head))})):u(i.scroller,"dblclick",function(n){p(t,n)||d(n)});is||u(i.scroller,"contextmenu",function(n){bv(t,n)});f={end:0};u(i.scroller,"touchstart",function(n){if(!p(t,n)&&!w(n)){clearTimeout(e);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-f.end<=300?f:null};n.touches.length==1&&(i.activeTouch.left=n.touches[0].pageX,i.activeTouch.top=n.touches[0].pageY)}});u(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)});u(i.scroller,"touchend",function(r){var u=i.activeTouch,f,e;u&&!fi(i,r)&&u.left!=null&&!u.moved&&new Date-u.start<300&&(f=t.coordsChar(i.activeTouch,"page"),e=!u.prev||c(u,u.prev)?new l(f,f):!u.prev.prev||c(u,u.prev.prev)?t.findWordAt(f):new l(n(f.line,0),o(t.doc,n(f.line+1,0))),t.setSelection(e.anchor,e.head),t.focus(),d(r));h()});u(i.scroller,"touchcancel",h);u(i.scroller,"scroll",function(){i.scroller.clientHeight&&(nf(t,i.scroller.scrollTop),br(t,i.scroller.scrollLeft,!0),y(t,"scroll",t))});u(i.scroller,"mousewheel",function(n){lv(t,n)});u(i.scroller,"DOMMouseScroll",function(n){lv(t,n)});u(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0});i.dragFunctions={enter:function(n){p(t,n)||kf(n)},over:function(n){p(t,n)||(yk(t,n),kf(n))},start:function(n){vk(t,n)},drop:v(t,ak),leave:function(n){p(t,n)||cv(t)}};r=i.input.getField();u(r,"keyup",function(n){pv.call(t,n)});u(r,"keydown",v(t,yv));u(r,"keypress",v(t,wv));u(r,"focus",te(vh,t));u(r,"blur",te(rf,t))}function ek(n,i,r){var o=r&&r!=t.Init,f,e;!i!=!o&&(f=n.display.dragFunctions,e=i?u:dt,e(n.display.scroller,"dragstart",f.start),e(n.display.scroller,"dragenter",f.enter),e(n.display.scroller,"dragover",f.over),e(n.display.scroller,"dragleave",f.leave),e(n.display.scroller,"drop",f.drop))}function ok(n){var t=n.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,n.setSize())}function fi(n,t){for(var i=oc(t);i!=n.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==n.sizer&&i!=n.mover)return!0}function nr(t,i,u,f){var a=t.display,s,c,h,e,o,l;if(!u&&oc(i).getAttribute("cm-not-content")=="true")return null;h=a.lineSpace.getBoundingClientRect();try{s=i.clientX-h.left;c=i.clientY-h.top}catch(i){return null}return e=ch(t,s,c),f&&e.xRel==1&&(o=r(t.doc,e.line).text).length==e.ch&&(l=yt(o,o.length,t.options.tabSize)-o.length,e=n(e.line,Math.max(0,Math.round((s-pa(t.display).left)/gu(t.display))-l))),e}function sk(n){var t=this,i=t.display,r;if(!p(t,n)&&(!i.activeTouch||!i.input.supportsTouch())){if(i.shift=n.shiftKey,fi(i,n)){w||(i.scroller.draggable=!1,setTimeout(function(){i.scroller.draggable=!0},100));return}if(!hv(t,n)){r=nr(t,n);window.focus();switch(bp(n)){case 1:t.state.selectingText?t.state.selectingText(n):r?hk(t,n,r):oc(n)==i.scroller&&d(n);break;case 2:w&&(t.state.lastMiddleDown=+new Date);r&&ae(t.doc,r);setTimeout(function(){i.input.focus()},20);d(n);break;case 3:is?bv(t,n):kk(t)}}}}function hk(n,t,i){var r,u,o,h,f;s?setTimeout(te(kl,n),0):n.curOp.focus=ni();r=+new Date;ge&&ge.time>r-400&&e(ge.pos,i)==0?u="triple":de&&de.time>r-400&&e(de.pos,i)==0?(u="double",ge={time:r,pos:i}):(u="single",de={time:r,pos:i});o=n.doc.sel;h=lt?t.metaKey:t.ctrlKey;n.options.dragDrop&&ow&&!n.isReadOnly()&&u=="single"&&(f=o.contains(i))>-1&&(e((f=o.ranges[f]).from(),i)<0||i.xRel>0)&&(e(f.to(),i)>0||i.xRel<0)?ck(n,t,i,h):lk(n,t,i,u,h)}function ck(n,t,i,r){var f=n.display,o=+new Date,e=v(n,function(u){w&&(f.scroller.draggable=!1);n.state.draggingText=!1;dt(document,"mouseup",e);dt(f.scroller,"drop",e);Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)<10&&(d(u),!r&&+new Date-200<o&&ae(n.doc,i),w||s&&a==9?setTimeout(function(){document.body.focus();f.input.focus()},20):f.input.focus())});w&&(f.scroller.draggable=!0);n.state.draggingText=e;f.scroller.dragDrop&&f.scroller.dragDrop();u(document,"mouseup",e);u(f.scroller,"drop",e)}function lk(t,i,f,s,h){function st(i){var h,ot,d,p,v,u;if(e(it,i)!=0)if(it=i,s=="rect"){var u=[],k=t.options.tabSize,rt=yt(r(c,f.line).text,f.ch,k),ut=yt(r(c,i.line).text,i.ch,k),ft=Math.min(rt,ut),et=Math.max(rt,ut);for(h=Math.min(f.line,i.line),ot=Math.min(t.lastLine(),Math.max(f.line,i.line));h<=ot;h++)d=r(c,h).text,p=nw(d,ft,k),ft==et?u.push(new l(n(h,p),n(h,p))):d.length>p&&u.push(new l(n(h,p),n(h,nw(d,et,k))));u.length||u.push(new l(f,f));b(c,at(w.ranges.slice(0,a).concat(u),a),{origin:"*mouse",scroll:!1});t.scrollIntoView(i)}else{var nt=y,g=nt.anchor,tt=i;s!="single"&&(v=s=="double"?t.findWordAt(i):new l(n(i.line,0),o(c,n(i.line+1,0))),e(v.anchor,g)>0?(tt=v.head,g=he(nt.from(),v.anchor)):(tt=v.anchor,g=se(nt.to(),v.head)));u=w.ranges.slice(0);u[a]=new l(o(c,g),tt);b(c,at(u,a),hc)}}function ft(n){var f=++k,i=nr(t,n,!0,s=="rect"),r,u;i&&(e(i,it)!=0?(t.curOp.focus=ni(),st(i),r=cs(g,c),(i.line>=r.to||i.line<r.from)&&setTimeout(v(t,function(){k==f&&ft(n)}),150)):(u=n.clientY<ut.top?-20:n.clientY>ut.bottom?20:0,u&&setTimeout(v(t,function(){k==f&&(g.scroller.scrollTop+=u,ft(n))}),50)))}function ot(n){t.state.selectingText=!1;k=Infinity;d(n);g.input.focus();dt(document,"mousemove",et);dt(document,"mouseup",rt);c.history.lastSelOrigin=null}var g=t.display,c=t.doc,y,a,w,p,nt,tt,it,ut,k,et,rt;d(i);w=c.sel;p=w.ranges;h&&!i.shiftKey?(a=c.sel.contains(f),y=a>-1?p[a]:new l(f,f)):(y=c.sel.primary(),a=c.sel.primIndex);i.altKey?(s="rect",h||(y=new l(f,f)),f=nr(t,i,!0,!0),a=-1):s=="double"?(nt=t.findWordAt(f),y=t.display.shift||c.extend?pu(c,y,nt.anchor,nt.head):nt):s=="triple"?(tt=new l(n(f.line,0),o(c,n(f.line+1,0))),y=t.display.shift||c.extend?pu(c,y,tt.anchor,tt.head):tt):y=pu(c,y,f);h?a==-1?(a=p.length,b(c,at(p.concat([y]),a),{scroll:!1,origin:"*mouse"})):p.length>1&&p[a].empty()&&s=="single"&&!i.shiftKey?(b(c,at(p.slice(0,a).concat(p.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),w=c.sel):th(c,a,y,hc):(a=0,b(c,new ti([y],0),hc),w=c.sel);it=f;ut=g.wrapper.getBoundingClientRect();k=0;et=v(t,function(n){bp(n)?ft(n):ot(n)});rt=v(t,ot);t.state.selectingText=rt;u(document,"mousemove",et);u(document,"mouseup",rt)}function sv(n,t,i,r){var o,f,e,s,u,h,c,l;try{o=t.clientX;f=t.clientY}catch(t){return!1}if(o>=Math.floor(n.display.gutters.getBoundingClientRect().right))return!1;if(r&&d(t),e=n.display,s=e.lineDiv.getBoundingClientRect(),f>s.bottom||!ht(n,i))return ec(t);for(f-=s.top-e.viewOffset,u=0;u<n.options.gutters.length;++u)if(h=e.gutters.childNodes[u],h&&h.getBoundingClientRect().right>=o)return c=er(n.doc,f),l=n.options.gutters[u],y(n,i,n,c,l,t),ec(t)}function hv(n,t){return sv(n,t,"gutterClick",!0)}function ak(n){var t=this,r,f,u,e,i;if((cv(t),!p(t,n)&&!fi(t.display,n))&&(d(n),s&&(lh=+new Date),r=nr(t,n,!0),f=n.dataTransfer.files,r&&!t.isReadOnly()))if(f&&f.length&&window.FileReader&&window.File){var h=f.length,u=Array(h),c=0,l=function(n,i){if(!t.options.allowDropFileTypes||g(t.options.allowDropFileTypes,n.type)!=-1){var f=new FileReader;f.onload=v(t,function(){var n=f.result,e;/[\x00-\x08\x0e-\x1f]{2}/.test(n)&&(n="");u[i]=n;++c==h&&(r=o(t.doc,r),e={from:r,to:r,text:t.doc.splitLines(u.join(t.doc.lineSeparator())),origin:"paste"},kr(t.doc,e),sa(t.doc,ii(r,ai(e))))});f.readAsText(n)}};for(i=0;i<h;++i)l(f[i],i)}else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(n);setTimeout(function(){t.display.input.focus()},20);return}try{if(u=n.dataTransfer.getData("Text"),u){if(!t.state.draggingText||(lt?n.altKey:n.ctrlKey)||(e=t.listSelections()),ve(t.doc,ii(r,r)),e)for(i=0;i<e.length;++i)dr(t.doc,"",e[i].anchor,e[i].head,"drag");t.replaceSelection(u,"around","paste");t.display.input.focus()}}catch(n){}}}function vk(n,t){if(s&&(!n.state.draggingText||+new Date-lh<100)){kf(t);return}if(!p(n,t)&&!fi(n.display,t)&&(t.dataTransfer.setData("Text",n.getSelection()),t.dataTransfer.setDragImage&&!il)){var r=i("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";ct&&(r.width=r.height=1,n.display.wrapper.appendChild(r),r._top=r.offsetTop);t.dataTransfer.setDragImage(r,0,0);ct&&r.parentNode.removeChild(r)}}function yk(n,t){var u=nr(n,t),r;u&&(r=document.createDocumentFragment(),ya(n,u,r),n.display.dragCursor||(n.display.dragCursor=i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),n.display.lineSpace.insertBefore(n.display.dragCursor,n.display.cursorDiv)),st(n.display.dragCursor,r))}function cv(n){n.display.dragCursor&&(n.display.lineSpace.removeChild(n.display.dragCursor),n.display.dragCursor=null)}function nf(n,t){Math.abs(n.doc.scrollTop-t)<2||(n.doc.scrollTop=t,hi||ps(n,{top:t}),n.display.scroller.scrollTop!=t&&(n.display.scroller.scrollTop=t),n.display.scrollbars.setScrollTop(t),hi&&ps(n),bu(n,100))}function br(n,t,i){(i?t==n.doc.scrollLeft:Math.abs(n.doc.scrollLeft-t)<2)||(t=Math.min(t,n.display.scroller.scrollWidth-n.display.scroller.clientWidth),n.doc.scrollLeft=t,ls(n),n.display.scroller.scrollLeft!=t&&(n.display.scroller.scrollLeft=t),n.display.scrollbars.setScrollLeft(t))}function lv(n,t){var v=ah(t),e=v.x,u=v.y,i=n.display,r=i.scroller,y=r.scrollWidth>r.clientWidth,h=r.scrollHeight>r.clientHeight,f,c,o;if(e&&y||u&&h){if(u&&lt&&w)n:for(f=t.target,c=i.view;f!=r;f=f.parentNode)for(o=0;o<c.length;o++)if(c[o].node==f){n.display.currentWheelTarget=f;break n}if(e&&!hi&&!ct&&rt!=null){u&&h&&nf(n,Math.max(0,Math.min(r.scrollTop+u*rt,r.scrollHeight-r.clientHeight)));br(n,Math.max(0,Math.min(r.scrollLeft+e*rt,r.scrollWidth-r.clientWidth)));(!u||u&&h)&&d(t);i.wheelStartX=null;return}if(u&&rt!=null){var l=u*rt,s=n.doc.scrollTop,a=s+i.wrapper.clientHeight;l<0?s=Math.max(0,s+l-50):a=Math.min(n.doc.height,a+l+50);ps(n,{top:s,bottom:a})}tf<20&&(i.wheelStartX==null?(i.wheelStartX=r.scrollLeft,i.wheelStartY=r.scrollTop,i.wheelDX=e,i.wheelDY=u,setTimeout(function(){if(i.wheelStartX!=null){var n=r.scrollLeft-i.wheelStartX,t=r.scrollTop-i.wheelStartY,u=t&&i.wheelDY&&t/i.wheelDY||n&&i.wheelDX&&n/i.wheelDX;(i.wheelStartX=i.wheelStartY=null,u)&&(rt=(rt*tf+u)/(tf+1),++tf)}},200)):(i.wheelDX+=e,i.wheelDY+=u))}}function no(n,t,i){if(typeof t=="string"&&(t=ef[t],!t))return!1;n.display.input.ensurePolled();var u=n.display.shift,r=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0);i&&(n.display.shift=!1);r=t(n)!=gp}finally{n.display.shift=u;n.state.suppressEdits=!1}return r}function pk(n,t,i){for(var u,r=0;r<n.state.keyMaps.length;r++)if(u=of(t,n.state.keyMaps[r],i,n),u)return u;return n.options.extraKeys&&of(t,n.options.extraKeys,i,n)||of(t,n.options.keyMap,i,n)}function to(n,t,i,r){var f=n.state.keySeq,u;if(f){if(fd(t))return"handled";av.set(50,function(){n.state.keySeq==f&&(n.state.keySeq=null,n.display.input.reset())});t=f+" "+t}return(u=pk(n,t,r),u=="multi"&&(n.state.keySeq=t),u=="handled"&&ut(n,"keyHandled",n,t,i),(u=="handled"||u=="multi")&&(d(i),rh(n)),f&&!u&&/\'$/.test(t))?(d(i),!0):!!u}function vv(n,t){var i=ed(t,!0);return i?t.shiftKey&&!n.state.keySeq?to(n,"Shift-"+i,t,function(t){return no(n,t,!0)})||to(n,i,t,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return no(n,t)}):to(n,i,t,function(t){return no(n,t)}):!1}function wk(n,t,i){return to(n,"'"+i+"'",t,function(t){return no(n,t,!0)})}function yv(n){var t=this,i,r;(t.curOp.focus=ni(),p(t,n))||(s&&a<11&&n.keyCode==27&&(n.returnValue=!1),i=n.keyCode,t.display.shift=i==16||n.shiftKey,r=vv(t,n),ct&&(io=r?i:null,r||i!=88||sw||!(lt?n.metaKey:n.ctrlKey)||t.replaceSelection("",null,"cut")),i!=18||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||bk(t))}function bk(n){function t(n){n.keyCode!=18&&n.altKey||(ou(i,"CodeMirror-crosshair"),dt(document,"keyup",t),dt(document,"mouseover",t))}var i=n.display.lineDiv;su(i,"CodeMirror-crosshair");u(document,"keyup",t);u(document,"mouseover",t)}function pv(n){n.keyCode==16&&(this.doc.sel.shift=!1);p(this,n)}function wv(n){var t=this,i,r,u;if(!fi(t.display,n)&&!p(t,n)&&(!n.ctrlKey||n.altKey)&&(!lt||!n.metaKey)){if(i=n.keyCode,r=n.charCode,ct&&i==io){io=null;d(n);return}if((!ct||!(!n.which||n.which<10)||!vv(t,n))&&(u=String.fromCharCode(r==null?i:r),!wk(t,n,u)))t.display.input.onKeyPress(n)}}function kk(n){n.state.delayingBlurEvent=!0;setTimeout(function(){n.state.delayingBlurEvent&&(n.state.delayingBlurEvent=!1,rf(n))},100)}function vh(n){(n.state.delayingBlurEvent&&(n.state.delayingBlurEvent=!1),n.options.readOnly!="nocursor")&&(n.state.focused||(y(n,"focus",n),n.state.focused=!0,su(n.display.wrapper,"CodeMirror-focused"),n.curOp||n.display.selForContextMenu==n.doc.sel||(n.display.input.reset(),w&&setTimeout(function(){n.display.input.reset(!0)},20)),n.display.input.receivedFocus()),rh(n))}function rf(n){n.state.delayingBlurEvent||(n.state.focused&&(y(n,"blur",n),n.state.focused=!1,ou(n.display.wrapper,"CodeMirror-focused")),clearInterval(n.display.blinker),setTimeout(function(){n.state.focused||(n.display.shift=!1)},150))}function bv(n,t){if(!fi(n.display,t)&&!dk(n,t)&&!p(n,t,"contextmenu"))n.display.input.onContextMenu(t)}function dk(n,t){return ht(n,"gutterContextMenu")?sv(n,t,"gutterContextMenu",!1):!1}function kv(t,i){if(e(t,i.from)<0)return t;if(e(t,i.to)<=0)return ai(i);var u=t.line+i.text.length-(i.to.line-i.from.line)-1,r=t.ch;return t.line==i.to.line&&(r+=ai(i).ch-i.to.ch),n(u,r)}function yh(n,t){for(var u=[],r,i=0;i<n.sel.ranges.length;i++)r=n.sel.ranges[i],u.push(new l(kv(r.anchor,t),kv(r.head,t)));return at(u,n.sel.primIndex)}function dv(t,i,r){return t.line==i.line?n(r.line,t.ch-i.ch+r.ch):n(r.line+(t.line-i.line),t.ch)}function gk(t,i,r){for(var s=[],f=n(t.first,0),h=f,v,y,u=0;u<i.length;u++){var c=i[u],o=dv(c.from,f,h),a=dv(ai(c),f,h);f=c.to;h=a;r=="around"?(v=t.sel.ranges[u],y=e(v.head,v.anchor)<0,s[u]=new l(y?a:o,y?o:a)):s[u]=new l(o,o)}return new ti(s,t.sel.primIndex)}function gv(n,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return(i&&(r.update=function(t,i,r,u){t&&(this.from=o(n,t));i&&(this.to=o(n,i));r&&(this.text=r);u!==undefined&&(this.origin=u)}),y(n,"beforeChange",n,r),n.cm&&y(n.cm,"beforeChange",n.cm,r),r.canceled)?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function kr(n,t,i){var u,r;if(n.cm){if(!n.cm.curOp)return v(n.cm,kr)(n,t,i);if(n.cm.state.suppressEdits)return}if(!ht(n,"beforeChange")&&(!n.cm||!ht(n.cm,"beforeChange"))||(t=gv(n,t,!0),t))if(u=ul&&!i&&yd(n,t.from,t.to),u)for(r=u.length-1;r>=0;--r)ny(n,{from:u[r].from,to:u[r].to,text:r?[""]:t.text});else ny(n,t)}function ny(n,t){var i,r;(t.text.length!=1||t.text[0]!=""||e(t.from,t.to)!=0)&&(i=yh(n,t),lp(n,t,i,n.cm?n.cm.curOp.id:NaN),uf(n,t,i,dh(n,t)),r=[],ur(n,function(n,i){i||g(r,n.history)!=-1||(pp(n.history,t),r.push(n.history));uf(n,t,null,dh(n,t))}))}function ro(n,t,i){var c,v,u,f,y,l;if(!n.cm||!n.cm.state.suppressEdits){var e=n.history,r,a=n.sel,o=t=="undo"?e.done:e.undone,s=t=="undo"?e.undone:e.done;for(u=0;u<o.length;u++)if(r=o[u],i?r.ranges&&!r.equals(n.sel):!r.ranges)break;if(u!=o.length){for(e.lastOrigin=e.lastSelOrigin=null;;)if(r=o.pop(),r.ranges){if(vo(r,s),i&&!r.equals(n.sel)){b(n,r,{clearRedo:!1});return}a=r}else break;for(c=[],vo(a,s),s.push({changes:c,generation:e.generation}),e.generation=r.generation||++e.maxGeneration,v=ht(n,"beforeChange")||n.cm&&ht(n.cm,"beforeChange"),u=r.changes.length-1;u>=0;--u){if(f=r.changes[u],f.origin=t,v&&!gv(n,f,!1)){o.length=0;return}c.push(fc(n,f));y=u?yh(n,f):h(o);uf(n,f,y,oy(n,f));!u&&n.cm&&n.cm.scrollIntoView({from:f.from,to:ai(f)});l=[];ur(n,function(n,t){t||g(l,n.history)!=-1||(pp(n.history,f),l.push(n.history));uf(n,f,null,oy(n,f))})}}}}function ty(t,i){if(i!=0&&(t.first+=i,t.sel=new ti(wo(t.sel.ranges,function(t){return new l(n(t.anchor.line+i,t.anchor.ch),n(t.head.line+i,t.head.ch))}),t.sel.primIndex),t.cm)){tt(t.cm,t.first,t.first-i,i);for(var u=t.cm.display,r=u.viewFrom;r<u.viewTo;r++)ui(t.cm,r,"gutter")}}function uf(t,i,u,f){var o,e;if(t.cm&&!t.cm.curOp)return v(t.cm,uf)(t,i,u,f);if(i.to.line<t.first){ty(t,i.text.length-1-(i.to.line-i.from.line));return}i.from.line>t.lastLine()||(i.from.line<t.first&&(o=i.text.length-1-(t.first-i.from.line),ty(t,o),i={from:n(t.first,0),to:n(i.to.line+o,i.to.ch),text:[h(i.text)],origin:i.origin}),e=t.lastLine(),i.to.line>e&&(i={from:i.from,to:n(e,r(t,e).text.length),text:[i.text[0]],origin:i.origin}),i.removed=fr(t,i.from,i.to),u||(u=yh(t,i)),t.cm?nd(t.cm,i,f):rc(t,i,f),ve(t,u,gt))}function nd(n,t,i){var f=n.doc,e=n.display,u=t.from,o=t.to,s=!1,h=u.line,y,l,a,v;n.options.lineWrapping||(h=c(bt(r(f,u.line))),f.iter(h,o.line+1,function(n){if(n==e.maxLine)return s=!0,!0}));f.sel.contains(t.from,t.to)>-1&&kp(n);rc(f,t,i,fl(n));n.options.lineWrapping||(f.iter(h,u.line+t.text.length,function(n){var t=fe(n);t>e.maxLineLength&&(e.maxLine=n,e.maxLineLength=t,e.maxLineChanged=!0,s=!1)}),s&&(n.curOp.updateMaxLine=!0));f.frontier=Math.min(f.frontier,u.line);bu(n,400);y=t.text.length-(o.line-u.line)-1;t.full?tt(n):u.line!=o.line||t.text.length!=1||ep(n.doc,t)?tt(n,u.line,o.line+1,y):ui(n,u.line,"text");l=ht(n,"changes");a=ht(n,"change");(a||l)&&(v={from:u,to:o,text:t.text,removed:t.removed,origin:t.origin},a&&ut(n,"change",n,v),l&&(n.curOp.changeObjs||(n.curOp.changeObjs=[])).push(v));n.display.selForContextMenu=null}function dr(n,t,i,r,u){if(r||(r=i),e(r,i)<0){var f=r;r=i;i=f}typeof t=="string"&&(t=n.splitLines(t));kr(n,{from:i,to:r,text:t,origin:u})}function td(n,t){var u;if(!p(n,"scrollCursorIntoView")){var f=n.display,e=f.sizer.getBoundingClientRect(),r=null;t.top+e.top<0?r=!0:t.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1);r==null||ww||(u=i("div","​",null,"position: absolute; top: "+(t.top-f.viewOffset-ye(n.display))+"px; height: "+(t.bottom-t.top+wt(n)+f.barHeight)+"px; left: "+t.left+"px; width: 2px;"),n.display.lineSpace.appendChild(u),u.scrollIntoView(r),n.display.lineSpace.removeChild(u))}}function id(n,t,i,r){var o;for(r==null&&(r=0),o=0;o<5;o++){var s=!1,u=ri(n,t),f=!i||i==t?u:ri(n,i),e=uo(n,Math.min(u.left,f.left),Math.min(u.top,f.top)-r,Math.max(u.left,f.left),Math.max(u.bottom,f.bottom)+r),h=n.doc.scrollTop,c=n.doc.scrollLeft;if(e.scrollTop!=null&&(nf(n,e.scrollTop),Math.abs(n.doc.scrollTop-h)>1&&(s=!0)),e.scrollLeft!=null&&(br(n,e.scrollLeft),Math.abs(n.doc.scrollLeft-c)>1&&(s=!0)),!s)break}return u}function rd(n,t,i,r,u){var f=uo(n,t,i,r,u);f.scrollTop!=null&&nf(n,f.scrollTop);f.scrollLeft!=null&&br(n,f.scrollLeft)}function uo(n,t,i,r,u){var e=n.display,a=ki(n.display),c;i<0&&(i=0);var h=n.curOp&&n.curOp.scrollTop!=null?n.curOp.scrollTop:e.scroller.scrollTop,o=fh(n),f={};u-i>o&&(u=i+o);var v=n.doc.height+uh(e),p=i<a,w=u>v-a;i<h?f.scrollTop=p?0:i:u>h+o&&(c=Math.min(i,(w?v:u)-o),c!=h&&(f.scrollTop=c));var y=n.curOp&&n.curOp.scrollLeft!=null?n.curOp.scrollLeft:e.scroller.scrollLeft,s=wi(n)-(n.options.fixedGutter?e.gutters.offsetWidth:0),l=r-t>s;return l&&(r=t+s),t<10?f.scrollLeft=0:t<y?f.scrollLeft=Math.max(0,t-(l?0:10)):r>s+y-3&&(f.scrollLeft=r+(l?0:10)-s),f}function ph(n,t,i){(t!=null||i!=null)&&fo(n);t!=null&&(n.curOp.scrollLeft=(n.curOp.scrollLeft==null?n.doc.scrollLeft:n.curOp.scrollLeft)+t);i!=null&&(n.curOp.scrollTop=(n.curOp.scrollTop==null?n.doc.scrollTop:n.curOp.scrollTop)+i)}function gr(t){fo(t);var i=t.getCursor(),r=i,u=i;t.options.lineWrapping||(r=i.ch?n(i.line,i.ch-1):i,u=n(i.line,i.ch+1));t.curOp.scrollToPos={from:r,to:u,margin:t.options.cursorScrollMargin,isCursor:!0}}function fo(n){var t=n.curOp.scrollToPos;if(t){n.curOp.scrollToPos=null;var i=uv(n,t.from),r=uv(n,t.to),u=uo(n,Math.min(i.left,r.left),Math.min(i.top,r.top)-t.margin,Math.max(i.right,r.right),Math.max(i.bottom,r.bottom)+t.margin);n.scrollTo(u.scrollLeft,u.scrollTop)}}function ff(t,i,u,f){var o=t.doc,b,a,e,v,s,w,c;u==null&&(u="add");u=="smart"&&(o.mode.indent?b=ku(t,i):u="prev");var y=t.options.tabSize,h=r(o,i),p=yt(h.text,null,y);if(h.stateAfter&&(h.stateAfter=null),a=h.text.match(/^\s*/)[0],f||/\S/.test(h.text)){if(u=="smart"&&(e=o.mode.indent(b,h.text.slice(a.length),h.text),e==gp||e>150)){if(!f)return;u="prev"}}else e=0,u="not";if(u=="prev"?e=i>o.first?yt(r(o,i-1).text,null,y):0:u=="add"?e=p+t.options.indentUnit:u=="subtract"?e=p-t.options.indentUnit:typeof u=="number"&&(e=p+u),e=Math.max(0,e),v="",c=0,t.options.indentWithTabs)for(s=Math.floor(e/y);s;--s)c+=y,v+="\t";if(c<e&&(v+=tw(e-c)),v!=a)return dr(o,v,n(i,0),n(i,a.length),"+input"),h.stateAfter=null,!0;for(s=0;s<o.sel.ranges.length;s++)if(w=o.sel.ranges[s],w.head.line==i&&w.head.ch<a.length){c=n(i,a.length);th(o,s,new l(c,c));break}}function eo(n,t,i,u){var f=t,e=t;return(typeof t=="number"?e=r(n,ua(n,t)):f=c(t),f==null)?null:(u(e,f)&&n.cm&&ui(n.cm,f,i),e)}function nu(n,t){for(var o=n.doc.sel.ranges,i=[],r,f,u=0;u<o.length;u++){for(r=t(o[u]);i.length&&e(r.from,h(i).to)<=0;)if(f=i.pop(),e(f.from,r.from)<0){r.from=f.from;break}i.push(r)}ot(n,function(){for(var t=i.length-1;t>=0;t--)dr(n.doc,"",i[t].from,i[t].to,"+delete");gr(n)})}function wh(t,i,u,f,o){function d(){var n=v+u;return n<t.first||n>=t.first+t.size?!1:(v=n,c=r(t,n))}function l(n){var t=(o?dc:lw)(c,s,u,!0);if(t==null)if(!n&&d())s=o?(u<0?ns:go)(c):u<0?c.text.length:0;else return!1;else s=t;return!0}var v=i.line,s=i.ch,k=u,c=r(t,v),a,y,h,p;if(f=="char")l();else if(f=="column")l(!0);else if(f=="word"||f=="group"){var w=null,b=f=="group",g=t.cm&&t.cm.getHelper(i,"wordChars");for(a=!0;;a=!1){if(u<0&&!l(!a))break;if(y=c.text.charAt(s)||"\n",h=bo(y,g)?"w":b&&y=="\n"?"n":!b||/\s/.test(y)?null:"p",!b||a||h||(h="s"),w&&w!=h){u<0&&(u=1,l());break}if(h&&(w=h),u>0&&!l(!a))break}}return p=ih(t,n(v,s),i,k,!0),e(i,p)||(p.hitSide=!0),p}function iy(n,t,i,r){var o=n.doc,s=t.left,u,e,f;for(r=="page"?(e=Math.min(n.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=t.top+i*(e-(i<0?1.5:.5)*ki(n.display))):r=="line"&&(u=i>0?t.bottom+3:t.top-3);;){if(f=ch(n,s,u),!f.outside)break;if(i<0?u<=0:u>=o.height){f.hitSide=!0;break}u+=i*5}return f}function f(n,i,r,u){t.defaults[n]=i;r&&(tr[n]=u?function(n,t,i){i!=bh&&r(n,t,i)}:r)}function ud(n){for(var i=n.split(/-(?!$)/),n=i[i.length-1],u,f,e,o,t,r=0;r<i.length-1;r++)if(t=i[r],/^(cmd|meta|m)$/i.test(t))o=!0;else if(/^a(lt)?$/i.test(t))u=!0;else if(/^(c|ctrl|control)$/i.test(t))f=!0;else if(/^s(hift)$/i.test(t))e=!0;else throw new Error("Unrecognized modifier name: "+t);return u&&(n="Alt-"+n),f&&(n="Ctrl-"+n),o&&(n="Cmd-"+n),e&&(n="Shift-"+n),n}function so(n){return typeof n=="string"?oi[n]:n}function ru(n,t,r,f,o){var s,a,c,h,y,l;if(f&&f.shared)return od(n,t,r,f,o);if(n.cm&&!n.cm.curOp)return v(n.cm,ru)(n,t,r,f,o);if(s=new vi(n,o),a=e(t,r),f&&pt(f,s,!1),a>0||a==0&&s.clearWhenEmpty!==!1)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=i("span",[s.replacedWith],"CodeMirror-widget"),f.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),f.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(vy(n,t.line,t,r,s)||t.line!=r.line&&vy(n,r.line,t,r,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");ci=!0}if(s.addToHistory&&lp(n,{from:t,to:r,origin:"markText"},n.sel,NaN),c=t.line,h=n.cm,n.iter(c,r.line+1,function(n){h&&s.collapsed&&!h.options.lineWrapping&&bt(n)==h.display.maxLine&&(y=!0);s.collapsed&&c!=t.line&&kt(n,0);ld(n,new ho(s,c==t.line?t.ch:null,c==r.line?r.ch:null));++c}),s.collapsed&&n.iter(t.line,r.line+1,function(t){rr(n,t)&&kt(t,0)}),s.clearOnEnter&&u(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(ul=!0,(n.history.done.length||n.history.undone.length)&&n.clearHistory()),s.collapsed&&(s.id=++hf,s.atomic=!0),h){if(y&&(h.curOp.updateMaxLine=!0),s.collapsed)tt(h,t.line,r.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(l=t.line;l<=r.line;l++)ui(h,l,"text");s.atomic&&ca(h.doc);ut(h,"markerAdded",h,s)}return s}function od(n,t,i,r,u){r=pt(r);r.shared=!1;var f=[ru(n,t,i,r,u)],e=f[0],s=r.widgetNode;return ur(n,function(n){s&&(r.widgetNode=s.cloneNode(!0));f.push(ru(n,o(n,t),o(n,i),r,u));for(var c=0;c<n.linked.length;++c)if(n.linked[c].isParent)return;e=h(f)}),new cf(f,e)}function fy(t){return t.findMarks(n(t.first,0),t.clipPos(n(t.lastLine())),function(n){return n.parent})}function sd(n,t){for(var u,r=0;r<t.length;r++){var i=t[r],f=i.find(),o=n.clipPos(f.from),s=n.clipPos(f.to);e(o,s)&&(u=ru(n,o,s,i.primary,i.primary.type),i.markers.push(u),u.parent=i)}}function hd(n){for(var t,u,i,f,r=0;r<n.length;r++)for(t=n[r],u=[t.primary.doc],ur(t.primary.doc,function(n){u.push(n)}),i=0;i<t.markers.length;i++)f=t.markers[i],g(u,f.doc)==-1&&(f.parent=null,t.markers.splice(i--,1))}function ho(n,t,i){this.marker=n;this.from=t;this.to=i}function lf(n,t){var i,r;if(n)for(i=0;i<n.length;++i)if(r=n[i],r.marker==t)return r}function cd(n,t){for(var r,i=0;i<n.length;++i)n[i]!=t&&(r||(r=[])).push(n[i]);return r}function ld(n,t){n.markedSpans=n.markedSpans?n.markedSpans.concat([t]):[t];t.marker.attachLine(n)}function ad(n,t,i){var u,e,o;if(n)for(u=0;u<n.length;++u){var r=n[u],f=r.marker,s=r.from==null||(f.inclusiveLeft?r.from<=t:r.from<t);!s&&(r.from!=t||f.type!="bookmark"||i&&r.marker.insertLeft)||(o=r.to==null||(f.inclusiveRight?r.to>=t:r.to>t),(e||(e=[])).push(new ho(f,r.from,o?null:r.to)))}return e}function vd(n,t,i){var u,e,o;if(n)for(u=0;u<n.length;++u){var r=n[u],f=r.marker,s=r.to==null||(f.inclusiveRight?r.to>=t:r.to>t);(s||r.from==t&&f.type=="bookmark"&&(!i||r.marker.insertLeft))&&(o=r.from==null||(f.inclusiveLeft?r.from<=t:r.from<t),(e||(e=[])).push(new ho(f,o?null:r.from-t,r.to==null?null:r.to-t)))}return e}function dh(n,t){var v,y,f,s,a,w,b,i;if(t.full||(v=yu(n,t.from.line)&&r(n,t.from.line).markedSpans,y=yu(n,t.to.line)&&r(n,t.to.line).markedSpans,!v&&!y))return null;var p=t.from.ch,d=t.to.ch,k=e(t.from,t.to)==0,u=ad(v,p,k),o=vd(y,d,k),c=t.text.length==1,l=h(t.text).length+(c?p:0);if(u)for(i=0;i<u.length;++i)f=u[i],f.to==null&&(s=lf(o,f.marker),s?c&&(f.to=s.to==null?null:s.to+l):f.to=p);if(o)for(i=0;i<o.length;++i)f=o[i],f.to!=null&&(f.to+=l),f.from==null?(s=lf(u,f.marker),s||(f.from=l,c&&(u||(u=[])).push(f))):(f.from+=l,c&&(u||(u=[])).push(f));if(u&&(u=ey(u)),o&&o!=u&&(o=ey(o)),a=[u],!c){if(w=t.text.length-2,w>0&&u)for(i=0;i<u.length;++i)u[i].to==null&&(b||(b=[])).push(new ho(u[i].marker,null,null));for(i=0;i<w;++i)a.push(b);a.push(o)}return a}function ey(n){for(var i,t=0;t<n.length;++t)i=n[t],i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&n.splice(t--,1);return n.length?n:null}function oy(n,t){var i=og(n,t),s=dh(n,t),r,f,u,e,h,o;if(!i)return s;if(!s)return i;for(r=0;r<i.length;++r)if(f=i[r],u=s[r],f&&u)n:for(e=0;e<u.length;++e){for(h=u[e],o=0;o<f.length;++o)if(f[o].marker==h.marker)continue n;f.push(h)}else u&&(i[r]=u);return i}function yd(n,t,i){var r=null,o,h,c,u,s,f;if(n.iter(t.line,i.line+1,function(n){var t,i;if(n.markedSpans)for(t=0;t<n.markedSpans.length;++t)i=n.markedSpans[t].marker,i.readOnly&&(!r||g(r,i)==-1)&&(r||(r=[])).push(i)}),!r)return null;for(o=[{from:t,to:i}],h=0;h<r.length;++h)for(c=r[h],u=c.find(0),s=0;s<o.length;++s)if(f=o[s],!(e(f.to,u.from)<0)&&!(e(f.from,u.to)>0)){var l=[s,1],a=e(f.from,u.from),v=e(f.to,u.to);(a<0||!c.inclusiveLeft&&!a)&&l.push({from:f.from,to:u.from});(v>0||!c.inclusiveRight&&!v)&&l.push({from:u.to,to:f.to});o.splice.apply(o,l);s+=l.length-1}return o}function sy(n){var i=n.markedSpans,t;if(i){for(t=0;t<i.length;++t)i[t].marker.detachLine(n);n.markedSpans=null}}function hy(n,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(n);n.markedSpans=t}}function co(n){return n.inclusiveLeft?-1:0}function lo(n){return n.inclusiveRight?1:0}function cy(n,t){var r=n.lines.length-t.lines.length,i;if(r!=0)return r;var u=n.find(),f=t.find(),o=e(u.from,f.from)||co(n)-co(t);return o?-o:(i=e(u.to,f.to)||lo(n)-lo(t),i)?i:t.id-n.id}function ly(n,t){var f=ci&&n.markedSpans,r,i,u;if(f)for(u=0;u<f.length;++u)i=f[u],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||cy(r,i.marker)<0)&&(r=i.marker);return r}function ay(n){return ly(n,!0)}function af(n){return ly(n,!1)}function vy(n,t,i,u,f){var v=r(n,t),l=ci&&v.markedSpans,s,o;if(l)for(s=0;s<l.length;++s)if(o=l[s],o.marker.collapsed){var h=o.marker.find(0),c=e(h.from,i)||co(o.marker)-co(f),a=e(h.to,u)||lo(o.marker)-lo(f);if((!(c>=0)||!(a<=0))&&(!(c<=0)||!(a>=0))&&(c<=0&&(e(h.to,i)>0||o.marker.inclusiveRight&&f.inclusiveLeft)||c>=0&&(e(h.from,u)<0||o.marker.inclusiveLeft&&f.inclusiveRight)))return!0}}function bt(n){for(var t;t=ay(n);)n=t.find(-1,!0).line;return n}function pd(n){for(var i,t;i=af(n);)n=i.find(1,!0).line,(t||(t=[])).push(n);return t}function gh(n,t){var i=r(n,t),u=bt(i);return i==u?t:c(u)}function yy(n,t){if(t>n.lastLine())return t;var i=r(n,t),u;if(!rr(n,i))return t;while(u=af(i))i=u.find(1,!0).line;return c(i)+1}function rr(n,t){var u=ci&&t.markedSpans,i,r;if(u)for(r=0;r<u.length;++r)if(i=u[r],i.marker.collapsed){if(i.from==null)return!0;if(!i.marker.widgetNode&&i.from==0&&i.marker.inclusiveLeft&&nc(n,t,i))return!0}}function nc(n,t,i){var f,r,u;if(i.to==null)return f=i.marker.find(1,!0),nc(n,f.line,lf(f.line.markedSpans,i.marker));if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(u=0;u<t.markedSpans.length;++u)if(r=t.markedSpans[u],r.marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(r.to==null||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&nc(n,t,r))return!0}function py(n,t,i){si(t)<(n.curOp&&n.curOp.scrollTop||n.doc.scrollTop)&&ph(n,null,i)}function yf(n){var t,r;return n.height!=null?n.height:(t=n.doc.cm,!t)?0:(ko(document.body,n.node)||(r="position: relative;",n.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),n.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),st(t.display.measure,i("div",[n.node],null,r))),n.height=n.node.parentNode.offsetHeight)}function wd(n,t,i,r){var u=new vf(n,i,r),f=n.cm;return f&&u.noHScroll&&(f.display.alignWidgets=!0),eo(n,t,"widget",function(t){var i=t.widgets||(t.widgets=[]),r;return u.insertAt==null?i.push(u):i.splice(Math.min(i.length-1,Math.max(0,u.insertAt)),0,u),u.line=t,f&&!rr(n,t)&&(r=si(t)<n.scrollTop,kt(t,t.height+yf(u)),r&&ph(f,null,u.height),f.curOp.forceUpdate=!0),!0}),u}function bd(n,t,i,r){n.text=t;n.stateAfter&&(n.stateAfter=null);n.styles&&(n.styles=null);n.order!=null&&(n.order=null);sy(n);hy(n,i);var u=r?r(n):1;u!=n.height&&kt(n,u)}function kd(n){n.parent=null;sy(n)}function wy(n,t){var i,r;if(n)for(;;){if(i=n.match(/(?:^|\s+)line-(background-)?(\S+)/),!i)break;n=n.slice(0,i.index)+n.slice(i.index+i[0].length);r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+i[2])}return n}function by(n,i){if(n.blankLine)return n.blankLine(i);if(n.innerMode){var r=t.innerMode(n,i);if(r.mode.blankLine)return r.mode.blankLine(r.state)}}function tc(n,i,r,u){for(var e,f=0;f<10;f++)if(u&&(u[0]=t.innerMode(n,r).mode),e=n.token(i,r),i.pos>i.start)return e;throw new Error("Mode "+n.name+" failed to advance stream.");}function ky(n,t,i,u){function c(n){return{start:f.start,end:f.pos,string:f.current(),type:l||null,state:n?ei(e.mode,s):s}}var e=n.doc,a=e.mode,l;t=o(e,t);var v=r(e,t.line),s=ku(n,t.line,i),f=new sf(v.text,n.options.tabSize),h;for(u&&(h=[]);(u||f.pos<t.ch)&&!f.eol();)f.start=f.pos,l=tc(a,f,s),u&&h.push(c(!0));return u?h:c()}function dy(n,t,i,r,u,f,e){var c=i.flattenSpans,a,y;c==null&&(c=n.options.flattenSpans);var s=0,l=null,o=new sf(t,n.options.tabSize),h,v=n.options.addModeClass&&[null];for(t==""&&wy(by(i,r),f);!o.eol();){if(o.pos>n.options.maxHighlightLength?(c=!1,e&&ic(n,t,r,o.pos),o.pos=t.length,h=null):h=wy(tc(i,o,r,v),f),v&&(a=v[0].name,a&&(h="m-"+(h?a+" "+h:a))),!c||l!=h){while(s<o.start)s=Math.min(o.start,s+5e4),u(s,l);l=h}o.start=o.pos}while(s<o.pos)y=Math.min(o.pos,s+5e4),u(y,l),s=y}function gy(n,t,i,r){var u=[n.state.modeGen],e={},o;for(dy(n,t.text,n.doc.mode,i,function(n,t){u.push(n,t)},e,r),o=0;o<n.state.overlays.length;++o){var s=n.state.overlays[o],f=1,h=0;dy(n,t.text,s.mode,!0,function(n,t){for(var i=f,r,e;h<n;)r=u[f],r>n&&u.splice(f,1,n,u[f+1],r),f+=2,h=Math.min(n,r);if(t)if(s.opaque)u.splice(i,f-i,n,"cm-overlay "+t),f=i+2;else for(;i<f;i+=2)e=u[i+1],u[i+1]=(e?e+" ":"")+"cm-overlay "+t},e)}return{styles:u,classes:e.bgClass||e.textClass?e:null}}function np(n,t,i){if(!t.styles||t.styles[0]!=n.state.modeGen){var r=ku(n,c(t)),u=gy(n,t,t.text.length>n.options.maxHighlightLength?ei(n.doc.mode,r):r);t.stateAfter=r;t.styles=u.styles;u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null);i===n.doc.frontier&&n.doc.frontier++}return t.styles}function ic(n,t,i,r){var f=n.doc.mode,u=new sf(t,n.options.tabSize);for(u.start=u.pos=r||0,t==""&&by(f,i);!u.eol();)tc(f,u,i),u.start=u.pos}function rp(n,t){if(!n||/^\s*$/.test(n))return null;var i=t.addModeClass?ip:tp;return i[n]||(i[n]=n.replace(/\S+/g,"cm-$&"))}function up(n,t){var e=i("span",null,null,w?"padding-right: .1px":null),r={pre:i("pre",[e],"CodeMirror-line"),content:e,col:0,pos:0,cm:n,splitSpaces:(s||w)&&n.getOption("lineWrapping")},f,u,o,h;for(t.measure={},f=0;f<=(t.rest?t.rest.length:0);f++)u=f?t.rest[f-1]:t.line,r.pos=0,r.addToken=gd,ag(n.display.measure)&&(o=vt(u))&&(r.addToken=tg(r.addToken,o)),r.map=[],h=t!=n.display.externalMeasured&&c(u),ig(u,r,np(n,u,h)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=lc(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=lc(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(lg(n.display.measure))),f==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}));return w&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),y(n,"renderLine",n,t.line,r.pre),r.pre.className&&(r.textClass=lc(r.pre.className,r.textClass||"")),r}function dd(n){var t=i("span","•","cm-invalidchar");return t.title="\\u"+n.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function gd(n,t,r,u,f,e,o){var c,v,l,y,h,p,b;if(t){var k=n.splitSpaces?t.replace(/ {3,}/g,ng):t,w=n.cm.state.specialChars,d=!1;if(w.test(t))for(c=document.createDocumentFragment(),v=0;;){if(w.lastIndex=v,l=w.exec(t),y=l?l.index-v:t.length-v,y&&(h=document.createTextNode(k.slice(v,v+y)),s&&a<9?c.appendChild(i("span",[h])):c.appendChild(h),n.map.push(n.pos,n.pos+y,h),n.col+=y,n.pos+=y),!l)break;if(v+=y+1,l[0]=="\t"){var g=n.cm.options.tabSize,nt=g-n.col%g,h=c.appendChild(i("span",tw(nt),"cm-tab"));h.setAttribute("role","presentation");h.setAttribute("cm-text","\t");n.col+=nt}else l[0]=="\r"||l[0]=="\n"?(h=c.appendChild(i("span",l[0]=="\r"?"␍":"␤","cm-invalidchar")),h.setAttribute("cm-text",l[0]),n.col+=1):(h=n.cm.options.specialCharPlaceholder(l[0]),h.setAttribute("cm-text",l[0]),s&&a<9?c.appendChild(i("span",[h])):c.appendChild(h),n.col+=1);n.map.push(n.pos,n.pos+1,h);n.pos++}else n.col+=t.length,c=document.createTextNode(k),n.map.push(n.pos,n.pos+t.length,c),s&&a<9&&(d=!0),n.pos+=t.length;if(r||u||f||d||o)return p=r||"",u&&(p+=u),f&&(p+=f),b=i("span",[c],p,o),e&&(b.title=e),n.content.appendChild(b);n.content.appendChild(c)}}function ng(n){for(var i=" ",t=0;t<n.length-2;++t)i+=t%2?" ":" ";return i+" "}function tg(n,t){return function(i,r,u,f,e,o,s){var h,a,l,c;for(u=u?u+" cm-force-border":"cm-force-border",h=i.pos,a=h+r.length;;){for(l=0;l<t.length;l++)if(c=t[l],c.to>h&&c.from<=h)break;if(c.to>=a)return n(i,r,u,f,e,o,s);n(i,r.slice(0,c.to-h),u,f,null,o,s);f=null;r=r.slice(c.to-h);h=c.to}}}function fp(n,t,i,r){var u=!r&&i.widgetNode;u&&n.map.push(n.pos,n.pos+t,u);!r&&n.cm.display.input.needsContentAttribute&&(u||(u=n.content.appendChild(document.createElement("span"))),u.setAttribute("cm-marker",i.id));u&&(n.cm.display.input.setUneditable(u),n.content.appendChild(u));n.pos+=t}function ig(n,t,i){var nt=n.markedSpans,tt=n.text,y=0,h,d,l,u,f,o,a,g,ut;if(!nt){for(h=1;h<i.length;h+=2)t.addToken(t,tt.slice(y,y=i[h]),rp(i[h+1],t.cm.options));return}for(var it=tt.length,r=0,h=1,c="",rt,v,s=0,p,w,b,k,e;;){if(s==r){for(p=w=b=k=v="",e=null,s=Infinity,d=[],o=0;o<nt.length;++o)u=nt[o],f=u.marker,f.type=="bookmark"&&u.from==r&&f.widgetNode?d.push(f):u.from<=r&&(u.to==null||u.to>r||f.collapsed&&u.to==r&&u.from==r)?(u.to!=null&&u.to!=r&&s>u.to&&(s=u.to,w=""),f.className&&(p+=" "+f.className),f.css&&(v=(v?v+";":"")+f.css),f.startStyle&&u.from==r&&(b+=" "+f.startStyle),f.endStyle&&u.to==s&&(l||(l=[])).push(f.endStyle,u.to),f.title&&!k&&(k=f.title),f.collapsed&&(!e||cy(e.marker,f)<0)&&(e=u)):u.from>r&&s>u.from&&(s=u.from);if(l)for(o=0;o<l.length;o+=2)l[o+1]==s&&(w+=" "+l[o]);if(!e||e.from==r)for(o=0;o<d.length;++o)fp(t,0,d[o]);if(e&&(e.from||0)==r){if(fp(t,(e.to==null?it+1:e.to)-r,e.marker,e.from==null),e.to==null)return;e.to==r&&(e=!1)}}if(r>=it)break;for(a=Math.min(it,s);;){if(c){if(g=r+c.length,e||(ut=g>a?c.slice(0,a-r):c,t.addToken(t,ut,rt?rt+p:p,b,r+ut.length==s?w:"",k,v)),g>=a){c=c.slice(a-r);r=a;break}r=g;b=""}c=tt.slice(y,y=i[h++]);rt=rp(i[h++],t.cm.options)}}}function ep(n,t){return t.from.ch==0&&t.to.ch==0&&h(t.text)==""&&(!n.cm||n.cm.options.wholeLineUpdateBefore)}function rc(n,t,i,u){function v(n){return i?i[n]:null}function c(n,i,r){bd(n,i,r,u);ut(n,"change",n,t)}function p(n,t){for(var i=n,r=[];i<t;++i)r.push(new uu(f[i],v(i),u));return r}var e=t.from,l=t.to,f=t.text,o=r(n,e.line),a=r(n,l.line),b=h(f),w=v(f.length-1),y=l.line-e.line,s;t.full?(n.insert(0,p(0,f.length)),n.remove(f.length,n.size-f.length)):ep(n,t)?(s=p(0,f.length-1),c(a,a.text,w),y&&n.remove(e.line,y),s.length&&n.insert(e.line,s)):o==a?f.length==1?c(o,o.text.slice(0,e.ch)+b+o.text.slice(l.ch),w):(s=p(1,f.length-1),s.push(new uu(b+o.text.slice(l.ch),w,u)),c(o,o.text.slice(0,e.ch)+f[0],v(0)),n.insert(e.line+1,s)):f.length==1?(c(o,o.text.slice(0,e.ch)+f[0]+a.text.slice(l.ch),v(0)),n.remove(e.line+1,y)):(c(o,o.text.slice(0,e.ch)+f[0],v(0)),c(a,b+a.text.slice(l.ch),w),s=p(1,f.length-1),y>1&&n.remove(e.line+1,y-1),n.insert(e.line+1,s));ut(n,"change",n,t)}function pf(n){this.lines=n;this.parent=null;for(var t=0,i=0;t<n.length;++t)n[t].parent=this,i+=n[t].height;this.height=i}function wf(n){var r,u,t,i;for(this.children=n,r=0,u=0,t=0;t<n.length;++t)i=n[t],r+=i.chunkSize(),u+=i.height,i.parent=this;this.size=r;this.height=u;this.parent=null}function ur(n,t,i){function r(n,u,f){var o,e,s;if(n.linked)for(o=0;o<n.linked.length;++o)(e=n.linked[o],e.doc!=u)&&(s=f&&e.sharedHist,!i||s)&&(t(e.doc,s),r(e.doc,n,s))}r(n,null,!0)}function hp(n,t){if(t.cm)throw new Error("This document is already in use.");n.doc=t;t.cm=n;us(n);rs(n);n.options.lineWrapping||es(n);n.options.mode=t.modeOption;tt(n)}function r(n,t){var i,r,u,f;if(t-=n.first,t<0||t>=n.size)throw new Error("There is no line "+(t+n.first)+" in the document.");for(i=n;!i.lines;)for(r=0;;++r){if(u=i.children[r],f=u.chunkSize(),t<f){i=u;break}t-=f}return i.lines[t]}function fr(n,t,i){var u=[],r=t.line;return n.iter(t.line,i.line+1,function(n){var f=n.text;r==i.line&&(f=f.slice(0,i.ch));r==t.line&&(f=f.slice(t.ch));u.push(f);++r}),u}function uc(n,t,i){var r=[];return n.iter(t,i,function(n){r.push(n.text)}),r}function kt(n,t){var r=t-n.height,i;if(r)for(i=n;i;i=i.parent)i.height+=r}function c(n){var i,u,t,r;if(n.parent==null)return null;for(i=n.parent,u=g(i.lines,n),t=i.parent;t;i=t,t=t.parent)for(r=0;;++r){if(t.children[r]==i)break;u+=t.children[r].chunkSize()}return u+i.first}function er(n,t){var u=n.first,r,f,i,o,e;n:do{for(i=0;i<n.children.length;++i){if(r=n.children[i],f=r.height,t<f){n=r;continue n}t-=f;u+=r.chunkSize()}return u}while(!n.lines);for(i=0;i<n.lines.length;++i){if(o=n.lines[i],e=o.height,t<e)break;t-=e}return u+i}function si(n){var u,i,f,r,t,e;for(n=bt(n),u=0,i=n.parent,t=0;t<i.lines.length;++t)if(f=i.lines[t],f==n)break;else u+=f.height;for(r=i.parent;r;i=r,r=i.parent)for(t=0;t<r.children.length;++t)if(e=r.children[t],e==i)break;else u+=e.height;return u}function vt(n){var t=n.order;return t==null&&(t=n.order=aw(n.text)),t}function ao(n){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=n||1}function fc(n,t){var i={from:ds(t.from),to:ai(t),text:fr(n,t.from,t.to)};return ap(n,i,t.from.line,t.to.line+1),ur(n,function(n){ap(n,i,t.from.line,t.to.line+1)},!0),i}function cp(n){while(n.length){var t=h(n);if(t.ranges)n.pop();else break}}function rg(n,t){return t?(cp(n.done),h(n.done)):n.done.length&&!h(n.done).ranges?h(n.done):n.done.length>1&&!n.done[n.done.length-2].ranges?(n.done.pop(),h(n.done)):void 0}function lp(n,t,i,r){var u=n.history,s,f,o,c;if(u.undone.length=0,s=+new Date,(u.lastOp==r||u.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.cm&&u.lastModTime>s-n.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))&&(f=rg(u,u.lastOp==r)))o=h(f.changes),e(t.from,t.to)==0&&e(t.from,o.to)==0?o.to=ai(t):f.changes.push(fc(n,t));else for(c=h(u.done),c&&c.ranges||vo(n.sel,u.done),f={changes:[fc(n,t)],generation:u.generation},u.done.push(f);u.done.length>u.undoDepth;)u.done.shift(),u.done[0].ranges||u.done.shift();u.done.push(i);u.generation=++u.maxGeneration;u.lastModTime=u.lastSelTime=s;u.lastOp=u.lastSelOp=r;u.lastOrigin=u.lastSelOrigin=t.origin;o||y(n,"historyAdded")}function ug(n,t,i,r){var u=t.charAt(0);return u=="*"||u=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-n.history.lastSelTime<=(n.cm?n.cm.options.historyEventDelay:500)}function fg(n,t,i,r){var u=n.history,f=r&&r.origin;i==u.lastSelOp||f&&u.lastSelOrigin==f&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==f||ug(n,f,h(u.done),t))?u.done[u.done.length-1]=t:vo(t,u.done);u.lastSelTime=+new Date;u.lastSelOrigin=f;u.lastSelOp=i;r&&r.clearRedo!==!1&&cp(u.undone)}function vo(n,t){var i=h(t);i&&i.ranges&&i.equals(n)||t.push(n)}function ap(n,t,i,r){var u=t["spans_"+n.id],f=0;n.iter(Math.max(n.first,i),Math.min(n.first+n.size,r),function(i){i.markedSpans&&((u||(u=t["spans_"+n.id]={}))[f]=i.markedSpans);++f})}function eg(n){if(!n)return null;for(var i=0,t;i<n.length;++i)n[i].marker.explicitlyCleared?t||(t=n.slice(0,i)):t&&t.push(n[i]);return t?t.length?t:null:n}function og(n,t){var u=t["spans_"+n.id],i,r;if(!u)return null;for(i=0,r=[];i<t.text.length;++i)r.push(eg(u[i]));return r}function fu(n,t,i){for(var u,l,s,c,r,a,f,e=0,o=[];e<n.length;++e){if(u=n[e],u.ranges){o.push(i?ti.prototype.deepCopy.call(u):u);continue}for(l=u.changes,s=[],o.push({changes:s}),c=0;c<l.length;++c)if(r=l[c],s.push({from:r.from,to:r.to,text:r.text}),t)for(f in r)(a=f.match(/^spans_(\d+)$/))&&g(t,Number(a[1]))>-1&&(h(s)[f]=r[f],delete r[f])}return o}function vp(n,t,i,r){i<n.line?n.line+=r:t<n.line&&(n.line=t,n.ch=0)}function yp(t,i,r,u){for(var f,h,e,o,s=0;s<t.length;++s){if(f=t[s],h=!0,f.ranges){for(f.copied||(f=t[s]=f.deepCopy(),f.copied=!0),e=0;e<f.ranges.length;e++)vp(f.ranges[e].anchor,i,r,u),vp(f.ranges[e].head,i,r,u);continue}for(e=0;e<f.changes.length;++e)if(o=f.changes[e],r<o.from.line)o.from=n(o.from.line+u,o.from.ch),o.to=n(o.to.line+u,o.to.ch);else if(i<=o.to.line){h=!1;break}h||(t.splice(0,s+1),s=0)}}function pp(n,t){var i=t.from.line,r=t.to.line,u=t.text.length-(r-i)-1;yp(n.done,i,r,u);yp(n.undone,i,r,u)}function ec(n){return n.defaultPrevented!=null?n.defaultPrevented:n.returnValue==!1}function oc(n){return n.target||n.srcElement}function bp(n){var t=n.which;return t==null&&(n.button&1?t=1:n.button&2?t=3:n.button&4&&(t=2)),lt&&n.ctrlKey&&t==1&&(t=3),t}function yo(n,t,i){var r=n._handlers&&n._handlers[t];return i?r&&r.length>0?r.slice():sc:r||sc}function ut(n,t){function e(n){return function(){n.apply(null,f)}}var u=yo(n,t,!1),f,i,r;if(u.length)for(f=Array.prototype.slice.call(arguments,2),di?i=di.delayedCallbacks:df?i=df:(i=df=[],setTimeout(sg,0)),r=0;r<u.length;++r)i.push(e(u[r]))}function sg(){var t=df,n;for(df=null,n=0;n<t.length;++n)t[n]()}function p(n,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),y(n,i||t.type,n,t),ec(t)||t.codemirrorIgnore}function kp(n){var i=n._handlers&&n._handlers.cursorActivity,r,t;if(i)for(r=n.curOp.cursorActivityHandlers||(n.curOp.cursorActivityHandlers=[]),t=0;t<i.length;++t)g(r,i[t])==-1&&r.push(i[t])}function ht(n,t){return yo(n,t).length>0}function eu(n){n.prototype.on=function(n,t){u(this,n,t)};n.prototype.off=function(n,t){dt(this,n,t)}}function or(){this.id=null}function tw(n){while(po.length<=n)po.push(h(po)+" ");return po[n]}function h(n){return n[n.length-1]}function g(n,t){for(var i=0;i<n.length;++i)if(n[i]==t)return i;return-1}function wo(n,t){for(var r=[],i=0;i<n.length;i++)r[i]=t(n[i],i);return r}function ne(){}function iw(n,t){var i;return Object.create?i=Object.create(n):(ne.prototype=n,i=new ne),t&&pt(t,i),i}function pt(n,t,i){t||(t={});for(var r in n)n.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=n[r]);return t}function te(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t)}}function bo(n,t){return t?t.source.indexOf("\\w")>-1&&cc(n)?!0:t.test(n):cc(n)}function uw(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0}function ie(n){return n.charCodeAt(0)>=768&&fw.test(n)}function i(n,t,i,r){var u=document.createElement(n),f;if(i&&(u.className=i),r&&(u.style.cssText=r),typeof t=="string")u.appendChild(document.createTextNode(t));else if(t)for(f=0;f<t.length;++f)u.appendChild(t[f]);return u}function cr(n){for(var t=n.childNodes.length;t>0;--t)n.removeChild(n.firstChild);return n}function st(n,t){return cr(n).appendChild(t)}function ni(){for(var n=document.activeElement;n&&n.root&&n.root.activeElement;)n=n.root.activeElement;return n}function re(n){return new RegExp("(^|\\s)"+n+"(?:$|\\s)\\s*")}function lc(n,t){for(var r=n.split(" "),i=0;i<r.length;i++)r[i]&&!re(r[i]).test(t)&&(t+=" "+r[i]);return t}function ew(n){var i,t,r;if(document.body.getElementsByClassName)for(i=document.body.getElementsByClassName("CodeMirror"),t=0;t<i.length;t++)r=i[t].CodeMirror,r&&n(r)}function hg(){ac||(cg(),ac=!0)}function cg(){var n;u(window,"resize",function(){n==null&&(n=setTimeout(function(){n=null;ew(ok)},100))});u(window,"blur",function(){ew(rf)})}function lg(n){var t,r;return vc==null&&(t=i("span","​"),st(n,i("span",[t,document.createTextNode("x")])),n.firstChild.offsetHeight!=0&&(vc=t.offsetWidth<=1&&t.offsetHeight>2&&!(s&&a<8))),r=vc?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px"),r.setAttribute("cm-text",""),r}function ag(n){var i,t,r;return yc!=null?yc:(i=st(n,document.createTextNode("AخA")),t=hr(i,0,1).getBoundingClientRect(),!t||t.left==t.right)?!1:(r=hr(i,1,2).getBoundingClientRect(),yc=r.right-t.right<3)}function pg(n){if(pc!=null)return pc;var t=st(n,i("span","x")),r=t.getBoundingClientRect(),u=hr(t,0,1).getBoundingClientRect();return pc=Math.abs(r.left-u.left)>1}function wg(n,t,i,r){var e,f,u;if(!n)return r(t,i,"ltr");for(e=!1,f=0;f<n.length;++f)u=n[f],(u.from<i&&u.to>t||t==i&&u.to==t)&&(r(Math.max(u.from,t),Math.min(u.to,i),u.level==1?"rtl":"ltr"),e=!0);e||r(t,i,"ltr")}function wc(n){return n.level%2?n.to:n.from}function bc(n){return n.level%2?n.from:n.to}function go(n){var t=vt(n);return t?wc(t[0]):0}function ns(n){var t=vt(n);return t?bc(h(t)):n.text.length}function hw(t,i){var e=r(t.doc,i),u=bt(e),f,o;return u!=e&&(i=c(u)),f=vt(u),o=f?f[0].level%2?ns(u):go(u):0,n(i,o)}function bg(t,i){for(var e,u=r(t.doc,i),f,o;e=af(u);)u=e.find(1,!0).line,i=null;return f=vt(u),o=f?f[0].level%2?go(u):ns(u):u.text.length,n(i==null?c(u):i,o)}function cw(t,i){var u=hw(t,i.line),e=r(t.doc,u.line),o=vt(e),f,s;return!o||o[0].level==0?(f=Math.max(0,e.text.search(/\S/)),s=i.line==u.line&&i.ch<=f&&i.ch,n(u.line,s?0:f)):u}function kg(n,t,i){var r=n[0].level;return t==r?!0:i==r?!1:t<i}function ts(n,t){var r,u,i;for(ue=null,r=0;r<n.length;++r){if(i=n[r],i.from<t&&i.to>t)return r;if(i.from==t||i.to==t)if(u==null)u=r;else return kg(n,i.level,n[u].level)?(i.from!=i.to&&(ue=u),r):(i.from!=i.to&&(ue=r),u)}return u}function kc(n,t,i,r){if(!r)return t+i;do t+=i;while(t>0&&ie(n.text.charAt(t)));return t}function dc(n,t,i,r){var e=vt(n);if(!e)return lw(n,t,i,r);for(var o=ts(e,t),u=e[o],f=kc(n,t,u.level%2?-i:i,r);;){if(f>u.from&&f<u.to)return f;if(f==u.from||f==u.to)return ts(e,f)==o?f:(u=e[o+=i],i>0==u.level%2?u.to:u.from);if(u=e[o+=i],!u)return null;f=i>0==u.level%2?kc(n,u.to,-1,r):kc(n,u.from,1,r)}}function lw(n,t,i,r){var u=t+i;if(r)while(u>0&&ie(n.text.charAt(u)))u+=i;return u<0||u>n.text.length?null:u}var ft=navigator.userAgent,gc=navigator.platform,hi=/gecko\/\d/i.test(ft),nl=/MSIE \d/.test(ft),tl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ft),s=nl||tl,a=s&&(nl?document.documentMode||6:tl[1]),w=/WebKit\//.test(ft),vw=w&&/Qt\/\d+\.\d+/.test(ft),yw=/Chrome\//.test(ft),ct=/Opera\//.test(ft),il=/Apple Computer/.test(navigator.vendor),pw=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ft),ww=/PhantomJS/.test(ft),lr=/AppleWebKit/.test(ft)&&/Mobile\/\w+/.test(ft),hu=lr||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ft),lt=lr||/Mac/.test(gc),bw=/win/i.test(gc),pi=ct&&ft.match(/Version\/(\d*\.\d*)/),n,e,et,pe,bi,di,fv,de,ge,lh,tf,rt,ah,av,io,ai,ry,tr,bh,kh,tu,iu,oo,ir,ei,uy,ef,oi,sf,vi,hf,cf,vf,uu,tp,ip,op,it,sp,bf,d,wp,kf,u,sc,sr,rw,cc,fw,hr,ko,ou,su,ac,ow,vc,yc,yi,ue,aw;pi&&(pi=Number(pi[1]));pi&&pi>=15&&(ct=!1,w=!0);var rl=lt&&(vw||ct&&(pi==null||pi<12.11)),is=hi||s&&a>=9,ul=!1,ci=!1;ss.prototype=pt({update:function(n){var i=n.scrollWidth>n.clientWidth+1,r=n.scrollHeight>n.clientHeight+1,t=n.nativeBarWidth,u,f;return r?(this.vert.style.display="block",this.vert.style.bottom=i?t+"px":"0",u=n.viewHeight-(i?t:0),this.vert.firstChild.style.height=Math.max(0,n.scrollHeight-n.clientHeight+u)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),i?(this.horiz.style.display="block",this.horiz.style.right=r?t+"px":"0",this.horiz.style.left=n.barLeft+"px",f=n.viewWidth-n.barLeft-(r?t:0),this.horiz.firstChild.style.width=n.scrollWidth-n.clientWidth+f+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&n.clientHeight>0&&(t==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?t:0,bottom:i?t:0}},setScrollLeft:function(n){this.horiz.scrollLeft!=n&&(this.horiz.scrollLeft=n);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(n){this.vert.scrollTop!=n&&(this.vert.scrollTop=n);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var n=lt&&!pw?"12px":"18px";this.horiz.style.height=this.vert.style.width=n;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new or;this.disableVert=new or},enableZeroWidthBar:function(n,t){function i(){var r=n.getBoundingClientRect(),u=document.elementFromPoint(r.left+1,r.bottom-1);u!=n?n.style.pointerEvents="none":t.set(1e3,i)}n.style.pointerEvents="auto";t.set(1e3,i)},clear:function(){var n=this.horiz.parentNode;n.removeChild(this.horiz);n.removeChild(this.vert)}},ss.prototype);hs.prototype=pt({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},hs.prototype);t.scrollbarModel={"native":ss,"null":hs};ee.prototype.signal=function(n,t){ht(n,t)&&this.events.push(arguments)};ee.prototype.finish=function(){for(var n=0;n<this.events.length;n++)y.apply(null,this.events[n])};n=t.Pos=function(t,i){if(!(this instanceof n))return new n(t,i);this.line=t;this.ch=i};e=t.cmpPos=function(n,t){return n.line-t.line||n.ch-t.ch};et=null;gs.prototype=pt({init:function(n){function e(n){if(!p(i,n)){if(i.somethingSelected())et=i.getSelections(),t.inaccurateSelection&&(t.prevInput="",t.inaccurateSelection=!1,r.value=et.join("\n"),sr(r));else if(i.options.lineWiseCopyCut){var u=na(i);et=u.text;n.type=="cut"?i.setSelections(u.ranges,null,gt):(t.prevInput="",r.value=u.text.join("\n"),sr(r))}else return;n.type=="cut"&&(i.state.cutIncoming=!0)}}var t=this,i=this.cm,f=this.wrapper=ia(),r=this.textarea=f.firstChild;n.wrapper.insertBefore(f,n.wrapper.firstChild);lr&&(r.style.width="0px");u(r,"input",function(){s&&a>=9&&t.hasSelection&&(t.hasSelection=null);t.poll()});u(r,"paste",function(n){p(i,n)||dl(n,i)||(i.state.pasteIncoming=!0,t.fastPoll())});u(r,"cut",e);u(r,"copy",e);u(n.scroller,"paste",function(r){fi(n,r)||p(i,r)||(i.state.pasteIncoming=!0,t.focus())});u(n.lineSpace,"selectstart",function(t){fi(n,t)||d(t)});u(r,"compositionstart",function(){var n=i.getCursor("from");t.composing&&t.composing.range.clear();t.composing={start:n,range:i.markText(n,i.getCursor("to"),{className:"CodeMirror-composing"})}});u(r,"compositionend",function(){t.composing&&(t.poll(),t.composing.range.clear(),t.composing=null)})},prepareSelection:function(){var n=this.cm,t=n.display,e=n.doc,i=va(n);if(n.options.moveInputWithCursor){var r=ri(n,e.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),f=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+f.top-u.top));i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+f.left-u.left))}return i},showSelection:function(n){var i=this.cm,t=i.display;st(t.cursorDiv,n.cursors);st(t.selectionDiv,n.selection);n.teTop!=null&&(this.wrapper.style.top=n.teTop+"px",this.wrapper.style.left=n.teLeft+"px")},reset:function(n){var i,f,t,e,r,u;this.contextMenuPending||(t=this.cm,e=t.doc,t.somethingSelected()?(this.prevInput="",r=e.sel.primary(),i=sw&&(r.to().line-r.from().line>100||(f=t.getSelection()).length>1e3),u=i?"-":f||t.getSelection(),this.textarea.value=u,t.state.focused&&sr(this.textarea),s&&a>=9&&(this.hasSelection=u)):n||(this.prevInput=this.textarea.value="",s&&a>=9&&(this.hasSelection=null)),this.inaccurateSelection=i)},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if(this.cm.options.readOnly!="nocursor"&&(!hu||ni()!=this.textarea))try{this.textarea.focus()}catch(n){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var n=this;n.pollingFast||n.polling.set(this.cm.options.pollInterval,function(){n.poll();n.cm.state.focused&&n.slowPoll()})},fastPoll:function(){function i(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,i))}var t=!1,n=this;n.pollingFast=!0;n.polling.set(20,i)},poll:function(){var n=this.cm,f=this.textarea,r=this.prevInput,t,e,u,o,i;if(this.contextMenuPending||!n.state.focused||yg(f)&&!r&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq||(t=f.value,t==r&&!n.somethingSelected()))return!1;if(s&&a>=9&&this.hasSelection===t||lt&&/[\uf700-\uf7ff]/.test(t))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu&&(e=t.charCodeAt(0),e!=8203||r||(r="​"),e==8666))return this.reset(),this.cm.execCommand("undo");for(u=0,o=Math.min(r.length,t.length);u<o&&r.charCodeAt(u)==t.charCodeAt(u);)++u;return i=this,ot(n,function(){ce(n,t.slice(u),r.length-u,null,i.composing?"*compose":null);t.length>1e3||t.indexOf("\n")>-1?f.value=i.prevInput="":i.prevInput=t;i.composing&&(i.composing.range.clear(),i.composing.range=n.markText(i.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){s&&a>=9&&(this.hasSelection=null);this.fastPoll()},onContextMenu:function(n){function k(){if(i.selectionStart!=null){var n=t.somethingSelected(),u="​"+(n?i.value:"");i.value="⇚";i.value=u;f.prevInput=n?"":"​";i.selectionStart=1;i.selectionEnd=u.length;r.selForContextMenu=t.doc.sel}}function d(){if(f.contextMenuPending=!1,f.wrapper.style.cssText=y,i.style.cssText=l,s&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=g),i.selectionStart!=null){(!s||s&&a<9)&&k();var u=0,n=function(){r.selForContextMenu==t.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&f.prevInput=="​"?v(t,ef.selectAll)(t):u++<10?r.detectingSelectAll=setTimeout(n,500):r.input.reset()};r.detectingSelectAll=setTimeout(n,200)}}var f=this,t=f.cm,r=t.display,i=f.textarea,e=nr(t,n),g=r.scroller.scrollTop,c,l,y,o,p,h;e&&!ct&&(c=t.options.resetSelectionOnContextMenu,c&&t.doc.sel.contains(e)==-1&&v(t,b)(t.doc,ii(e),gt),l=i.style.cssText,y=f.wrapper.style.cssText,f.wrapper.style.cssText="position: absolute",o=f.wrapper.getBoundingClientRect(),i.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(n.clientY-o.top-5)+"px; left: "+(n.clientX-o.left-5)+"px; z-index: 1000; background: "+(s?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",w&&(p=window.scrollY),r.input.focus(),w&&window.scrollTo(null,p),r.input.reset(),t.somethingSelected()||(i.value=f.prevInput=" "),f.contextMenuPending=!0,r.selForContextMenu=t.doc.sel,clearTimeout(r.detectingSelectAll),s&&a>=9&&k(),is?(kf(n),h=function(){dt(window,"mouseup",h);setTimeout(d,20)},u(window,"mouseup",h)):setTimeout(d,50))},readOnlyChanged:function(n){n||this.reset()},setUneditable:ne,needsContentAttribute:!1},gs.prototype);nh.prototype=pt({init:function(t){function e(n){var r,t,u,f;if(!p(i,n)){if(i.somethingSelected())et=i.getSelections(),n.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut)r=na(i),et=r.text,n.type=="cut"&&i.operation(function(){i.setSelections(r.ranges,0,gt);i.replaceSelection("",null,"cut")});else return;n.clipboardData&&!lr?(n.preventDefault(),n.clipboardData.clearData(),n.clipboardData.setData("text/plain",et.join("\n"))):(t=ia(),u=t.firstChild,i.display.lineSpace.insertBefore(t,i.display.lineSpace.firstChild),u.value=et.join("\n"),f=document.activeElement,sr(u),setTimeout(function(){i.display.lineSpace.removeChild(t);f.focus()},50))}}var r=this,i=r.cm,f=r.div=t.lineDiv;ta(f);u(f,"paste",function(n){p(i,n)||dl(n,i)});u(f,"compositionstart",function(t){var u=t.data;if(r.composing={sel:i.doc.sel,data:u,startData:u},u){var f=i.doc.sel.primary(),o=i.getLine(f.head.line),e=o.indexOf(u,Math.max(0,f.head.ch-u.length));e>-1&&e<=f.head.ch&&(r.composing.sel=ii(n(f.head.line,e),n(f.head.line,e+u.length)))}});u(f,"compositionupdate",function(n){r.composing.data=n.data});u(f,"compositionend",function(n){var t=r.composing;t&&(n.data==t.startData||/\u200b/.test(n.data)||(t.data=n.data),setTimeout(function(){t.handled||r.applyComposition(t);r.composing==t&&(r.composing=null)},50))});u(f,"touchstart",function(){r.forceCompositionEnd()});u(f,"input",function(){r.composing||(i.isReadOnly()||!r.pollContent())&&ot(r.cm,function(){tt(i)})});u(f,"copy",e);u(f,"cut",e)},prepareSelection:function(){var n=va(this.cm,!1);return n.focus=this.cm.state.focused,n},showSelection:function(n){n&&this.cm.display.view.length&&(n.focus&&this.showPrimarySelection(),this.showMultipleSelections(n))},showPrimarySelection:function(){var n=window.getSelection(),o=this.cm.doc.sel.primary(),s=le(this.cm,n.anchorNode,n.anchorOffset),h=le(this.cm,n.focusNode,n.focusOffset),t,r,c,l,u,i,f;if((!s||s.bad||!h||h.bad||e(he(s,h),o.from())!=0||e(se(s,h),o.to())!=0)&&(t=ra(this.cm,o.from()),r=ra(this.cm,o.to()),t||r)){c=this.cm.display.view;l=n.rangeCount&&n.getRangeAt(0);t?r||(u=c[c.length-1].measure,i=u.maps?u.maps[u.maps.length-1]:u.map,r={node:i[i.length-1],offset:i[i.length-2]-i[i.length-3]}):t={node:c[0].measure.map[2],offset:0};try{f=hr(t.node,t.offset,r.offset,r.node)}catch(a){}f&&(!hi&&this.cm.state.focused?(n.collapse(t.node,t.offset),f.collapsed||n.addRange(f)):(n.removeAllRanges(),n.addRange(f)),l&&n.anchorNode==null?n.addRange(l):hi&&this.startGracePeriod());this.rememberSelection()}},startGracePeriod:function(){var n=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){n.gracePeriod=!1;n.selectionChanged()&&n.cm.operation(function(){n.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(n){st(this.cm.display.cursorDiv,n.cursors);st(this.cm.display.selectionDiv,n.selection)},rememberSelection:function(){var n=window.getSelection();this.lastAnchorNode=n.anchorNode;this.lastAnchorOffset=n.anchorOffset;this.lastFocusNode=n.focusNode;this.lastFocusOffset=n.focusOffset},selectionInEditor:function(){var n=window.getSelection(),t;return n.rangeCount?(t=n.getRangeAt(0).commonAncestorContainer,ko(this.div,t)):!1},focus:function(){this.cm.options.readOnly!="nocursor"&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))}var n=this;this.selectionInEditor()?this.pollSelection():ot(this.cm,function(){n.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,t)},selectionChanged:function(){var n=window.getSelection();return n.anchorNode!=this.lastAnchorNode||n.anchorOffset!=this.lastAnchorOffset||n.focusNode!=this.lastFocusNode||n.focusOffset!=this.lastFocusOffset},pollSelection:function(){var t,n,i,r;this.composing||this.gracePeriod||!this.selectionChanged()||(t=window.getSelection(),n=this.cm,this.rememberSelection(),i=le(n,t.anchorNode,t.anchorOffset),r=le(n,t.focusNode,t.focusOffset),i&&r&&ot(n,function(){b(n.doc,ii(i,r),gt);(i.bad||r.bad)&&(n.curOp.selectionChanged=!0)}))},pollContent:function(){var f=this.cm,i=f.display,tt=f.doc.sel.primary(),b=tt.from(),it=tt.to(),k,l,y,p,o,w,t,u,g,nt;if(b.line<i.viewFrom||it.line>i.viewTo-1)return!1;for(b.line==i.viewFrom||(k=gi(f,b.line))==0?(l=c(i.view[0].line),y=i.view[0].node):(l=c(i.view[k].line),y=i.view[k-1].node.nextSibling),p=gi(f,it.line),p==i.view.length-1?(o=i.viewTo-1,w=i.lineDiv.lastChild):(o=c(i.view[p+1].line)-1,w=i.view[p+1].node.previousSibling),t=f.doc.splitLines(ob(f,y,w,l,o)),u=fr(f.doc,n(l,0),n(o,r(f.doc,o).text.length));t.length>1&&u.length>1;)if(h(t)==h(u))t.pop(),u.pop(),o--;else if(t[0]==u[0])t.shift(),u.shift(),l++;else break;for(var s=0,a=0,rt=t[0],ut=u[0],ft=Math.min(rt.length,ut.length);s<ft&&rt.charCodeAt(s)==ut.charCodeAt(s);)++s;for(var v=h(t),d=h(u),et=Math.min(v.length-(t.length==1?s:0),d.length-(u.length==1?s:0));a<et&&v.charCodeAt(v.length-a-1)==d.charCodeAt(d.length-a-1);)++a;return t[t.length-1]=v.slice(0,v.length-a),t[0]=t[0].slice(s),g=n(l,s),nt=n(o,u.length?h(u).length-a:0),t.length>1||t[0]||e(g,nt)?(dr(f.doc,t,g,nt,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(n){this.cm.isReadOnly()?v(this.cm,tt)(this.cm):n.data&&n.data!=n.startData&&v(this.cm,ce)(this.cm,n.data,0,n.sel)},setUneditable:function(n){n.contentEditable="false"},onKeyPress:function(n){n.preventDefault();this.cm.isReadOnly()||v(this.cm,ce)(this.cm,String.fromCharCode(n.charCode==null?n.keyCode:n.charCode),0)},readOnlyChanged:function(n){this.div.contentEditable=String(n!="nocursor")},onContextMenu:ne,resetPosition:ne,needsContentAttribute:!0},nh.prototype);t.inputStyles={textarea:gs,contenteditable:nh};ti.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(n){var t,i,r;if(n==this)return!0;if(n.primIndex!=this.primIndex||n.ranges.length!=this.ranges.length)return!1;for(t=0;t<this.ranges.length;t++)if(i=this.ranges[t],r=n.ranges[t],e(i.anchor,r.anchor)!=0||e(i.head,r.head)!=0)return!1;return!0},deepCopy:function(){for(var t=[],n=0;n<this.ranges.length;n++)t[n]=new l(ds(this.ranges[n].anchor),ds(this.ranges[n].head));return new ti(t,this.primIndex)},somethingSelected:function(){for(var n=0;n<this.ranges.length;n++)if(!this.ranges[n].empty())return!0;return!1},contains:function(n,t){var i,r;for(t||(t=n),i=0;i<this.ranges.length;i++)if(r=this.ranges[i],e(t,r.from())>=0&&e(n,r.to())<=0)return i;return-1}};l.prototype={from:function(){return he(this.anchor,this.head)},to:function(){return se(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};pe={left:0,right:0,top:0,bottom:0};di=null;fv=0;lh=0;tf=0;rt=null;s?rt=-.53:hi?rt=15:yw?rt=-.7:il&&(rt=-1/3);ah=function(n){var i=n.wheelDeltaX,t=n.wheelDeltaY;return i==null&&n.detail&&n.axis==n.HORIZONTAL_AXIS&&(i=n.detail),t==null&&n.detail&&n.axis==n.VERTICAL_AXIS?t=n.detail:t==null&&(t=n.wheelDelta),{x:i,y:t}};t.wheelEventPixels=function(n){var t=ah(n);return t.x*=rt,t.y*=rt,t};av=new or;io=null;ai=t.changeEnd=function(t){return t.text?n(t.from.line+t.text.length-1,h(t.text).length+(t.text.length==1?t.from.ch:0)):t.to};t.prototype={constructor:t,focus:function(){window.focus();this.display.input.focus()},setOption:function(n,t){var i=this.options,r=i[n];(i[n]!=t||n=="mode")&&(i[n]=t,tr.hasOwnProperty(n)&&v(this,tr[n])(this,t,r))},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,t){this.state.keyMaps[t?"push":"unshift"](so(n))},removeKeyMap:function(n){for(var i=this.state.keyMaps,t=0;t<i.length;++t)if(i[t]==n||i[t].name==n)return i.splice(t,1),!0},addOverlay:k(function(n,i){var r=n.token?n:t.getMode(this.options,n);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:n,opaque:i&&i.opaque});this.state.modeGen++;tt(this)}),removeOverlay:k(function(n){for(var i=this.state.overlays,r,t=0;t<i.length;++t)if(r=i[t].modeSpec,r==n||typeof n=="string"&&r.name==n){i.splice(t,1);this.state.modeGen++;tt(this);return}}),indentLine:k(function(n,t,i){typeof t!="string"&&typeof t!="number"&&(t=t==null?this.options.smartIndent?"smart":"prev":t?"add":"subtract");yu(this.doc,n)&&ff(this,n,t,i)}),indentSelection:k(function(n){for(var e=this.doc.sel.ranges,r=-1,i,u,f,t=0;t<e.length;t++)if(i=e[t],i.empty())i.head.line>r&&(ff(this,i.head.line,n,!0),r=i.head.line,t==this.doc.sel.primIndex&&gr(this));else{var o=i.from(),s=i.to(),h=Math.max(r,o.line);for(r=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1,u=h;u<r;++u)ff(this,u,n);f=this.doc.sel.ranges;o.ch==0&&e.length==f.length&&f[t].from().ch>0&&th(this.doc,t,new l(o,f[t].to()),gt)}}),getTokenAt:function(n,t){return ky(this,n,t)},getLineTokens:function(t,i){return ky(this,n(t),i,!0)},getTokenTypeAt:function(n){var t,f;n=o(this.doc,n);var u=np(this,r(this.doc,n.line)),s=0,h=(u.length-1)/2,e=n.ch,i;if(e==0)i=u[2];else for(;;)if(t=s+h>>1,(t?u[t*2-1]:0)>=e)h=t;else if(u[t*2+1]<e)s=t+1;else{i=u[t*2+2];break}return f=i?i.indexOf("cm-overlay "):-1,f<0?i:f==0?null:i.slice(0,f-1)},getModeAt:function(n){var i=this.doc.mode;return i.innerMode?t.innerMode(i,this.getTokenAt(n).state).mode:i},getHelper:function(n,t){return this.getHelpers(n,t)[0]},getHelpers:function(n,t){var f=[],r,i,o,u,e;if(!ir.hasOwnProperty(t))return f;if(r=ir[t],i=this.getModeAt(n),typeof i[t]=="string")r[i[t]]&&f.push(r[i[t]]);else if(i[t])for(u=0;u<i[t].length;u++)o=r[i[t][u]],o&&f.push(o);else i.helperType&&r[i.helperType]?f.push(r[i.helperType]):r[i.name]&&f.push(r[i.name]);for(u=0;u<r._global.length;u++)e=r._global[u],e.pred(i,this)&&g(f,e.val)==-1&&f.push(e.val);return f},getStateAfter:function(n,t){var i=this.doc;return n=ua(i,n==null?i.first+i.size-1:n),ku(this,n+1,t)},cursorCoords:function(n,t){var r,i=this.doc.sel.primary();return r=n==null?i.head:typeof n=="object"?o(this.doc,n):n?i.from():i.to(),ri(this,r,t||"page")},charCoords:function(n,t){return hh(this,o(this.doc,n),t||"page")},coordsChar:function(n,t){return n=rv(this,n,t||"page"),ch(this,n.left,n.top)},lineAtHeight:function(n,t){return n=rv(this,{top:n,left:0},t||"page").top,er(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,t){var f=!1,i,u;return typeof n=="number"?(u=this.doc.first+this.doc.size-1,n<this.doc.first?n=this.doc.first:n>u&&(n=u,f=!0),i=r(this.doc,n)):i=n,sh(this,i,{top:0,left:0},t||"page").top+(f?this.doc.height-si(i):0)},defaultTextHeight:function(){return ki(this.display)},defaultCharWidth:function(){return gu(this.display)},setGutterMarker:k(function(n,t,i){return eo(this.doc,n,"gutter",function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return r[t]=i,!i&&uw(r)&&(n.gutterMarkers=null),!0})}),clearGutter:k(function(n){var t=this,i=t.doc,r=i.first;i.iter(function(i){i.gutterMarkers&&i.gutterMarkers[n]&&(i.gutterMarkers[n]=null,ui(t,r,"gutter"),uw(i.gutterMarkers)&&(i.gutterMarkers=null));++r})}),lineInfo:function(n){var t;if(typeof n=="number"){if(!yu(this.doc,n)||(t=n,n=r(this.doc,n),!n))return null}else if(t=c(n),t==null)return null;return{line:t,handle:n,text:n.text,gutterMarkers:n.gutterMarkers,textClass:n.textClass,bgClass:n.bgClass,wrapClass:n.wrapClass,widgets:n.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,t,i,r,u){var s=this.display,e,f,h,c;n=ri(this,o(this.doc,n));e=n.bottom;f=n.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);s.sizer.appendChild(t);r=="over"?e=n.top:(r=="above"||r=="near")&&(h=Math.max(s.wrapper.clientHeight,this.doc.height),c=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),(r=="above"||n.bottom+t.offsetHeight>h)&&n.top>t.offsetHeight?e=n.top-t.offsetHeight:n.bottom+t.offsetHeight<=h&&(e=n.bottom),f+t.offsetWidth>c&&(f=c-t.offsetWidth));t.style.top=e+"px";t.style.left=t.style.right="";u=="right"?(f=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(u=="left"?f=0:u=="middle"&&(f=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=f+"px");i&&rd(this,f,e,f+t.offsetWidth,e+t.offsetHeight)},triggerOnKeyDown:k(yv),triggerOnKeyPress:k(wv),triggerOnKeyUp:pv,execCommand:function(n){if(ef.hasOwnProperty(n))return ef[n].call(null,this)},triggerElectric:k(function(n){gl(this,n)}),findPosH:function(n,t,i,r){var e=1,f,u;for(t<0&&(e=-1,t=-t),f=0,u=o(this.doc,n);f<t;++f)if(u=wh(this.doc,u,e,i,r),u.hitSide)break;return u},moveH:k(function(n,t){var i=this;i.extendSelectionsBy(function(r){return i.display.shift||i.doc.extend||r.empty()?wh(i.doc,r.head,n,t,i.options.rtlMoveVisually):n<0?r.from():r.to()},gf)}),deleteH:k(function(n,t){var r=this.doc.sel,i=this.doc;r.somethingSelected()?i.replaceSelection("",null,"+delete"):nu(this,function(r){var u=wh(i,r.head,n,t,!1);return n<0?{from:u,to:r.head}:{from:r.head,to:u}})}),findPosV:function(n,t,i,r){var h=1,e=r,s,u,f;for(t<0&&(h=-1,t=-t),s=0,u=o(this.doc,n);s<t;++s)if(f=ri(this,u,"div"),e==null?e=f.left:f.left=e,u=iy(this,f,h,i),u.hitSide)break;return u},moveV:k(function(n,t){var r=this,i=this.doc,f=[],e=!r.display.shift&&!i.extend&&i.sel.somethingSelected(),u;if(i.extendSelectionsBy(function(u){var o,s;return e?n<0?u.from():u.to():(o=ri(r,u.head,"div"),u.goalColumn!=null&&(o.left=u.goalColumn),f.push(o.left),s=iy(r,o,n,t),t=="page"&&u==i.sel.primary()&&ph(r,null,hh(r,s,"div").top-o.top),s)},gf),f.length)for(u=0;u<i.sel.ranges.length;u++)i.sel.ranges[u].goalColumn=f[u]}),findWordAt:function(t){var h=this.doc,u=r(h,t.line).text,i=t.ch,f=t.ch,e,o,s;if(u){for(e=this.getHelper(t,"wordChars"),(t.xRel<0||f==u.length)&&i?--i:++f,o=u.charAt(i),s=bo(o,e)?function(n){return bo(n,e)}:/\s/.test(o)?function(n){return/\s/.test(n)}:function(n){return!/\s/.test(n)&&!bo(n)};i>0&&s(u.charAt(i-1));)--i;while(f<u.length&&s(u.charAt(f)))++f}return new l(n(t.line,i),n(t.line,f))},toggleOverwrite:function(n){(n==null||n!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?su(this.display.cursorDiv,"CodeMirror-overwrite"):ou(this.display.cursorDiv,"CodeMirror-overwrite"),y(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==ni()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:k(function(n,t){(n!=null||t!=null)&&fo(this);n!=null&&(this.curOp.scrollLeft=n);t!=null&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-wt(this)-this.display.barHeight,width:n.scrollWidth-wt(this)-this.display.barWidth,clientHeight:fh(this),clientWidth:wi(this)}},scrollIntoView:k(function(t,i){if(t==null?(t={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof t=="number"?t={from:n(t,0),to:null}:t.from==null&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=i||0,t.from.line!=null)fo(this),this.curOp.scrollToPos=t;else{var r=uo(this,Math.min(t.from.left,t.to.left),Math.min(t.from.top,t.to.top)-t.margin,Math.max(t.from.right,t.to.right),Math.max(t.from.bottom,t.to.bottom)+t.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:k(function(n,t){function u(n){return typeof n=="number"||/^\d+$/.test(String(n))?n+"px":n}var i=this,r;n!=null&&(i.display.wrapper.style.width=u(n));t!=null&&(i.display.wrapper.style.height=u(t));i.options.lineWrapping&&nv(this);r=i.display.viewFrom;i.doc.iter(r,i.display.viewTo,function(n){if(n.widgets)for(var t=0;t<n.widgets.length;t++)if(n.widgets[t].noHScroll){ui(i,r,"widget");break}++r});i.curOp.forceUpdate=!0;y(i,"refresh",this)}),operation:function(n){return ot(this,n)},refresh:k(function(){var n=this.display.cachedTextHeight;tt(this);this.curOp.forceUpdate=!0;du(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);fs(this);(n==null||Math.abs(n-ki(this.display))>.5)&&us(this);y(this,"refresh",this)}),swapDoc:k(function(n){var t=this.doc;return t.cm=null,hp(this,n),du(this),this.display.input.reset(),this.scrollTo(n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,ut(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};eu(t);ry=t.defaults={};tr=t.optionHandlers={};bh=t.Init={toString:function(){return"CodeMirror.Init"}};f("value","",function(n,t){n.setValue(t)},!0);f("mode",null,function(n,t){n.doc.modeOption=t;rs(n)},!0);f("indentUnit",2,rs,!0);f("indentWithTabs",!1);f("smartIndent",!0);f("tabSize",4,function(n){cu(n);du(n);tt(n)},!0);f("lineSeparator",null,function(t,i){var r,f,u;if(t.doc.lineSep=i,i)for(r=[],f=t.doc.first,t.doc.iter(function(t){for(var u,e=0;;){if(u=t.text.indexOf(i,e),u==-1)break;e=u+i.length;r.push(n(f,u))}f++}),u=r.length-1;u>=0;u--)dr(t.doc,i,r[u],n(r[u].line,r[u].ch+i.length))});f("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(n,i,r){n.state.specialChars=new RegExp(i.source+(i.test("\t")?"":"|\t"),"g");r!=t.Init&&n.refresh()});f("specialCharPlaceholder",dd,function(n){n.refresh()},!0);f("electricChars",!0);f("inputStyle",hu?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor");},!0);f("rtlMoveVisually",!bw);f("wholeLineUpdateBefore",!0);f("theme","default",function(n){el(n);lu(n)},!0);f("keyMap","default",function(n,i,r){var f=so(i),u=r!=t.Init&&so(r);u&&u.detach&&u.detach(n,f);f.attach&&f.attach(n,u||null)});f("extraKeys",null);f("lineWrapping",!1,dw,!0);f("gutters",[],function(n){os(n.options);lu(n)},!0);f("fixedGutter",!0,function(n,t){n.display.gutters.style.left=t?vs(n.display)+"px":"0";n.refresh()},!0);f("coverGutterNextToScrollbar",!1,function(n){ar(n)},!0);f("scrollbarStyle","native",function(n){sl(n);ar(n);n.display.scrollbars.setScrollTop(n.doc.scrollTop);n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0);f("lineNumbers",!1,function(n){os(n.options);lu(n)},!0);f("firstLineNumber",1,lu,!0);f("lineNumberFormatter",function(n){return n},lu,!0);f("showCursorWhenSelecting",!1,wu,!0);f("resetSelectionOnContextMenu",!0);f("lineWiseCopyCut",!0);f("readOnly",!1,function(n,t){t=="nocursor"?(rf(n),n.display.input.blur(),n.display.disabled=!0):n.display.disabled=!1;n.display.input.readOnlyChanged(t)});f("disableInput",!1,function(n,t){t||n.display.input.reset()},!0);f("dragDrop",!0,ek);f("allowDropFileTypes",null);f("cursorBlinkRate",530);f("cursorScrollMargin",0);f("cursorHeight",1,wu,!0);f("singleCursorHeightPerLine",!0,wu,!0);f("workTime",100);f("workDelay",100);f("flattenSpans",!0,cu,!0);f("addModeClass",!1,cu,!0);f("pollInterval",100);f("undoDepth",200,function(n,t){n.doc.history.undoDepth=t});f("historyEventDelay",1250);f("viewportMargin",10,function(n){n.refresh()},!0);f("maxHighlightLength",1e4,cu,!0);f("moveInputWithCursor",!0,function(n,t){t||n.display.input.resetPosition()});f("tabindex",null,function(n,t){n.display.input.getField().tabIndex=t||""});f("autofocus",null);kh=t.modes={};tu=t.mimeModes={};t.defineMode=function(n,i){t.defaults.mode||n=="null"||(t.defaults.mode=n);arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2));kh[n]=i};t.defineMIME=function(n,t){tu[n]=t};t.resolveMode=function(n){if(typeof n=="string"&&tu.hasOwnProperty(n))n=tu[n];else if(n&&typeof n.name=="string"&&tu.hasOwnProperty(n.name)){var i=tu[n.name];typeof i=="string"&&(i={name:i});n=iw(i,n);n.name=i.name}else if(typeof n=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(n))return t.resolveMode("application/xml");return typeof n=="string"?{name:n}:n||{name:"null"}};t.getMode=function(n,i){var i=t.resolveMode(i),e=kh[i.name],u,f,r;if(!e)return t.getMode(n,"text/plain");if(u=e(n,i),iu.hasOwnProperty(i.name)){f=iu[i.name];for(r in f)f.hasOwnProperty(r)&&(u.hasOwnProperty(r)&&(u["_"+r]=u[r]),u[r]=f[r])}if(u.name=i.name,i.helperType&&(u.helperType=i.helperType),i.modeProps)for(r in i.modeProps)u[r]=i.modeProps[r];return u};t.defineMode("null",function(){return{token:function(n){n.skipToEnd()}}});t.defineMIME("text/plain","null");iu=t.modeExtensions={};t.extendMode=function(n,t){var i=iu.hasOwnProperty(n)?iu[n]:iu[n]={};pt(t,i)};t.defineExtension=function(n,i){t.prototype[n]=i};t.defineDocExtension=function(n,t){it.prototype[n]=t};t.defineOption=f;oo=[];t.defineInitHook=function(n){oo.push(n)};ir=t.helpers={};t.registerHelper=function(n,i,r){ir.hasOwnProperty(n)||(ir[n]=t[n]={_global:[]});ir[n][i]=r};t.registerGlobalHelper=function(n,i,r,u){t.registerHelper(n,i,u);ir[n]._global.push({pred:r,val:u})};ei=t.copyState=function(n,t){var r,u,i;if(t===!0)return t;if(n.copyState)return n.copyState(t);r={};for(u in t)i=t[u],i instanceof Array&&(i=i.concat([])),r[u]=i;return r};uy=t.startState=function(n,t,i){return n.startState?n.startState(t,i):!0};t.innerMode=function(n,t){while(n.innerMode){var i=n.innerMode(t);if(!i||i.mode==n)break;t=i.state;n=i.mode}return i||{mode:n,state:t}};ef=t.commands={selectAll:function(t){t.setSelection(n(t.firstLine(),0),n(t.lastLine()),gt)},singleSelection:function(n){n.setSelection(n.getCursor("anchor"),n.getCursor("head"),gt)},killLine:function(t){nu(t,function(i){if(i.empty()){var u=r(t.doc,i.head.line).text.length;return i.head.ch==u&&i.head.line<t.lastLine()?{from:i.head,to:n(i.head.line+1,0)}:{from:i.head,to:n(i.head.line,u)}}return{from:i.from(),to:i.to()}})},deleteLine:function(t){nu(t,function(i){return{from:n(i.from().line,0),to:o(t.doc,n(i.to().line+1,0))}})},delLineLeft:function(t){nu(t,function(t){return{from:n(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(n){nu(n,function(t){var i=n.charCoords(t.head,"div").top+5,r=n.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(n){nu(n,function(t){var i=n.charCoords(t.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(n){n.undo()},redo:function(n){n.redo()},undoSelection:function(n){n.undoSelection()},redoSelection:function(n){n.redoSelection()},goDocStart:function(t){t.extendSelection(n(t.firstLine(),0))},goDocEnd:function(t){t.extendSelection(n(t.lastLine()))},goLineStart:function(n){n.extendSelectionsBy(function(t){return hw(n,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(n){n.extendSelectionsBy(function(t){return cw(n,t.head)},{origin:"+move",bias:1})},goLineEnd:function(n){n.extendSelectionsBy(function(t){return bg(n,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(n){n.extendSelectionsBy(function(t){var i=n.charCoords(t.head,"div").top+5;return n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:i},"div")},gf)},goLineLeft:function(n){n.extendSelectionsBy(function(t){var i=n.charCoords(t.head,"div").top+5;return n.coordsChar({left:0,top:i},"div")},gf)},goLineLeftSmart:function(n){n.extendSelectionsBy(function(t){var r=n.charCoords(t.head,"div").top+5,i=n.coordsChar({left:0,top:r},"div");return i.ch<n.getLine(i.line).search(/\S/)?cw(n,t.head):i},gf)},goLineUp:function(n){n.moveV(-1,"line")},goLineDown:function(n){n.moveV(1,"line")},goPageUp:function(n){n.moveV(-1,"page")},goPageDown:function(n){n.moveV(1,"page")},goCharLeft:function(n){n.moveH(-1,"char")},goCharRight:function(n){n.moveH(1,"char")},goColumnLeft:function(n){n.moveH(-1,"column")},goColumnRight:function(n){n.moveH(1,"column")},goWordLeft:function(n){n.moveH(-1,"word")},goGroupRight:function(n){n.moveH(1,"group")},goGroupLeft:function(n){n.moveH(-1,"group")},goWordRight:function(n){n.moveH(1,"word")},delCharBefore:function(n){n.deleteH(-1,"char")},delCharAfter:function(n){n.deleteH(1,"char")},delWordBefore:function(n){n.deleteH(-1,"word")},delWordAfter:function(n){n.deleteH(1,"word")},delGroupBefore:function(n){n.deleteH(-1,"group")},delGroupAfter:function(n){n.deleteH(1,"group")},indentAuto:function(n){n.indentSelection("smart")},indentMore:function(n){n.indentSelection("add")},indentLess:function(n){n.indentSelection("subtract")},insertTab:function(n){n.replaceSelection("\t")},insertSoftTab:function(n){for(var u=[],f=n.listSelections(),i=n.options.tabSize,r,e,t=0;t<f.length;t++)r=f[t].from(),e=yt(n.getLine(r.line),r.ch,i),u.push(new Array(i-e%i+1).join(" "));n.replaceSelections(u)},defaultTab:function(n){n.somethingSelected()?n.indentSelection("add"):n.execCommand("insertTab")},transposeChars:function(t){ot(t,function(){for(var o=t.listSelections(),s=[],i,u,f,e=0;e<o.length;e++)i=o[e].head,u=r(t.doc,i.line).text,u&&(i.ch==u.length&&(i=new n(i.line,i.ch-1)),i.ch>0?(i=new n(i.line,i.ch+1),t.replaceRange(u.charAt(i.ch-1)+u.charAt(i.ch-2),n(i.line,i.ch-2),i,"+transpose")):i.line>t.doc.first&&(f=r(t.doc,i.line-1).text,f&&t.replaceRange(u.charAt(0)+t.doc.lineSeparator()+f.charAt(f.length-1),n(i.line-1,f.length-1),n(i.line,1),"+transpose"))),s.push(new l(i,i));t.setSelections(s)})},newlineAndIndent:function(n){ot(n,function(){for(var r=n.listSelections().length,i,t=0;t<r;t++)i=n.listSelections()[t],n.replaceRange(n.doc.lineSeparator(),i.anchor,i.head,"+input"),n.indentLine(i.from().line+1,null,!0);gr(n)})},toggleOverwrite:function(n){n.toggleOverwrite()}};oi=t.keyMap={};oi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};oi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};oi.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"};oi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};oi["default"]=lt?oi.macDefault:oi.pcDefault;t.normalizeKeyMap=function(n){var f={},t,o,i,r,e,u,s,h;for(t in n)if(n.hasOwnProperty(t)){if(o=n[t],/^(name|fallthrough|(de|at)tach)$/.test(t))continue;if(o=="..."){delete n[t];continue}for(i=wo(t.split(" "),ud),r=0;r<i.length;r++)if(r==i.length-1?(u=i.join(" "),e=o):(u=i.slice(0,r+1).join(" "),e="..."),s=f[u],s){if(s!=e)throw new Error("Inconsistent bindings for "+u);}else f[u]=e;delete n[t]}for(h in f)n[h]=f[h];return n};var of=t.lookupKey=function(n,t,i,r){var u,f,e;if(t=so(t),u=t.call?t.call(n,r):t[n],u===!1)return"nothing";if(u==="...")return"multi";if(u!=null&&i(u))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return of(n,t.fallthrough,i,r);for(f=0;f<t.fallthrough.length;f++)if(e=of(n,t.fallthrough[f],i,r),e)return e}},fd=t.isModifierKey=function(n){var t=typeof n=="string"?n:yi[n.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"},ed=t.keyName=function(n,t){if(ct&&n.keyCode==34&&n.char)return!1;var r=yi[n.keyCode],i=r;return i==null||n.altGraphKey?!1:(n.altKey&&r!="Alt"&&(i="Alt-"+i),(rl?n.metaKey:n.ctrlKey)&&r!="Ctrl"&&(i="Ctrl-"+i),(rl?n.ctrlKey:n.metaKey)&&r!="Cmd"&&(i="Cmd-"+i),!t&&n.shiftKey&&r!="Shift"&&(i="Shift-"+i),i)};t.fromTextArea=function(n,i){function f(){n.value=h.getValue()}var e,r,o,s,h;if(i=i?pt(i):{},i.value=n.value,!i.tabindex&&n.tabIndex&&(i.tabindex=n.tabIndex),!i.placeholder&&n.placeholder&&(i.placeholder=n.placeholder),i.autofocus==null&&(e=ni(),i.autofocus=e==n||n.getAttribute("autofocus")!=null&&e==document.body),n.form&&(u(n.form,"submit",f),!i.leaveSubmitMethodAlone)){r=n.form;o=r.submit;try{s=r.submit=function(){f();r.submit=o;r.submit();r.submit=s}}catch(c){}}return i.finishInit=function(t){t.save=f;t.getTextArea=function(){return n};t.toTextArea=function(){t.toTextArea=isNaN;f();n.parentNode.removeChild(t.getWrapperElement());n.style.display="";n.form&&(dt(n.form,"submit",f),typeof n.form.submit=="function"&&(n.form.submit=o))}},n.style.display="none",h=t(function(t){n.parentNode.insertBefore(t,n.nextSibling)},i)};sf=t.StringStream=function(n,t){this.pos=this.start=0;this.string=n;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0};sf.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(n){var t=this.string.charAt(this.pos),i;return i=typeof n=="string"?t==n:t&&(n.test?n.test(t):n(t)),i?(++this.pos,t):void 0},eatWhile:function(n){for(var t=this.pos;this.eat(n););return this.pos>t},eatSpace:function(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n},skipToEnd:function(){this.pos=this.string.length},skipTo:function(n){var t=this.string.indexOf(n,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(n){this.pos-=n},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=yt(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?yt(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return yt(this.string,null,this.tabSize)-(this.lineStart?yt(this.string,this.lineStart,this.tabSize):0)},match:function(n,t,i){var u,f,r;if(typeof n=="string"){if(u=function(n){return i?n.toLowerCase():n},f=this.string.substr(this.pos,n.length),u(f)==u(n))return t!==!1&&(this.pos+=n.length),!0}else return(r=this.string.slice(this.pos).match(n),r&&r.index>0)?null:(r&&t!==!1&&(this.pos+=r[0].length),r)},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(n,t){this.lineStart+=n;try{return t()}finally{this.lineStart-=n}}};hf=0;vi=t.TextMarker=function(n,t){this.lines=[];this.type=t;this.doc=n;this.id=++hf};eu(vi);vi.prototype.clear=function(){var n,e,u,f,o,i,r,t,s,h;if(!this.explicitlyCleared){for(n=this.doc.cm,e=n&&!n.curOp,e&&pr(n),ht(this,"clear")&&(u=this.find(),u&&ut(this,"clear",u.from,u.to)),f=null,o=null,t=0;t<this.lines.length;++t)i=this.lines[t],r=lf(i.markedSpans,this),n&&!this.collapsed?ui(n,c(i),"text"):n&&(r.to!=null&&(o=c(i)),r.from!=null&&(f=c(i))),i.markedSpans=cd(i.markedSpans,r),r.from==null&&this.collapsed&&!rr(this.doc,i)&&n&&kt(i,ki(n.display));if(n&&this.collapsed&&!n.options.lineWrapping)for(t=0;t<this.lines.length;++t)s=bt(this.lines[t]),h=fe(s),h>n.display.maxLineLength&&(n.display.maxLine=s,n.display.maxLineLength=h,n.display.maxLineChanged=!0);f!=null&&n&&this.collapsed&&tt(n,f,o+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,n&&ca(n.doc));n&&ut(n,"markerCleared",n,this);e&&wr(n);this.parent&&this.parent.clear()}};vi.prototype.find=function(t,i){var f,o,e,r,u;for(t==null&&this.type=="bookmark"&&(t=1),e=0;e<this.lines.length;++e){if(r=this.lines[e],u=lf(r.markedSpans,this),u.from!=null&&(f=n(i?r:c(r),u.from),t==-1))return f;if(u.to!=null&&(o=n(i?r:c(r),u.to),t==1))return o}return f&&{from:f,to:o}};vi.prototype.changed=function(){var i=this.find(-1,!0),t=this,n=this.doc.cm;i&&n&&ot(n,function(){var r=i.line,o=c(i.line),f=eh(n,o),e,u;f&&(ga(f),n.curOp.selectionChanged=n.curOp.forceUpdate=!0);n.curOp.updateMaxLine=!0;rr(t.doc,r)||t.height==null||(e=t.height,t.height=null,u=yf(t)-e,u&&kt(r,r.height+u))})};vi.prototype.attachLine=function(n){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&g(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(n)};vi.prototype.detachLine=function(n){if(this.lines.splice(g(this.lines,n),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};hf=0;cf=t.SharedTextMarker=function(n,t){this.markers=n;this.primary=t;for(var i=0;i<n.length;++i)n[i].parent=this};eu(cf);cf.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var n=0;n<this.markers.length;++n)this.markers[n].clear();ut(this,"clear")}};cf.prototype.find=function(n,t){return this.primary.find(n,t)};vf=t.LineWidget=function(n,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=n;this.node=t};eu(vf);vf.prototype.clear=function(){var r=this.doc.cm,n=this.line.widgets,t=this.line,f=c(t),i,u;if(f!=null&&n){for(i=0;i<n.length;++i)n[i]==this&&n.splice(i--,1);n.length||(t.widgets=null);u=yf(this);kt(t,Math.max(0,t.height-u));r&&ot(r,function(){py(r,t,-u);ui(r,f,"widget")})}};vf.prototype.changed=function(){var r=this.height,n=this.doc.cm,i=this.line,t;(this.height=null,t=yf(this)-r,t)&&(kt(i,i.height+t),n&&ot(n,function(){n.curOp.forceUpdate=!0;py(n,i,t)}))};uu=t.Line=function(n,t,i){this.text=n;hy(this,t);this.height=i?i(this):1};eu(uu);uu.prototype.lineNo=function(){return c(this)};tp={};ip={};pf.prototype={chunkSize:function(){return this.lines.length},removeInner:function(n,t){for(var r,i=n,u=n+t;i<u;++i)r=this.lines[i],this.height-=r.height,kd(r),ut(r,"delete");this.lines.splice(n,t)},collapse:function(n){n.push.apply(n,this.lines)},insertInner:function(n,t,i){this.height+=i;this.lines=this.lines.slice(0,n).concat(t).concat(this.lines.slice(n));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(n,t,i){for(var r=n+t;n<r;++n)if(i(this.lines[n]))return!0}};wf.prototype={chunkSize:function(){return this.size},removeInner:function(n,t){var r,i,u,f,o,e;for(this.size-=t,r=0;r<this.children.length;++r)if(i=this.children[r],u=i.chunkSize(),n<u){if(f=Math.min(t,u-n),o=i.height,i.removeInner(n,f),this.height-=o-i.height,u==f&&(this.children.splice(r--,1),i.parent=null),(t-=f)==0)break;n=0}else n-=u;this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pf))&&(e=[],this.collapse(e),this.children=[new pf(e)],this.children[0].parent=this)},collapse:function(n){for(var t=0;t<this.children.length;++t)this.children[t].collapse(n)},insertInner:function(n,t,i){var u,r,e,o,f;for(this.size+=t.length,this.height+=i,u=0;u<this.children.length;++u){if(r=this.children[u],e=r.chunkSize(),n<=e){if(r.insertInner(n,t,i),r.lines&&r.lines.length>50){while(r.lines.length>50)o=r.lines.splice(r.lines.length-25,25),f=new pf(o),r.height-=f.height,this.children.splice(u+1,0,f),f.parent=this;this.maybeSpill()}break}n-=e}},maybeSpill:function(){var n,r,t,i,u;if(!(this.children.length<=10)){n=this;do r=n.children.splice(n.children.length-5,5),t=new wf(r),n.parent?(n.size-=t.size,n.height-=t.height,u=g(n.parent.children,n),n.parent.children.splice(u+1,0,t)):(i=new wf(n.children),i.parent=n,n.children=[i,t],n=i),t.parent=n.parent;while(n.children.length>10);n.parent.maybeSpill()}},iterN:function(n,t,i){for(var f,u,e,r=0;r<this.children.length;++r)if(f=this.children[r],u=f.chunkSize(),n<u){if(e=Math.min(t,u-n),f.iterN(n,e,i))return!0;if((t-=e)==0)break;n=0}else n-=u}};op=0;it=t.Doc=function(t,i,r,u){if(!(this instanceof it))return new it(t,i,r,u);r==null&&(r=0);wf.call(this,[new pf([new uu("",null)])]);this.first=r;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=r;var f=n(r,0);this.sel=ii(f);this.history=new ao(null);this.id=++op;this.modeOption=i;this.lineSep=u;this.extend=!1;typeof t=="string"&&(t=this.splitLines(t));rc(this,{from:f,to:f,text:t});b(this,ii(f),gt)};it.prototype=iw(wf.prototype,{constructor:it,iter:function(n,t,i){i?this.iterN(n-this.first,t-n,i):this.iterN(this.first,this.first+this.size,n)},insert:function(n,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(n-this.first,t,r)},remove:function(n,t){this.removeInner(n-this.first,t)},getValue:function(n){var t=uc(this,this.first,this.first+this.size);return n===!1?t:t.join(n||this.lineSeparator())},setValue:nt(function(t){var i=n(this.first,0),u=this.first+this.size-1;kr(this,{from:i,to:n(u,r(this,u).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0);b(this,ii(i))}),replaceRange:function(n,t,i,r){t=o(this,t);i=i?o(this,i):t;dr(this,n,t,i,r)},getRange:function(n,t,i){var r=fr(this,o(this,n),o(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(n){var t=this.getLineHandle(n);return t&&t.text},getLineHandle:function(n){if(yu(this,n))return r(this,n)},getLineNumber:function(n){return c(n)},getLineHandleVisualStart:function(n){return typeof n=="number"&&(n=r(this,n)),bt(n)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(n){return o(this,n)},getCursor:function(n){var t=this.sel.primary();return n==null||n=="head"?t.head:n=="anchor"?t.anchor:n=="end"||n=="to"||n===!1?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:nt(function(t,i,r){oa(this,o(this,typeof t=="number"?n(t,i||0):t),null,r)}),setSelection:nt(function(n,t,i){oa(this,o(this,n),o(this,t||n),i)}),extendSelection:nt(function(n,t,i){ae(this,o(this,n),t&&o(this,t),i)}),extendSelections:nt(function(n,t){ea(this,fa(this,n),t)}),extendSelectionsBy:nt(function(n,t){var i=wo(this.sel.ranges,n);ea(this,fa(this,i),t)}),setSelections:nt(function(n,t,i){if(n.length){for(var r=0,u=[];r<n.length;r++)u[r]=new l(o(this,n[r].anchor),o(this,n[r].head));t==null&&(t=Math.min(n.length-1,this.sel.primIndex));b(this,at(u,t),i)}}),addSelection:nt(function(n,t,i){var r=this.sel.ranges.slice(0);r.push(new l(o(this,n),o(this,t||n)));b(this,at(r,r.length-1),i)}),getSelection:function(n){for(var r=this.sel.ranges,t,u,i=0;i<r.length;i++)u=fr(this,r[i].from(),r[i].to()),t=t?t.concat(u):u;return n===!1?t:t.join(n||this.lineSeparator())},getSelections:function(n){for(var u=[],r=this.sel.ranges,i,t=0;t<r.length;t++)i=fr(this,r[t].from(),r[t].to()),n!==!1&&(i=i.join(n||this.lineSeparator())),u[t]=i;return u},replaceSelection:function(n,t,i){for(var u=[],r=0;r<this.sel.ranges.length;r++)u[r]=n;this.replaceSelections(u,t,i||"+input")},replaceSelections:nt(function(n,t,i){for(var u=[],o=this.sel,f,e,r=0;r<o.ranges.length;r++)f=o.ranges[r],u[r]={from:f.from(),to:f.to(),text:this.splitLines(n[r]),origin:i};for(e=t&&t!="end"&&gk(this,u,t),r=u.length-1;r>=0;r--)kr(this,u[r]);e?sa(this,e):this.cm&&gr(this.cm)}),undo:nt(function(){ro(this,"undo")}),redo:nt(function(){ro(this,"redo")}),undoSelection:nt(function(){ro(this,"undo",!0)}),redoSelection:nt(function(){ro(this,"redo",!0)}),setExtending:function(n){this.extend=n},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,i=0,r=0,n=0;n<t.done.length;n++)t.done[n].ranges||++i;for(n=0;n<t.undone.length;n++)t.undone[n].ranges||++r;return{undo:i,redo:r}},clearHistory:function(){this.history=new ao(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(n){return n&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(n){return this.history.generation==(n||this.cleanGeneration)},getHistory:function(){return{done:fu(this.history.done),undone:fu(this.history.undone)}},setHistory:function(n){var t=this.history=new ao(this.history.maxGeneration);t.done=fu(n.done.slice(0),null,!0);t.undone=fu(n.undone.slice(0),null,!0)},addLineClass:nt(function(n,t,i){return eo(this,n,t=="gutter"?"gutter":"class",function(n){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(n[r]){if(re(i).test(n[r]))return!1;n[r]+=" "+i}else n[r]=i;return!0})}),removeLineClass:nt(function(n,t,i){return eo(this,n,t=="gutter"?"gutter":"class",function(n){var f=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=n[f],r,e;if(u)if(i==null)n[f]=null;else{if(r=u.match(re(i)),!r)return!1;e=r.index+r[0].length;n[f]=u.slice(0,r.index)+(!r.index||e==u.length?"":" ")+u.slice(e)||null}else return!1;return!0})}),addLineWidget:nt(function(n,t,i){return wd(this,n,t,i)}),removeLineWidget:function(n){n.clear()},markText:function(n,t,i){return ru(this,o(this,n),o(this,t),i,i&&i.type||"range")},setBookmark:function(n,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return n=o(this,n),ru(this,n,n,i,"bookmark")},findMarksAt:function(n){var f,i,u,t;if(n=o(this,n),f=[],i=r(this,n.line).markedSpans,i)for(u=0;u<i.length;++u)t=i[u],(t.from==null||t.from<=n.ch)&&(t.to==null||t.to>=n.ch)&&f.push(t.marker.parent||t.marker);return f},findMarks:function(n,t,i){n=o(this,n);t=o(this,t);var u=[],r=n.line;return this.iter(n.line,t.line+1,function(f){var s=f.markedSpans,o,e;if(s)for(o=0;o<s.length;o++)e=s[o],e.to!=null&&r==n.line&&n.ch>e.to||e.from==null&&r!=n.line||e.from!=null&&r==t.line&&e.from>t.ch||i&&!i(e.marker)||u.push(e.marker.parent||e.marker);++r}),u},getAllMarks:function(){var n=[];return this.iter(function(t){var r=t.markedSpans,i;if(r)for(i=0;i<r.length;++i)r[i].from!=null&&n.push(r[i].marker)}),n},posFromIndex:function(t){var i,r=this.first;return this.iter(function(n){var u=n.text.length+1;if(u>t)return i=t,!0;t-=u;++r}),o(this,n(r,i))},indexFromPos:function(n){n=o(this,n);var t=n.ch;return n.line<this.first||n.ch<0?0:(this.iter(this.first,n.line,function(n){t+=n.text.length+1}),t)},copy:function(n){var t=new it(uc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,n&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(n){var i,r,t;return n||(n={}),i=this.first,r=this.first+this.size,n.from!=null&&n.from>i&&(i=n.from),n.to!=null&&n.to<r&&(r=n.to),t=new it(uc(this,i,r),n.mode||this.modeOption,i,this.lineSep),n.sharedHist&&(t.history=this.history),(this.linked||(this.linked=[])).push({doc:t,sharedHist:n.sharedHist}),t.linked=[{doc:this,isParent:!0,sharedHist:n.sharedHist}],sd(t,fy(this)),t},unlinkDoc:function(n){var i,u,r;if(n instanceof t&&(n=n.doc),this.linked)for(i=0;i<this.linked.length;++i)if(u=this.linked[i],u.doc==n){this.linked.splice(i,1);n.unlinkDoc(this);hd(fy(this));break}n.history==this.history&&(r=[n.id],ur(n,function(n){r.push(n.id)},!0),n.history=new ao(null),n.history.done=fu(this.history.done,r),n.history.undone=fu(this.history.undone,r))},iterLinkedDocs:function(n){ur(this,n)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(n){return this.lineSep?n.split(this.lineSep):vg(n)},lineSeparator:function(){return this.lineSep||"\n"}});it.prototype.eachLine=it.prototype.iter;sp="iter insert remove copy getEditor constructor".split(" ");for(bf in it.prototype)it.prototype.hasOwnProperty(bf)&&g(sp,bf)<0&&(t.prototype[bf]=function(n){return function(){return n.apply(this.doc,arguments)}}(it.prototype[bf]));eu(it);d=t.e_preventDefault=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1};wp=t.e_stopPropagation=function(n){n.stopPropagation?n.stopPropagation():n.cancelBubble=!0};kf=t.e_stop=function(n){d(n);wp(n)};u=t.on=function(n,t,i){if(n.addEventListener)n.addEventListener(t,i,!1);else if(n.attachEvent)n.attachEvent("on"+t,i);else{var r=n._handlers||(n._handlers={}),u=r[t]||(r[t]=[]);u.push(i)}};sc=[];var dt=t.off=function(n,t,i){var u,r;if(n.removeEventListener)n.removeEventListener(t,i,!1);else if(n.detachEvent)n.detachEvent("on"+t,i);else for(u=yo(n,t,!1),r=0;r<u.length;++r)if(u[r]==i){u.splice(r,1);break}},y=t.signal=function(n,t){var r=yo(n,t,!0),u,i;if(r.length)for(u=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,u)},df=null;var dp=30,gp=t.Pass={toString:function(){return"CodeMirror.Pass"}},gt={scroll:!1},hc={origin:"*mouse"},gf={origin:"+move"};or.prototype.set=function(n,t){clearTimeout(this.id);this.id=setTimeout(t,n)};var yt=t.countColumn=function(n,t,i,r,u){var f,e,o;for(t==null&&(t=n.search(/[^\s\u00a0]/),t==-1&&(t=n.length)),f=r||0,e=u||0;;){if(o=n.indexOf("\t",f),o<0||o>=t)return e+(t-f);e+=o-f;e+=i-e%i;f=o+1}},nw=t.findColumn=function(n,t,i){for(var f,e,r=0,u=0;;){if(f=n.indexOf("\t",r),f==-1&&(f=n.length),e=f-r,f==n.length||u+e>=t)return r+Math.min(e,t-u);if(u+=f-r,u+=i-u%i,r=f+1,u>=t)return r}},po=[""];sr=function(n){n.select()};lr?sr=function(n){n.selectionStart=0;n.selectionEnd=n.value.length}:s&&(sr=function(n){try{n.select()}catch(t){}});rw=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;cc=t.isWordChar=function(n){return/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||rw.test(n))};fw=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;hr=document.createRange?function(n,t,i,r){var u=document.createRange();return u.setEnd(r||n,i),u.setStart(n,t),u}:function(n,t,i){var r=document.body.createTextRange();try{r.moveToElementText(n.parentNode)}catch(u){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};ko=t.contains=function(n,t){if(t.nodeType==3&&(t=t.parentNode),n.contains)return n.contains(t);do if(t.nodeType==11&&(t=t.host),t==n)return!0;while(t=t.parentNode)};s&&a<11&&(ni=function(){try{return document.activeElement}catch(n){return document.body}});ou=t.rmClass=function(n,t){var r=n.className,i=re(t).exec(r),u;i&&(u=r.slice(i.index+i[0].length),n.className=r.slice(0,i.index)+(u?i[1]+u:""))};su=t.addClass=function(n,t){var i=n.className;re(t).test(i)||(n.className+=(i?" ":"")+t)};ac=!1;ow=function(){if(s&&a<9)return!1;var n=i("div");return"draggable"in n||"dragDrop"in n}();var vg=t.splitLines="\n\nb".split(/\n/).length!=3?function(n){for(var i=0,f=[],e=n.length,t,r,u;i<=e;)t=n.indexOf("\n",i),t==-1&&(t=n.length),r=n.slice(i,n.charAt(t-1)=="\r"?t-1:t),u=r.indexOf("\r"),u!=-1?(f.push(r.slice(0,u)),i+=u+1):(f.push(r),i=t+1);return f}:function(n){return n.split(/\r\n?|\n/)},yg=window.getSelection?function(n){try{return n.selectionStart!=n.selectionEnd}catch(t){return!1}}:function(n){try{var t=n.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=n?!1:t.compareEndPoints("StartToEnd",t)!=0},sw=function(){var n=i("div");return"oncopy"in n?!0:(n.setAttribute("oncopy","return;"),typeof n.oncopy=="function")}(),pc=null;return yi=t.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},function(){for(var n=0;n<10;n++)yi[n+48]=yi[n+96]=String(n);for(n=65;n<=90;n++)yi[n]=String.fromCharCode(n);for(n=1;n<=12;n++)yi[n+111]=yi[n+63235]="F"+n}(),aw=function(){function s(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1773?o.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function n(n,t,i){this.level=n;this.from=t;this.to=i}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",o="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,r=/[LRr]/,u=/[Lb1n]/,f=/[1n]/,t="L";return function(e){var p,l,b,nt,k,a,w,y,g,o,it,d,tt,v,rt;if(!c.test(e))return!1;for(p=e.length,l=[],o=0;o<p;++o)l.push(a=s(e.charCodeAt(o)));for(o=0,b=t;o<p;++o)a=l[o],a=="m"?l[o]=b:b=a;for(o=0,k=t;o<p;++o)a=l[o],a=="1"&&k=="r"?l[o]="n":r.test(a)&&(k=a,a=="r"&&(l[o]="R"));for(o=1,b=l[0];o<p-1;++o)a=l[o],a=="+"&&b=="1"&&l[o+1]=="1"?l[o]="1":a==","&&b==l[o+1]&&(b=="1"||b=="n")&&(l[o]=b),b=a;for(o=0;o<p;++o)if(a=l[o],a==",")l[o]="N";else if(a=="%"){for(w=o+1;w<p&&l[w]=="%";++w);for(nt=o&&l[o-1]=="!"||w<p&&l[w]=="1"?"1":"N",v=o;v<w;++v)l[v]=nt;o=w-1}for(o=0,k=t;o<p;++o)a=l[o],k=="L"&&a=="1"?l[o]="L":r.test(a)&&(k=a);for(o=0;o<p;++o)if(i.test(l[o])){for(w=o+1;w<p&&i.test(l[w]);++w);var ut=(o?l[o-1]:t)=="L",ft=(w<p?l[w]:t)=="L",nt=ut||ft?"L":"R";for(v=o;v<w;++v)l[v]=nt;o=w-1}for(y=[],o=0;o<p;)if(u.test(l[o])){for(it=o,++o;o<p&&u.test(l[o]);++o);y.push(new n(0,it,o))}else{for(d=o,tt=y.length,++o;o<p&&l[o]!="L";++o);for(v=d;v<o;)if(f.test(l[v])){for(d<v&&y.splice(tt,0,new n(1,d,v)),rt=v,++v;v<o&&f.test(l[v]);++v);y.splice(tt,0,new n(2,rt,v));d=v}else++v;d<o&&y.splice(tt,0,new n(1,d,o))}return y[0].level==1&&(g=e.match(/^\s+/))&&(y[0].from=g[0].length,y.unshift(new n(0,0,g[0].length))),h(y).level==1&&(g=e.match(/\s+$/))&&(h(y).to-=g[0].length,y.push(new n(0,p-g[0].length,p))),y[0].level==2&&y.unshift(new n(1,y[0].to,y[0].to)),y[0].level!=h(y).level&&y.push(new n(y[0].level,p,p)),y}}(),t.version="5.13.2",t}),function(n){typeof exports=="object"&&typeof module=="object"?n(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function t(n,t,i){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||t.lastType=="quasi"&&/\{\s*$/.test(n.string.slice(0,n.pos-(i||0)))}n.defineMode("javascript",function(i,r){function di(n){for(var r=!1,t,i=!1;(t=n.next())!=null;){if(!r){if(t=="/"&&!i)return;t=="["?i=!0:i&&t=="]"&&(i=!1)}r=!r&&t=="\\"}}function l(n,t,i){return g=n,ht=i,t}function k(n,i){var r=n.next(),u,f;return r=='"'||r=="'"?(i.tokenize=gi(r),i.tokenize(n,i)):r=="."&&n.match(/^\d+(?:[eE][+\-]?\d+)?/)?l("number","number"):r=="."&&n.match("..")?l("spread","meta"):/[\[\]{}\(\),;\:\.]/.test(r)?l(r):r=="="&&n.eat(">")?l("=>","operator"):r=="0"&&n.eat(/x/i)?(n.eatWhile(/[\da-f]/i),l("number","number")):r=="0"&&n.eat(/o/i)?(n.eatWhile(/[0-7]/i),l("number","number")):r=="0"&&n.eat(/b/i)?(n.eatWhile(/[01]/i),l("number","number")):/\d/.test(r)?(n.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),l("number","number")):r=="/"?n.eat("*")?(i.tokenize=ct,ct(n,i)):n.eat("/")?(n.skipToEnd(),l("comment","comment")):t(n,i,1)?(di(n),n.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),l("regexp","string-2")):(n.eatWhile(st),l("operator","operator",n.current())):r=="`"?(i.tokenize=bt,bt(n,i)):r=="#"?(n.skipToEnd(),l("error","error")):st.test(r)?(n.eatWhile(st),l("operator","operator",n.current())):wt.test(r)?(n.eatWhile(wt),u=n.current(),f=fi.propertyIsEnumerable(u)&&fi[u],f&&i.lastType!="."?l(f.type,f.style,u):l("variable","variable",u)):void 0}function gi(n){return function(t,i){var r=!1,u;if(ot&&t.peek()=="@"&&t.match(ki))return i.tokenize=k,l("jsonld-keyword","meta");while((u=t.next())!=null){if(u==n&&!r)break;r=!r&&u=="\\"}return r||(i.tokenize=k),l("string","string")}}function ct(n,t){for(var r=!1,i;i=n.next();){if(i=="/"&&r){t.tokenize=k;break}r=i=="*"}return l("comment","comment")}function bt(n,t){for(var r=!1,i;(i=n.next())!=null;){if(!r&&(i=="`"||i=="$"&&n.eat("{"))){t.tokenize=k;break}r=!r&&i=="\\"}return l("quasi","string-2",n.current())}function kt(n,t){var o,r,f,i,e,u;if(t.fatArrowAt&&(t.fatArrowAt=null),o=n.string.indexOf("=>",n.start),!(o<0)){for(r=0,f=!1,i=o-1;i>=0;--i)if(e=n.string.charAt(i),u=nr.indexOf(e),u>=0&&u<3){if(!r){++i;break}if(--r==0)break}else if(u>=3&&u<6)++r;else if(wt.test(e))f=!0;else{if(/["'\/]/.test(e))return;if(f&&!r){++i;break}}f&&!r&&(t.fatArrowAt=i)}}function ei(n,t,i,r,u,f){this.indented=n;this.column=t;this.type=i;this.prev=u;this.info=f;r!=null&&(this.align=r)}function ir(n,t){for(var r,i=n.localVars;i;i=i.next)if(i.name==t)return!0;for(r=n.context;r;r=r.prev)for(i=r.vars;i;i=i.next)if(i.name==t)return!0}function rr(n,t,i,r,u){var e=n.cc,o;for(f.state=n,f.stream=u,f.marked=null,f.cc=e,f.style=t,n.lexical.hasOwnProperty("align")||(n.lexical.align=!0);;)if(o=e.length?e.pop():b?s:a,o(i,r)){while(e.length&&e[e.length-1].lex)e.pop()();return f.marked?f.marked:i=="variable"&&ir(n,r)?"variable-2":t}}function e(){for(var n=arguments.length-1;n>=0;n--)f.cc.push(arguments[n])}function u(){return e.apply(null,arguments),!0}function nt(n){function i(t){for(var i=t;i;i=i.next)if(i.name==n)return!0;return!1}var t=f.state;if(f.marked="def",t.context){if(i(t.localVars))return;t.localVars={name:n,next:t.localVars}}else{if(i(t.globalVars))return;r.globalVars&&(t.globalVars={name:n,next:t.globalVars})}}function tt(){f.state.context={prev:f.state.context,vars:f.state.localVars};f.state.localVars=ur}function it(){f.state.localVars=f.state.context.vars;f.state.context=f.state.context.prev}function h(n,t){var i=function(){var r=f.state,u=r.indented,i;if(r.lexical.type=="stat")u=r.lexical.indented;else for(i=r.lexical;i&&i.type==")"&&i.align;i=i.prev)u=i.indented;r.lexical=new ei(u,f.stream.column(),n,null,r.lexical,t)};return i.lex=!0,i}function o(){var n=f.state;n.lexical.prev&&(n.lexical.type==")"&&(n.indented=n.lexical.indented),n.lexical=n.lexical.prev)}function c(n){function t(i){return i==n?u():n==";"?e():u(t)}return t}function a(n,t){return n=="var"?u(h("vardef",t.length),gt,c(";"),o):n=="keyword a"?u(h("form"),s,a,o):n=="keyword b"?u(h("form"),a,o):n=="{"?u(h("}"),vt,o):n==";"?u():n=="if"?(f.state.lexical.info=="else"&&f.state.cc[f.state.cc.length-1]==o&&f.state.cc.pop()(),u(h("form"),s,a,o,vi)):n=="function"?u(p):n=="for"?u(h("form"),yi,a,o):n=="variable"?u(h("stat"),hr):n=="switch"?u(h("form"),s,h("}","switch"),c("{"),vt,o,o):n=="case"?u(s,c(":")):n=="default"?u(c(":")):n=="catch"?u(h("form"),tt,c("("),ti,c(")"),a,o,it):n=="class"?u(h("form"),kr,o):n=="export"?u(h("stat"),gr,o):n=="import"?u(h("stat"),nu,o):n=="module"?u(h("form"),y,h("}"),c("{"),vt,o,o):e(h("stat"),s,c(";"),o)}function s(n){return oi(n,!1)}function v(n){return oi(n,!0)}function oi(n,t){var r,i;if(f.state.fatArrowAt==f.stream.start){if(r=t?ci:hi,n=="(")return u(tt,h(")"),ft(y,")"),o,c("=>"),r,it);if(n=="variable")return e(tt,y,c("=>"),r,it)}return(i=t?lt:rt,tr.hasOwnProperty(n))?u(i):n=="function"?u(p,i):n=="keyword c"?u(t?si:dt):n=="("?u(h(")"),dt,pt,c(")"),o,i):n=="operator"||n=="spread"?u(t?v:s):n=="["?u(h("]"),iu,o,i):n=="{"?et(li,"}",null,i):n=="quasi"?e(at,i):n=="new"?u(er(t)):u()}function dt(n){return n.match(/[;\}\)\],]/)?e():e(s)}function si(n){return n.match(/[;\}\)\],]/)?e():e(v)}function rt(n,t){return n==","?u(s):lt(n,t,!1)}function lt(n,t,i){var r=i==!1?rt:lt,f=i==!1?s:v;return n=="=>"?u(tt,i?ci:hi,it):n=="operator"?/\+\+|--/.test(t)?u(r):t=="?"?u(s,c(":"),f):u(f):n=="quasi"?e(at,r):n==";"?void 0:n=="("?et(v,")","call",r):n=="."?u(cr,r):n=="["?u(h("]"),dt,c("]"),o,r):void 0}function at(n,t){return n!="quasi"?e():t.slice(t.length-2)!="${"?u(at):u(s,fr)}function fr(n){if(n=="}")return f.marked="string-2",f.state.tokenize=bt,u(at)}function hi(n){return kt(f.stream,f.state),e(n=="{"?a:s)}function ci(n){return kt(f.stream,f.state),e(n=="{"?a:v)}function er(n){return function(t){return t=="."?u(n?sr:or):e(n?v:s)}}function or(n,t){if(t=="target")return f.marked="keyword",u(rt)}function sr(n,t){if(t=="target")return f.marked="keyword",u(lt)}function hr(n){return n==":"?u(o,a):e(rt,c(";"),o)}function cr(n){if(n=="variable")return f.marked="property",u()}function li(n,t){return n=="variable"||f.style=="keyword"?(f.marked="property",t=="get"||t=="set")?u(lr):u(ut):n=="number"||n=="string"?(f.marked=ot?"property":f.style+" property",u(ut)):n=="jsonld-keyword"?u(ut):n=="modifier"?u(li):n=="["?u(s,c("]"),ut):n=="spread"?u(s):void 0}function lr(n){return n!="variable"?e(ut):(f.marked="property",u(p))}function ut(n){return n==":"?u(v):n=="("?e(p):void 0}function ft(n,t){function i(r){if(r==","){var e=f.state.lexical;return e.info=="call"&&(e.pos=(e.pos||0)+1),u(n,i)}return r==t?u():u(c(t))}return function(r){return r==t?u():e(n,i)}}function et(n,t,i){for(var r=3;r<arguments.length;r++)f.cc.push(arguments[r]);return u(h(t,i),ft(n,t),o)}function vt(n){return n=="}"?u():e(a,vt)}function ai(n){if(ui&&n==":")return u(vr)}function ar(n,t){if(t=="=")return u(v)}function vr(n){if(n=="variable")return f.marked="variable-3",u()}function gt(){return e(y,ai,ni,pr)}function y(n,t){return n=="modifier"?u(y):n=="variable"?(nt(t),u()):n=="spread"?u(y):n=="["?et(y,"]"):n=="{"?et(yr,"}"):void 0}function yr(n,t){return n=="variable"&&!f.stream.match(/^\s*:/,!1)?(nt(t),u(ni)):(n=="variable"&&(f.marked="property"),n=="spread")?u(y):n=="}"?e():u(c(":"),y,ni)}function ni(n,t){if(t=="=")return u(v)}function pr(n){if(n==",")return u(gt)}function vi(n,t){if(n=="keyword b"&&t=="else")return u(h("form","else"),a,o)}function yi(n){if(n=="(")return u(h(")"),wr,c(")"),o)}function wr(n){return n=="var"?u(gt,c(";"),yt):n==";"?u(yt):n=="variable"?u(br):e(s,c(";"),yt)}function br(n,t){return t=="in"||t=="of"?(f.marked="keyword",u(s)):u(rt,yt)}function yt(n,t){return n==";"?u(pi):t=="in"||t=="of"?(f.marked="keyword",u(s)):e(s,c(";"),pi)}function pi(n){n!=")"&&u(s)}function p(n,t){return t=="*"?(f.marked="keyword",u(p)):n=="variable"?(nt(t),u(p)):n=="("?u(tt,h(")"),ft(ti,")"),o,a,it):void 0}function ti(n){return n=="spread"?u(ti):e(y,ai,ar)}function kr(n,t){if(n=="variable")return nt(t),u(wi)}function wi(n,t){return t=="extends"?u(s,wi):n=="{"?u(h("}"),d,o):void 0}function d(n,t){return n=="variable"||f.style=="keyword"?t=="static"?(f.marked="keyword",u(d)):(f.marked="property",t=="get"||t=="set")?u(dr,p,d):u(p,d):t=="*"?(f.marked="keyword",u(d)):n==";"?u(d):n=="}"?u():void 0}function dr(n){return n!="variable"?e():(f.marked="property",u())}function gr(n,t){return t=="*"?(f.marked="keyword",u(bi,c(";"))):t=="default"?(f.marked="keyword",u(s,c(";"))):e(a)}function nu(n){return n=="string"?u():e(ii,bi)}function ii(n,t){return n=="{"?et(ii,"}"):(n=="variable"&&nt(t),t=="*"&&(f.marked="keyword"),u(tu))}function tu(n,t){if(t=="as")return f.marked="keyword",u(ii)}function bi(n,t){if(t=="from")return f.marked="keyword",u(s)}function iu(n){return n=="]"?u():e(v,ru)}function ru(n){return n=="for"?e(pt,c("]")):n==","?u(ft(si,"]")):e(ft(v,"]"))}function pt(n){return n=="for"?u(yi,pt):n=="if"?u(s,pt):void 0}function uu(n,t){return n.lastType=="operator"||n.lastType==","||st.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var w=i.indentUnit,ri=r.statementIndent,ot=r.jsonld,b=r.json||ot,ui=r.typescript,wt=r.wordCharacters||/[\w$\xa1-\uffff]/,fi=function(){function n(n){return{type:n,style:"keyword"}}var s=n("keyword a"),u=n("keyword b"),t=n("keyword c"),f=n("operator"),i={type:"atom",style:"atom"},h={"if":n("if"),"while":s,"with":s,"else":u,"do":u,"try":u,"finally":u,"return":t,"break":t,"continue":t,"new":n("new"),"delete":t,"throw":t,"debugger":t,"var":n("var"),"const":n("var"),"let":n("var"),"function":n("function"),"catch":n("catch"),"for":n("for"),"switch":n("switch"),"case":n("case"),"default":n("default"),"in":f,"typeof":f,"instanceof":f,"true":i,"false":i,"null":i,undefined:i,NaN:i,Infinity:i,"this":n("this"),"class":n("class"),"super":n("atom"),"yield":t,"export":n("export"),"import":n("import"),"extends":t},r,e,o;if(ui){r={type:"variable",style:"variable-3"};e={"interface":n("class"),"implements":t,namespace:t,module:n("module"),"enum":n("module"),"public":n("modifier"),"private":n("modifier"),"protected":n("modifier"),abstract:n("modifier"),as:f,string:r,number:r,boolean:r,any:r};for(o in e)h[o]=e[o]}return h}(),st=/[+\-*&%=<>!?|~^]/,ki=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,g,ht,nr="([{}])",tr={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},f={state:null,column:null,marked:null,cc:null},ur={name:"this",next:{name:"arguments"}};return o.lex=!0,{startState:function(n){var t={tokenize:k,lastType:"sof",cc:[],lexical:new ei((n||0)-w,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:n||0};return r.globalVars&&typeof r.globalVars=="object"&&(t.globalVars=r.globalVars),t},token:function(n,t){if(n.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=n.indentation(),kt(n,t)),t.tokenize!=ct&&n.eatSpace())return null;var i=t.tokenize(n,t);return g=="comment"?i:(t.lastType=g=="operator"&&(ht=="++"||ht=="--")?"incdec":g,rr(t,i,g,ht,n))},indent:function(t,i){var e,u,s,c,f,h;if(t.tokenize==ct)return n.Pass;if(t.tokenize!=k)return 0;if(e=i&&i.charAt(0),u=t.lexical,!/^\s*else\b/.test(i))for(s=t.cc.length-1;s>=0;--s)if(c=t.cc[s],c==o)u=u.prev;else if(c!=vi)break;return u.type=="stat"&&e=="}"&&(u=u.prev),ri&&u.type==")"&&u.prev.type=="stat"&&(u=u.prev),f=u.type,h=e==f,f=="vardef"?u.indented+(t.lastType=="operator"||t.lastType==","?u.info+1:0):f=="form"&&e=="{"?u.indented:f=="form"?u.indented+w:f=="stat"?u.indented+(uu(t,i)?ri||w:0):u.info!="switch"||h||r.doubleIndentSwitch==!1?u.align?u.column+(h?0:1):u.indented+(h?0:w):u.indented+(/^(?:case|default)\b/.test(i)?w:2*w)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:b?null:"/*",blockCommentEnd:b?null:"*/",lineComment:b?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:b?"json":"javascript",jsonldMode:ot,jsonMode:b,expressionAllowed:t,skipExpression:function(n){var t=n.cc[n.cc.length-1];(t==s||t==v)&&n.cc.pop()}}});n.registerHelper("wordChars","javascript",/[\w$]/);n.defineMIME("text/javascript","javascript");n.defineMIME("text/ecmascript","javascript");n.defineMIME("application/javascript","javascript");n.defineMIME("application/x-javascript","javascript");n.defineMIME("application/ecmascript","javascript");n.defineMIME("application/json",{name:"javascript",json:!0});n.defineMIME("application/x-json",{name:"javascript",json:!0});n.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});n.defineMIME("text/typescript",{name:"javascript",typescript:!0});n.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(n){typeof exports=="object"&&typeof module=="object"?n(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){function i(n){n.state.placeholder&&(n.state.placeholder.parentNode.removeChild(n.state.placeholder),n.state.placeholder=null)}function u(n){var t,r;i(n);t=n.state.placeholder=document.createElement("pre");t.style.cssText="height: 0; overflow: visible";t.className="CodeMirror-placeholder";r=n.getOption("placeholder");typeof r=="string"&&(r=document.createTextNode(r));t.appendChild(r);n.display.lineSpace.insertBefore(t,n.display.lineSpace.firstChild)}function r(n){f(n)&&u(n)}function t(n){var t=n.getWrapperElement(),r=f(n);t.className=t.className.replace(" CodeMirror-empty","")+(r?" CodeMirror-empty":"");r?u(n):i(n)}function f(n){return n.lineCount()===1&&n.getLine(0)===""}n.defineOption("placeholder","",function(u,f,e){var s=e&&e!=n.Init,o;if(f&&!s){u.on("blur",r);u.on("change",t);u.on("swapDoc",t);t(u)}else!f&&s&&(u.off("blur",r),u.off("change",t),u.off("swapDoc",t),i(u),o=u.getWrapperElement(),o.className=o.className.replace(" CodeMirror-empty",""));f&&!u.hasFocus()&&r(u)})})