UNPKG

mongo-express-leufu

Version:

Web-based admin interface for MongoDB

1 lines 186 kB
webpackJsonp([1],{13:function(e,t,r){!function(e){e(r(4))}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function i(e,t,r){return Ve=e,je=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=l(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=a,a(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):Be(e,t,1)?(n(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),i("regexp","string-2")):(e.eat("="),i("operator","operator",e.current()));if("`"==r)return t.tokenize=s,s(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(qe.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),i("operator","operator",e.current());if(Ye.test(r)){e.eatWhile(Ye);var o=e.current();if("."!=t.lastType){if(_e.propertyIsEnumerable(o)){var u=_e[o];return i(u.type,u.style,o)}if("async"==o&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return i("async","keyword",o)}return i("variable","variable",o)}}function l(e){return function(t,r){var n,l=!1;if(Ke&&"@"==t.peek()&&t.match(Ze))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||l);)l=!l&&"\\"==n;return l||(r.tokenize=o),i("string","string")}}function a(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=o;break}n="*"==r}return i("comment","comment")}function s(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=o;break}n=!n&&"\\"==r}return i("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if($e){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,l=r-1;l>=0;--l){var a=e.string.charAt(l),s=Je.indexOf(a);if(s>=0&&s<3){if(!i){++l;break}if(0==--i){"("==a&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(Ye.test(a))o=!0;else{if(/["'\/]/.test(a))return;if(o&&!i){++l;break}}}o&&!i&&(t.fatArrowAt=l)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function f(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function d(e,t,r,n,i){var o=e.cc;for(et.state=e,et.stream=i,et.marked=null,et.cc=o,et.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((o.length?o.pop():Xe?A:M)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return et.marked?et.marked:"variable"==r&&f(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)et.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function g(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function v(e){var t=et.state;if(et.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=m(e,t.context);if(null!=n)return void(t.context=n)}else if(!g(e,t.localVars))return void(t.localVars=new w(e,t.localVars));r.globalVars&&!g(e,t.globalVars)&&(t.globalVars=new w(e,t.globalVars))}function m(e,t){if(t){if(t.block){var r=m(e,t.prev);return r?r==t.prev?t:new b(r,t.vars,!0):null}return g(e,t.vars)?t:new b(t.prev,new w(e,t.vars),!1)}return null}function y(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function b(e,t,r){this.prev=e,this.vars=t,this.block=r}function w(e,t){this.name=e,this.next=t}function x(){et.state.context=new b(et.state.context,et.state.localVars,!1),et.state.localVars=tt}function C(){et.state.context=new b(et.state.context,et.state.localVars,!0),et.state.localVars=null}function k(){et.state.localVars=et.state.context.vars,et.state.context=et.state.context.prev}function S(e,t){var r=function(){var r=et.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new c(n,et.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function L(){var e=et.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function T(e){function t(r){return r==e?p():";"==e||"}"==r||")"==r||"]"==r?h():p(t)}return t}function M(e,t){return"var"==e?p(S("vardef",t),se,T(";"),L):"keyword a"==e?p(S("form"),D,M,L):"keyword b"==e?p(S("form"),M,L):"keyword d"==e?et.stream.match(/^\s*$/,!1)?p():p(S("stat"),H,T(";"),L):"debugger"==e?p(T(";")):"{"==e?p(S("}"),C,q,L,k):";"==e?p():"if"==e?("else"==et.state.lexical.info&&et.state.cc[et.state.cc.length-1]==L&&et.state.cc.pop()(),p(S("form"),D,M,L,pe)):"function"==e?p(we):"for"==e?p(S("form"),ge,M,L):"class"==e||$e&&"interface"==t?(et.marked="keyword",p(S("form","class"==e?e:t),Le,L)):"variable"==e?$e&&"declare"==t?(et.marked="keyword",p(M)):$e&&("module"==t||"enum"==t||"type"==t)&&et.stream.match(/^\s*\w/,!1)?(et.marked="keyword","enum"==t?p(Ie):"type"==t?p(Ce,T("operator"),ee,T(";")):p(S("form"),ue,T("{"),S("}"),q,L,L)):$e&&"namespace"==t?(et.marked="keyword",p(S("form"),A,M,L)):$e&&"abstract"==t?(et.marked="keyword",p(M)):p(S("stat"),G):"switch"==e?p(S("form"),D,T("{"),S("}","switch"),C,q,L,L,k):"case"==e?p(A,T(":")):"default"==e?p(T(":")):"catch"==e?p(S("form"),x,N,M,L,k):"export"==e?p(S("stat"),Ae,L):"import"==e?p(S("stat"),De,L):"async"==e?p(M):"@"==t?p(A,M):h(S("stat"),A,T(";"),L)}function N(e){if("("==e)return p(ke,T(")"))}function A(e,t){return W(e,t,!1)}function O(e,t){return W(e,t,!0)}function D(e){return"("!=e?h():p(S(")"),A,T(")"),L)}function W(e,t,r){if(et.state.fatArrowAt==et.stream.start){var n=r?R:z;if("("==e)return p(x,S(")"),Y(ke,")"),L,T("=>"),n,k);if("variable"==e)return h(x,ue,T("=>"),n,k)}var i=r?E:F;return Qe.hasOwnProperty(e)?p(i):"function"==e?p(we,i):"class"==e||$e&&"interface"==t?(et.marked="keyword",p(S("form"),Se,L)):"keyword c"==e||"async"==e?p(r?O:A):"("==e?p(S(")"),H,T(")"),L,i):"operator"==e||"spread"==e?p(r?O:A):"["==e?p(S("]"),Pe,L,i):"{"==e?_(K,"}",null,i):"quasi"==e?h(P,i):"new"==e?p(B(r)):"import"==e?p(A):p()}function H(e){return e.match(/[;\}\)\],]/)?h():h(A)}function F(e,t){return","==e?p(A):E(e,t,!1)}function E(e,t,r){var n=0==r?F:E,i=0==r?A:O;return"=>"==e?p(x,r?R:z,k):"operator"==e?/\+\+|--/.test(t)||$e&&"!"==t?p(n):$e&&"<"==t&&et.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?p(S(">"),Y(ee,">"),L,n):"?"==t?p(A,T(":"),i):p(i):"quasi"==e?h(P,n):";"!=e?"("==e?_(O,")","call",n):"."==e?p(U,n):"["==e?p(S("]"),H,T("]"),L,n):$e&&"as"==t?(et.marked="keyword",p(ee,n)):"regexp"==e?(et.state.lastType=et.marked="operator",et.stream.backUp(et.stream.pos-et.stream.start-1),p(i)):void 0:void 0}function P(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(P):p(A,I)}function I(e){if("}"==e)return et.marked="string-2",et.state.tokenize=s,p(P)}function z(e){return u(et.stream,et.state),h("{"==e?M:A)}function R(e){return u(et.stream,et.state),h("{"==e?M:O)}function B(e){return function(t){return"."==t?p(e?j:V):"variable"==t&&$e?p(oe,e?E:F):h(e?O:A)}}function V(e,t){if("target"==t)return et.marked="keyword",p(F)}function j(e,t){if("target"==t)return et.marked="keyword",p(E)}function G(e){return":"==e?p(L,M):h(F,T(";"),L)}function U(e){if("variable"==e)return et.marked="property",p()}function K(e,t){if("async"==e)return et.marked="property",p(K);if("variable"==e||"keyword"==et.style){if(et.marked="property","get"==t||"set"==t)return p(X);var r;return $e&&et.state.fatArrowAt==et.stream.start&&(r=et.stream.match(/^\s*:\s*/,!1))&&(et.state.fatArrowAt=et.stream.pos+r[0].length),p($)}return"number"==e||"string"==e?(et.marked=Ke?"property":et.style+" property",p($)):"jsonld-keyword"==e?p($):$e&&y(t)?(et.marked="keyword",p(K)):"["==e?p(A,Z,T("]"),$):"spread"==e?p(O,$):"*"==t?(et.marked="keyword",p(K)):":"==e?h($):void 0}function X(e){return"variable"!=e?h($):(et.marked="property",p(we))}function $(e){return":"==e?p(O):"("==e?h(we):void 0}function Y(e,t,r){function n(i,o){if(r?r.indexOf(i)>-1:","==i){var l=et.state.lexical;return"call"==l.info&&(l.pos=(l.pos||0)+1),p(function(r,n){return r==t||n==t?h():h(e)},n)}return i==t||o==t?p():r&&r.indexOf(";")>-1?h(e):p(T(t))}return function(r,i){return r==t||i==t?p():h(e,n)}}function _(e,t,r){for(var n=3;n<arguments.length;n++)et.cc.push(arguments[n]);return p(S(t,r),Y(e,t),L)}function q(e){return"}"==e?p():h(M,q)}function Z(e,t){if($e){if(":"==e||"in"==t)return p(ee);if("?"==t)return p(Z)}}function J(e){if($e&&":"==e)return et.stream.match(/^\s*\w+\s+is\b/,!1)?p(A,Q,ee):p(ee)}function Q(e,t){if("is"==t)return et.marked="keyword",p()}function ee(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(et.marked="keyword",p("typeof"==t?O:ee)):"variable"==e||"void"==t?(et.marked="type",p(ie)):"string"==e||"number"==e||"atom"==e?p(ie):"["==e?p(S("]"),Y(ee,"]",","),L,ie):"{"==e?p(S("}"),Y(re,"}",",;"),L,ie):"("==e?p(Y(ne,")"),te,ie):"<"==e?p(Y(ee,">"),ee):void 0}function te(e){if("=>"==e)return p(ee)}function re(e,t){return"variable"==e||"keyword"==et.style?(et.marked="property",p(re)):"?"==t||"number"==e||"string"==e?p(re):":"==e?p(ee):"["==e?p(T("variable"),Z,T("]"),re):"("==e?h(xe,re):void 0}function ne(e,t){return"variable"==e&&et.stream.match(/^\s*[?:]/,!1)||"?"==t?p(ne):":"==e?p(ee):"spread"==e?p(ne):h(ee)}function ie(e,t){return"<"==t?p(S(">"),Y(ee,">"),L,ie):"|"==t||"."==e||"&"==t?p(ee):"["==e?p(ee,T("]"),ie):"extends"==t||"implements"==t?(et.marked="keyword",p(ee)):"?"==t?p(ee,T(":"),ee):void 0}function oe(e,t){if("<"==t)return p(S(">"),Y(ee,">"),L,ie)}function le(){return h(ee,ae)}function ae(e,t){if("="==t)return p(ee)}function se(e,t){return"enum"==t?(et.marked="keyword",p(Ie)):h(ue,Z,de,he)}function ue(e,t){return $e&&y(t)?(et.marked="keyword",p(ue)):"variable"==e?(v(t),p()):"spread"==e?p(ue):"["==e?_(fe,"]"):"{"==e?_(ce,"}"):void 0}function ce(e,t){return"variable"!=e||et.stream.match(/^\s*:/,!1)?("variable"==e&&(et.marked="property"),"spread"==e?p(ue):"}"==e?h():"["==e?p(A,T("]"),T(":"),ce):p(T(":"),ue,de)):(v(t),p(de))}function fe(){return h(ue,de)}function de(e,t){if("="==t)return p(O)}function he(e){if(","==e)return p(se)}function pe(e,t){if("keyword b"==e&&"else"==t)return p(S("form","else"),M,L)}function ge(e,t){return"await"==t?p(ge):"("==e?p(S(")"),ve,T(")"),L):void 0}function ve(e){return"var"==e?p(se,T(";"),ye):";"==e?p(ye):"variable"==e?p(me):h(A,T(";"),ye)}function me(e,t){return"in"==t||"of"==t?(et.marked="keyword",p(A)):p(F,ye)}function ye(e,t){return";"==e?p(be):"in"==t||"of"==t?(et.marked="keyword",p(A)):h(A,T(";"),be)}function be(e){")"!=e&&p(A)}function we(e,t){return"*"==t?(et.marked="keyword",p(we)):"variable"==e?(v(t),p(we)):"("==e?p(x,S(")"),Y(ke,")"),L,J,M,k):$e&&"<"==t?p(S(">"),Y(le,">"),L,we):void 0}function xe(e,t){return"*"==t?(et.marked="keyword",p(xe)):"variable"==e?(v(t),p(xe)):"("==e?p(x,S(")"),Y(ke,")"),L,J,k):$e&&"<"==t?p(S(">"),Y(le,">"),L,xe):void 0}function Ce(e,t){return"keyword"==e||"variable"==e?(et.marked="type",p(Ce)):"<"==t?p(S(">"),Y(le,">"),L):void 0}function ke(e,t){return"@"==t&&p(A,ke),"spread"==e?p(ke):$e&&y(t)?(et.marked="keyword",p(ke)):h(ue,Z,de)}function Se(e,t){return"variable"==e?Le(e,t):Te(e,t)}function Le(e,t){if("variable"==e)return v(t),p(Te)}function Te(e,t){return"<"==t?p(S(">"),Y(le,">"),L,Te):"extends"==t||"implements"==t||$e&&","==e?("implements"==t&&(et.marked="keyword"),p($e?ee:A,Te)):"{"==e?p(S("}"),Me,L):void 0}function Me(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||$e&&y(t))&&et.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(et.marked="keyword",p(Me)):"variable"==e||"keyword"==et.style?(et.marked="property",p($e?Ne:we,Me)):"number"==e||"string"==e?p($e?Ne:we,Me):"["==e?p(A,Z,T("]"),$e?Ne:we,Me):"*"==t?(et.marked="keyword",p(Me)):$e&&"("==e?h(xe,Me):";"==e||","==e?p(Me):"}"==e?p():"@"==t?p(A,Me):void 0}function Ne(e,t){if("?"==t)return p(Ne);if(":"==e)return p(ee,de);if("="==t)return p(O);var r=et.state.lexical.prev;return h(r&&"interface"==r.info?xe:we)}function Ae(e,t){return"*"==t?(et.marked="keyword",p(Ee,T(";"))):"default"==t?(et.marked="keyword",p(A,T(";"))):"{"==e?p(Y(Oe,"}"),Ee,T(";")):h(M)}function Oe(e,t){return"as"==t?(et.marked="keyword",p(T("variable"))):"variable"==e?h(O,Oe):void 0}function De(e){return"string"==e?p():"("==e?h(A):h(We,He,Ee)}function We(e,t){return"{"==e?_(We,"}"):("variable"==e&&v(t),"*"==t&&(et.marked="keyword"),p(Fe))}function He(e){if(","==e)return p(We,He)}function Fe(e,t){if("as"==t)return et.marked="keyword",p(We)}function Ee(e,t){if("from"==t)return et.marked="keyword",p(A)}function Pe(e){return"]"==e?p():h(Y(O,"]"))}function Ie(){return h(S("form"),ue,T("{"),S("}"),Y(ze,"}"),L,L)}function ze(){return h(ue,de)}function Re(e,t){return"operator"==e.lastType||","==e.lastType||qe.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}function Be(e,t,r){return t.tokenize==o&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}var Ve,je,Ge=t.indentUnit,Ue=r.statementIndent,Ke=r.jsonld,Xe=r.json||Ke,$e=r.typescript,Ye=r.wordCharacters||/[\w$\xa1-\uffff]/,_e=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("keyword d"),o=e("operator"),l={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:l,false:l,null:l,undefined:l,NaN:l,Infinity:l,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),qe=/[+\-*&%=<>!?|~^@]/,Ze=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Je="([{}])",Qe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},et={state:null,column:null,marked:null,cc:null},tt=new w("this",new w("arguments",null));return k.lex=!0,L.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new c((e||0)-Ge,0,"block",!1),localVars:r.localVars,context:r.localVars&&new b(null,null,!1),indented:e||0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=a&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==Ve?r:(t.lastType="operator"!=Ve||"++"!=je&&"--"!=je?Ve:"incdec",d(t,r,Ve,je,e))},indent:function(t,n){if(t.tokenize==a)return e.Pass;if(t.tokenize!=o)return 0;var i,l=n&&n.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(n))for(var u=t.cc.length-1;u>=0;--u){var c=t.cc[u];if(c==L)s=s.prev;else if(c!=pe)break}for(;("stat"==s.type||"form"==s.type)&&("}"==l||(i=t.cc[t.cc.length-1])&&(i==F||i==E)&&!/^[,\.=+\-*:?[\(]/.test(n));)s=s.prev;Ue&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var f=s.type,d=l==f;return"vardef"==f?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==f&&"{"==l?s.indented:"form"==f?s.indented+Ge:"stat"==f?s.indented+(Re(t,n)?Ue||Ge:0):"switch"!=s.info||d||0==r.doubleIndentSwitch?s.align?s.column+(d?0:1):s.indented+(d?0:Ge):s.indented+(/^(?:case|default)\b/.test(n)?Ge:2*Ge)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Xe?null:"/*",blockCommentEnd:Xe?null:"*/",blockCommentContinue:Xe?null:" * ",lineComment:Xe?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Xe?"json":"javascript",jsonldMode:Ke,jsonMode:Xe,expressionAllowed:Be,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=A&&t!=O||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},2:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(r(4));r(13);var i=n.default;t.default=i},4:function(e,t,r){!function(t,r){e.exports=r()}(0,function(){"use strict";function e(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function t(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function r(e,r){return t(e).appendChild(r)}function n(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function i(e,t,r,i){var o=n(e,t,r,i);return o.setAttribute("role","presentation"),o}function o(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function l(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function a(t,r){var n=t.className;e(r).test(n)||(t.className+=(n?" ":"")+r)}function s(t,r){for(var n=t.split(" "),i=0;i<n.length;i++)n[i]&&!e(n[i]).test(r)&&(r+=" "+n[i]);return r}function u(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function c(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function f(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var a=e.indexOf("\t",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=r-l%r,o=a+1}}function d(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function h(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function p(e){for(;Yl.length<=e;)Yl.push(g(Yl)+" ");return Yl[e]}function g(e){return e[e.length-1]}function v(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function m(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}function y(){}function b(e,t){var r;return Object.create?r=Object.create(e):(y.prototype=e,r=new y),t&&c(t,r),r}function w(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||_l.test(e))}function x(e,t){return t?!!(t.source.indexOf("\\w")>-1&&w(e))||t.test(e):w(e)}function C(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function k(e){return e.charCodeAt(0)>=768&&ql.test(e)}function S(e,t,r){for(;(r<0?t>0:t<e.length)&&k(e.charAt(t));)t+=r;return t}function L(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function T(e,t,r){var o=this;this.input=r,o.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=n("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=i("div",null,"CodeMirror-code"),o.selectionDiv=n("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=n("div",null,"CodeMirror-cursors"),o.measure=n("div",null,"CodeMirror-measure"),o.lineMeasure=n("div",null,"CodeMirror-measure"),o.lineSpace=i("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var l=i("div",[o.lineSpace],"CodeMirror-lines");o.mover=n("div",[l],null,"position: relative"),o.sizer=n("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=n("div",null,null,"position: absolute; height: "+Gl+"px; width: 1px;"),o.gutters=n("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=n("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=n("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),bl&&wl<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),xl||gl&&Ol||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,r.init(o)}function M(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function N(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function A(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function O(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function D(e){if(null==e.parent)return null;for(var t=e.parent,r=d(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function W(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l],s=a.height;if(t<s)break;t-=s}return r+l}function H(e,t){return t>=e.first&&t<e.first+e.size}function F(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function E(e,t,r){if(void 0===r&&(r=null),!(this instanceof E))return new E(e,t,r);this.line=e,this.ch=t,this.sticky=r}function P(e,t){return e.line-t.line||e.ch-t.ch}function I(e,t){return e.sticky==t.sticky&&0==P(e,t)}function z(e){return E(e.line,e.ch)}function R(e,t){return P(e,t)<0?t:e}function B(e,t){return P(e,t)<0?e:t}function V(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function j(e,t){if(t.line<e.first)return E(e.first,0);var r=e.first+e.size-1;return t.line>r?E(r,M(e,r).text.length):G(t,M(e,t.line).text.length)}function G(e,t){var r=e.ch;return null==r||r>t?E(e.line,t):r<0?E(e.line,0):e}function U(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=j(e,t[n]);return r}function K(){Zl=!0}function X(){Jl=!0}function $(e,t,r){this.marker=e,this.from=t,this.to=r}function Y(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function _(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function q(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Z(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new $(l,o.from,s?null:o.to))}}return n}function J(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new $(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function Q(e,t){if(t.full)return null;var r=H(e,t.from.line)&&M(e,t.from.line).markedSpans,n=H(e,t.to.line)&&M(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==P(t.from,t.to),a=Z(r,i,l),s=J(n,o,l),u=1==t.text.length,c=g(t.text).length+(u?i:0);if(a)for(var f=0;f<a.length;++f){var d=a[f];if(null==d.to){var h=Y(s,d.marker);h?u&&(d.to=null==h.to?null:h.to+c):d.to=i}}if(s)for(var p=0;p<s.length;++p){var v=s[p];if(null!=v.to&&(v.to+=c),null==v.from){var m=Y(a,v.marker);m||(v.from=c,u&&(a||(a=[])).push(v))}else v.from+=c,u&&(a||(a=[])).push(v)}a&&(a=ee(a)),s&&s!=a&&(s=ee(s));var y=[a];if(!u){var b,w=t.text.length-2;if(w>0&&a)for(var x=0;x<a.length;++x)null==a[x].to&&(b||(b=[])).push(new $(a[x].marker,null,null));for(var C=0;C<w;++C)y.push(b);y.push(s)}return y}function ee(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function te(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=d(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],a=l.find(0),s=0;s<i.length;++s){var u=i[s];if(!(P(u.to,a.from)<0||P(u.from,a.to)>0)){var c=[s,1],f=P(u.from,a.from),h=P(u.to,a.to);(f<0||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:a.from}),(h>0||!l.inclusiveRight&&!h)&&c.push({from:a.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function re(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function ne(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function ie(e){return e.inclusiveLeft?-1:0}function oe(e){return e.inclusiveRight?1:0}function le(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=P(n.from,i.from)||ie(e)-ie(t);if(o)return-o;var l=P(n.to,i.to)||oe(e)-oe(t);return l||t.id-e.id}function ae(e,t){var r,n=Jl&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||le(r,i.marker)<0)&&(r=i.marker);return r}function se(e){return ae(e,!0)}function ue(e){return ae(e,!1)}function ce(e,t){var r,n=Jl&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||le(r,o.marker)<0)&&(r=o.marker)}return r}function fe(e,t,r,n,i){var o=M(e,t),l=Jl&&o.markedSpans;if(l)for(var a=0;a<l.length;++a){var s=l[a];if(s.marker.collapsed){var u=s.marker.find(0),c=P(u.from,r)||ie(s.marker)-ie(i),f=P(u.to,n)||oe(s.marker)-oe(i);if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?P(u.to,r)>=0:P(u.to,r)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?P(u.from,n)<=0:P(u.from,n)<0)))return!0}}}function de(e){for(var t;t=se(e);)e=t.find(-1,!0).line;return e}function he(e){for(var t;t=ue(e);)e=t.find(1,!0).line;return e}function pe(e){for(var t,r;t=ue(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function ge(e,t){var r=M(e,t),n=de(r);return r==n?t:D(n)}function ve(e,t){if(t>e.lastLine())return t;var r,n=M(e,t);if(!me(e,n))return t;for(;r=ue(n);)n=r.find(1,!0).line;return D(n)+1}function me(e,t){var r=Jl&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&ye(e,t,n))return!0}}function ye(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return ye(e,n.line,Y(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&ye(e,t,i))return!0}function be(e){e=de(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==r)break;t+=a.height}return t}function we(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=se(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=ue(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,n=o.to.line,r+=n.text.length-o.to.ch}return r}function xe(e){var t=e.display,r=e.doc;t.maxLine=M(r,r.first),t.maxLineLength=we(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=we(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function Ce(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}function ke(e,t,r){var n;Ql=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:Ql=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:Ql=i)}return null!=n?n:Ql}function Se(e,t){var r=e.order;return null==r&&(r=e.order=ea(e.text,t)),r}function Le(e,t){return e._handlers&&e._handlers[t]||ta}function Te(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=d(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Me(e,t){var r=Le(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Ne(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Me(e,r||t.type,e,t),Fe(t)||t.codemirrorIgnore}function Ae(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==d(r,t[n])&&r.push(t[n])}function Oe(e,t){return Le(e,t).length>0}function De(e){e.prototype.on=function(e,t){ra(this,e,t)},e.prototype.off=function(e,t){Te(this,e,t)}}function We(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function He(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Fe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ee(e){We(e),He(e)}function Pe(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Dl&&e.ctrlKey&&1==t&&(t=3),t}function ze(e){if(null==Vl){var t=n("span","​");r(e,n("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Vl=t.offsetWidth<=1&&t.offsetHeight>2&&!(bl&&wl<8))}var i=Vl?n("span","​"):n("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Re(e){if(null!=jl)return jl;var n=r(e,document.createTextNode("AخA")),i=El(n,0,1).getBoundingClientRect(),o=El(n,1,2).getBoundingClientRect();return t(e),!(!i||i.left==i.right)&&(jl=o.right-i.right<3)}function Be(e){if(null!=aa)return aa;var t=r(e,n("span","x")),i=t.getBoundingClientRect(),o=El(t,0,1).getBoundingClientRect();return aa=Math.abs(i.left-o.left)>1}function Ve(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),sa[e]=t}function je(e,t){ua[e]=t}function Ge(e){if("string"==typeof e&&ua.hasOwnProperty(e))e=ua[e];else if(e&&"string"==typeof e.name&&ua.hasOwnProperty(e.name)){var t=ua[e.name];"string"==typeof t&&(t={name:t}),e=b(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ge("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ge("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ue(e,t){t=Ge(t);var r=sa[t.name];if(!r)return Ue(e,"text/plain");var n=r(e,t);if(ca.hasOwnProperty(t.name)){var i=ca[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}function Ke(e,t){c(t,ca.hasOwnProperty(e)?ca[e]:ca[e]={})}function Xe(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function $e(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Ye(e,t,r){return!e.startState||e.startState(t,r)}function _e(e,t,r,n){var i=[e.state.modeGen],o={};nt(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,a=0;a<e.state.overlays.length;++a)!function(n){r.baseTokens=i;var a=e.state.overlays[n],s=1,u=0;r.state=!0,nt(e,t.text,a.mode,r,function(e,t){for(var r=s;u<e;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,u=Math.min(e,n)}if(t)if(a.opaque)i.splice(r,s-r,e,"overlay "+t),s=r+2;else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o),r.state=l,r.baseTokens=null,r.baseTokenPos=1}(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function qe(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ze(e,D(t)),i=t.text.length>e.options.maxHighlightLength&&Xe(e.doc.mode,n.state),o=_e(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ze(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new ha(n,!0,t);var o=it(e,t,r),l=o>n.first&&M(n,o-1).stateAfter,a=l?ha.fromSaved(n,l,o):new ha(n,Ye(n.mode),o);return n.iter(o,t,function(r){Je(e,r.text,a);var n=a.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?a.save():null,a.nextLine()}),r&&(n.modeFrontier=a.line),a}function Je(e,t,r,n){var i=e.doc.mode,o=new fa(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Qe(i,r.state);!o.eol();)et(i,o,r.state),o.start=o.pos}function Qe(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=$e(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function et(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=$e(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function tt(e,t,r,n){var i,o=e.doc,l=o.mode;t=j(o,t);var a,s=M(o,t.line),u=Ze(e,t.line,r),c=new fa(s.text,e.options.tabSize,u);for(n&&(a=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=et(l,c,u.state),n&&a.push(new pa(c,i,Xe(o.mode,u.state)));return n?a:new pa(c,i,u.state)}function rt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function nt(e,t,r,n,i,o,l){var a=r.flattenSpans;null==a&&(a=e.options.flattenSpans);var s,u=0,c=null,f=new fa(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];for(""==t&&rt(Qe(r,n.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(a=!1,l&&Je(e,t,n,f.pos),f.pos=t.length,s=null):s=rt(et(r,f,n.state,d),o),d){var h=d[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!a||c!=s){for(;u<f.start;)u=Math.min(f.start,u+5e3),i(u,c);c=s}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e3);i(p,c),u=p}}function it(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=M(o,a-1),u=s.stateAfter;if(u&&(!r||a+(u instanceof da?u.lookAhead:0)<=o.modeFrontier))return a;var c=f(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=a-1,n=c)}return i}function ot(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=M(e,n).stateAfter;if(i&&(!(i instanceof da)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}function lt(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),re(e),ne(e,r);var i=n?n(e):1;i!=e.height&&O(e,i)}function at(e){e.parent=null,re(e)}function st(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?ya:ma;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function ut(e,t){var r=i("span",null,null,xl?"padding-right: .1px":null),n={pre:i("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var l=o?t.rest[o-1]:t.line,a=void 0;n.pos=0,n.addToken=ft,Re(e.display.measure)&&(a=Se(l,e.doc.direction))&&(n.addToken=ht(n.addToken,a)),n.map=[];gt(l,n,qe(e,l,t!=e.display.externalMeasured&&D(l))),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=s(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=s(l.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(ze(e.display.measure))),0==o?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(xl){var u=n.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Me(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=s(n.pre.className,n.textClass||"")),n}function ct(e){var t=n("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ft(e,t,r,i,o,l,a){if(t){var s,u=e.splitSpaces?dt(t,e.trailingSpace):t,c=e.cm.state.specialChars,f=!1;if(c.test(t)){s=document.createDocumentFragment();for(var d=0;;){c.lastIndex=d;var h=c.exec(t),g=h?h.index-d:t.length-d;if(g){var v=document.createTextNode(u.slice(d,d+g));bl&&wl<9?s.appendChild(n("span",[v])):s.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!h)break;d+=g+1;var m=void 0;if("\t"==h[0]){var y=e.cm.options.tabSize,b=y-e.col%y;m=s.appendChild(n("span",p(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==h[0]||"\n"==h[0]?(m=s.appendChild(n("span","\r"==h[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",h[0]),e.col+=1):(m=e.cm.options.specialCharPlaceholder(h[0]),m.setAttribute("cm-text",h[0]),bl&&wl<9?s.appendChild(n("span",[m])):s.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,s=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,s),bl&&wl<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),r||i||o||f||l){var w=r||"";i&&(w+=i),o&&(w+=o);var x=n("span",[s],w,l);if(a)for(var C in a)a.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,a[C]);return e.content.appendChild(x)}e.content.appendChild(s)}}function dt(e,t){if(e.length>1&&!/  /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function ht(e,t){return function(r,n,i,o,l,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var f=void 0,d=0;d<t.length&&(f=t[d],!(f.to>u&&f.from<=u));d++);if(f.to>=c)return e(r,n,i,o,l,a,s);e(r,n.slice(0,f.to-u),i,o,null,a,s),o=null,n=n.slice(f.to-u),u=f.to}}}function pt(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function gt(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,a,s,u,c,f,d,h=i.length,p=0,g=1,v="",m=0;;){if(m==p){s=u=c=a="",d=null,f=null,m=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((d||(d={})).title=C.title),C.attributes)for(var k in C.attributes)(d||(d={}))[k]=C.attributes[k];C.collapsed&&(!f||le(f.marker,C)<0)&&(f=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==m&&(u+=" "+b[S]);if(!f||f.from==p)for(var L=0;L<y.length;++L)pt(t,0,y[L]);if(f&&(f.from||0)==p){if(pt(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}}if(p>=h)break;for(var T=Math.min(h,m);;){if(v){var M=p+v.length;if(!f){var N=M>T?v.slice(0,T-p):v;t.addToken(t,N,l?l+s:s,c,p+N.length==m?u:"",a,d)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,c=""}v=i.slice(o,o=r[g++]),l=st(r[g++],t.cm.options)}}else for(var A=1;A<r.length;A+=2)t.addToken(t,i.slice(o,o=r[A]),st(r[A+1],t.cm.options))}function vt(e,t,r){this.line=t,this.rest=pe(t),this.size=this.rest?D(g(this.rest))-r+1:1,this.node=this.text=null,this.hidden=me(e,t)}function mt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new vt(e.doc,M(e.doc,o),o);n=o+l.size,i.push(l)}return i}function yt(e){ba?ba.ops.push(e):e.ownsGroup=ba={ops:[e],delayedCallbacks:[]}}function bt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function wt(e,t){var r=e.ownsGroup;if(r)try{bt(r)}finally{ba=null,t(r)}}function xt(e,t){var r=Le(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);ba?n=ba.delayedCallbacks:wa?n=wa:(n=wa=[],setTimeout(Ct,0));for(var o=0;o<r.length;++o)!function(e){n.push(function(){return r[e].apply(null,i)})}(o)}}function Ct(){var e=wa;wa=null;for(var t=0;t<e.length;++t)e[t]()}function kt(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Mt(e,t):"gutter"==o?At(e,t,r,n):"class"==o?Nt(e,t):"widget"==o&&Ot(e,t,n)}t.changes=null}function St(e){return e.node==e.text&&(e.node=n("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),bl&&wl<8&&(e.node.style.zIndex=2)),e.node}function Lt(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=St(t);t.background=i.insertBefore(n("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function Tt(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):ut(e,t)}function Mt(e,t){var r=t.text.className,n=Tt(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,Nt(e,t)):r&&(t.text.className=r)}function Nt(e,t){Lt(e,t),t.line.wrapClass?St(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function At(e,t,r,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=St(t);t.gutterBackground=n("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var a=St(t),s=t.gutter=n("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),a.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(n("div",F(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var u=0;u<e.options.gutters.length;++u){var c=e.options.gutters[u],f=l.hasOwnProperty(c)&&l[c];f&&s.appendChild(n("div",[f],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function Ot(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);Wt(e,t,r)}function Dt(e,t,r,n){var i=Tt(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Nt(e,t),At(e,t,r,n),Wt(e,t,n),t.node}function Wt(e,t,r){if(Ht(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)Ht(e,t.rest[n],t,r,!1)}function Ht(e,t,r,i,o){if(t.widgets)for(var l=St(r),a=0,s=t.widgets;a<s.length;++a){var u=s[a],c=n("div",[u.node],"CodeMirror-linewidget");u.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Ft(u,c,r,i),e.display.input.setUneditable(c),o&&u.above?l.insertBefore(c,r.gutter||r.text):l.appendChild(c),xt(u,"redraw")}}function Ft(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function Et(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!o(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),r(t.display.measure,n("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Pt(e,t){for(var r=Pe(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function It(e){return e.lineSpace.offsetTop}function zt(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Rt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=r(e.measure,n("pre","x")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,o={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(o.left)||isNaN(o.right)||(e.cachedPaddingH=o),o}function Bt(e){return Gl-e.display.nativeBarWidth}function Vt(e){return e.display.scroller.clientWidth-Bt(e)-e.display.barWidth}function jt(e){return e.display.scroller.clientHeight-Bt(e)-e.display.barHeight}function Gt(e,t,r){var n=e.options.lineWrapping,i=n&&Vt(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),a=0;a<l.length-1;a++){var s=l[a],u=l[a+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Ut(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(D(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Kt(e,t){t=de(t);var n=D(t),i=e.display.externalMeasured=new vt(e.doc,t,n);i.lineN=n;var o=i.built=ut(e,i);return i.text=o.pre,r(e.display.lineMeasure,o.pre),i}function Xt(e,t,r,n){return _t(e,Yt(e,t),r,n)}function $t(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Tr(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Yt(e,t){var r=D(t),n=$t(e,r);n&&!n.text?n=null:n&&n.changes&&(kt(e,n,r,xr(e)),e.curOp.forceUpdate=!0),n||(n=Kt(e,t));var i=Ut(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function _t(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Gt(e,t.view,t.rect),t.hasHeights=!0),o=Jt(e,t,r,n),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function qt(e,t,r){for(var n,i,o,l,a,s,u=0;u<e.length;u+=3)if(a=e[u],s=e[u+1],t<a?(i=0,o=1,l="left"):t<s?(i=t-a,o=i+1):(u==e.length-3||t==s&&e[u+3]>t)&&(o=s-a,i=o-1,t>=s&&(l="right")),null!=i){if(n=e[u+2],a==s&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==s-a)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:a,coverEnd:s}}function Zt(e,t){var r=xa;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Jt(e,t,r,n){var i,o=qt(t.map,r,n),l=o.node,a=o.start,s=o.end,u=o.collapse;if(3==l.nodeType){for(var c=0;c<4;c++){for(;a&&k(t.line.text.charAt(o.coverStart+a));)--a;for(;o.coverStart+s<o.coverEnd&&k(t.line.text.charAt(o.coverStart+s));)++s;if(i=bl&&wl<9&&0==a&&s==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():Zt(El(l,a,s).getClientRects(),n),i.left||i.right||0==a)break;s=a,a-=1,u="right"}bl&&wl<11&&(i=Qt(e.display.measure,i))}else{a>0&&(u=n="right");var f;i=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(bl&&wl<9&&!a&&(!i||!i.left&&!i.right)){var d=l.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+wr(e.display),top:d.top,bottom:d.bottom}:xa}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(h+p)/2,v=t.view.measure.heights,m=0;m<v.length-1&&!(g<v[m]);m++);var y=m?v[m-1]:0,b=v[m],w={left:("right"==u?i.right:i.left)-t.rect.left,right:("left"==u?i.left:i.right)-t.rect.left,top:y,bottom:b};return i.left||i.right||(w.bogus=!0),e.options.singleCursorHeightPerLine||(w.rtop=h,w.rbottom=p),w}function Qt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Be(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function er(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function tr(e){e.display.externalMeasure=null,t(e.display.lineMeasure);for(var r=0;r<e.display.view.length;r++)er(e.display.view[r])}function rr(e){tr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function nr(){return kl&&Al?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ir(){return kl&&Al?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function or(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=Et(e.widgets[r]));return t}function lr(e,t,r,n,i){if(!i){var o=or(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=be(t);if("local"==n?l+=It(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var a=e.display.lineSpace.getBoundingClientRect();l+=a.top+("window"==n?0:ir());var s=a.left+("window"==n?0:nr());r.left+=s,r.right+=s}return r.top+=l,r.bottom+=l,r}function ar(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=nr(),i-=ir();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function sr(e,t,r,n,i){return n||(n=M(e.doc,t.line)),lr(e,n,Xt(e,n,t.ch,i),r)}function ur(e,t,r,n,i,o){function l(t,l){var a=_t(e,i,t,l?"right":"left",o);return l?a.left=a.right:a.right=a.left,lr(e,n,a,r)}function a(e,t,r){var n=s[t],i=1==n.level;return l(r?e-1:e,i!=r)}n=n||M(e.doc,t.line),i||(i=Yt(e,n));var s=Se(n,e.doc.direction),u=t.ch,c=t.sticky;if(u>=n.text.length?(u=n.text.length,c="before"):u<=0&&(u=0,c="after"),!s)return l("before"==c?u-1:u,"before"==c);var f=ke(s,u,c),d=Ql,h=a(u,f,"before"==c);return null!=d&&(h.other=a(u,d,"before"!=c)),h}function cr(e,t){var r=0;t=j(e.doc,t),e.options.lineWrapping||(r=wr(e.display)*t.ch);var n=M(e.doc,t.line),i=be(n)+It(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function fr(e,t,r,n,i){var o=E(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function dr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return fr(n.first,0,null,!0,-1);var i=W(n,r),o=n.first+n.size-1;if(i>o)return fr(n.first+n.size-1,M(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=M(n,i);;){var a=vr(e,l,i,t,r),s=ce(l,a.ch+(a.xRel>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==i)return u;l=M(n,i=u.line)}}function hr(e,t,r,n){n-=or(t);var i=t.text.length,o=L(function(t){return _t(e,r,t-1).bottom<=n},i,0);return i=L(function(t){return _t(e,r,t).top>n},o,i),{begin:o,end:i}}function pr(e,t,r,n){return r||(r=Yt(e,t)),hr(e,t,r,lr(e,t,_t(e,r,n),"line").top)}function gr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function vr(e,t,r,n,i){i-=be(t);var o=Yt(e,t),l=or(t),a=0,s=t.text.length,u=!0,c=Se(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?yr:mr)(e,t,r,o,c,n,i);u=1!=f.level,a=u?f.from:f.to-1,s=u?f.to:f.from-1}var d,h,p=null,g=null,v=L(function(t){var r=_t(e,o,t);return r.top+=l,r.bottom+=l,!!gr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)},a,s),m=!1;if(g){var y=n-g.left<g.right-n,b=y==u;v=p+(b?0:1),h=b?"after":"before",d=y?g.left:g.right}else{u||v!=s&&v!=a||v++,h=0==v?"after":v==t.text.length?"before":_t(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=ur(e,E(r,v,h),"line",t,o);d=w.left,m=i<w.top||i>=w.bottom}return v=S(t.text,v,1),fr(r,v,h,m,n-d)}function mr(e,t,r,n,i,o,l){var a=L(function(a){var s=i[a],u=1!=s.level;return gr(ur(e,E(r,u?s.to:s.from,u?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),s=i[a];if(a>0){var u=1!=s.level,c=ur(e,E(r,u?s.from:s.to,u?"after":"before"),"line",t,n);gr(c,o,l,!0)&&c.top>l&&(s=i[a-1])}return s}function yr(e,t,r,n,i,o,l){var a=hr(e,t,n,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,d=0;d<i.length;d++){var h=i[d];if(!(h.from>=u||h.to<=s)){var p=1!=h.level,g=_t(e,n,p?Math.min(u,h.to)-1:Math.max(s,h.from)).right,v=g<o?o-g+1e9:g-o;(!c||f>v)&&(c=h,f=v)}}return c||(c=i[i.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function br(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==va){va=n("pre");for(var i=0;i<49;++i)va.appendChild(document.createTextNode("x")),va.appendChild(n("br"));va.appendChild(document.createTextNode("x"))}r(e.measure,va);var o=va.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function wr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=n("span","xxxxxxxxxx"),i=n("pre",[t]);r(e.measure,i);var o=t.getBoundingClientRect(),l=(o.right-o.left)/10;return l>2&&(e.cachedCharWidth=l),l||10}function xr(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:Cr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Cr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function kr(e){var t=br(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/wr(e.display)-3);return function(i){if(me(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function Sr(e){var t=e.doc,r=kr(e);t.iter(function(e){var t=r(e);t!=e.height&&O(e,t)})}function Lr(e,t,r,n){var i=e.display;if(!r&&"true"==Pe(t).getAttribute("cm-not-content"))return null;var o,l,a=i.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,l=t.clientY-a.top}catch(t){return null}var s,u=dr(e,o,l);if(n&&1==u.xRel&&(s=M(e.doc,u.line).text).length==u.ch){var c=f(s,s.length,e.options.tabSize)-s.length;u=E(u.line,Math.max(0,Math.round((o-Rt(e.display).left)/wr(e.display))-c))}return u}function Tr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function Mr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Nr(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var a=r.sel.ranges[l];if(!(a.from().line>=e.display.viewTo||a.to().line<e.display.viewFrom)){var s=a.empty();(s||e.options.showCursorWhenSelecting)&&Ar(e,a.head,i),s||Dr(e,a,o)}}return n}function Ar(e,t,r){var i=ur(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=r.appendChild(n("div"," ","CodeMirror-cursor"));if(o.style.left=i.left+"px",o.style.top=i.top+"px",o.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var l=r.appendChild(n("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=i.other.left+"px",l.style.top=i.other.top+"px",l.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Or(e,t){return e.top-t.top||e.left-t.left}function Dr(e,t,r){function i(e,t,r,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),s.appendChild(n("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(null==r?f-e:r)+"px;\n                             height: "+(i-t)+"px"))}function o(t,r,n){function o(r,n){return sr(e,E(t,r),"div",h,n)}function l(t,r,n){var i=pr(e,h,null,t),l="ltr"==r==("after"==n)?"left":"right";return o("after"==n?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),l)[l]}var s,u,h=M(a,t),p=h.text.length,g=Se(h,a.direction);return Ce(g,r||0,null==n?p:n,function(e,t,a,h){var v="ltr"==a,m=o(e,v?"left":"right"),y=o(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==p,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var k=(d?b:w)&&x,S=(d?w:b)&&C,L=k?c:(v?m:y).left,T=S?f:(v?y:m).right;i(L,m.top,T-L,m.bottom)}else{var M,N,A,O;v?(M=d&&b&&x?c:m.left,N=d?f:l(e,a,"before"),A=d?c:l(t,a,"after"),O=d&&w&&C?f:y.right):(M=d?l(e,a,"before"):c,N=!d&&b&&x?f:m.right,A=!d&&w&&C?c:y.left,O=d?l(t,a,"after"):f),i(M,m.top,N-M,m.bottom),m.bottom<y.top&&i(c,m.bottom,null,y.top),i(A,y.top,O-A,y.bottom)}(!s||Or(m,s)<0)&&(s=m),Or(y,s)<0&&(s=y),(!u||Or(m,u)<0)&&(u=m),Or(y,u)<0&&(u=y)}),{start:s,end:u}}var l=e.display,a=e.doc,s=document.createDocumentFragment(),u=Rt(e.display),c=u.left,f=Math.max(l.sizerWidth,Vt(e)-l.sizer.offsetLeft)-u.right,d="ltr"==a.direction,h=t.from(),p=t.to();if(h.line==p.line)o(h.line,h.ch,p.ch);else{var g=M(a,h.line),v=M(a,p.line),m=de(g)==de(v),y=o(h.line,h.ch,m?g.text.length+1:null).end,b=o(p.line,m?0:null,p.ch).start;m&&(y.top<b.top-2?(i(y.right,y.top,null,y.bottom),i(c,b.top,b.left,b.bottom)):i(y.right,y.top,b.left-y.right,y.bottom)),y.bottom<b.top&&i(c,y.bottom,null,b.top)}r.appendChild(s)}function Wr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Hr(e){e.state.focused||(e.display.input.focus(),Er(e))}function Fr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pr(e))},100)}function Er(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,a(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),xl&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Wr(e))}function Pr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,zl(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Ir(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,l=void 0,a=0;if(!i.hidden){if(bl&&wl<8){var s=i.node.offsetTop+i.node.offsetHeight;l=s-r,r=s}else{var u=i.node.getBoundingClientRect();l=u.bottom-u.top,!o&&i.text.firstChild&&(a=i.text.firstChild.getBoundingClientRect().right-u.left-1)}var c=i.line.height-l;if(l<2&&(l=br(t)),(c>.005||c<-.005)&&(O(i.line,l),zr(i.line),i.rest))for(var f=0;f<i.rest.length;f++)zr(i.rest[f]);if(a>e.display.sizerWidth){var d=Math.ceil(a/wr(e.display));d>e.display.maxLineLength&&(e.display.maxLineLength=d,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function zr(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Rr(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-It(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=W(t,n),l=W(t,i);if(r&&r.ensure){var a=r.ensure.from.line,s=r.ensure.to.line;a<o?(o=a,l=W(t,be(M(t,a))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=l&&(o=W(t,be(M(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function Br(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=Cr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var a=r[l].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function Vr(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=F(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var o=i.measure.appendChild(n("div",[n("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),l=o.firstChild.offsetWidth,a=o.offsetWidth-l;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(l,i.lineGutter.offsetWidth-a)+1,i.lineNumWidth=i.lineNumInnerWidth+a,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Hn(e),!0}return!1}function jr(e,t){if(!Ne(e,"scrollCursorIntoView")){var r=e.display,i=r.sizer.getBoundingClientRect(),o=null;if(t.top+i.top<0?o=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Ml){var l=n("div","​",null,"position: absolute;\n                         top: "+(t.top-r.viewOffset-It(e.display))+"px;\n                         height: "+(t.bottom-t.top+Bt(e)+r.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(o),e.display.lineSpace.removeChild(l)}}}function Gr(e,t,r,n){null==n&&(n=0);var i;e.options.lineWrapping||t!=r||(t=t.ch?E(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,r="before"==t.sticky?E(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,a=ur(e,t),s=r&&r!=t?ur(e,r):a;i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-n,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+n};var u=Kr(e,i),c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=u.scrollTop&&(Jr(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(en(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(l=!0)),!l)break}return i}function Ur(e,t){var r=Kr(e,t);null!=r.scrollTop&&Jr(e,r.scrollTop),null!=r.scrollLeft&&en(e,r.scrollLeft)}function Kr(e,t){var r=e.display,n=br(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=jt(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+zt(r),s=t.top<n,u=t.bottom>a-n;if(t.top<i)l.scrollTop=s?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?a:t.bottom)-o);c!=i&&(l.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Vt(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(h?0:10)-d),l}function Xr(e,t){null!=t&&(qr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function $r(e){qr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Yr(e,t,r){null==t&&null==r||qr(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function _r(e,t){qr(e),e.curOp.scrollToPos=t}function qr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;Zr(e,cr(e,t.from),cr(e,t.to),t.margin)}}function Zr(e,t,r,n){var i=Kr(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Yr(e,i.scrollLeft,i.scrollTop)}function Jr(e,t){Math.abs(e.doc.scrollTop-t)<2||(gl||Dn(e,{top:t}),Qr(e,t,!0),gl&&Dn(e),Sn(e,100))}function Qr(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function en(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,Br(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function tn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+zt(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Bt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function rn(e,t){t||(t=tn(e));var r=e.display.barWidth,n=e.display.barHeight;nn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Ir(e),nn(e,tn(e)),r=e.display.barWidth,n=e.display.barHeight}function nn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function on(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&zl(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Sa[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ra(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?en(e,t):Jr(e,t)},e),e.display.scrollbars.addClass&&a(e.display.wrapper,e.display.scrollbars.addClass)}function ln(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++La},yt(e.curOp)}function an(e){var t=e.curOp;t&&wt(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;sn(e)})}function sn(e){for(var t=e.ops,r=0;r<t.length;r++)un(t[r]);for(var n=0;n<t.length;n++)cn(t[n]);for(var i=0;i<t.length;i++)fn(t[i]);for(var o=0;o<t.length;o++)dn(t[o]);for(var l=0;l<t.length;l++)hn(t[l])}function un(e){var t=e.cm,r=t.display;Tn(t),e.updateMaxLine&&xe(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ta(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function cn(e){e.updatedDisplay=e.mustUpdate&&An(e.cm,e.update)}function fn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Ir(t),e.barMeasure=tn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Xt(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Bt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Vt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function dn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&en(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==l();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&rn(t,e.barMeasure),e.updatedDisplay&&Fn(t,e.barMeasure),e.selectionChanged&&Wr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Hr(e.cm)}function hn(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&On(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Qr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&en(t,e.scrollLeft,!0,!0),e.scrollToPos){jr(t,Gr(t,j(n,e.scrollToPos.from),j(n,e.scrollToPos.to),e.scrollToPos.margin))}var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||Me(i[l],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&Me(o[a],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function pn(e,t){if(e.curOp)return t();ln(e);try{return t()}finally{an(e)}}function gn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ln(e);try{return t.apply(e,arguments)}finally{an(e)}}}function vn(e){return function(){if(this.curOp)return e.apply(this,arguments);ln(this);try{return e.apply(this,arguments)}finally{an(this)}}}function mn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ln(t);try{return e.apply(this,arguments)}finally{an(t)}}}function yn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Jl&&ge(e.doc,t)<i.viewTo&&wn(e);else if(r<=i.viewFrom)Jl&&ve(e.doc,r+n)>i.viewFrom?wn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)wn(e);else if(t<=i.viewFrom){var o=xn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):wn(e)}else if(r>=i.viewTo){var l=xn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):wn(e)}else{var a=xn(e,t,t,-1),s=xn(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(mt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):wn(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function bn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Tr(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==d(l,r)&&l.push(r)}}}function wn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function xn(e,t,r,n){var i,o=Tr(e,t),l=e.display.view;if(!Jl||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var a=e.display.viewFrom,s=0;s<o;s++)a+=l[s].size;if(a!=t){if(n>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,r+=i}for(;ge(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Cn(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=mt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=mt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Tr(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(mt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Tr(e,r)))),n.viewTo=r}function kn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Sn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,u(Ln,e))}function Ln(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Ze(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?Xe(t.mode,n.state):null,s=_e(e,o,n,!0);a&&(n.state=a),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!f&&d<l.length;++d)f=l[d]!=o.styles[d];f&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&Je(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Sn(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&pn(e,function(){for(var t=0;t<i.length;t++)bn(e,i[t],"text")})}}function Tn(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Bt(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Bt(e)+"px",t.scrollbarsClipped=!0)}function Mn(e){if(e.hasFocus())return null;var t=l();if(!t||!o(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&o(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function Nn(e){if(e&&e.activeElt&&e.activeElt!=l()&&(e.activeElt.focus(),e.anchorNode&&o(document.body,e.anchorNode)&&o(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function An(e,r){var n=e.display,i=e.doc;if(r.editorIsHidden)return wn(e),!1;if(!r.force&&r.visible.from>=n.viewFrom&&r.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==kn(e))return!1;Vr(e)&&(wn(e),r.dims=xr(e));var o=i.first+i.size,l=Math.max(r.visible.from-e.options.viewportMargin,i.first),a=Math.min(o,r.visible.to+e.options.viewportMargin);n.viewFrom<l&&l-n.viewFrom<20&&(l=Math.max(i.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(o,n.viewTo)),Jl&&(l=ge(e.doc,l),a=ve(e.doc,a));var s=l!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=r.wrapperHeight||n.lastWrapWidth!=r.wrapperWidth;Cn(e,l,a),n.viewOffset=be(M(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=kn(e);if(!s&&0==u&&!r.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Mn(e);return u>4&&(n.lineDiv.style.display="none"),Wn(e,n.updateLineNumbers,r.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Nn(c),t(n.cursorDiv),t(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=r.wrapperHeight,n.lastWrapWidth=r.wrapperWidth,Sn(e,400)),n.updateLineNumbers=null,!0}function On(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Vt(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+zt(e.display)-jt(e),r.top)}),t.visible=Rr(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&An(e,t);n=!1){Ir(e);var i=tn(e);Mr(e),rn(e,i),Fn(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Dn(e,t){var r=new Ta(e,t);if(An(e,r)){Ir(e),On(e,r);var n=tn(e);Mr(e),rn(e,n),Fn(e,n),r.finish()}}function Wn(e,r,n){function i(t){var r=t.nextSibling;return xl&&Dl&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var o=e.display,l=e.options.lineNumbers,a=o.lineDiv,s=a.firstChild,u=o.view,c=o.viewFrom,f=0;f<u.length;f++){var h=u[f];if(h.hidden);else if(h.node&&h.node.parentNode==a){for(;s!=h.node;)s=i(s);var p=l&&null!=r&&r<=c&&h.lineNumber;h.changes&&(d(h.changes,"gutter")>-1&&(p=!1),kt(e,h,c,n)),p&&(t(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(F(e.options,c)))),s=h.node.nextSibling}else{var g=Dt(e,h,c,n);a.insertBefore(g,s)}c+=h.size}for(;s;)s=i(s)}function Hn(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Fn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Bt(e)+"px"}function En(e){var r=e.display.gutters,i=e.options.gutters;t(r);for(var o=0;o<i.length;++o){var l=i[o],a=r.appendChild(n("div",null,"CodeMirror-gutter "+l));"CodeMirror-linenumbers"==l&&(e.display.lineGutter=a,a.style.width=(e.display.lineNumWidth||1)+"px")}r.style.display=o?"":"none",Hn(e)}function Pn(e){var t=d(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function In(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function zn(e){var t=In(e);return t.x*=Na,t.y*=Na,t}function Rn(e,t){var r=In(t),n=r.x,i=r.y,o=e.display,l=o.scroller,a=l.scrollWidth>l.clientWidth,s=l.scrollHeight>l.clientHeight;if(n&&a||i&&s){if(i&&Dl&&xl)e:for(var u=t.target,c=o.view;u!=l;u=u.parentNode)for(var f=0;f<c.length;f++)if(c[f].node==u){e.display.currentWheelTarget=u;break e}if(n&&!gl&&!Sl&&null!=Na)return i&&s&&Jr(e,Math.max(0,l.scrollTop+i*Na)),en(e,Math.max(0,l.scrollLeft+n*Na)),(!i||i&&s)&&We(t),void(o.wheelStartX=null);if(i&&null!=Na){var d=i*Na,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;d<0?h=Math.max(0,h+d-50):p=Math.min(e.doc.height,p+d+50),Dn(e,{top:h,bottom:p})}Ma<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Na=(Na*Ma+r)/(Ma+1),++Ma)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function Bn(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(e,t){return P(e.from(),t.from())}),r=d(t,i);for(var o=1;o<t.length;o++){var l=t[o],a=t[o-1],s=P(a.to(),l.from());if(n&&!l.empty()?s>0:s>=0){var u=B(a.from(),l.from()),c=R(a.to(),l.to()),f=a.empty()?l.from()==l.head:a.from()==a.head;o<=r&&--r,t.splice(--o,2,new Oa(f?c:u,f?u:c))}}return new Aa(t,r)}function Vn(e,t){return new Aa([new Oa(e,t||e)],0)}function jn(e){return e.text?E(e.from.line+e.text.length-1,g(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Gn(e,t){if(P(e,t.from)<0)return e;if(P(e,t.to)<=0)return jn(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=jn(t).ch-t.to.ch),E(r,n)}function Un(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Oa(Gn(i.anchor,t),Gn(i.head,t)))}return Bn(e.cm,r,e.sel.primIndex)}function Kn(e,t,r){return e.line==t.line?E(r.line,e.ch-t.ch+r.ch):E(r.line+(e.line-t.line),e.ch)}function Xn(e,t,r){for(var n=[],i=E(e.first,0),o=i,l=0;l<t.length;l++){var a=t[l],s=Kn(a.from,i,o),u=Kn(jn(a),i,o);if(i=a.to,o=u,"around"==r){var c=e.sel.ranges[l],f=P(c.head,c.anchor)<0;n[l]=new Oa(f?u:s,f?s:u)}else n[l]=new Oa(s,s)}return new Aa(n,e.sel.primIndex)}function $n(e){e.doc.mode=Ue(e.options,e.doc.modeOption),Yn(e)}function Yn(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Sn(e,100),e.state.modeGen++,e.curOp&&yn(e)}function _n(e,t){return 0==t.from.ch&&0==t.to.ch&&""==g(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){lt(e,r,i,n),xt(e,"change",e,t)}function l(e,t){for(var r=[],o=e;o<t;++o)r.push(new ga(u[o],i(o),n));return r}var a=t.from,s=t.to,u=t.text,c=M(e,a.line),f=M(e,s.line),d=g(u),h=i(u.length-1),p=s.line-a.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(_n(e,t)){var v=l(0,u.length-1);o(f,f.text,h),p&&e.remove(a.line,p),v.length&&e.insert(a.line,v)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,a.ch)+d+c.text.slice(s.ch),h);else{var m=l(1,u.length-1);m.push(new ga(d+c.text.slice(s.ch),h,n)),o(c,c.text.slice(0,a.ch)+u[0],i(0)),e.insert(a.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,a.ch)+u[0]+f.text.slice(s.ch),i(0)),e.remove(a.line+1,p);else{o(c,c.text.slice(0,a.ch)+u[0],i(0)),o(f,d+f.text.slice(s.ch),h);var y=l(1,u.length-1);p>1&&e.remove(a.line+1,p-1),e.insert(a.line+1,y)}xt(e,"change",e,t)}function Zn(e,t,r){function n(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var a=e.linked[l];if(a.doc!=i){var s=o&&a.sharedHist;r&&!s||(t(a.doc,s),n(a.doc,e,s))}}}n(e,null,!0)}function Jn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Sr(e),$n(e),Qn(e),e.options.lineWrapping||xe(e),e.options.mode=t.modeOption,yn(e)}function Qn(e){("rtl"==e.doc.direction?a:zl)(e.display.lineDiv,"CodeMirror-rtl")}function ei(e){pn(e,function(){Qn(e),yn(e)})}function ti(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function ri(e,t){var r={from:z(t.from),to:jn(t),text:N(e,t.from,t.to)};return ui(e,r,t.from.line,t.to.line+1),Zn(e,function(e){return ui(e,r,t.from.line,t.to.line+1)},!0),r}function ni(e){for(;e.length;){if(!g(e).ranges)break;e.pop()}}function ii(e,t){return t?(ni(e.done),g(e.done)):e.done.length&&!g(e.done).ranges?g(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),g(e.done)):void 0}function oi(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=ii(i,i.lastOp==n)))l=g(o.changes),0==P(t.from,t.to)&&0==P(t.from,l.to)?l.to=jn(t):o.changes.push(ri(e,t));else{var s=g(i.done);for(s&&s.ranges||si(e.sel,i.done),o={changes:[ri(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||Me(e,"historyAdded")}function li(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ai(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||li(e,o,g(i.done),t))?i.done[i.done.length-1]=t:si(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&ni(i.undone)}function si(e,t){var r=g(t);r&&r.ranges&&r.equals(e)||t.push(e)}function ui(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function ci(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function fi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(ci(r[i]));return n}function di(e,t){var r=fi(e,t),n=Q(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var a=0;a<l.length;++a){for(var s=l[a],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else l&&(r[i]=l)}return r}function hi(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?Aa.prototype.deepCopy.call(o):o);else{var l=o.changes,a=[];n.push({changes:a});for(var s=0;s<l.length;++s){var u=l[s],c=void 0;if(a.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&d(t,Number(c[1]))>-1&&(g(a)[f]=u[f],delete u[f])}}}return n}function pi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=P(t,i)<0;o!=P(r,i)<0?(i=t,t=r):o!=P(t,r)<0&&(t=r)}return new Oa(i,t)}return new Oa(r||t,t)}function gi(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),xi(e,new Aa([pi(e.sel.primary(),t,r,i)],0),n)}function vi(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=pi(e.sel.ranges[o],t[o],null,i);xi(e,Bn(e.cm,n,e.sel.primIndex),r)}function mi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,xi(e,Bn(e.cm,i,e.sel.primIndex),n)}function yi(e,t,r,n){xi(e,Vn(t,r),n)}function bi(e,t,r){var n={ranges:t.ranges,update:function(t){var r=this;this.ranges=[];for(var n=0;n<t.length;n++)r.ranges[n]=new Oa(j(e,t[n].anchor),j(e,t[n].head))},origin:r&&r.origin};return Me(e,"beforeSelectionChange",e,n),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Bn(e.cm,n.ranges,n.ranges.length-1):t}function wi(e,t,r){var n=e.history.done,i=g(n);i&&i.ranges?(n[n.length-1]=t,Ci(e,t,r)):xi(e,t,r)}function xi(e,t,r){Ci(e,t,r),ai(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Ci(e,t,r){(Oe(e,"beforeSelectionChange")||e.cm&&Oe(e.cm,"beforeSelectionChange"))&&(t=bi(e,t,r)),ki(e,Li(e,t,r&&r.bias||(P(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&!1===r.scroll||!e.cm||$r(e.cm)}function ki(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ae(e.cm)),xt(e,"cursorActivity",e))}function Si(e){ki(e,Li(e,e.sel,null,!1))}function Li(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],a=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Mi(e,l.anchor,a&&a.anchor,r,n),u=Mi(e,l.head,a&&a.head,r,n);(i||s!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Oa(s,u))}return i?Bn(e.cm,i,t.primIndex):t}function Ti(e,t,r,n,i){var o=M(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var a=o.markedSpans[l],s=a.marker;if((null==a.from||(s.inclusiveLeft?a.from<=t.ch:a.from<t.ch))&&(null==a.to||(s.inclusiveRight?a.to>=t.ch:a.to>t.ch))){if(i&&(Me(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!s.atomic)continue;if(r){var u=s.find(n<0?1:-1),c=void 0;if((n<0?s.inclusiveRight:s.inclusiveLeft)&&(u=Ni(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=P(u,r))&&(n<0?c<0:c>0))return Ti(e,u,t,n,i)}var f=s.find(n<0?-1:1);return(n<0?s.inclusiveLeft:s.inclusiveRight)&&(f=Ni(e,f,n,f.line==t.line?o:null)),f?Ti(e,f,t,n,i):null}}return t}function Mi(e,t,r,n,i){var o=n||1,l=Ti(e,t,r,o,i)||!i&&Ti(e,t,r,o,!0)||Ti(e,t,r,-o,i)||!i&&Ti(e,t,r,-o,!0);return l||(e.cantEdit=!0,E(e.first,0))}function Ni(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?j(e,E(t.line-1)):null:r>0&&t.ch==(n||M(e,t.line)).text.length?t.line<e.first+e.size-1?E(t.line+1,0):null:new E(t.line,t.ch+r)}function Ai(e){e.setSelection(E(e.firstLine(),0),E(e.lastLine()),Kl)}function Oi(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=j(e,t)),r&&(n.to=j(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),Me(e,"beforeChange",e,n),e.cm&&Me(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Di(e,t,r){if(e.cm){if(!e.cm.curOp)return gn(e.cm,Di)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Oe(e,"beforeChange")||e.cm&&Oe(e.cm,"beforeChange"))||(t=Oi(e,t,!0))){var n=Zl&&!r&&te(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Wi(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Wi(e,t)}}function Wi(e,t){if(1!=t.text.length||""!=t.text[0]||0!=P(t.from,t.to)){var r=Un(e,t);oi(e,t,r,e.cm?e.cm.curOp.id:NaN),Ei(e,t,r,Q(e,t));var n=[];Zn(e,function(e,r){r||-1!=d(n,e.history)||(Bi(e.history,t),n.push(e.history)),Ei(e,t,null,Q(e,t))})}}function Hi(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,l=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u<a.length&&(i=a[u],r?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(i=a.pop(),!i.ranges){if(n)return void a.push(i);break}if(si(i,s),r&&!i.equals(e.sel))return void xi(e,i,{clearRedo:!1});l=i}var c=[];si(l,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var f=Oe(e,"beforeChange")||e.cm&&Oe(e.cm,"beforeChange"),h=i.changes.length-1;h>=0;--h){var p=function(r){var n=i.changes[r];if(n.origin=t,f&&!Oi(e,n,!1))return a.length=0,{};c.push(ri(e,n));var o=r?Un(e,n):g(a);Ei(e,n,o,di(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:jn(n)});var l=[];Zn(e,function(e,t){t||-1!=d(l,e.history)||(Bi(e.history,n),l.push(e.history)),Ei(e,n,null,di(e,n))})}(h);if(p)return p.v}}}}function Fi(e,t){if(0!=t&&(e.first+=t,e.sel=new Aa(v(e.sel.ranges,function(e){return new Oa(E(e.anchor.line+t,e.anchor.ch),E(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){yn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)bn(e.cm,n,"gutter")}}function Ei(e,t,r,n){if(e.cm&&!e.cm.curOp)return gn(e.cm,Ei)(e,t,r,n);if(t.to.line<e.first)return void Fi(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Fi(e,i),t={from:E(e.first,0),to:E(t.to.line+i,t.to.ch),text:[g(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:E(o,M(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=N(e,t.from,t.to),r||(r=Un(e,t)),e.cm?Pi(e.cm,t,n):qn(e,t,n),Ci(e,r,Kl)}}function Pi(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=D(de(M(n,o.line))),n.iter(s,l.line+1,function(e){if(e==i.maxLine)return a=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ae(e),qn(n,t,r,kr(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,function(e){var t=we(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),ot(n,o.line),Sn(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?yn(e):o.line!=l.line||1!=t.text.length||_n(e.doc,t)?yn(e,o.line,l.line+1,u):bn(e,o.line,"text");var c=Oe(e,"changes"),f=Oe(e,"change");if(f||c){var d={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&xt(e,"change",e,d),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}function Ii(e,t,r,n,i){var o;n||(n=r),P(n,r)<0&&(o=[n,r],r=o[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Di(e,{from:r,to:n,text:t,origin:i})}function zi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Ri(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)zi(o.ranges[a].anchor,t,r,n),zi(o.ranges[a].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s];if(r<u.from.line)u.from=E(u.from.line+n,u.from.ch),u.to=E(u.to.line+n,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function Bi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Ri(e.done,r,n,i),Ri(e.undone,r,n,i)}function Vi(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=M(e,V(e,t)):i=D(t),null==i?null:(n(o,i)&&e.cm&&bn(e.cm,i,r),o)}function ji(e){var t=this;this.lines=e,this.parent=null;for(var r=0,n=0;n<e.length;++n)e[n].parent=t,r+=e[n].height;this.height=r}function Gi(e){var t=this;this.children=e;for(var r=0,n=0,i=0;i<e.length;++i){var o=e[i];r+=o.chunkSize(),n+=o.height,o.parent=t}this.size=r,this.height=n,this.parent=null}function Ui(e,t,r){be(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Xr(e,r)}function Ki(e,t,r,n){var i=new Da(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Vi(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!me(e,t)){var n=be(t)<e.scrollTop;O(t,t.height+Et(i)),n&&Xr(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&xt(o,"lineWidgetAdded",o,i,"number"==typeof t?t:D(t)),i}function Xi(e,t,r,n,o){if(n&&n.shared)return $i(e,t,r,n,o);if(e.cm&&!e.cm.curOp)return gn(e.cm,Xi)(e,t,r,n,o);var l=new Ha(e,o),a=P(t,r);if(n&&c(n,l,!1),a>0||0==a&&!1!==l.clearWhenEmpty)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=i("span",[l.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(fe(e,t.line,t,r,l)||t.line!=r.line&&fe(e,r.line,t,r,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");X()}l.addToHistory&&oi(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,u=t.line,f=e.cm;if(e.iter(u,r.line+1,function(e){f&&l.collapsed&&!f.options.lineWrapping&&de(e)==f.display.maxLine&&(s=!0),l.collapsed&&u!=t.line&&O(e,0),q(e,new $(l,u==t.line?t.ch:null,u==r.line?r.ch:null)),++u}),l.collapsed&&e.iter(t.line,r.line+1,function(t){me(e,t)&&O(t,0)}),l.clearOnEnter&&ra(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(K(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++Wa,l.atomic=!0),f){if(s&&(f.curOp.updateMaxLine=!0),l.collapsed)yn(f,t.line,r.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var d=t.line;d<=r.line;d++)bn(f,d,"text");l.atomic&&Si(f.doc),xt(f,"markerAdded",f,l)}return l}function $i(e,t,r,n,i){n=c(n),n.shared=!1;var o=[Xi(e,t,r,n,i)],l=o[0],a=n.widgetNode;return Zn(e,function(e){a&&(n.widgetNode=a.cloneNode(!0)),o.push(Xi(e,j(e,t),j(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;l=g(o)}),new Fa(o,l)}function Yi(e){return e.findMarks(E(e.first,0),e.clipPos(E(e.lastLine())),function(e){return e.parent})}function _i(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(P(o,l)){var a=Xi(e,o,l,n.primary,n.primary.type);n.markers.push(a),a.parent=n}}}function qi(e){for(var t=0;t<e.length;t++)!function(t){var r=e[t],n=[r.primary.doc];Zn(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==d(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}(t)}function Zi(e){var t=this;if(eo(t),!Ne(t,e)&&!Pt(t.display,e)){We(e),bl&&(Ia=+new Date);var r=Lr(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,a=0;a<i;++a)!function(e,n){if(!t.options.allowDropFileTypes||-1!=d(t.options.allowDropFileTypes,e.type)){var a=new FileReader;a.onload=gn(t,function(){var e=a.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++l==i){r=j(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Di(t.doc,s),wi(t.doc,Vn(r,jn(s)))}}),a.readAsText(e)}}(n[a],a);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var s=e.dataTransfer.getData("Text");if(s){var u;if(t.state.draggingText&&!t.state.draggingText.copy&&(u=t.listSelections()),Ci(t.doc,Vn(r,r)),u)for(var c=0;c<u.length;++c)Ii(t.doc,"",u[c].anchor,u[c].head,"drag");t.replaceSelection(s,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Ji(e,t){if(bl&&(!e.state.draggingText||+new Date-Ia<100))return void Ee(t);if(!Ne(e,t)&&!Pt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Ll)){var r=n("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Sl&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),Sl&&r.parentNode.removeChild(r)}}function Qi(e,t){var i=Lr(e,t);if(i){var o=document.createDocumentFragment();Ar(e,i,o),e.display.dragCursor||(e.display.dragCursor=n("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),r(e.display.dragCursor,o)}}function eo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function to(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation(function(){for(var t=0;t<r.length;t++)e(r[t])})}}function ro(){za||(no(),za=!0)}function no(){var e;ra(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,to(io)},100))}),ra(window,"blur",function(){return to(Pr)})}function io(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}function oo(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,o,l=0;l<t.length-1;l++){var a=t[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function lo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=v(r.split(" "),oo),o=0;o<i.length;o++){var l=void 0,a=void 0;o==i.length-1?(a=i.join(" "),l=n):(a=i.slice(0,o+1).join(" "),l="...");var s=t[a];if(s){if(s!=l)throw new Error("Inconsistent bindings for "+a)}else t[a]=l}delete e[r]}for(var u in t)e[u]=t[u];return e}function ao(e,t,r,n){t=fo(t);var i=t.call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return ao(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=ao(e,t.fallthrough[o],r,n);if(l)return l}}}function so(e){var t="string"==typeof e?e:Ra[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function uo(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(Pl?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(Pl?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function co(e,t){if(Sl&&34==e.keyCode&&e.char)return!1;var r=Ra[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),uo(r,e,t))}function fo(e){return"string"==typeof e?Ga[e]:e}function ho(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&P(o.from,g(n).to)<=0;){var l=n.pop();if(P(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}pn(e,function(){for(var t=n.length-1;t>=0;t--)Ii(e.doc,"",n[t].from,n[t].to,"+delete");$r(e)})}function po(e,t,r){var n=S(e.text,t+r,r);return n<0||n>e.text.length?null:n}function go(e,t,r){var n=po(e,t.ch,r);return null==n?null:new E(t.line,n,r<0?"after":"before")}function vo(e,t,r,n,i){if(e){var o=Se(r,t.doc.direction);if(o){var l,a=i<0?g(o):o[0],s=i<0==(1==a.level),u=s?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=Yt(t,r);l=i<0?r.text.length-1:0;var f=_t(t,c,l).top;l=L(function(e){return _t(t,c,e).top==f},i<0==(1==a.level)?a.from:a.to-1,l),"before"==u&&(l=po(r,l,1))}else l=i<0?a.to:a.from;return new E(n,l,u)}}return new E(n,i<0?r.text.length:0,i<0?"before":"after")}function mo(e,t,r,n){var i=Se(t,e.doc.direction);if(!i)return go(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=ke(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from<r.ch))return go(t,r,n);var a,s=function(e,r){return po(t,e instanceof E?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(a=a||Yt(e,t),pr(e,t,a,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?s(r,-1):r.ch);if("rtl"==e.doc.direction||1==l.level){var f=1==l.level==n<0,d=s(r,f?1:-1);if(null!=d&&(f?d<=l.to&&d<=c.end:d>=l.from&&d>=c.begin)){var h=f?"before":"after";return new E(r.line,d,h)}}var p=function(e,t,n){for(var o=function(e,t){return t?new E(r.line,s(e,1),"before"):new E(r.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],a=t>0==(1!=l.level),u=a?n.begin:s(n.end,-1);if(l.from<=u&&u<l.to)return o(u,a);if(u=a?l.from:s(l.to,-1),n.begin<=u&&u<n.end)return o(u,a)}},g=p(o+n,n,c);if(g)return g;var v=n>0?c.end:s(c.begin,-1);return null==v||n>0&&v==t.text.length||!(g=p(n>0?0:i.length-1,n,u(v)))?null:g}function yo(e,t){var r=M(e.doc,t),n=de(r);return n!=r&&(t=D(n)),vo(!0,e,n,t,1)}function bo(e,t){var r=M(e.doc,t),n=he(r);return n!=r&&(t=D(n)),vo(!0,e,r,t,-1)}function wo(e,t){var r=yo(e,t.line),n=M(e.doc,r.line),i=Se(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return E(r.line,l?0:o,r.sticky)}return r}function xo(e,t,r){if("string"==typeof t&&!(t=Ua[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ul}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function Co(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=ao(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&ao(t,e.options.extraKeys,r,e)||ao(t,e.options.keyMap,r,e)}function ko(e,t,r,n){var i=e.state.keySeq;if(i){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ka.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),So(e,i+" "+t,r,n))return!0}return So(e,t,r,n)}function So(e,t,r,n){var i=Co(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&xt(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(We(r),Wr(e)),!!i}function Lo(e,t){var r=co(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?ko(e,"Shift-"+r,t,function(t){return xo(e,t,!0)})||ko(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return xo(e,t)}):ko(e,r,t,function(t){return xo(e,t)}))}function To(e,t,r){return ko(e,"'"+r+"'",t,function(t){return xo(e,t,!0)})}function Mo(e){var t=this;if(t.curOp.focus=l(),!Ne(t,e)){bl&&wl<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=Lo(t,e);Sl&&(Xa=n?r:null,!n&&88==r&&!la&&(Dl?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||No(t)}}function No(e){function t(e){18!=e.keyCode&&e.altKey||(zl(r,"CodeMirror-crosshair"),Te(document,"keyup",t),Te(document,"mouseover",t))}var r=e.display.lineDiv;a(r,"CodeMirror-crosshair"),ra(document,"keyup",t),ra(document,"mouseover",t)}function Ao(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ne(this,e)}function Oo(e){var t=this;if(!(Pt(t.display,e)||Ne(t,e)||e.ctrlKey&&!e.altKey||Dl&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(Sl&&r==Xa)return Xa=null,void We(e);if(!Sl||e.which&&!(e.which<10)||!Lo(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(To(t,e,i)||t.display.input.onKeyPress(e))}}}function Do(e,t){var r=+new Date;return _a&&_a.compare(r,e,t)?(Ya=_a=null,"triple"):Ya&&Ya.compare(r,e,t)?(_a=new $a(r,e,t),Ya=null,"double"):(Ya=new $a(r,e,t),_a=null,"single")}function Wo(e){var t=this,r=t.display;if(!(Ne(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.input.ensurePolled(),r.shift=e.shiftKey,Pt(r,e))return void(xl||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100)));if(!Vo(t,e)){var n=Lr(t,e),i=Ie(e),o=n?Do(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&Ho(t,i,n,o,e)||(1==i?n?Eo(t,n,o,e):Pe(e)==r.scroller&&We(e):2==i?(n&&gi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):3==i&&(Il?t.display.input.onContextMenu(e):Fr(t)))}}}function Ho(e,t,r,n,i){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,ko(e,uo(o,i),i,function(t){if("string"==typeof t&&(t=Ua[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=Ul}finally{e.state.suppressEdits=!1}return n})}function Fo(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=Wl?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=Dl?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(Dl?r.altKey:r.ctrlKey)),i}function Eo(e,t,r,n){bl?setTimeout(u(Hr,e),0):e.curOp.focus=l();var i,o=Fo(e,r,n),a=e.doc.sel;e.options.dragDrop&&na&&!e.isReadOnly()&&"single"==r&&(i=a.contains(t))>-1&&(P((i=a.ranges[i]).from(),t)<0||t.xRel>0)&&(P(i.to(),t)>0||t.xRel<0)?Po(e,n,t,o):zo(e,n,t,o)}function Po(e,t,r,n){var i=e.display,o=!1,l=gn(e,function(t){xl&&(i.scroller.draggable=!1),e.state.draggingText=!1,Te(i.wrapper.ownerDocument,"mouseup",l),Te(i.wrapper.ownerDocument,"mousemove",a),Te(i.scroller,"dragstart",s),Te(i.scroller,"drop",l),o||(We(t),n.addNew||gi(e.doc,r,null,null,n.extend),xl||bl&&9==wl?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),a=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},s=function(){return o=!0};xl&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ra(i.wrapper.ownerDocument,"mouseup",l),ra(i.wrapper.ownerDocument,"mousemove",a),ra(i.scroller,"dragstart",s),ra(i.scroller,"drop",l),Fr(e),setTimeout(function(){return i.input.focus()},20)}function Io(e,t,r){if("char"==r)return new Oa(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Oa(E(t.line,0),j(e.doc,E(t.line+1,0)));var n=r(e,t);return new Oa(n.from,n.to)}function zo(e,t,r,n){function i(t){if(0!=P(m,t))if(m=t,"rectangle"==n.unit){for(var i=[],o=e.options.tabSize,l=f(M(u,r.line).text,r.ch,o),a=f(M(u,t.line).text,t.ch,o),s=Math.min(l,a),g=Math.max(l,a),v=Math.min(r.line,t.line),y=Math.min(e.lastLine(),Math.max(r.line,t.line));v<=y;v++){var b=M(u,v).text,w=h(b,s,o);s==g?i.push(new Oa(E(v,w),E(v,w))):b.length>w&&i.push(new Oa(E(v,w),E(v,h(b,g,o))))}i.length||i.push(new Oa(r,r)),xi(u,Bn(e,p.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x,C=c,k=Io(e,t,n.unit),S=C.anchor;P(k.anchor,S)>0?(x=k.head,S=B(C.from(),k.anchor)):(x=k.anchor,S=R(C.to(),k.head));var L=p.ranges.slice(0);L[d]=Ro(e,new Oa(j(u,S),x)),xi(u,Bn(e,L,d),Xl)}}function o(t){var r=++b,a=Lr(e,t,!0,"rectangle"==n.unit);if(a)if(0!=P(a,m)){e.curOp.focus=l(),i(a);var c=Rr(s,u);(a.line>=c.to||a.line<c.from)&&setTimeout(gn(e,function(){b==r&&o(t)}),150)}else{var f=t.clientY<y.top?-20:t.clientY>y.bottom?20:0;f&&setTimeout(gn(e,function(){b==r&&(s.scroller.scrollTop+=f,o(t))}),50)}}function a(t){e.state.selectingText=!1,b=1/0,We(t),s.input.focus(),Te(s.wrapper.ownerDocument,"mousemove",w),Te(s.wrapper.ownerDocument,"mouseup",x),u.history.lastSelOrigin=null}var s=e.display,u=e.doc;We(t);var c,d,p=u.sel,g=p.ranges;if(n.addNew&&!n.extend?(d=u.sel.contains(r),c=d>-1?g[d]:new Oa(r,r)):(c=u.sel.primary(),d=u.sel.primIndex),"rectangle"==n.unit)n.addNew||(c=new Oa(r,r)),r=Lr(e,t,!0,!0),d=-1;else{var v=Io(e,r,n.unit);c=n.extend?pi(c,v.anchor,v.head,n.extend):v}n.addNew?-1==d?(d=g.length,xi(u,Bn(e,g.concat([c]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&"char"==n.unit&&!n.extend?(xi(u,Bn(e,g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),p=u.sel):mi(u,d,c,Xl):(d=0,xi(u,new Aa([c],0),Xl),p=u.sel);var m=r,y=s.wrapper.getBoundingClientRect(),b=0,w=gn(e,function(e){0!==e.buttons&&Ie(e)?o(e):a(e)}),x=gn(e,a);e.state.selectingText=x,ra(s.wrapper.ownerDocument,"mousemove",w),ra(s.wrapper.ownerDocument,"mouseup",x)}function Ro(e,t){var r=t.anchor,n=t.head,i=M(e.doc,r.line);if(0==P(r,n)&&r.sticky==n.sticky)return t;var o=Se(i);if(!o)return t;var l=ke(o,r.ch,r.sticky),a=o[l];if(a.from!=r.ch&&a.to!=r.ch)return t;var s=l+(a.from==r.ch==(1!=a.level)?0:1);if(0==s||s==o.length)return t;var u;if(n.line!=r.line)u=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ke(o,n.ch,n.sticky),f=c-l||(n.ch-r.ch)*(1==a.level?-1:1);u=c==s-1||c==s?f<0:f>0}var d=o[s+(u?-1:0)],h=u==(1==d.level),p=h?d.from:d.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new Oa(new E(r.line,p,g),n)}function Bo(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&We(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!Oe(e,r))return Fe(t);o-=a.top-l.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var u=l.gutters.childNodes[s];if(u&&u.getBoundingClientRect().right>=i){return Me(e,r,e,W(e.doc,o),e.options.gutters[s],t),Fe(t)}}}function Vo(e,t){return Bo(e,t,"gutterClick",!0)}function jo(e,t){Pt(e.display,t)||Go(e,t)||Ne(e,t,"contextmenu")||Il||e.display.input.onContextMenu(t)}function Go(e,t){return!!Oe(e,"gutterContextMenu")&&Bo(e,t,"gutterContextMenu",!1)}function Uo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),rr(e)}function Ko(e){En(e),yn(e),Br(e)}function Xo(e,t,r){if(!t!=!(r&&r!=qa)){var n=e.display.dragFunctions,i=t?ra:Te;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function $o(e){e.options.lineWrapping?(a(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(zl(e.display.wrapper,"CodeMirror-wrap"),xe(e)),Sr(e),yn(e),rr(e),setTimeout(function(){return rn(e)},100)}function Yo(e,t){var r=this;if(!(this instanceof Yo))return new Yo(e,t);this.options=t=t?c(t):{},c(Za,t,!1),Pn(t);var n=t.value;"string"==typeof n?n=new Pa(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Yo.inputStyles[t.inputStyle](this),o=this.display=new T(e,n,i);o.wrapper.CodeMirror=this,En(this),Uo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),on(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 Bl,keySeq:null,specialChars:null},t.autofocus&&!Ol&&o.input.focus(),bl&&wl<11&&setTimeout(function(){return r.display.input.reset(!0)},20),_o(this),ro(),ln(this),this.curOp.forceUpdate=!0,Jn(this,n),t.autofocus&&!Ol||this.hasFocus()?setTimeout(u(Er,this),20):Pr(this);for(var l in Ja)Ja.hasOwnProperty(l)&&Ja[l](r,t[l],qa);Vr(this),t.finishInit&&t.finishInit(this);for(var a=0;a<Qa.length;++a)Qa[a](r);an(this),xl&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function _o(e){function t(){i.activeTouch&&(o=setTimeout(function(){return i.activeTouch=null},1e3),l=i.activeTouch,l.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;ra(i.scroller,"mousedown",gn(e,Wo)),bl&&wl<11?ra(i.scroller,"dblclick",gn(e,function(t){if(!Ne(e,t)){var r=Lr(e,t);if(r&&!Vo(e,t)&&!Pt(e.display,t)){We(t);var n=e.findWordAt(r);gi(e.doc,n.anchor,n.head)}}})):ra(i.scroller,"dblclick",function(t){return Ne(e,t)||We(t)}),ra(i.scroller,"contextmenu",function(t){return jo(e,t)});var o,l={end:0};ra(i.scroller,"touchstart",function(t){if(!Ne(e,t)&&!r(t)&&!Vo(e,t)){i.input.ensurePolled(),clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-l.end<=300?l:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),ra(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ra(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Pt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var l,a=e.coordsChar(i.activeTouch,"page");l=!o.prev||n(o,o.prev)?new Oa(a,a):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(a):new Oa(E(a.line,0),j(e.doc,E(a.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),We(r)}t()}),ra(i.scroller,"touchcancel",t),ra(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Jr(e,i.scroller.scrollTop),en(e,i.scroller.scrollLeft,!0),Me(e,"scroll",e))}),ra(i.scroller,"mousewheel",function(t){return Rn(e,t)}),ra(i.scroller,"DOMMouseScroll",function(t){return Rn(e,t)}),ra(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ne(e,t)||Ee(t)},over:function(t){Ne(e,t)||(Qi(e,t),Ee(t))},start:function(t){return Ji(e,t)},drop:gn(e,Zi),leave:function(t){Ne(e,t)||eo(e)}};var a=i.input.getField();ra(a,"keyup",function(t){return Ao.call(e,t)}),ra(a,"keydown",gn(e,Mo)),ra(a,"keypress",gn(e,Oo)),ra(a,"focus",function(t){return Er(e,t)}),ra(a,"blur",function(t){return Pr(e,t)})}function qo(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Ze(e,t).state:r="prev");var l=e.options.tabSize,a=M(o,t),s=f(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var u,c=a.text.match(/^\s*/)[0];if(n||/\S/.test(a.text)){if("smart"==r&&((u=o.mode.indent(i,a.text.slice(c.length),a.text))==Ul||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?f(M(o,t-1).text,null,l):0:"add"==r?u=s+e.options.indentUnit:"subtract"==r?u=s-e.options.indentUnit:"number"==typeof r&&(u=s+r),u=Math.max(0,u);var d="",h=0;if(e.options.indentWithTabs)for(var g=Math.floor(u/l);g;--g)h+=l,d+="\t";if(h<u&&(d+=p(u-h)),d!=c)return Ii(o,d,E(t,0),E(t,c.length),"+input"),a.stateAfter=null,!0;for(var v=0;v<o.sel.ranges.length;v++){var m=o.sel.ranges[v];if(m.head.line==t&&m.head.ch<c.length){var y=E(t,c.length);mi(o,v,new Oa(y,y));break}}}function Zo(e){es=e}function Jo(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=e.state.pasteIncoming||"paste"==i,a=ia(t),s=null;if(l&&n.ranges.length>1)if(es&&es.text.join("\n")==t){if(n.ranges.length%es.text.length==0){s=[];for(var u=0;u<es.text.length;u++)s.push(o.splitLines(es.text[u]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(s=v(a,function(e){return[e]}));for(var c=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var d=n.ranges[f],h=d.from(),p=d.to();d.empty()&&(r&&r>0?h=E(h.line,h.ch-r):e.state.overwrite&&!l?p=E(p.line,Math.min(M(o,p.line).text.length,p.ch+g(a).length)):l&&es&&es.lineWise&&es.text.join("\n")==t&&(h=p=E(h.line,0)));var m={from:h,to:p,text:s?s[f%s.length]:a,origin:i||(l?"paste":e.state.cutIncoming?"cut":"+input")};Di(e.doc,m),xt(e,"inputRead",e,m)}t&&!l&&el(e,t),$r(e),e.curOp.updateInput<2&&(e.curOp.updateInput=c),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Qo(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||pn(t,function(){return Jo(t,r,0,null,"paste")}),!0}function el(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(t.indexOf(o.electricChars.charAt(a))>-1){l=qo(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(M(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=qo(e,i.head.line,"smart"));l&&xt(e,"electricInput",e,i.head.line)}}}function tl(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:E(i,0),head:E(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function rl(e,t,r,n){e.setAttribute("autocorrect",!!r),e.setAttribute("autocapitalize",!!n),e.setAttribute("spellcheck",!!t)}function nl(){var e=n("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=n("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return xl?e.style.width="1000px":e.setAttribute("wrap","off"),Nl&&(e.style.border="1px solid black"),rl(e),t}function il(e,t,r,n,i){function o(){var n=t.line+r;return!(n<e.first||n>=e.first+e.size)&&(t=new E(n,t.ch,t.sticky),u=M(e,n))}function l(n){var l;if(null==(l=i?mo(e.cm,u,t,r):go(u,t,r))){if(n||!o())return!1;t=vo(i,e.cm,u,t.line,r)}else t=l;return!0}var a=t,s=r,u=M(e,t.line);if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var c=null,f="group"==n,d=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||l(!h);h=!1){var p=u.text.charAt(t.ch)||"\n",g=x(p,d)?"w":f&&"\n"==p?"n":!f||/\s/.test(p)?null:"p";if(!f||h||g||(g="s"),c&&c!=g){r<0&&(r=1,l(),t.sticky="after");break}if(g&&(c=g),r>0&&!l(!h))break}var v=Mi(e,t,a,s,!0);return I(a,v)&&(v.hitSide=!0),v}function ol(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(a-.5*br(e.display),3);i=(r>0?t.bottom:t.top)+r*s}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(var u;u=dr(e,l,i),u.outside;){if(r<0?i<=0:i>=o.height){u.hitSide=!0;break}i+=5*r}return u}function ll(e,t){var r=$t(e,t.line);if(!r||r.hidden)return null;var n=M(e.doc,t.line),i=Ut(r,n,t.line),o=Se(n,e.doc.direction),l="left";if(o){l=ke(o,t.ch)%2?"right":"left"}var a=qt(i.map,t.ch,l);return a.offset="right"==a.collapse?a.end:a.start,a}function al(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function sl(e,t){return t&&(e.bad=!0),e}function ul(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function l(){c&&(u+=f,d&&(u+=f),c=d=!1)}function a(e){e&&(l(),u+=e)}function s(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void a(r);var u,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(E(n,0),E(i+1,0),o(+h));return void(p.length&&(u=p[0].find(0))&&a(N(e.doc,u.from,u.to).join(f)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&l();for(var v=0;v<t.childNodes.length;v++)s(t.childNodes[v]);/^(pre|p)$/i.test(t.nodeName)&&(d=!0),g&&(c=!0)}else 3==t.nodeType&&a(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var u="",c=!1,f=e.doc.lineSeparator(),d=!1;s(t),t!=r;)t=t.nextSibling,d=!1;return u}function cl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return sl(e.clipPos(E(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return fl(o,t,r)}}function fl(e,t,r){function n(t,r,n){for(var i=-1;i<(f?f.length:0);i++)for(var o=i<0?c.map:f[i],l=0;l<o.length;l+=3){var a=o[l+2];if(a==t||a==r){var s=D(i<0?e.line:e.rest[i]),u=o[l]+n;return(n<0||a!=t)&&(u=o[l+(n?1:0)]),E(s,u)}}}var i=e.text.firstChild,l=!1;if(!t||!o(i,t))return sl(E(D(e.line),0),!0);if(t==i&&(l=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?g(e.rest):e.line;return sl(E(D(a),a.text.length),l)}var s=3==t.nodeType?t:null,u=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));u.parentNode!=i;)u=u.parentNode;var c=e.measure,f=c.maps,d=n(s,u,r);if(d)return sl(d,l);for(var h=u.nextSibling,p=s?s.nodeValue.length-r:0;h;h=h.nextSibling){if(d=n(h,h.firstChild,0))return sl(E(d.line,d.ch-p),l);p+=h.textContent.length}for(var v=u.previousSibling,m=r;v;v=v.previousSibling){if(d=n(v,v.firstChild,-1))return sl(E(d.line,d.ch+m),l);m+=v.textContent.length}}function dl(e,t){function r(){e.value=s.getValue()}if(t=t?c(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=l();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}var i;if(e.form&&(ra(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(Te(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=Yo(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s}var hl=navigator.userAgent,pl=navigator.platform,gl=/gecko\/\d/i.test(hl),vl=/MSIE \d/.test(hl),ml=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hl),yl=/Edge\/(\d+)/.exec(hl),bl=vl||ml||yl,wl=bl&&(vl?document.documentMode||6:+(yl||ml)[1]),xl=!yl&&/WebKit\//.test(hl),Cl=xl&&/Qt\/\d+\.\d+/.test(hl),kl=!yl&&/Chrome\//.test(hl),Sl=/Opera\//.test(hl),Ll=/Apple Computer/.test(navigator.vendor),Tl=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(hl),Ml=/PhantomJS/.test(hl),Nl=!yl&&/AppleWebKit/.test(hl)&&/Mobile\/\w+/.test(hl),Al=/Android/.test(hl),Ol=Nl||Al||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(hl),Dl=Nl||/Mac/.test(pl),Wl=/\bCrOS\b/.test(hl),Hl=/win/i.test(pl),Fl=Sl&&hl.match(/Version\/(\d*\.\d*)/);Fl&&(Fl=Number(Fl[1])),Fl&&Fl>=15&&(Sl=!1,xl=!0);var El,Pl=Dl&&(Cl||Sl&&(null==Fl||Fl<12.11)),Il=gl||bl&&wl>=9,zl=function(t,r){var n=t.className,i=e(r).exec(n);if(i){var o=n.slice(i.index+i[0].length);t.className=n.slice(0,i.index)+(o?i[1]+o:"")}};El=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Rl=function(e){e.select()};Nl?Rl=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:bl&&(Rl=function(e){try{e.select()}catch(e){}});var Bl=function(){this.id=null};Bl.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Vl,jl,Gl=30,Ul={toString:function(){return"CodeMirror.Pass"}},Kl={scroll:!1},Xl={origin:"*mouse"},$l={origin:"+move"},Yl=[""],_l=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ql=/[\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]/,Zl=!1,Jl=!1,Ql=null,ea=function(){function e(e){return e<=247?r.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?n.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,l=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;return function(r,n){var u="ltr"==n?"L":"R";if(0==r.length||"ltr"==n&&!i.test(r))return!1;for(var c=r.length,f=[],d=0;d<c;++d)f.push(e(r.charCodeAt(d)));for(var h=0,p=u;h<c;++h){var v=f[h];"m"==v?f[h]=p:p=v}for(var m=0,y=u;m<c;++m){var b=f[m];"1"==b&&"r"==y?f[m]="n":l.test(b)&&(y=b,"r"==b&&(f[m]="R"))}for(var w=1,x=f[0];w<c-1;++w){var C=f[w];"+"==C&&"1"==x&&"1"==f[w+1]?f[w]="1":","!=C||x!=f[w+1]||"1"!=x&&"n"!=x||(f[w]=x),x=C}for(var k=0;k<c;++k){var S=f[k];if(","==S)f[k]="N";else if("%"==S){var L=void 0;for(L=k+1;L<c&&"%"==f[L];++L);for(var T=k&&"!"==f[k-1]||L<c&&"1"==f[L]?"1":"N",M=k;M<L;++M)f[M]=T;k=L-1}}for(var N=0,A=u;N<c;++N){var O=f[N];"L"==A&&"1"==O?f[N]="L":l.test(O)&&(A=O)}for(var D=0;D<c;++D)if(o.test(f[D])){var W=void 0;for(W=D+1;W<c&&o.test(f[W]);++W);for(var H="L"==(D?f[D-1]:u),F="L"==(W<c?f[W]:u),E=H==F?H?"L":"R":u,P=D;P<W;++P)f[P]=E;D=W-1}for(var I,z=[],R=0;R<c;)if(a.test(f[R])){var B=R;for(++R;R<c&&a.test(f[R]);++R);z.push(new t(0,B,R))}else{var V=R,j=z.length;for(++R;R<c&&"L"!=f[R];++R);for(var G=V;G<R;)if(s.test(f[G])){V<G&&z.splice(j,0,new t(1,V,G));var U=G;for(++G;G<R&&s.test(f[G]);++G);z.splice(j,0,new t(2,U,G)),V=G}else++G;V<R&&z.splice(j,0,new t(1,V,R))}return"ltr"==n&&(1==z[0].level&&(I=r.match(/^\s+/))&&(z[0].from=I[0].length,z.unshift(new t(0,0,I[0].length))),1==g(z).level&&(I=r.match(/\s+$/))&&(g(z).to-=I[0].length,z.push(new t(0,c-I[0].length,c)))),"rtl"==n?z.reverse():z}}(),ta=[],ra=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ta).concat(r)}},na=function(){if(bl&&wl<9)return!1;var e=n("div");return"draggable"in e||"dragDrop"in e}(),ia=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},oa=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},la=function(){var e=n("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),aa=null,sa={},ua={},ca={},fa=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};fa.prototype.eol=function(){return this.pos>=this.string.length},fa.prototype.sol=function(){return this.pos==this.lineStart},fa.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},fa.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},fa.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},fa.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},fa.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},fa.prototype.skipToEnd=function(){this.pos=this.string.length},fa.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},fa.prototype.backUp=function(e){this.pos-=e},fa.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=f(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?f(this.string,this.lineStart,this.tabSize):0)},fa.prototype.indentation=function(){return f(this.string,null,this.tabSize)-(this.lineStart?f(this.string,this.lineStart,this.tabSize):0)},fa.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},fa.prototype.current=function(){return this.string.slice(this.start,this.pos)},fa.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},fa.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},fa.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var da=function(e,t){this.state=e,this.lookAhead=t},ha=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};ha.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ha.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)t.baseTokenPos+=2;var r=this.baseTokens[this.baseTokenPos+1];return{type:r&&r.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ha.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ha.fromSaved=function(e,t,r){return t instanceof da?new ha(e,Xe(e.mode,t.state),r,t.lookAhead):new ha(e,Xe(e.mode,t),r)},ha.prototype.save=function(e){var t=!1!==e?Xe(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new da(t,this.maxLookAhead):t};var pa=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r},ga=function(e,t,r){this.text=e,ne(this,t),this.height=r?r(this):1};ga.prototype.lineNo=function(){return D(this)},De(ga);var va,ma={},ya={},ba=null,wa=null,xa={left:0,right:0,top:0,bottom:0},Ca=function(e,t,r){this.cm=r;var i=this.vert=n("div",[n("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=n("div",[n("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=o.tabIndex=-1,e(i),e(o),ra(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),ra(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,bl&&wl<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ca.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Ca.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ca.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ca.prototype.zeroWidthHack=function(){var e=Dl&&!Tl?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Bl,this.disableVert=new Bl},Ca.prototype.enableZeroWidthBar=function(e,t,r){function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},Ca.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ka=function(){};ka.prototype.update=function(){return{bottom:0,right:0}},ka.prototype.setScrollLeft=function(){},ka.prototype.setScrollTop=function(){},ka.prototype.clear=function(){};var Sa={native:Ca,null:ka},La=0,Ta=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Rr(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Vt(e),this.force=r,this.dims=xr(e),this.events=[]};Ta.prototype.signal=function(e,t){Oe(e,t)&&this.events.push(arguments)},Ta.prototype.finish=function(){for(var e=this,t=0;t<this.events.length;t++)Me.apply(null,e.events[t])};var Ma=0,Na=null;bl?Na=-.53:gl?Na=15:kl?Na=-.7:Ll&&(Na=-1/3);var Aa=function(e,t){this.ranges=e,this.primIndex=t};Aa.prototype.primary=function(){return this.ranges[this.primIndex]},Aa.prototype.equals=function(e){var t=this;if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var r=0;r<this.ranges.length;r++){var n=t.ranges[r],i=e.ranges[r];if(!I(n.anchor,i.anchor)||!I(n.head,i.head))return!1}return!0},Aa.prototype.deepCopy=function(){for(var e=this,t=[],r=0;r<this.ranges.length;r++)t[r]=new Oa(z(e.ranges[r].anchor),z(e.ranges[r].head));return new Aa(t,this.primIndex)},Aa.prototype.somethingSelected=function(){for(var e=this,t=0;t<this.ranges.length;t++)if(!e.ranges[t].empty())return!0;return!1},Aa.prototype.contains=function(e,t){var r=this;t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=r.ranges[n];if(P(t,i.from())>=0&&P(e,i.to())<=0)return n}return-1};var Oa=function(e,t){this.anchor=e,this.head=t};Oa.prototype.from=function(){return B(this.anchor,this.head)},Oa.prototype.to=function(){return R(this.anchor,this.head)},Oa.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ji.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=this,n=e,i=e+t;n<i;++n){var o=r.lines[n];r.height-=o.height,at(o),xt(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){var n=this;this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=n},iterN:function(e,t,r){for(var n=this,i=e+t;e<i;++e)if(r(n.lines[e]))return!0}},Gi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var r=this;this.size-=t;for(var n=0;n<this.children.length;++n){var i=r.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e),a=i.height;if(i.removeInner(e,l),r.height-=a-i.height,o==l&&(r.children.splice(n--,1),i.parent=null),0==(t-=l))break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ji))){var s=[];this.collapse(s),this.children=[new ji(s)],this.children[0].parent=this}},collapse:function(e){for(var t=this,r=0;r<this.children.length;++r)t.children[r].collapse(e)},insertInner:function(e,t,r){var n=this;this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var o=n.children[i],l=o.chunkSize();if(e<=l){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(var a=o.lines.length%25+25,s=a;s<o.lines.length;){var u=new ji(o.lines.slice(s,s+=25));o.height-=u.height,n.children.splice(++i,0,u),u.parent=n}o.lines=o.lines.slice(0,a),n.maybeSpill()}break}e-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Gi(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=d(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Gi(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=this,i=0;i<this.children.length;++i){var o=n.children[i],l=o.chunkSize();if(e<l){var a=Math.min(t,l-e);if(o.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=l}}};var Da=function(e,t,r){var n=this;if(r)for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i]);this.doc=e,this.node=t};Da.prototype.clear=function(){var e=this,t=this.doc.cm,r=this.line.widgets,n=this.line,i=D(n);if(null!=i&&r){for(var o=0;o<r.length;++o)r[o]==e&&r.splice(o--,1);r.length||(n.widgets=null);var l=Et(this);O(n,Math.max(0,n.height-l)),t&&(pn(t,function(){Ui(t,n,-l),bn(t,i,"widget")}),xt(t,"lineWidgetCleared",t,this,i))}},Da.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=Et(this)-t;i&&(me(this.doc,n)||O(n,n.height+i),r&&pn(r,function(){r.curOp.forceUpdate=!0,Ui(r,n,i),xt(r,"lineWidgetChanged",r,e,D(n))}))},De(Da);var Wa=0,Ha=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Wa};Ha.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&ln(t),Oe(this,"clear")){var n=this.find();n&&xt(this,"clear",n.from,n.to)}for(var i=null,o=null,l=0;l<this.lines.length;++l){var a=e.lines[l],s=Y(a.markedSpans,e);t&&!e.collapsed?bn(t,D(a),"text"):t&&(null!=s.to&&(o=D(a)),null!=s.from&&(i=D(a))),a.markedSpans=_(a.markedSpans,s),null==s.from&&e.collapsed&&!me(e.doc,a)&&t&&O(a,br(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=de(e.lines[u]),f=we(c);f>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&yn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Si(t.doc)),t&&xt(t,"markerCleared",t,this,i,o),r&&an(t),this.parent&&this.parent.clear()}},Ha.prototype.find=function(e,t){var r=this;null==e&&"bookmark"==this.type&&(e=1);for(var n,i,o=0;o<this.lines.length;++o){var l=r.lines[o],a=Y(l.markedSpans,r);if(null!=a.from&&(n=E(t?l:D(l),a.from),-1==e))return n;if(null!=a.to&&(i=E(t?l:D(l),a.to),1==e))return i}return n&&{from:n,to:i}},Ha.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&pn(n,function(){var i=t.line,o=D(t.line),l=$t(n,o);if(l&&(er(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!me(r.doc,i)&&null!=r.height){var a=r.height;r.height=null;var s=Et(r)-a;s&&O(i,i.height+s)}xt(n,"markerChanged",n,e)})},Ha.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=d(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ha.prototype.detachLine=function(e){if(this.lines.splice(d(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},De(Ha);var Fa=function(e,t){var r=this;this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=r};Fa.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)e.markers[t].clear();xt(this,"clear")}},Fa.prototype.find=function(e,t){return this.primary.find(e,t)},De(Fa);var Ea=0,Pa=function(e,t,r,n,i){if(!(this instanceof Pa))return new Pa(e,t,r,n,i);null==r&&(r=0),Gi.call(this,[new ji([new ga("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=E(r,0);this.sel=Vn(o),this.history=new ti(null),this.id=++Ea,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),qn(this,{from:o,to:o,text:e}),xi(this,Vn(o),Kl)};Pa.prototype=b(Gi.prototype,{constructor:Pa,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=A(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:mn(function(e){var t=E(this.first,0),r=this.first+this.size-1;Di(this,{from:t,to:E(r,M(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Yr(this.cm,0,0),xi(this,Vn(t),Kl)}),replaceRange:function(e,t,r,n){t=j(this,t),r=r?j(this,r):t,Ii(this,e,t,r,n)},getRange:function(e,t,r){var n=N(this,j(this,e),j(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(H(this,e))return M(this,e)},getLineNumber:function(e){return D(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=M(this,e)),de(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return j(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:mn(function(e,t,r){yi(this,j(this,"number"==typeof e?E(e,t||0):e),null,r)}),setSelection:mn(function(e,t,r){yi(this,j(this,e),j(this,t||e),r)}),extendSelection:mn(function(e,t,r){gi(this,j(this,e),t&&j(this,t),r)}),extendSelections:mn(function(e,t){vi(this,U(this,e),t)}),extendSelectionsBy:mn(function(e,t){vi(this,U(this,v(this.sel.ranges,e)),t)}),setSelections:mn(function(e,t,r){var n=this;if(e.length){for(var i=[],o=0;o<e.length;o++)i[o]=new Oa(j(n,e[o].anchor),j(n,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),xi(this,Bn(this.cm,i,t),r)}}),addSelection:mn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Oa(j(this,e),j(this,t||e))),xi(this,Bn(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t,r=this,n=this.sel.ranges,i=0;i<n.length;i++){var o=N(r,n[i].from(),n[i].to());t=t?t.concat(o):o}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,r=[],n=this.sel.ranges,i=0;i<n.length;i++){var o=N(t,n[i].from(),n[i].to());!1!==e&&(o=o.join(e||t.lineSeparator())),r[i]=o}return r},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:mn(function(e,t,r){for(var n=this,i=[],o=this.sel,l=0;l<o.ranges.length;l++){var a=o.ranges[l];i[l]={from:a.from(),to:a.to(),text:n.splitLines(e[l]),origin:r}}for(var s=t&&"end"!=t&&Xn(this,i,t),u=i.length-1;u>=0;u--)Di(n,i[u]);s?wi(this,s):this.cm&&$r(this.cm)}),undo:mn(function(){Hi(this,"undo")}),redo:mn(function(){Hi(this,"redo")}),undoSelection:mn(function(){Hi(this,"undo",!0)}),redoSelection:mn(function(){Hi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new ti(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:hi(this.history.done),undone:hi(this.history.undone)}},setHistory:function(e){var t=this.history=new ti(this.history.maxGeneration);t.done=hi(e.done.slice(0),null,!0),t.undone=hi(e.undone.slice(0),null,!0)},setGutterMarker:mn(function(e,t,r){return Vi(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&C(n)&&(e.gutterMarkers=null),!0})}),clearGutter:mn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Vi(t,r,"gutter",function(){return r.gutterMarkers[e]=null,C(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!H(this,e))return null;if(t=e,!(e=M(this,e)))return null}else if(null==(t=D(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:mn(function(t,r,n){return Vi(this,t,"gutter"==r?"gutter":"class",function(t){var i="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(t[i]){if(e(n).test(t[i]))return!1;t[i]+=" "+n}else t[i]=n;return!0})}),removeLineClass:mn(function(t,r,n){return Vi(this,t,"gutter"==r?"gutter":"class",function(t){var i="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass",o=t[i];if(!o)return!1;if(null==n)t[i]=null;else{var l=o.match(e(n));if(!l)return!1;var a=l.index+l[0].length;t[i]=o.slice(0,l.index)+(l.index&&a!=o.length?" ":"")+o.slice(a)||null}return!0})}),addLineWidget:mn(function(e,t,r){return Ki(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Xi(this,j(this,e),j(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=j(this,e),Xi(this,e,e,r,"bookmark")},findMarksAt:function(e){e=j(this,e);var t=[],r=M(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=j(this,e),t=j(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var a=0;a<l.length;a++){var s=l[a];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r}),j(this,E(r,t))},indexFromPos:function(e){e=j(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new Pa(A(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Pa(A(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],_i(n,Yi(this)),n},unlinkDoc:function(e){var t=this;if(e instanceof Yo&&(e=e.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=t.linked[r];if(n.doc==e){t.linked.splice(r,1),e.unlinkDoc(t),qi(Yi(t));break}}if(e.history==this.history){var i=[e.id];Zn(e,function(e){return i.push(e.id)},!0),e.history=new ti(null),e.history.done=hi(this.history.done,i),e.history.undone=hi(this.history.undone,i)}},iterLinkedDocs:function(e){Zn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ia(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:mn(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&ei(this.cm))})}),Pa.prototype.eachLine=Pa.prototype.iter;for(var Ia=0,za=!1,Ra={3:"Pause",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",145:"ScrollLock",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"},Ba=0;Ba<10;Ba++)Ra[Ba+48]=Ra[Ba+96]=String(Ba);for(var Va=65;Va<=90;Va++)Ra[Va]=String.fromCharCode(Va);for(var ja=1;ja<=12;ja++)Ra[ja+111]=Ra[ja+63235]="F"+ja;var Ga={};Ga.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"},Ga.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"},Ga.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","Ctrl-O":"openLine"},Ga.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"]},Ga.default=Dl?Ga.macDefault:Ga.pcDefault;var Ua={selectAll:Ai,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Kl)},killLine:function(e){return ho(e,function(t){if(t.empty()){var r=M(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:E(t.head.line+1,0)}:{from:t.head,to:E(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ho(e,function(t){return{from:E(t.from().line,0),to:j(e.doc,E(t.to().line+1,0))}})},delLineLeft:function(e){return ho(e,function(e){return{from:E(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return ho(e,function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}})},delWrappedLineRight:function(e){return ho(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(E(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(E(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return yo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return wo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return bo(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},$l)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},$l)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?wo(e,t.head):n},$l)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=f(e.getLine(o.line),o.ch,n);t.push(p(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return pn(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=M(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new E(i.line,i.ch-1)),i.ch>0)i=new E(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),E(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=M(e.doc,i.line-1).text;l&&(i=new E(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),E(i.line-1,l.length-1),i,"+transpose"))}r.push(new Oa(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return pn(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);$r(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}},Ka=new Bl,Xa=null,$a=function(e,t,r){this.time=e,this.pos=t,this.button=r};$a.prototype.compare=function(e,t,r){return this.time+400>e&&0==P(t,this.pos)&&r==this.button};var Ya,_a,qa={toString:function(){return"CodeMirror.Init"}},Za={},Ja={};Yo.defaults=Za,Yo.optionHandlers=Ja;var Qa=[];Yo.defineInitHook=function(e){return Qa.push(e)};var es=null,ts=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Bl,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ts.prototype.init=function(e){function t(e){if(!Ne(i,e)){if(i.somethingSelected())Zo({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=tl(i);Zo({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,Kl),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=es.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var l=nl(),a=l.firstChild;i.display.lineSpace.insertBefore(l,i.display.lineSpace.firstChild),a.value=es.text.join("\n");var s=document.activeElement;Rl(a),setTimeout(function(){i.display.lineSpace.removeChild(l),s.focus(),s==o&&n.showPrimarySelection()},50)}}var r=this,n=this,i=n.cm,o=n.div=e.lineDiv;rl(o,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize),ra(o,"paste",function(e){Ne(i,e)||Qo(e,i)||wl<=11&&setTimeout(gn(i,function(){return r.updateFromDOM()}),20)}),ra(o,"compositionstart",function(e){r.composing={data:e.data,done:!1}}),ra(o,"compositionupdate",function(e){r.composing||(r.composing={data:e.data,done:!1})}),ra(o,"compositionend",function(e){r.composing&&(e.data!=r.composing.data&&r.readFromDOMSoon(),r.composing.done=!0)}),ra(o,"touchstart",function(){return n.forceCompositionEnd()}),ra(o,"input",function(){r.composing||r.readFromDOMSoon()}),ra(o,"copy",t),ra(o,"cut",t)},ts.prototype.prepareSelection=function(){var e=Nr(this.cm,!1);return e.focus=this.cm.state.focused,e},ts.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ts.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ts.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)return void e.removeAllRanges();var o=cl(t,e.anchorNode,e.anchorOffset),l=cl(t,e.focusNode,e.focusOffset);if(!o||o.bad||!l||l.bad||0!=P(B(o,l),n)||0!=P(R(o,l),i)){var a=t.display.view,s=n.line>=t.display.viewFrom&&ll(t,n)||{node:a[0].measure.map[2],offset:0},u=i.line<t.display.viewTo&&ll(t,i);if(!u){var c=a[a.length-1].measure,f=c.maps?c.maps[c.maps.length-1]:c.map;u={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(!s||!u)return void e.removeAllRanges();var d,h=e.rangeCount&&e.getRangeAt(0);try{d=El(s.node,s.offset,u.offset,u.node)}catch(e){}d&&(!gl&&t.state.focused?(e.collapse(s.node,s.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),h&&null==e.anchorNode?e.addRange(h):gl&&this.startGracePeriod()),this.rememberSelection()}},ts.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},ts.prototype.showMultipleSelections=function(e){r(this.cm.display.cursorDiv,e.cursors),r(this.cm.display.selectionDiv,e.selection)},ts.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ts.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return o(this.div,t)},ts.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ts.prototype.blur=function(){this.div.blur()},ts.prototype.getField=function(){return this.div},ts.prototype.supportsTouch=function(){return!0},ts.prototype.receivedFocus=function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():pn(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},ts.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ts.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(Al&&kl&&this.cm.options.gutters.length&&al(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=cl(t,e.anchorNode,e.anchorOffset),n=cl(t,e.focusNode,e.focusOffset);r&&n&&pn(t,function(){xi(t.doc,Vn(r,n),Kl),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},ts.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(0==n.ch&&n.line>e.firstLine()&&(n=E(n.line-1,M(e.doc,n.line-1).length)),i.ch==M(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=E(i.line+1,0)),n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o,l,a;n.line==t.viewFrom||0==(o=Tr(e,n.line))?(l=D(t.view[0].line),a=t.view[0].node):(l=D(t.view[o].line),a=t.view[o-1].node.nextSibling);var s,u,c=Tr(e,i.line);if(c==t.view.length-1?(s=t.viewTo-1,u=t.lineDiv.lastChild):(s=D(t.view[c+1].line)-1,u=t.view[c+1].node.previousSibling),!a)return!1;for(var f=e.doc.splitLines(ul(e,a,u,l,s)),d=N(e.doc,E(l,0),E(s,M(e.doc,s).text.length));f.length>1&&d.length>1;)if(g(f)==g(d))f.pop(),d.pop(),s--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),l++}for(var h=0,p=0,v=f[0],m=d[0],y=Math.min(v.length,m.length);h<y&&v.charCodeAt(h)==m.charCodeAt(h);)++h;for(var b=g(f),w=g(d),x=Math.min(b.length-(1==f.length?h:0),w.length-(1==d.length?h:0));p<x&&b.charCodeAt(b.length-p-1)==w.charCodeAt(w.length-p-1);)++p;if(1==f.length&&1==d.length&&l==n.line)for(;h&&h>n.ch&&b.charCodeAt(b.length-p-1)==w.charCodeAt(w.length-p-1);)h--,p++;f[f.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var C=E(l,h),k=E(s,d.length?g(d).length-p:0);return f.length>1||f[0]||P(C,k)?(Ii(e.doc,f,C,k,"+input"),!0):void 0},ts.prototype.ensurePolled=function(){this.forceCompositionEnd()},ts.prototype.reset=function(){this.forceCompositionEnd()},ts.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ts.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},ts.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||pn(this.cm,function(){return yn(e.cm)})},ts.prototype.setUneditable=function(e){e.contentEditable="false"},ts.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||gn(this.cm,Jo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ts.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},ts.prototype.onContextMenu=function(){},ts.prototype.resetPosition=function(){},ts.prototype.needsContentAttribute=!0;var rs=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Bl,this.hasSelection=!1,this.composing=null};rs.prototype.init=function(e){function t(e){if(!Ne(i,e)){if(i.somethingSelected())Zo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=tl(i);Zo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,Kl):(n.prevInput="",o.value=t.text.join("\n"),Rl(o))}"cut"==e.type&&(i.state.cutIncoming=!0)}}var r=this,n=this,i=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),Nl&&(o.style.width="0px"),ra(o,"input",function(){bl&&wl>=9&&r.hasSelection&&(r.hasSelection=null),n.poll()}),ra(o,"paste",function(e){Ne(i,e)||Qo(e,i)||(i.state.pasteIncoming=!0,n.fastPoll())}),ra(o,"cut",t),ra(o,"copy",t),ra(e.scroller,"paste",function(t){Pt(e,t)||Ne(i,t)||(i.state.pasteIncoming=!0,n.focus())}),ra(e.lineSpace,"selectstart",function(t){Pt(e,t)||We(t)}),ra(o,"compositionstart",function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),ra(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},rs.prototype.createField=function(e){this.wrapper=nl(),this.textarea=this.wrapper.firstChild},rs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Nr(e);if(e.options.moveInputWithCursor){var i=ur(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},rs.prototype.showSelection=function(e){var t=this.cm,n=t.display;r(n.cursorDiv,e.cursors),r(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},rs.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&Rl(this.textarea),bl&&wl>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",bl&&wl>=9&&(this.hasSelection=null))}},rs.prototype.getField=function(){return this.textarea},rs.prototype.supportsTouch=function(){return!1},rs.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Ol||l()!=this.textarea))try{this.textarea.focus()}catch(e){}},rs.prototype.blur=function(){this.textarea.blur()},rs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rs.prototype.receivedFocus=function(){this.slowPoll()},rs.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},rs.prototype.fastPoll=function(){function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},rs.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||oa(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(bl&&wl>=9&&this.hasSelection===i||Dl&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,a=Math.min(n.length,i.length);l<a&&n.charCodeAt(l)==i.charCodeAt(l);)++l;return pn(t,function(){Jo(t,i.slice(l),n.length-l,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},rs.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rs.prototype.onKeyPress=function(){bl&&wl>=9&&(this.hasSelection=null),this.fastPoll()},rs.prototype.onContextMenu=function(e){function t(){if(null!=l.selectionStart){var e=i.somethingSelected(),t="​"+(e?l.value:"");l.value="⇚",l.value=t,n.prevInput=e?"":"​",l.selectionStart=1,l.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending==r&&(n.contextMenuPending=!1,n.wrapper.style.cssText=c,l.style.cssText=u,bl&&wl<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=l.selectionStart)){(!bl||bl&&wl<9)&&t();var e=0,a=function(){o.selForContextMenu==i.doc.sel&&0==l.selectionStart&&l.selectionEnd>0&&"​"==n.prevInput?gn(i,Ai)(i):e++<10?o.detectingSelectAll=setTimeout(a,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(a,200)}}var n=this,i=n.cm,o=i.display,l=n.textarea;n.contextMenuPending&&n.contextMenuPending();var a=Lr(i,e),s=o.scroller.scrollTop;if(a&&!Sl){i.options.resetSelectionOnContextMenu&&-1==i.doc.sel.contains(a)&&gn(i,xi)(i.doc,Vn(a),Kl);var u=l.style.cssText,c=n.wrapper.style.cssText,f=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static",l.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px;\n      z-index: 1000; background: "+(bl?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var d;if(xl&&(d=window.scrollY),o.input.focus(),xl&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(l.value=n.prevInput=" "),n.contextMenuPending=r,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),bl&&wl>=9&&t(),Il){Ee(e);var h=function(){Te(window,"mouseup",h),setTimeout(r,20)};ra(window,"mouseup",h)}else setTimeout(r,50)}},rs.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},rs.prototype.setUneditable=function(){},rs.prototype.needsContentAttribute=!1,function(e){function t(t,n,i,o){e.defaults[t]=n,i&&(r[t]=o?function(e,t,r){r!=qa&&i(e,t,r)}:i)}var r=e.optionHandlers;e.defineOption=t,e.Init=qa,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,$n(e)},!0),t("indentUnit",2,$n,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Yn(e),rr(e),yn(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(E(n,o))}n++});for(var i=r.length-1;i>=0;i--)Ii(e.doc,t,r[i],E(r[i].line,r[i].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=qa&&e.refresh()}),t("specialCharPlaceholder",ct,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Ol?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),t("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),t("rtlMoveVisually",!Hl),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){Uo(e),Ko(e)},!0),t("keyMap","default",function(e,t,r){var n=fo(t),i=r!=qa&&fo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,$o,!0),t("gutters",[],function(e){Pn(e.options),Ko(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Cr(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return rn(e)},!0),t("scrollbarStyle","native",function(e){on(e),rn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e){Pn(e.options),Ko(e)},!0),t("firstLineNumber",1,Ko,!0),t("lineNumberFormatter",function(e){return e},Ko,!0),t("showCursorWhenSelecting",!1,Mr,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("selectionsMayTouch",!1),t("readOnly",!1,function(e,t){"nocursor"==t&&(Pr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Xo),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,Mr,!0),t("singleCursorHeightPerLine",!0,Mr,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Yn,!0),t("addModeClass",!1,Yn,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Yn,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),t("phrases",null)}(Yo),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&gn(this,t[e])(this,r,i),Me(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](fo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:vn(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");m(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},function(e){return e.priority}),this.state.modeGen++,yn(this)}),removeOverlay:vn(function(e){for(var t=this,r=this.state.overlays,n=0;n<r.length;++n){var i=r[n].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return r.splice(n,1),t.state.modeGen++,void yn(t)}}),indentLine:vn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),H(this.doc,e)&&qo(this,e,t,r)}),indentSelection:vn(function(e){for(var t=this,r=this.doc.sel.ranges,n=-1,i=0;i<r.length;i++){var o=r[i];if(o.empty())o.head.line>n&&(qo(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&$r(t));else{var l=o.from(),a=o.to(),s=Math.max(n,l.line);n=Math.min(t.lastLine(),a.line-(a.ch?0:1))+1;for(var u=s;u<n;++u)qo(t,u,e);var c=t.doc.sel.ranges;0==l.ch&&r.length==c.length&&c[i].from().ch>0&&mi(t.doc,i,new Oa(l,c[i].to()),Kl)}}}),getTokenAt:function(e,t){return tt(this,e,t)},getLineTokens:function(e,t){return tt(this,E(e),t,!0)},getTokenTypeAt:function(e){e=j(this.doc,e);var t,r=qe(this,M(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var a=t?t.indexOf("overlay "):-1;return a<0?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=this,i=[];if(!r.hasOwnProperty(t))return i;var o=r[t],l=this.getModeAt(e);if("string"==typeof l[t])o[l[t]]&&i.push(o[l[t]]);else if(l[t])for(var a=0;a<l[t].length;a++){var s=o[l[t][a]];s&&i.push(s)}else l.helperType&&o[l.helperType]?i.push(o[l.helperType]):o[l.name]&&i.push(o[l.name]);for(var u=0;u<o._global.length;u++){var c=o._global[u];c.pred(l,n)&&-1==d(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(e,t){var r=this.doc;return e=V(r,null==e?r.first+r.size-1:e),Ze(this,e+1,t).state},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?j(this.doc,e):e?n.from():n.to(),ur(this,r,t||"page")},charCoords:function(e,t){return sr(this,j(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ar(this,e,t||"page"),dr(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ar(this,{top:e,left:0},t||"page").top,W(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=M(this.doc,e)}else n=e;return lr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-be(n):0)},defaultTextHeight:function(){return br(this.display)},defaultCharWidth:function(){return wr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ur(this,j(this.doc,e));var l=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(l=e.bottom),a+t.offsetWidth>u&&(a=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),r&&Ur(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:vn(Mo),triggerOnKeyPress:vn(Oo),triggerOnKeyUp:Ao,triggerOnMouseDown:vn(Wo),execCommand:function(e){if(Ua.hasOwnProperty(e))return Ua[e].call(null,this)},triggerElectric:vn(function(e){el(this,e)}),findPosH:function(e,t,r,n){var i=this,o=1;t<0&&(o=-1,t=-t);for(var l=j(this.doc,e),a=0;a<t&&(l=il(i.doc,l,o,r,n),!l.hitSide);++a);return l},moveH:vn(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?il(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},$l)}),deleteH:vn(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):ho(this,function(r){var i=il(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=this,o=1,l=n;t<0&&(o=-1,t=-t);for(var a=j(this.doc,e),s=0;s<t;++s){var u=ur(i,a,"div");if(null==l?l=u.left:u.left=l,a=ol(i,u,o,r),a.hitSide)break}return a},moveV:vn(function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var a=ur(r,l.head,"div");null!=l.goalColumn&&(a.left=l.goalColumn),i.push(a.left);var s=ol(r,a,e,t);return"page"==t&&l==n.sel.primary()&&Xr(r,sr(r,s,"div").top-a.top),s},$l),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=this.doc,r=M(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=r.length||!n?++i:--n;for(var l=r.charAt(n),a=x(l,o)?function(e){return x(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!x(e)};n>0&&a(r.charAt(n-1));)--n;for(;i<r.length&&a(r.charAt(i));)++i}return new Oa(E(e.line,n),E(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?a(this.display.cursorDiv,"CodeMirror-overwrite"):zl(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==l()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:vn(function(e,t){Yr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Bt(this)-this.display.barHeight,width:e.scrollWidth-Bt(this)-this.display.barWidth,clientHeight:jt(this),clientWidth:Vt(this)}},scrollIntoView:vn(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:E(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?_r(this,e):Zr(this,e.from,e.to,e.margin)}),setSize:vn(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&tr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){bn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(e){return pn(this,e)},startOperation:function(){return ln(this)},endOperation:function(){return an(this)},refresh:vn(function(){var e=this.display.cachedTextHeight;yn(this),this.curOp.forceUpdate=!0,rr(this),Yr(this,this.doc.scrollLeft,this.doc.scrollTop),Hn(this),(null==e||Math.abs(e-br(this.display))>.5)&&Sr(this),Me(this,"refresh",this)}),swapDoc:vn(function(e){var t=this.doc;return t.cm=null,Jn(this,e),rr(this),this.display.input.reset(),Yr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,xt(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},De(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(Yo);var ns="iter insert remove copy getEditor constructor".split(" ");for(var is in Pa.prototype)Pa.prototype.hasOwnProperty(is)&&d(ns,is)<0&&(Yo.prototype[is]=function(e){return function(){return e.apply(this.doc,arguments)}}(Pa.prototype[is]));return De(Pa),Yo.inputStyles={textarea:rs,contenteditable:ts},Yo.defineMode=function(e){Yo.defaults.mode||"null"==e||(Yo.defaults.mode=e),Ve.apply(this,arguments)},Yo.defineMIME=je,Yo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yo.defineMIME("text/plain","null"),Yo.defineExtension=function(e,t){Yo.prototype[e]=t},Yo.defineDocExtension=function(e,t){Pa.prototype[e]=t},Yo.fromTextArea=dl,function(e){e.off=Te,e.on=ra,e.wheelEventPixels=zn,e.Doc=Pa,e.splitLines=ia,e.countColumn=f,e.findColumn=h,e.isWordChar=w,e.Pass=Ul,e.signal=Me,e.Line=ga,e.changeEnd=jn,e.scrollbarModel=Sa,e.Pos=E,e.cmpPos=P,e.modes=sa,e.mimeModes=ua,e.resolveMode=Ge,e.getMode=Ue,e.modeExtensions=ca,e.extendMode=Ke,e.copyState=Xe,e.startState=Ye,e.innerMode=$e,e.commands=Ua,e.keyMap=Ga,e.keyName=co,e.isModifierKey=so,e.lookupKey=ao,e.normalizeKeyMap=lo,e.StringStream=fa,e.SharedTextMarker=Fa,e.TextMarker=Ha,e.LineWidget=Da,e.e_preventDefault=We,e.e_stopPropagation=He,e.e_stop=Ee,e.addClass=a,e.contains=o,e.rmClass=zl,e.keyNames=Ra}(Yo),Yo.version="5.43.0",Yo})}},[2]);