OnlineJudge/dist_backup/static/js/5.6788f74327c1e26c64b1.js
2018-09-21 13:13:48 +00:00

1 line
218 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

webpackJsonp([5],{"/n6Q":function(e,t,n){n("zQR9"),n("+tPU"),e.exports=n("Kh4W").f("iterator")},"06OY":function(e,t,n){var r=n("3Eo+")("meta"),i=n("EqjI"),o=n("D2L2"),a=n("evD5").f,l=0,s=Object.isExtensible||function(){return!0},u=!n("S82l")(function(){return s(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++l,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!s(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!o(e,r)){if(!s(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&f.NEED&&s(e)&&!o(e,r)&&c(e),e}}},"4/hK":function(e,t){},"5QVw":function(e,t,n){e.exports={default:n("BwfY"),__esModule:!0}},"6S2o":function(e,t,n){(function(e){"use strict";function t(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=i,this.prev=o}function n(e,n,r,i){var o=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=r&&(o=e.context.indented),e.context=new t(o,n,r,i,null,e.context)}function r(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function i(e,t,n){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function o(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function a(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function l(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}e.defineMode("clike",function(a,s){var u,c,f=a.indentUnit,d=s.statementIndentUnit||f,h=s.dontAlignCalls,p=s.keywords||{},g=s.types||{},m=s.builtin||{},v=s.blockKeywords||{},y=s.defKeywords||{},b=s.atoms||{},w=s.hooks||{},x=s.multiLineStrings,C=!1!==s.indentStatements,S=!1!==s.indentSwitch,k=s.namespaceSeparator,L=s.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,T=s.numberStart||/[\d\.]/,M=s.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,_=s.isOperatorChar||/[+\-*&%=<>!?|\/]/,O=s.isIdentifierChar||/[\w\$_\xa1-\uffff]/;function D(e,t){var n,r=e.next();if(w[r]){var i=w[r](e,t);if(!1!==i)return i}if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){for(var r,i=!1,o=!1;null!=(r=e.next());){if(r==n&&!i){o=!0;break}i=!i&&"\\"==r}return(o||!i&&!x)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(L.test(r))return u=r,null;if(T.test(r)){if(e.backUp(1),e.match(M))return"number";e.next()}if("/"==r){if(e.eat("*"))return t.tokenize=A,A(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(_.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(_););return"operator"}if(e.eatWhile(O),k)for(;e.match(k);)e.eatWhile(O);var o=e.current();return l(p,o)?(l(v,o)&&(u="newstatement"),l(y,o)&&(c=!0),"keyword"):l(g,o)?"type":l(m,o)?(l(v,o)&&(u="newstatement"),"builtin"):l(b,o)?"atom":"variable"}function A(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function N(e,t){s.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new t((e||0)-f,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var a=t.context;if(e.sol()&&(null==a.align&&(a.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return N(e,t),null;u=c=null;var l=(t.tokenize||D)(e,t);if("comment"==l||"meta"==l)return l;if(null==a.align&&(a.align=!0),";"==u||":"==u||","==u&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)r(t);else if("{"==u)n(t,e.column(),"}");else if("["==u)n(t,e.column(),"]");else if("("==u)n(t,e.column(),")");else if("}"==u){for(;"statement"==a.type;)a=r(t);for("}"==a.type&&(a=r(t));"statement"==a.type;)a=r(t)}else u==a.type?r(t):C&&(("}"==a.type||"top"==a.type)&&";"!=u||"statement"==a.type&&"newstatement"==u)&&n(t,e.column(),"statement",e.current());if("variable"==l&&("def"==t.prevToken||s.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(l="def"),w.token){var f=w.token(e,t,l);void 0!==f&&(l=f)}return"def"==l&&!1===s.styleDefs&&(l="variable"),t.startOfLine=!1,t.prevToken=c?"def":l||u,N(e,t),l},indent:function(t,n){if(t.tokenize!=D&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var r=t.context,i=n&&n.charAt(0);if("statement"==r.type&&"}"==i&&(r=r.prev),s.dontIndentStatements)for(;"statement"==r.type&&s.dontIndentStatements.test(r.info);)r=r.prev;if(w.indent){var o=w.indent(t,r,n);if("number"==typeof o)return o}var a=i==r.type,l=r.prev&&"switch"==r.prev.info;if(s.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==i?0:d):!r.align||h&&")"==r.type?")"!=r.type||a?r.indented+(a?0:f)+(a||!l||/^(?:case|default)\b/.test(n)?0:f):r.indented+d:r.column+(a?0:1)},electricInput:S?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var s="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",u="int long char short double float unsigned signed void size_t ptrdiff_t";function c(e,t){if(!t.startOfLine)return!1;for(var n,r=null;n=e.peek();){if("\\"==n&&e.match(/^.$/)){r=c;break}if("/"==n&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=r,"meta"}function f(e,t){return"type"==t.prevToken&&"type"}function d(e){return e.eatWhile(/[\w\.']/),"number"}function h(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var n=e.match(/"([^\s\\()]{0,16})\(/);return!!n&&(t.cpp11RawStringDelim=n[1],t.tokenize=g,g(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function p(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function g(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+n+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function m(t,n){"string"==typeof t&&(t=[t]);var r=[];function i(e){if(e)for(var t in e)e.hasOwnProperty(t)&&r.push(t)}i(n.keywords),i(n.types),i(n.builtin),i(n.atoms),r.length&&(n.helperType=t[0],e.registerHelper("hintWords",t[0],r));for(var o=0;o<t.length;++o)e.defineMIME(t[o],n)}function v(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}m(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(s),types:a(u+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:a("case do else for if switch while struct"),defKeywords:a("struct"),typeFirstDefinitions:!0,atoms:a("NULL true false"),hooks:{"#":c,"*":f},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(s+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:a(u+" bool wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),defKeywords:a("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:a("true false NULL"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":c,"*":f,u:h,U:h,L:h,R:h,0:d,1:d,2:d,3:d,4:d,5:d,6:d,7:d,8:d,9:d,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&(r=e.current(),(i=/(\w+)::~?(\w+)$/.exec(r))&&i[1]==i[2]))return"def";var r,i}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:a("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:a("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:a("catch class do else finally for if switch try while"),defKeywords:a("class interface enum @interface"),typeFirstDefinitions:!0,atoms:a("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),m("text/x-csharp",{name:"clike",keywords:a("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:a("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),defKeywords:a("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),m("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:a("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:a("catch class enum do else finally for forSome if match switch try while"),defKeywords:a("class enum def object package trait type val var"),atoms:a("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=v,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,n){var r=n.context;return!("}"!=r.type||!r.align||!e.eat(">"))&&(n.context=new t(r.indented,r.column,r.type,r.info,null,r.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function e(t){return function(n,r){for(var i;i=n.next();){if("*"==i&&n.eat("/")){if(1==t){r.tokenize=null;break}return r.tokenize=e(t-1),r.tokenize(n,r)}if("/"==i&&n.eat("*"))return r.tokenize=e(t+1),r.tokenize(n,r)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{triples:'"'}}}),m("text/x-kotlin",{name:"clike",keywords:a("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:a("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:a("catch class do else finally for if where try while enum"),defKeywords:a("class val var object interface fun"),atoms:a("true false null this"),hooks:{'"':function(e,t){var n;return t.tokenize=(n=e.match('""'),function(e,t){for(var r,i=!1,o=!1;!e.eol();){if(!n&&!i&&e.match('"')){o=!0;break}if(n&&e.match('"""')){o=!0;break}r=e.next(),!i&&"$"==r&&e.match("{")&&e.skipTo("}"),i=!i&&"\\"==r&&!n}return!o&&n||(t.tokenize=null),"string"}),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),m(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:a("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:a("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:a("for while do if else struct"),builtin:a("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:a("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":c},modeProps:{fold:["brace","include"]}}),m("text/x-nesc",{name:"clike",keywords:a(s+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:a(u),blockKeywords:a("case do else for if switch while struct"),atoms:a("null true false"),hooks:{"#":c},modeProps:{fold:["brace","include"]}}),m("text/x-objectivec",{name:"clike",keywords:a(s+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:a(u),atoms:a("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":c,indent:function(e,t,n){if("statement"==t.type&&/^@\w/.test(n))return t.indented}},modeProps:{fold:"brace"}}),m("text/x-squirrel",{name:"clike",keywords:a("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:a(u),blockKeywords:a("case catch class else for foreach if switch try while"),defKeywords:a("function local class"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"#":c},modeProps:{fold:["brace","include"]}});var y=null;m("text/x-ceylon",{name:"clike",keywords:a("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:a("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:a("class dynamic function interface module object package value"),builtin:a("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:a("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function e(t){return function(n,r){for(var i,o=!1,a=!1;!n.eol();){if(!o&&n.match('"')&&("single"==t||n.match('""'))){a=!0;break}if(!o&&n.match("``")){y=e(t),a=!0;break}i=n.next(),o="single"==t&&!o&&"\\"==i}return a&&(r.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!y||!e.match("`"))&&(t.tokenize=y,y=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,n){if(("variable"==n||"type"==n)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})(n("8U58"))},"7UMu":function(e,t,n){var r=n("R9M2");e.exports=Array.isArray||function(e){return"Array"==r(e)}},"8U58":function(e,t,n){var r;r=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,l=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),u=s&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=f&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(f=!1,s=!0);var C=y&&(u||f&&(null==x||x<12.11)),S=n||a&&l>=9;function k(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L,T=function(e,t){var n=e.className,r=k(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return M(e).appendChild(t)}function O(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"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 D(e,t,n,r){var i=O(e,t,n,r);return i.setAttribute("role","presentation"),i}function A(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 N(){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 P(e,t){var n=e.className;k(t).test(n)||(e.className+=(n?" ":"")+t)}function I(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!k(n[r]).test(t)&&(t+=" "+n[r]);return t}L=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var E=function(e){e.select()};function W(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,n){for(var r in t||(t={}),e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function z(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}g?E=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(E=function(e){try{e.select()}catch(e){}});var H=function(){this.id=null};function R(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}H.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var B=30,U={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},j={origin:"*mouse"},G={origin:"+move"};function K(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var $=[""];function Y(e){for(;$.length<=e;)$.push(q($)+" ");return $[e]}function q(e){return e[e.length-1]}function X(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(){}function Q(e,t){var n;return Object.create?n=Object.create(e):(Z.prototype=e,n=new Z),t&&F(t,n),n}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\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]/;function ie(e){return e.charCodeAt(0)>=768&&re.test(e)}function oe(e,t,n){for(;(n<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=n;return t}function ae(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function le(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 n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function se(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function ue(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ce(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function fe(e){if(null==e.parent)return null;for(var t=e.parent,n=R(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function de(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return n+a}function he(e,t){return t>=e.first&&t<e.first+e.size}function pe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ge(e,t,n){if(void 0===n&&(n=null),!(this instanceof ge))return new ge(e,t,n);this.line=e,this.ch=t,this.sticky=n}function me(e,t){return e.line-t.line||e.ch-t.ch}function ve(e,t){return e.sticky==t.sticky&&0==me(e,t)}function ye(e){return ge(e.line,e.ch)}function be(e,t){return me(e,t)<0?t:e}function we(e,t){return me(e,t)<0?e:t}function xe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Ce(e,t){if(t.line<e.first)return ge(e.first,0);var n=e.first+e.size-1;return t.line>n?ge(n,le(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?ge(e.line,t):n<0?ge(e.line,0):e}(t,le(e,t.line).text.length)}function Se(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Ce(e,t[r]);return n}var ke=!1,Le=!1;function Te(e,t,n){this.marker=e,this.from=t,this.to=n}function Me(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function _e(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Oe(e,t){if(t.full)return null;var n=he(e,t.from.line)&&le(e,t.from.line).markedSpans,r=he(e,t.to.line)&&le(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==me(t.from,t.to),l=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Te(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Te(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),u=1==t.text.length,c=q(t.text).length+(u?i:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var h=Me(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 g=s[p];if(null!=g.to&&(g.to+=c),null==g.from)Me(l,g.marker)||(g.from=c,u&&(l||(l=[])).push(g));else g.from+=c,u&&(l||(l=[])).push(g)}l&&(l=De(l)),s&&s!=l&&(s=De(s));var m=[l];if(!u){var v,y=t.text.length-2;if(y>0&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v||(v=[])).push(new Te(l[b].marker,null,null));for(var w=0;w<y;++w)m.push(v);m.push(s)}return m}function De(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Ae(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Ne(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Pe(e){return e.inclusiveLeft?-1:0}function Ie(e){return e.inclusiveRight?1:0}function Ee(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=me(r.from,i.from)||Pe(e)-Pe(t);if(o)return-o;var a=me(r.to,i.to)||Ie(e)-Ie(t);return a||t.id-e.id}function We(e,t){var n,r=Le&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ee(n,i.marker)<0)&&(n=i.marker);return n}function Fe(e){return We(e,!0)}function ze(e){return We(e,!1)}function He(e,t,n,r,i){var o=le(e,t),a=Le&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=me(u.from,n)||Pe(s.marker)-Pe(i),f=me(u.to,r)||Ie(s.marker)-Ie(i);if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?me(u.to,n)>=0:me(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?me(u.from,r)<=0:me(u.from,r)<0)))return!0}}}function Re(e){for(var t;t=Fe(e);)e=t.find(-1,!0).line;return e}function Be(e,t){var n=le(e,t),r=Re(n);return n==r?t:fe(r)}function Ue(e,t){if(t>e.lastLine())return t;var n,r=le(e,t);if(!Ve(e,r))return t;for(;n=ze(r);)r=n.find(1,!0).line;return fe(r)+1}function Ve(e,t){var n=Le&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&je(e,t,r))return!0}}function je(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return je(e,r.line,Me(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&je(e,t,i))return!0}function Ge(e){for(var t=0,n=(e=Re(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==n)break;t+=l.height}return t}function Ke(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Fe(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=ze(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function $e(e){var t=e.display,n=e.doc;t.maxLine=le(n,n.first),t.maxLineLength=Ke(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=Ke(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}var Ye=null;function qe(e,t,n){var r;Ye=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"==n?r=i:Ye=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Ye=i)}return null!=r?r:Ye}var Xe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,a=/[1n]/;function l(e,t,n){this.level=e,this.from=t,this.to=n}return function(s,u){var c="ltr"==u?"L":"R";if(0==s.length||"ltr"==u&&!n.test(s))return!1;for(var f,d=s.length,h=[],p=0;p<d;++p)h.push((f=s.charCodeAt(p))<=247?e.charAt(f):1424<=f&&f<=1524?"R":1536<=f&&f<=1785?t.charAt(f-1536):1774<=f&&f<=2220?"r":8192<=f&&f<=8203?"w":8204==f?"b":"L");for(var g=0,m=c;g<d;++g){var v=h[g];"m"==v?h[g]=m:m=v}for(var y=0,b=c;y<d;++y){var w=h[y];"1"==w&&"r"==b?h[y]="n":i.test(w)&&(b=w,"r"==w&&(h[y]="R"))}for(var x=1,C=h[0];x<d-1;++x){var S=h[x];"+"==S&&"1"==C&&"1"==h[x+1]?h[x]="1":","!=S||C!=h[x+1]||"1"!=C&&"n"!=C||(h[x]=C),C=S}for(var k=0;k<d;++k){var L=h[k];if(","==L)h[k]="N";else if("%"==L){var T=void 0;for(T=k+1;T<d&&"%"==h[T];++T);for(var M=k&&"!"==h[k-1]||T<d&&"1"==h[T]?"1":"N",_=k;_<T;++_)h[_]=M;k=T-1}}for(var O=0,D=c;O<d;++O){var A=h[O];"L"==D&&"1"==A?h[O]="L":i.test(A)&&(D=A)}for(var N=0;N<d;++N)if(r.test(h[N])){var P=void 0;for(P=N+1;P<d&&r.test(h[P]);++P);for(var I="L"==(N?h[N-1]:c),E=I==("L"==(P<d?h[P]:c))?I?"L":"R":c,W=N;W<P;++W)h[W]=E;N=P-1}for(var F,z=[],H=0;H<d;)if(o.test(h[H])){var R=H;for(++H;H<d&&o.test(h[H]);++H);z.push(new l(0,R,H))}else{var B=H,U=z.length;for(++H;H<d&&"L"!=h[H];++H);for(var V=B;V<H;)if(a.test(h[V])){B<V&&z.splice(U,0,new l(1,B,V));var j=V;for(++V;V<H&&a.test(h[V]);++V);z.splice(U,0,new l(2,j,V)),B=V}else++V;B<H&&z.splice(U,0,new l(1,B,H))}return"ltr"==u&&(1==z[0].level&&(F=s.match(/^\s+/))&&(z[0].from=F[0].length,z.unshift(new l(0,0,F[0].length))),1==q(z).level&&(F=s.match(/\s+$/))&&(q(z).to-=F[0].length,z.push(new l(0,d-F[0].length,d)))),"rtl"==u?z.reverse():z}}();function Ze(e,t){var n=e.order;return null==n&&(n=e.order=Xe(e.text,t)),n}var Qe=[],Je=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Qe).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||Qe}function tt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=R(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function nt(e,t){var n=et(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function rt(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),nt(e,n||t.type,e,t),ut(t)||t.codemirrorIgnore}function it(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==R(n,t[r])&&n.push(t[r])}function ot(e,t){return et(e,t).length>0}function at(e){e.prototype.on=function(e,t){Je(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function lt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function st(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ut(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ct(e){lt(e),st(e)}function ft(e){return e.target||e.srcElement}function dt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var ht,pt,gt=function(){if(a&&l<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function mt(e){if(null==ht){var t=O("span","");_(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ht=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=ht?O("span",""):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function vt(e){if(null!=pt)return pt;var t=_(e,document.createTextNode("AخA")),n=L(t,0,1).getBoundingClientRect(),r=L(t,1,2).getBoundingClientRect();return M(e),!(!n||n.left==n.right)&&(pt=r.right-n.right<3)}var yt,bt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},wt=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)},xt="oncopy"in(yt=O("div"))||(yt.setAttribute("oncopy","return;"),"function"==typeof yt.oncopy),Ct=null;var St={},kt={};function Lt(e){if("string"==typeof e&&kt.hasOwnProperty(e))e=kt[e];else if(e&&"string"==typeof e.name&&kt.hasOwnProperty(e.name)){var t=kt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Lt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Lt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Tt(e,t){t=Lt(t);var n=St[t.name];if(!n)return Tt(e,"text/plain");var r=n(e,t);if(Mt.hasOwnProperty(t.name)){var i=Mt[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var Mt={};function _t(e,t){F(t,Mt.hasOwnProperty(e)?Mt[e]:Mt[e]={})}function Ot(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Dt(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function At(e,t,n){return!e.startState||e.startState(t,n)}var Nt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Nt.prototype.eol=function(){return this.pos>=this.string.length},Nt.prototype.sol=function(){return this.pos==this.lineStart},Nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Nt.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},Nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Nt.prototype.skipToEnd=function(){this.pos=this.string.length},Nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Nt.prototype.backUp=function(e){this.pos-=e},Nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Pt=function(e,t){this.state=e,this.lookAhead=t},It=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function Et(e,t,n,r){var i=[e.state.modeGen],o={};jt(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var a=n.state,l=function(r){n.baseTokens=i;var l=e.state.overlays[r],s=1,u=0;n.state=!0,jt(e,t.text,l.mode,n,function(e,t){for(var n=s;u<e;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}},o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Wt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ft(e,fe(t)),i=t.text.length>e.options.maxHighlightLength&&Ot(e.doc.mode,r.state),o=Et(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ft(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new It(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=le(o,l-1),u=s.stateAfter;if(u&&(!n||l+(u instanceof Pt?u.lookAhead:0)<=o.modeFrontier))return l;var c=z(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}(e,t,n),a=o>r.first&&le(r,o-1).stateAfter,l=a?It.fromSaved(r,a,o):new It(r,At(r.mode),o);return r.iter(o,t,function(n){zt(e,n.text,l);var r=l.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?l.save():null,l.nextLine()}),n&&(r.modeFrontier=l.line),l}function zt(e,t,n,r){var i=e.doc.mode,o=new Nt(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&Ht(i,n.state);!o.eol();)Rt(i,o,n.state),o.start=o.pos}function Ht(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Dt(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Rt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Dt(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}It.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},It.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},It.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},It.fromSaved=function(e,t,n){return t instanceof Pt?new It(e,Ot(e.mode,t.state),n,t.lookAhead):new It(e,Ot(e.mode,t),n)},It.prototype.save=function(e){var t=!1!==e?Ot(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Pt(t,this.maxLookAhead):t};var Bt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ut(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=le(a,(t=Ce(a,t)).line),u=Ft(e,t.line,n),c=new Nt(s.text,e.options.tabSize,u);for(r&&(o=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=Rt(l,c,u.state),r&&o.push(new Bt(c,i,Ot(a.mode,u.state)));return r?o:new Bt(c,i,u.state)}function Vt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function jt(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,u=0,c=null,f=new Nt(t,e.options.tabSize,r),d=e.options.addModeClass&&[null];for(""==t&&Vt(Ht(n,r.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&zt(e,t,r,f.pos),f.pos=t.length,s=null):s=Vt(Rt(n,f,r.state,d),o),d){var h=d[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||c!=s){for(;u<f.start;)i(u=Math.min(f.start,u+5e3),c);c=s}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e3);i(p,c),u=p}}var Gt=function(e,t,n){this.text=e,Ne(this,t),this.height=n?n(this):1};function Kt(e){e.parent=null,Ae(e)}Gt.prototype.lineNo=function(){return fe(this)},at(Gt);var $t={},Yt={};function qt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Yt:$t;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,t){var n=D("span",null,null,s?"padding-right: .1px":null),r={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(a||s)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;r.pos=0,r.addToken=Qt,vt(e.display.measure)&&(l=Ze(o,e.doc.direction))&&(r.addToken=Jt(r.addToken,l)),r.map=[],tn(o,r,Wt(e,o,t!=e.display.externalMeasured&&fe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=I(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=I(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(mt(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var u=r.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return nt(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=I(r.pre.className,r.textClass||"")),r}function Zt(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,n,r,i,o,s){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,f=e.cm.state.specialChars,d=!1;if(f.test(t)){u=document.createDocumentFragment();for(var h=0;;){f.lastIndex=h;var p=f.exec(t),g=p?p.index-h:t.length-h;if(g){var m=document.createTextNode(c.slice(h,h+g));a&&l<9?u.appendChild(O("span",[m])):u.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break;h+=g+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=u.appendChild(O("span",Y(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&l<9?u.appendChild(O("span",[v])):u.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),a&&l<9&&(d=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||r||i||d||s){var w=n||"";r&&(w+=r),i&&(w+=i);var x=O("span",[u],w,s);return o&&(x.title=o),e.content.appendChild(x)}e.content.appendChild(u)}}function Jt(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var f=void 0,d=0;d<t.length&&!((f=t[d]).to>u&&f.from<=u);d++);if(f.to>=c)return e(n,r,i,o,a,l,s);e(n,r.slice(0,f.to-u),i,o,null,l,s),o=null,r=r.slice(f.to-u),u=f.to}}}function en(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function tn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,u,c,f,d,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=u=c=f=l="",d=null,v=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],C=x.marker;"bookmark"==C.type&&x.from==p&&C.widgetNode?y.push(C):x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(l=(l?l+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==v&&(b||(b=[])).push(C.endStyle,x.to),C.title&&!f&&(f=C.title),C.collapsed&&(!d||Ee(d.marker,C)<0)&&(d=x)):x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(u+=" "+b[S]);if(!d||d.from==p)for(var k=0;k<y.length;++k)en(t,0,y[k]);if(d&&(d.from||0)==p){if(en(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=h)break;for(var L=Math.min(h,v);;){if(m){var T=p+m.length;if(!d){var M=T>L?m.slice(0,L-p):m;t.addToken(t,M,a?a+s:s,c,p+M.length==v?u:"",f,l)}if(T>=L){m=m.slice(L-p),p=L;break}p=T,c=""}m=i.slice(o,o=n[g++]),a=qt(n[g++],t.cm.options)}}else for(var _=1;_<n.length;_+=2)t.addToken(t,i.slice(o,o=n[_]),qt(n[_+1],t.cm.options))}function nn(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=ze(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}(t),this.size=this.rest?fe(q(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Ve(e,t)}function rn(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new nn(e.doc,le(e.doc,o),o);r=o+a.size,i.push(a)}return i}var on=null;var an=null;function ln(e,t){var n=et(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);on?r=on.delayedCallbacks:an?r=an:(r=an=[],setTimeout(sn,0));for(var o=function(e){r.push(function(){return n[e].apply(null,i)})},a=0;a<n.length;++a)o(a)}}function sn(){var e=an;an=null;for(var t=0;t<e.length;++t)e[t]()}function un(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?dn(e,t):"gutter"==o?pn(e,t,n,r):"class"==o?hn(e,t):"widget"==o&&gn(e,t,r)}t.changes=null}function cn(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&l<8&&(e.node.style.zIndex=2)),e.node}function fn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Xt(e,t)}function dn(e,t){var n=t.text.className,r=fn(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,hn(e,t)):n&&(t.text.className=n)}function hn(e,t){!function(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=cn(t);t.background=r.insertBefore(O("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function pn(e,t,n,r){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 i=cn(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=cn(t),l=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(O("div",pe(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.options.gutters.length;++s){var u=e.options.gutters[s],c=o.hasOwnProperty(u)&&o[u];c&&l.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function gn(e,t,n){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,i=void 0;r;r=i)i=r.nextSibling,"CodeMirror-linewidget"==r.className&&t.node.removeChild(r);vn(e,t,n)}function mn(e,t,n,r){var i=fn(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),hn(e,t),pn(e,t,n,r),vn(e,t,r),t.node}function vn(e,t,n){if(yn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)yn(e,t.rest[r],t,n,!1)}function yn(e,t,n,r,i){if(t.widgets)for(var o=cn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=O("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),bn(s,u,n,r),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),ln(s,"redraw")}}function bn(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function wn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!A(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),_(t.display.measure,O("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function xn(e,t){for(var n=ft(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Cn(e){return e.lineSpace.offsetTop}function Sn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=_(e.measure,O("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Ln(e){return B-e.display.nativeBarWidth}function Tn(e){return e.display.scroller.clientWidth-Ln(e)-e.display.barWidth}function Mn(e){return e.display.scroller.clientHeight-Ln(e)-e.display.barHeight}function _n(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(fe(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function On(e,t,n,r){return Nn(e,An(e,t),n,r)}function Dn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[lr(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function An(e,t){var n=fe(t),r=Dn(e,n);r&&!r.text?r=null:r&&r.changes&&(un(e,r,n,nr(e)),e.curOp.forceUpdate=!0),r||(r=function(e,t){var n=fe(t=Re(t)),r=e.display.externalMeasured=new nn(e.doc,t,n);r.lineN=n;var i=r.built=Xt(e,r);return r.text=i.pre,_(e.display.lineMeasure,i.pre),r}(e,t));var i=_n(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Nn(e,t,n,r,i){t.before&&(n=-1);var o,s=n+(r||"");return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,n){var r=e.options.lineWrapping,i=r&&Tn(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=En(t.map,n,r),s=o.node,u=o.start,c=o.end,f=o.collapse;if(3==s.nodeType){for(var d=0;d<4;d++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+c));)++c;if((i=a&&l<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Wn(L(s,u,c).getClientRects(),r)).left||i.right||0==u)break;c=u,u-=1,f="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ct)return Ct;var t=_(e,O("span","x")),n=t.getBoundingClientRect(),r=L(t,0,1).getBoundingClientRect();return Ct=Math.abs(n.left-r.left)>1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var h;u>0&&(f=r="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==r?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+tr(e.display),top:p.top,bottom:p.bottom}:In}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var w=b?y[b-1]:0,x=y[b],C={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:w,bottom:x};i.left||i.right||(C.bogus=!0);e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=m);return C}(e,t,n,r)).bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Pn,In={left:0,right:0,top:0,bottom:0};function En(e,t,n){for(var r,i,o,a,l,s,u=0;u<e.length;u+=3)if(l=e[u],s=e[u+1],t<l?(i=0,o=1,a="left"):t<s?o=(i=t-l)+1:(u==e.length-3||t==s&&e[u+3]>t)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(r=e[u+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],a="left";if("right"==n&&i==s-l)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Wn(e,t){var n=In;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Fn(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 zn(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Fn(e.display.view[t])}function Hn(e){zn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Rn(){return c&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Bn(){return c&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Un(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=wn(e.widgets[n]));return t}function Vn(e,t,n,r,i){if(!i){var o=Un(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Ge(t);if("local"==r?a+=Cn(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:Bn());var s=l.left+("window"==r?0:Rn());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function jn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=Rn(),i-=Bn();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Gn(e,t,n,r,i){return r||(r=le(e.doc,t.line)),Vn(e,r,On(e,r,t.ch,i),n)}function Kn(e,t,n,r,i,o){function a(t,a){var l=Nn(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,Vn(e,r,l,n)}r=r||le(e.doc,t.line),i||(i=An(e,r));var l=Ze(r,e.doc.direction),s=t.ch,u=t.sticky;if(s>=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!l)return a("before"==u?s-1:s,"before"==u);function c(e,t,n){var r=1==l[t].level;return a(n?e-1:e,r!=n)}var f=qe(l,s,u),d=Ye,h=c(s,f,"before"==u);return null!=d&&(h.other=c(s,d,"before"!=u)),h}function $n(e,t){var n=0;t=Ce(e.doc,t),e.options.lineWrapping||(n=tr(e.display)*t.ch);var r=le(e.doc,t.line),i=Ge(r)+Cn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Yn(e,t,n,r,i){var o=ge(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function qn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Yn(r.first,0,null,!0,-1);var i=de(r,n),o=r.first+r.size-1;if(i>o)return Yn(r.first+r.size-1,le(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=le(r,i);;){var l=Jn(e,a,i,t,n),s=ze(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=fe(a=u.to.line)}}function Xn(e,t,n,r){r-=Un(t);var i=t.text.length,o=ae(function(t){return Nn(e,n,t-1).bottom<=r},i,0);return{begin:o,end:i=ae(function(t){return Nn(e,n,t).top>r},o,i)}}function Zn(e,t,n,r){return n||(n=An(e,t)),Xn(e,t,n,Vn(e,t,Nn(e,n,r),"line").top)}function Qn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Jn(e,t,n,r,i){i-=Ge(t);var o=An(e,t),a=Un(t),l=0,s=t.text.length,u=!0,c=Ze(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?function(e,t,n,r,i,o,a){var l=Xn(e,t,r,a),s=l.begin,u=l.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=Nn(e,r,p?Math.min(u,h.to)-1:Math.max(s,h.from)).right,m=g<o?o-g+1e9:g-o;(!c||f>m)&&(c=h,f=m)}}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});return c}:function(e,t,n,r,i,o,a){var l=ae(function(l){var s=i[l],u=1!=s.level;return Qn(Kn(e,ge(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var u=1!=s.level,c=Kn(e,ge(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Qn(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s})(e,t,n,o,c,r,i);l=(u=1!=f.level)?f.from:f.to-1,s=u?f.to:f.from-1}var d,h,p=null,g=null,m=ae(function(t){var n=Nn(e,o,t);return n.top+=a,n.bottom+=a,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,g=n),!0)},l,s),v=!1;if(g){var y=r-g.left<g.right-r,b=y==u;m=p+(b?0:1),h=b?"after":"before",d=y?g.left:g.right}else{u||m!=s&&m!=l||m++,h=0==m?"after":m==t.text.length?"before":Nn(e,o,m-(u?1:0)).bottom+a<=i==u?"after":"before";var w=Kn(e,ge(n,m,h),"line",t,o);d=w.left,v=i<w.top||i>=w.bottom}return Yn(n,m=oe(t.text,m,1),h,v,r-d)}function er(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Pn){Pn=O("pre");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(O("br"));Pn.appendChild(document.createTextNode("x"))}_(e.measure,Pn);var n=Pn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),M(e.measure),n||1}function tr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),n=O("pre",[t]);_(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function nr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:rr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function rr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ir(e){var t=er(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/tr(e.display)-3);return function(i){if(Ve(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function or(e){var t=e.doc,n=ir(e);t.iter(function(e){var t=n(e);t!=e.height&&ce(e,t)})}function ar(e,t,n,r){var i=e.display;if(!n&&"true"==ft(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=qn(e,o,a);if(r&&1==u.xRel&&(s=le(e.doc,u.line).text).length==u.ch){var c=z(s,s.length,e.options.tabSize)-s.length;u=ge(u.line,Math.max(0,Math.round((o-kn(e.display).left)/tr(e.display))-c))}return u}function lr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function sr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ur(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var l=n.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&cr(e,l.head,i),s||dr(e,l,o)}}return r}function cr(e,t,n){var r=Kn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(O("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function fr(e,t){return e.top-t.top||e.left-t.left}function dr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=kn(e.display),l=a.left,s=Math.max(r.sizerWidth,Tn(e)-r.sizer.offsetLeft)-a.right,u="ltr"==i.direction;function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n height: "+(r-t)+"px"))}function f(t,n,r){var o,a,f=le(i,t),d=f.text.length;function h(n,r){return Gn(e,ge(t,n),"div",f,r)}function p(t,n,r){var i=Zn(e,f,null,t),o="ltr"==n==("after"==r)?"left":"right";return h("after"==r?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1),o)[o]}var g=Ze(f,i.direction);return function(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(g,n||0,null==r?d:r,function(e,t,i,f){var m="ltr"==i,v=h(e,m?"left":"right"),y=h(t-1,m?"right":"left"),b=null==n&&0==e,w=null==r&&t==d,x=0==f,C=!g||f==g.length-1;if(y.top-v.top<=3){var S=(u?w:b)&&C,k=(u?b:w)&&x?l:(m?v:y).left,L=S?s:(m?y:v).right;c(k,v.top,L-k,v.bottom)}else{var T,M,_,O;m?(T=u&&b&&x?l:v.left,M=u?s:p(e,i,"before"),_=u?l:p(t,i,"after"),O=u&&w&&C?s:y.right):(T=u?p(e,i,"before"):l,M=!u&&b&&x?s:v.right,_=!u&&w&&C?l:y.left,O=u?p(t,i,"after"):s),c(T,v.top,M-T,v.bottom),v.bottom<y.top&&c(l,v.bottom,null,y.top),c(_,y.top,O-_,y.bottom)}(!o||fr(v,o)<0)&&(o=v),fr(y,o)<0&&(o=y),(!a||fr(v,a)<0)&&(a=v),fr(y,a)<0&&(a=y)}),{start:o,end:a}}var d=t.from(),h=t.to();if(d.line==h.line)f(d.line,d.ch,h.ch);else{var p=le(i,d.line),g=le(i,h.line),m=Re(p)==Re(g),v=f(d.line,d.ch,m?p.text.length+1:null).end,y=f(h.line,m?0:null,h.ch).start;m&&(v.top<y.top-2?(c(v.right,v.top,null,v.bottom),c(l,y.top,y.left,y.bottom)):c(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&c(l,v.bottom,null,y.top)}n.appendChild(o)}function hr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function pr(e){e.state.focused||(e.display.input.focus(),mr(e))}function gr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vr(e))},100)}function mr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(nt(e,"focus",e,t),e.state.focused=!0,P(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hr(e))}function vr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(nt(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=void 0;if(!i.hidden){if(a&&l<8){var s=i.node.offsetTop+i.node.offsetHeight;o=s-n,n=s}else{var u=i.node.getBoundingClientRect();o=u.bottom-u.top}var c=i.line.height-o;if(o<2&&(o=er(t)),(c>.005||c<-.005)&&(ce(i.line,o),br(i.line),i.rest))for(var f=0;f<i.rest.length;f++)br(i.rest[f])}}}function br(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function wr(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Cn(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=de(t,r),a=de(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;l<o?(o=l,a=de(t,Ge(le(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=de(t,Ge(le(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function xr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=rr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var l=n[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Cr(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pe(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(O("div",[O("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",li(e),!0}return!1}function Sr(e,t){var n=e.display,r=er(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Mn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Sn(n),s=t.top<r,u=t.bottom>l-r;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?l:t.bottom)-o);c!=i&&(a.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,d=Tn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(a.scrollLeft=t.right+(h?0:10)-d),a}function kr(e,t){null!=t&&(Mr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Lr(e){Mr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Tr(e,t,n){null==t&&null==n||Mr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Mr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,_r(e,$n(e,t.from),$n(e,t.to),t.margin))}function _r(e,t,n,r){var i=Sr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Tr(e,i.scrollLeft,i.scrollTop)}function Or(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||ai(e,{top:t}),Dr(e,t,!0),n&&ai(e),ti(e,100))}function Dr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ar(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,xr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Nr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Sn(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?n:0,docHeight:r,scrollHeight:r+Ln(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Pr=function(e,t,n){this.cm=n;var r=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Je(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Je(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Pr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r: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=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Pr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Pr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Pr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},Pr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,function r(){var i=e.getBoundingClientRect();("vert"==n?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,r)})},Pr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ir=function(){};function Er(e,t){t||(t=Nr(e));var n=e.display.barWidth,r=e.display.barHeight;Wr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&yr(e),Wr(e,Nr(e)),n=e.display.barWidth,r=e.display.barHeight}function Wr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ir.prototype.update=function(){return{bottom:0,right:0}},Ir.prototype.setScrollLeft=function(){},Ir.prototype.setScrollTop=function(){},Ir.prototype.clear=function(){};var Fr={native:Pr,null:Ir};function zr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Fr[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Je(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?Ar(e,t):Or(e,t)},e),e.display.scrollbars.addClass&&P(e.display.wrapper,e.display.scrollbars.addClass)}var Hr=0;function Rr(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Hr},t=e.curOp,on?on.ops.push(t):t.ownsGroup=on={ops:[t],delayedCallbacks:[]}}function Br(e){!function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(n)}finally{on=null,t(n)}}(e.curOp,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,n=0;n<t.length;n++)Ur(t[n]);for(var r=0;r<t.length;r++)(i=t[r]).updatedDisplay=i.mustUpdate&&ii(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Vr(t[o]);for(var a=0;a<t.length;a++)jr(t[a]);for(var l=0;l<t.length;l++)Gr(t[l])}(e)})}function Ur(e){var t=e.cm,n=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ln(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ln(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&$e(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ri(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Vr(e){var t=e.cm,n=t.display;e.updatedDisplay&&yr(t),e.barMeasure=Nr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=On(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ln(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Tn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function jr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ar(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Er(t,e.barMeasure),e.updatedDisplay&&si(t,e.barMeasure),e.selectionChanged&&hr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&pr(e.cm)}function Gr(e){var t=e.cm,n=t.display,r=t.doc;(e.updatedDisplay&&oi(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Dr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Ar(t,e.scrollLeft,!0,!0),e.scrollToPos)&&function(e,t){if(!rt(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=O("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Cn(e.display))+"px;\n height: "+(t.bottom-t.top+Ln(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?ge(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?ge(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=Kn(e,t),s=n&&n!=t?Kn(e,n):l,u=Sr(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=u.scrollTop&&(Or(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(Ar(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return i}(t,Ce(r,e.scrollToPos.from),Ce(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||nt(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&nt(o[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&nt(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Kr(e,t){if(e.curOp)return t();Rr(e);try{return t()}finally{Br(e)}}function $r(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Rr(e);try{return t.apply(e,arguments)}finally{Br(e)}}}function Yr(e){return function(){if(this.curOp)return e.apply(this,arguments);Rr(this);try{return e.apply(this,arguments)}finally{Br(this)}}}function qr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Rr(t);try{return e.apply(this,arguments)}finally{Br(t)}}}function Xr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Le&&Be(e.doc,t)<i.viewTo&&Qr(e);else if(n<=i.viewFrom)Le&&Ue(e.doc,n+r)>i.viewFrom?Qr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Qr(e);else if(t<=i.viewFrom){var o=Jr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Qr(e)}else if(n>=i.viewTo){var a=Jr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):Qr(e)}else{var l=Jr(e,t,t,-1),s=Jr(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(rn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):Qr(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function Zr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[lr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==R(a,n)&&a.push(n)}}}function Qr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Jr(e,t,n,r){var i,o=lr(e,t),a=e.display.view;if(!Le||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(r>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;Be(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function ei(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,W(ni,e))}function ni(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=Ft(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Ot(t.mode,r.state):null,s=Et(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!f&&d<a.length;++d)f=a[d]!=o.styles[d];f&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&zt(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ti(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Kr(e,function(){for(var t=0;t<i.length;t++)Zr(e,i[t],"text")})}}var ri=function(e,t,n){var r=e.display;this.viewport=t,this.visible=wr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Tn(e),this.force=n,this.dims=nr(e),this.events=[]};function ii(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Qr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==ei(e))return!1;Cr(e)&&(Qr(e),t.dims=nr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Le&&(o=Be(e.doc,o),a=Ue(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=rn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=rn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(lr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(rn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,lr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=Ge(le(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=ei(e);if(!l&&0==u&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=N();if(!t||!A(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&A(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return u>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,f=0;f<u.length;f++){var d=u[f];if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=l(a);var h=i&&null!=t&&t<=c&&d.lineNumber;d.changes&&(R(d.changes,"gutter")>-1&&(h=!1),un(e,d,c,n)),h&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(pe(e.options,c)))),a=d.node.nextSibling}else{var p=mn(e,d,c,n);o.insertBefore(p,a)}c+=d.size}for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=N()&&(e.activeElt.focus(),e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ti(e,400)),n.updateLineNumbers=null,!0}function oi(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Tn(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Sn(e.display)-Mn(e),n.top)}),t.visible=wr(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ii(e,t);r=!1){yr(e);var i=Nr(e);sr(e),Er(e,i),si(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 ai(e,t){var n=new ri(e,t);if(ii(e,n)){yr(e),oi(e,n);var r=Nr(e);sr(e),Er(e,r),si(e,r),n.finish()}}function li(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function si(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+Ln(e)+"px"}function ui(e){var t=e.display.gutters,n=e.options.gutters;M(t);for(var r=0;r<n.length;++r){var i=n[r],o=t.appendChild(O("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",li(e)}function ci(e){var t=R(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))}ri.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},ri.prototype.finish=function(){for(var e=0;e<this.events.length;e++)nt.apply(null,this.events[e])};var fi=0,di=null;function hi(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function pi(e){var t=hi(e);return t.x*=di,t.y*=di,t}function gi(e,t){var r=hi(t),i=r.x,o=r.y,a=e.display,l=a.scroller,u=l.scrollWidth>l.clientWidth,c=l.scrollHeight>l.clientHeight;if(i&&u||o&&c){if(o&&y&&s)e:for(var d=t.target,h=a.view;d!=l;d=d.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==d){e.display.currentWheelTarget=d;break e}if(i&&!n&&!f&&null!=di)return o&&c&&Or(e,Math.max(0,l.scrollTop+o*di)),Ar(e,Math.max(0,l.scrollLeft+i*di)),(!o||o&&c)&&lt(t),void(a.wheelStartX=null);if(o&&null!=di){var g=o*di,m=e.doc.scrollTop,v=m+a.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),ai(e,{top:m,bottom:v})}fi<20&&(null==a.wheelStartX?(a.wheelStartX=l.scrollLeft,a.wheelStartY=l.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout(function(){if(null!=a.wheelStartX){var e=l.scrollLeft-a.wheelStartX,t=l.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(di=(di*fi+n)/(fi+1),++fi)}},200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?di=-.53:n?di=15:c?di=-.7:d&&(di=-1/3);var mi=function(e,t){this.ranges=e,this.primIndex=t};mi.prototype.primary=function(){return this.ranges[this.primIndex]},mi.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!ve(n.anchor,r.anchor)||!ve(n.head,r.head))return!1}return!0},mi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vi(ye(this.ranges[t].anchor),ye(this.ranges[t].head));return new mi(e,this.primIndex)},mi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mi.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(me(t,r.from())>=0&&me(e,r.to())<=0)return n}return-1};var vi=function(e,t){this.anchor=e,this.head=t};function yi(e,t){var n=e[t];e.sort(function(e,t){return me(e.from(),t.from())}),t=R(e,n);for(var r=1;r<e.length;r++){var i=e[r],o=e[r-1];if(me(o.to(),i.from())>=0){var a=we(o.from(),i.from()),l=be(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new vi(s?l:a,s?a:l))}}return new mi(e,t)}function bi(e,t){return new mi([new vi(e,t||e)],0)}function wi(e){return e.text?ge(e.from.line+e.text.length-1,q(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function xi(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return wi(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=wi(t).ch-t.to.ch),ge(n,r)}function Ci(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new vi(xi(i.anchor,t),xi(i.head,t)))}return yi(n,e.sel.primIndex)}function Si(e,t,n){return e.line==t.line?ge(n.line,e.ch-t.ch+n.ch):ge(n.line+(e.line-t.line),e.ch)}function ki(e){e.doc.mode=Tt(e.options,e.doc.modeOption),Li(e)}function Li(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,ti(e,100),e.state.modeGen++,e.curOp&&Xr(e)}function Ti(e,t){return 0==t.from.ch&&0==t.to.ch&&""==q(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Mi(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){!function(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Ae(e),Ne(e,n);var i=r?r(e):1;i!=e.height&&ce(e,i)}(e,n,i,r),ln(e,"change",e,t)}function a(e,t){for(var n=[],o=e;o<t;++o)n.push(new Gt(u[o],i(o),r));return n}var l=t.from,s=t.to,u=t.text,c=le(e,l.line),f=le(e,s.line),d=q(u),h=i(u.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length);else if(Ti(e,t)){var g=a(0,u.length-1);o(f,f.text,h),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,l.ch)+d+c.text.slice(s.ch),h);else{var m=a(1,u.length-1);m.push(new Gt(d+c.text.slice(s.ch),h,r)),o(c,c.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,l.ch)+u[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(c,c.text.slice(0,l.ch)+u[0],i(0)),o(f,d+f.text.slice(s.ch),h);var v=a(1,u.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}ln(e,"change",e,t)}function _i(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;a<r.linked.length;++a){var l=r.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;n&&!s||(t(l.doc,s),e(l.doc,r,s))}}}(e,null,!0)}function Oi(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,or(e),ki(e),Di(e),e.options.lineWrapping||$e(e),e.options.mode=t.modeOption,Xr(e)}function Di(e){("rtl"==e.doc.direction?P:T)(e.display.lineDiv,"CodeMirror-rtl")}function Ai(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 Ni(e,t){var n={from:ye(t.from),to:wi(t),text:se(e,t.from,t.to)};return Fi(e,n,t.from.line,t.to.line+1),_i(e,function(e){return Fi(e,n,t.from.line,t.to.line+1)},!0),n}function Pi(e){for(;e.length;){if(!q(e).ranges)break;e.pop()}}function Ii(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Pi(e.done),q(e.done)):e.done.length&&!q(e.done).ranges?q(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),q(e.done)):void 0}(i,i.lastOp==r)))a=q(o.changes),0==me(t.from,t.to)&&0==me(t.from,a.to)?a.to=wi(t):o.changes.push(Ni(e,t));else{var s=q(i.done);for(s&&s.ranges||Wi(e.sel,i.done),o={changes:[Ni(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(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||nt(e,"historyAdded")}function Ei(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,q(i.done),t))?i.done[i.done.length-1]=t:Wi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Pi(i.undone)}function Wi(e,t){var n=q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function zi(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function Hi(e,t){var n=function(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(zi(n[i]));return r}(e,t),r=Oe(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function Ri(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?mi.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c=void 0;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&R(t,Number(c[1]))>-1&&(q(l)[f]=u[f],delete u[f])}}}return r}function Bi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=me(t,i)<0;o!=me(n,i)<0?(i=t,t=n):o!=me(t,n)<0&&(t=n)}return new vi(i,t)}return new vi(n||t,t)}function Ui(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),$i(e,new mi([Bi(e.sel.primary(),t,n,i)],0),r)}function Vi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Bi(e.sel.ranges[o],t[o],null,i);$i(e,yi(r,e.sel.primIndex),n)}function ji(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,$i(e,yi(i,e.sel.primIndex),r)}function Gi(e,t,n,r){$i(e,bi(t,n),r)}function Ki(e,t,n){var r=e.history.done,i=q(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):$i(e,t,n)}function $i(e,t,n){Yi(e,t,n),Ei(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(ot(e,"beforeSelectionChange")||e.cm&&ot(e.cm,"beforeSelectionChange"))&&(t=function(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new vi(Ce(e,t[n].anchor),Ce(e,t[n].head))},origin:n&&n.origin};return nt(e,"beforeSelectionChange",e,r),e.cm&&nt(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?yi(r.ranges,r.ranges.length-1):t}(e,t,n)),qi(e,Zi(e,t,n&&n.bias||(me(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),n&&!1===n.scroll||!e.cm||Lr(e.cm)}function qi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,it(e.cm)),ln(e,"cursorActivity",e))}function Xi(e){qi(e,Zi(e,e.sel,null,!1))}function Zi(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Ji(e,a.anchor,l&&l.anchor,n,r),u=Ji(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new vi(s,u))}return i?yi(i,t.primIndex):t}function Qi(e,t,n,r,i){var o=le(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(nt(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var u=s.find(r<0?1:-1),c=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(u=eo(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=me(u,n))&&(r<0?c<0:c>0))return Qi(e,u,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=eo(e,f,r,f.line==t.line?o:null)),f?Qi(e,f,t,r,i):null}}return t}function Ji(e,t,n,r,i){var o=r||1,a=Qi(e,t,n,o,i)||!i&&Qi(e,t,n,o,!0)||Qi(e,t,n,-o,i)||!i&&Qi(e,t,n,-o,!0);return a||(e.cantEdit=!0,ge(e.first,0))}function eo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?Ce(e,ge(t.line-1)):null:n>0&&t.ch==(r||le(e,t.line)).text.length?t.line<e.first+e.size-1?ge(t.line+1,0):null:new ge(t.line,t.ch+n)}function to(e){e.setSelection(ge(e.firstLine(),0),ge(e.lastLine()),V)}function no(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=Ce(e,t)),n&&(r.to=Ce(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),nt(e,"beforeChange",e,r),e.cm&&nt(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ro(e,t,n){if(e.cm){if(!e.cm.curOp)return $r(e.cm,ro)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"))||(t=no(e,t,!0))){var r=ke&&!n&&function(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=R(r,n)||(r||(r=[])).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s];if(!(me(u.to,l.from)<0||me(u.from,l.to)>0)){var c=[s,1],f=me(u.from,l.from),d=me(u.to,l.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)io(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else io(e,t)}}function io(e,t){if(1!=t.text.length||""!=t.text[0]||0!=me(t.from,t.to)){var n=Ci(e,t);Ii(e,t,n,e.cm?e.cm.curOp.id:NaN),lo(e,t,n,Oe(e,t));var r=[];_i(e,function(e,n){n||-1!=R(r,e.history)||(fo(e.history,t),r.push(e.history)),lo(e,t,null,Oe(e,t))})}}function oo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u<l.length&&(i=l[u],n?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=l.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=l.pop()).ranges){if(r)return void l.push(i);break}if(Wi(i,s),n&&!i.equals(e.sel))return void $i(e,i,{clearRedo:!1});a=i}var c=[];Wi(a,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var f=ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"),d=function(n){var r=i.changes[n];if(r.origin=t,f&&!no(e,r,!1))return l.length=0,{};c.push(Ni(e,r));var o=n?Ci(e,r):q(l);lo(e,r,o,Hi(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:wi(r)});var a=[];_i(e,function(e,t){t||-1!=R(a,e.history)||(fo(e.history,r),a.push(e.history)),lo(e,r,null,Hi(e,r))})},h=i.changes.length-1;h>=0;--h){var p=d(h);if(p)return p.v}}}}function ao(e,t){if(0!=t&&(e.first+=t,e.sel=new mi(X(e.sel.ranges,function(e){return new vi(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Xr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Zr(e.cm,r,"gutter")}}function lo(e,t,n,r){if(e.cm&&!e.cm.curOp)return $r(e.cm,lo)(e,t,n,r);if(t.to.line<e.first)ao(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);ao(e,i),t={from:ge(e.first,0),to:ge(t.to.line+i,t.to.ch),text:[q(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ge(o,le(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=se(e,t.from,t.to),n||(n=Ci(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=fe(Re(le(r,o.line))),r.iter(s,a.line+1,function(e){if(e==i.maxLine)return l=!0,!0}));r.sel.contains(t.from,t.to)>-1&&it(e);Mi(r,t,n,ir(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(e){var t=Ke(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=le(e,r).stateAfter;if(i&&(!(i instanceof Pt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}})(r,o.line),ti(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?Xr(e):o.line!=a.line||1!=t.text.length||Ti(e.doc,t)?Xr(e,o.line,a.line+1,u):Zr(e,o.line,"text");var c=ot(e,"changes"),f=ot(e,"change");if(f||c){var d={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};f&&ln(e,"change",e,d),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,r):Mi(e,t,r),Yi(e,n,V)}}function so(e,t,n,r,i){var o;(r||(r=n),me(r,n)<0)&&(n=(o=[r,n])[0],r=o[1]);"string"==typeof t&&(t=e.splitLines(t)),ro(e,{from:n,to:r,text:t,origin:i})}function uo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function co(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)uo(o.ranges[l].anchor,t,n,r),uo(o.ranges[l].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s];if(n<u.from.line)u.from=ge(u.from.line+r,u.from.ch),u.to=ge(u.to.line+r,u.to.ch);else if(t<=u.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function fo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;co(e.done,n,r,i),co(e.undone,n,r,i)}function ho(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=le(e,xe(e,t)):i=fe(t),null==i?null:(r(o,i)&&e.cm&&Zr(e.cm,i,n),o)}function po(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function go(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}vi.prototype.from=function(){return we(this.anchor,this.head)},vi.prototype.to=function(){return be(this.anchor,this.head)},vi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Kt(i),ln(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},go.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof po))){var l=[];this.collapse(l),this.children=[new po(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new po(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++r,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new go(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var n=R(e.parent.children,e);e.parent.children.splice(n+1,0,t)}else{var r=new go(e.children);r.parent=e,e.children=[r,t],e=r}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var mo=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};function vo(e,t,n){Ge(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&kr(e,n)}mo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=fe(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=wn(this);ce(n,Math.max(0,n.height-o)),e&&(Kr(e,function(){vo(e,n,-o),Zr(e,r,"widget")}),ln(e,"lineWidgetCleared",e,this,r))}},mo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=wn(this)-t;i&&(ce(r,r.height+i),n&&Kr(n,function(){n.curOp.forceUpdate=!0,vo(n,r,i),ln(n,"lineWidgetChanged",n,e,fe(r))}))},at(mo);var yo=0,bo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++yo};function wo(e,t,n,r,i){if(r&&r.shared)return function(e,t,n,r,i){(r=F(r)).shared=!1;var o=[wo(e,t,n,r,i)],a=o[0],l=r.widgetNode;return _i(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(wo(e,Ce(e,t),Ce(e,n),r,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=q(o)}),new xo(o,a)}(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return $r(e.cm,wo)(e,t,n,r,i);var o=new bo(e,i),a=me(t,n);if(r&&F(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(He(e,t.line,t,n,o)||t.line!=n.line&&He(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le=!0}o.addToHistory&&Ii(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,s=t.line,u=e.cm;if(e.iter(s,n.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&Re(e)==u.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ce(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Te(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){Ve(e,t)&&ce(t,0)}),o.clearOnEnter&&Je(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(ke=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),u){if(l&&(u.curOp.updateMaxLine=!0),o.collapsed)Xr(u,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=n.line;c++)Zr(u,c,"text");o.atomic&&Xi(u.doc),ln(u,"markerAdded",u,o)}return o}bo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Rr(e),ot(this,"clear")){var n=this.find();n&&ln(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Me(a.markedSpans,this);e&&!this.collapsed?Zr(e,fe(a),"text"):e&&(null!=l.to&&(i=fe(a)),null!=l.from&&(r=fe(a))),a.markedSpans=_e(a.markedSpans,l),null==l.from&&this.collapsed&&!Ve(this.doc,a)&&e&&ce(a,er(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var u=Re(this.lines[s]),c=Ke(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Xr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xi(e.doc)),e&&ln(e,"markerCleared",e,this,r,i),t&&Br(e),this.parent&&this.parent.clear()}},bo.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Me(o.markedSpans,this);if(null!=a.from&&(n=ge(t?o:fe(o),a.from),-1==e))return n;if(null!=a.to&&(r=ge(t?o:fe(o),a.to),1==e))return r}return n&&{from:n,to:r}},bo.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;t&&r&&Kr(r,function(){var i=t.line,o=fe(t.line),a=Dn(r,o);if(a&&(Fn(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ve(n.doc,i)&&null!=n.height){var l=n.height;n.height=null;var s=wn(n)-l;s&&ce(i,i.height+s)}ln(r,"markerChanged",r,e)})},bo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=R(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},bo.prototype.detachLine=function(e){if(this.lines.splice(R(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},at(bo);var xo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function Co(e){return e.findMarks(ge(e.first,0),e.clipPos(ge(e.lastLine())),function(e){return e.parent})}function So(e){for(var t=function(t){var n=e[t],r=[n.primary.doc];_i(n.primary.doc,function(e){return r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==R(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}xo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ln(this,"clear")}},xo.prototype.find=function(e,t){return this.primary.find(e,t)},at(xo);var ko=0,Lo=function(e,t,n,r,i){if(!(this instanceof Lo))return new Lo(e,t,n,r,i);null==n&&(n=0),go.call(this,[new po([new Gt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=ge(n,0);this.sel=bi(o),this.history=new Ai(null),this.id=++ko,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Mi(this,{from:o,to:o,text:e}),$i(this,bi(o),V)};Lo.prototype=Q(go.prototype,{constructor:Lo,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ue(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:qr(function(e){var t=ge(this.first,0),n=this.first+this.size-1;ro(this,{from:t,to:ge(n,le(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Tr(this.cm,0,0),$i(this,bi(t),V)}),replaceRange:function(e,t,n,r){so(this,e,t=Ce(this,t),n=n?Ce(this,n):t,r)},getRange:function(e,t,n){var r=se(this,Ce(this,e),Ce(this,t));return!1===n?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(he(this,e))return le(this,e)},getLineNumber:function(e){return fe(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=le(this,e)),Re(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Ce(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:qr(function(e,t,n){Gi(this,Ce(this,"number"==typeof e?ge(e,t||0):e),null,n)}),setSelection:qr(function(e,t,n){Gi(this,Ce(this,e),Ce(this,t||e),n)}),extendSelection:qr(function(e,t,n){Ui(this,Ce(this,e),t&&Ce(this,t),n)}),extendSelections:qr(function(e,t){Vi(this,Se(this,e),t)}),extendSelectionsBy:qr(function(e,t){Vi(this,Se(this,X(this.sel.ranges,e)),t)}),setSelections:qr(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new vi(Ce(this,e[i].anchor),Ce(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),$i(this,yi(r,t),n)}}),addSelection:qr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new vi(Ce(this,e),Ce(this,t||e))),$i(this,yi(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=se(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=se(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:qr(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var l=t&&"end"!=t&&function(e,t,n){for(var r=[],i=ge(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Si(l.from,i,o),u=Si(wi(l),i,o);if(i=l.to,o=u,"around"==n){var c=e.sel.ranges[a],f=me(c.head,c.anchor)<0;r[a]=new vi(f?u:s,f?s:u)}else r[a]=new vi(s,s)}return new mi(r,e.sel.primIndex)}(this,r,t),s=r.length-1;s>=0;s--)ro(this,r[s]);l?Ki(this,l):this.cm&&Lr(this.cm)}),undo:qr(function(){oo(this,"undo")}),redo:qr(function(){oo(this,"redo")}),undoSelection:qr(function(){oo(this,"undo",!0)}),redoSelection:qr(function(){oo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new Ai(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:Ri(this.history.done),undone:Ri(this.history.undone)}},setHistory:function(e){var t=this.history=new Ai(this.history.maxGeneration);t.done=Ri(e.done.slice(0),null,!0),t.undone=Ri(e.undone.slice(0),null,!0)},setGutterMarker:qr(function(e,t,n){return ho(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&ne(r)&&(e.gutterMarkers=null),!0})}),clearGutter:qr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&ho(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ne(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!he(this,e))return null;if(t=e,!(e=le(this,e)))return null}else if(null==(t=fe(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:qr(function(e,t,n){return ho(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(k(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:qr(function(e,t,n){return ho(this,e,"gutter"==t?"gutter":"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(k(n));if(!o)return!1;var a=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:qr(function(e,t,n){return function(e,t,n,r){var i=new mo(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),ho(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Ve(e,t)){var r=Ge(t)<e.scrollTop;ce(t,t.height+wn(i)),r&&kr(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&ln(o,"lineWidgetAdded",o,i,"number"==typeof t?t:fe(t)),i}(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return wo(this,Ce(this,e),Ce(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return wo(this,e=Ce(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=le(this,(e=Ce(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(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,n){e=Ce(this,e),t=Ce(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];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||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n}),Ce(this,ge(n,t))},indexFromPos:function(e){var t=(e=Ce(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Lo(ue(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,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Lo(ue(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(me(o,a)){var l=wo(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}(r,Co(this)),r},unlinkDoc:function(e){if(e instanceof Ca&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),So(Co(this));break}}if(e.history==this.history){var n=[e.id];_i(e,function(e){return n.push(e.id)},!0),e.history=new Ai(null),e.history.done=Ri(this.history.done,n),e.history.undone=Ri(this.history.undone,n)}},iterLinkedDocs:function(e){_i(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):bt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:qr(function(e){var t;("rtl"!=e&&(e="ltr"),e!=this.direction)&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Kr(t=this.cm,function(){Di(t),Xr(t)}))})}),Lo.prototype.eachLine=Lo.prototype.iter;var To=0;function Mo(e){var t=this;if(_o(t),!rt(t,e)&&!xn(t.display,e)){lt(e),a&&(To=+new Date);var n=ar(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),l=0,s=function(e,r){if(!t.options.allowDropFileTypes||-1!=R(t.options.allowDropFileTypes,e.type)){var a=new FileReader;a.onload=$r(t,function(){var e=a.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++l==i){var s={from:n=Ce(t.doc,n),to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};ro(t.doc,s),Ki(t.doc,bi(n,wi(s)))}}),a.readAsText(e)}},u=0;u<i;++u)s(r[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Yi(t.doc,bi(n,n)),f)for(var d=0;d<f.length;++d)so(t.doc,"",f[d].anchor,f[d].head,"drag");t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch(e){}}}}function _o(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Oo(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName("CodeMirror"),n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}var Do=!1;function Ao(){var e;Do||(Je(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Oo(No)},100))}),Je(window,"blur",function(){return Oo(vr)}),Do=!0)}function No(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}for(var Po={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"},Io=0;Io<10;Io++)Po[Io+48]=Po[Io+96]=String(Io);for(var Eo=65;Eo<=90;Eo++)Po[Eo]=String.fromCharCode(Eo);for(var Wo=1;Wo<=12;Wo++)Po[Wo+111]=Po[Wo+63235]="F"+Wo;var Fo={};function zo(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Ho(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=X(n.split(" "),zo),o=0;o<i.length;o++){var a=void 0,l=void 0;o==i.length-1?(l=i.join(" "),a=r):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var u in t)e[u]=t[u];return e}function Ro(e,t,n,r){var i=(t=jo(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Ro(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=Ro(e,t.fallthrough[o],n,r);if(a)return a}}}function Bo(e){var t="string"==typeof e?e:Po[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Uo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Vo(e,t){if(f&&34==e.keyCode&&e.char)return!1;var n=Po[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Uo(n,e,t))}function jo(e){return"string"==typeof e?Fo[e]:e}function Go(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&me(o.from,q(r).to)<=0;){var a=r.pop();if(me(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Kr(e,function(){for(var t=r.length-1;t>=0;t--)so(e.doc,"",r[t].from,r[t].to,"+delete");Lr(e)})}function Ko(e,t,n){var r=oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function $o(e,t,n){var r=Ko(e,t.ch,n);return null==r?null:new ge(t.line,r,n<0?"after":"before")}function Yo(e,t,n,r,i){if(e){var o=Ze(n,t.doc.direction);if(o){var a,l=i<0?q(o):o[0],s=i<0==(1==l.level)?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var u=An(t,n);a=i<0?n.text.length-1:0;var c=Nn(t,u,a).top;a=ae(function(e){return Nn(t,u,e).top==c},i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Ko(n,a,1))}else a=i<0?l.to:l.from;return new ge(r,a,s)}}return new ge(r,i<0?n.text.length:0,i<0?"before":"after")}Fo.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"},Fo.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"},Fo.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"},Fo.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"]},Fo.default=y?Fo.macDefault:Fo.pcDefault;var qo={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Go(e,function(t){if(t.empty()){var n=le(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:ge(t.head.line+1,0)}:{from:t.head,to:ge(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Go(e,function(t){return{from:ge(t.from().line,0),to:Ce(e.doc,ge(t.to().line+1,0))}})},delLineLeft:function(e){return Go(e,function(e){return{from:ge(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return Go(e,function(t){var n=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:n},"div"),to:t.from()}})},delWrappedLineRight:function(e){return Go(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},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(ge(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ge(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Zo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return function(e,t){var n=le(e.doc,t),r=function(e){for(var t;t=ze(e);)e=t.find(1,!0).line;return e}(n);r!=n&&(t=fe(r));return Yo(!0,e,n,t,-1)}(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},G)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},G)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Zo(e,t.head):r},G)},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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=z(e.getLine(o.line),o.ch,r);t.push(Y(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Kr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=le(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ge(i.line,i.ch-1)),i.ch>0)i=new ge(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=le(e.doc,i.line-1).text;a&&(i=new ge(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),ge(i.line-1,a.length-1),i,"+transpose"))}n.push(new vi(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Kr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Lr(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xo(e,t){var n=le(e.doc,t),r=Re(n);return r!=n&&(t=fe(r)),Yo(!0,e,r,t,1)}function Zo(e,t){var n=Xo(e,t.line),r=le(e.doc,n.line),i=Ze(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return ge(n.line,a?0:o,n.sticky)}return n}function Qo(e,t,n){if("string"==typeof t&&!(t=qo[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=U}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var Jo=new H;function ea(e,t,n,r){var i=e.state.keySeq;if(i){if(Bo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ta(e,i+" "+t,n,r))return!0}return ta(e,t,n,r)}function ta(e,t,n,r){var i=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Ro(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Ro(t,e.options.extraKeys,n,e)||Ro(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&ln(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(lt(n),hr(e)),!!i}function na(e,t){var n=Vo(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?ea(e,"Shift-"+n,t,function(t){return Qo(e,t,!0)})||ea(e,n,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return Qo(e,t)}):ea(e,n,t,function(t){return Qo(e,t)}))}var ra=null;function ia(e){var t=this;if(t.curOp.focus=N(),!rt(t,e)){a&&l<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=na(t,e);f&&(ra=r?n:null,!r&&88==n&&!xt&&(y?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),tt(document,"keyup",n),tt(document,"mouseover",n))}P(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n)}(t)}}function oa(e){16==e.keyCode&&(this.doc.sel.shift=!1),rt(this,e)}function aa(e){var t=this;if(!(xn(t.display,e)||rt(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(f&&n==ra)return ra=null,void lt(e);if(!f||e.which&&!(e.which<10)||!na(t,e)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(function(e,t,n){return ea(e,"'"+n+"'",t,function(t){return Qo(e,t,!0)})}(t,e,i)||t.display.input.onKeyPress(e))}}}var la,sa,ua=function(e,t,n){this.time=e,this.pos=t,this.button=n};function ca(e){var t=this,n=t.display;if(!(rt(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,xn(n,e))s||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));else if(!ha(t,e)){var r=ar(t,e),i=dt(e),o=r?function(e,t){var n=+new Date;return sa&&sa.compare(n,e,t)?(la=sa=null,"triple"):la&&la.compare(n,e,t)?(sa=new ua(n,e,t),la=null,"double"):(la=new ua(n,e,t),sa=null,"single")}(r,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&function(e,t,n,r,i){var o="Click";"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o);return ea(e,Uo(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,function(t){if("string"==typeof t&&(t=qo[t]),!t)return!1;var r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=U}finally{e.state.suppressEdits=!1}return r})}(t,i,r,o,e)||(1==i?r?function(e,t,n,r){a?setTimeout(W(pr,e),0):e.curOp.focus=N();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=b?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey);null==i.addNew&&(i.addNew=y?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(y?n.altKey:n.ctrlKey));return i}(e,n,r),u=e.doc.sel;e.options.dragDrop&&gt&&!e.isReadOnly()&&"single"==n&&(i=u.contains(t))>-1&&(me((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(me(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,u=$r(e,function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,tt(i.wrapper.ownerDocument,"mouseup",u),tt(i.wrapper.ownerDocument,"mousemove",c),tt(i.scroller,"dragstart",f),tt(i.scroller,"drop",u),o||(lt(t),r.addNew||Ui(e.doc,n,null,null,r.extend),s||a&&9==l?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};s&&(i.scroller.draggable=!0);e.state.draggingText=u,u.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop();Je(i.wrapper.ownerDocument,"mouseup",u),Je(i.wrapper.ownerDocument,"mousemove",c),Je(i.scroller,"dragstart",f),Je(i.scroller,"drop",u),gr(e),setTimeout(function(){return i.input.focus()},20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;lt(t);var a,l,s=o.sel,u=s.ranges;r.addNew&&!r.extend?(l=o.sel.contains(n),a=l>-1?u[l]:new vi(n,n)):(a=o.sel.primary(),l=o.sel.primIndex);if("rectangle"==r.unit)r.addNew||(a=new vi(n,n)),n=ar(e,t,!0,!0),l=-1;else{var c=fa(e,n,r.unit);a=r.extend?Bi(a,c.anchor,c.head,r.extend):c}r.addNew?-1==l?(l=u.length,$i(o,yi(u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==r.unit&&!r.extend?($i(o,yi(u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):ji(o,l,a,j):(l=0,$i(o,new mi([a],0),j),s=o.sel);var f=n;function d(t){if(0!=me(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],u=e.options.tabSize,c=z(le(o,n.line).text,n.ch,u),d=z(le(o,t.line).text,t.ch,u),h=Math.min(c,d),p=Math.max(c,d),g=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=m;g++){var v=le(o,g).text,y=K(v,h,u);h==p?i.push(new vi(ge(g,y),ge(g,y))):v.length>y&&i.push(new vi(ge(g,y),ge(g,K(v,p,u))))}i.length||i.push(new vi(n,n)),$i(o,yi(s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=fa(e,t,r.unit),C=w.anchor;me(x.anchor,C)>0?(b=x.head,C=we(w.from(),x.anchor)):(b=x.anchor,C=be(w.to(),x.head));var S=s.ranges.slice(0);S[l]=function(e,t){var n=t.anchor,r=t.head,i=le(e.doc,n.line);if(0==me(n,r)&&n.sticky==r.sticky)return t;var o=Ze(i);if(!o)return t;var a=qe(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s,u=a+(l.from==n.ch==(1!=l.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=qe(o,r.ch,r.sticky),f=c-a||(r.ch-n.ch)*(1==l.level?-1:1);s=c==u-1||c==u?f<0:f>0}var d=o[u+(s?-1:0)],h=s==(1==d.level),p=h?d.from:d.to,g=h?"after":"before";return n.ch==p&&n.sticky==g?t:new vi(new ge(n.line,p,g),r)}(e,new vi(Ce(o,C),b)),$i(o,yi(S,l),j)}}var h=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,lt(t),i.input.focus(),tt(i.wrapper.ownerDocument,"mousemove",m),tt(i.wrapper.ownerDocument,"mouseup",v),o.history.lastSelOrigin=null}var m=$r(e,function(t){dt(t)?function t(n){var a=++p;var l=ar(e,n,!0,"rectangle"==r.unit);if(!l)return;if(0!=me(l,f)){e.curOp.focus=N(),d(l);var s=wr(i,o);(l.line>=s.to||l.line<s.from)&&setTimeout($r(e,function(){p==a&&t(n)}),150)}else{var u=n.clientY<h.top?-20:n.clientY>h.bottom?20:0;u&&setTimeout($r(e,function(){p==a&&(i.scroller.scrollTop+=u,t(n))}),50)}}(t):g(t)}),v=$r(e,g);e.state.selectingText=v,Je(i.wrapper.ownerDocument,"mousemove",m),Je(i.wrapper.ownerDocument,"mouseup",v)}(e,r,t,o)}(t,r,o,e):ft(e)==n.scroller&&lt(e):2==i?(r&&Ui(t.doc,r),setTimeout(function(){return n.input.focus()},20)):3==i&&(S?pa(t,e):gr(t)))}}function fa(e,t,n){if("char"==n)return new vi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new vi(ge(t.line,0),Ce(e.doc,ge(t.line+1,0)));var r=n(e,t);return new vi(r.from,r.to)}function da(e,t,n,r){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;r&&lt(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!ot(e,n))return ut(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var u=a.gutters.childNodes[s];if(u&&u.getBoundingClientRect().right>=i)return nt(e,n,e,de(e.doc,o),e.options.gutters[s],t),ut(t)}}function ha(e,t){return da(e,t,"gutterClick",!0)}function pa(e,t){xn(e.display,t)||function(e,t){if(!ot(e,"gutterContextMenu"))return!1;return da(e,t,"gutterContextMenu",!1)}(e,t)||rt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function ga(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hn(e)}ua.prototype.compare=function(e,t,n){return this.time+400>e&&0==me(t,this.pos)&&n==this.button};var ma={toString:function(){return"CodeMirror.Init"}},va={},ya={};function ba(e){ui(e),Xr(e),xr(e)}function wa(e,t,n){if(!t!=!(n&&n!=ma)){var r=e.display.dragFunctions,i=t?Je:tt;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function xa(e){e.options.lineWrapping?(P(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),$e(e)),or(e),Xr(e),Hn(e),setTimeout(function(){return Er(e)},100)}function Ca(e,t){var r=this;if(!(this instanceof Ca))return new Ca(e,t);this.options=t=t?F(t):{},F(va,t,!1),ci(t);var i=t.value;"string"==typeof i&&(i=new Lo(i,t.mode,null,t.lineSeparator,t.direction)),this.doc=i;var o=new Ca.inputStyles[t.inputStyle](this),u=this.display=new function(e,t,r){var i=this;this.input=r,i.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=D("div",null,"CodeMirror-code"),i.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=O("div",null,"CodeMirror-cursors"),i.measure=O("div",null,"CodeMirror-measure"),i.lineMeasure=O("div",null,"CodeMirror-measure"),i.lineSpace=D("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=D("div",[i.lineSpace],"CodeMirror-lines");i.mover=O("div",[o],null,"position: relative"),i.sizer=O("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=O("div",null,null,"position: absolute; height: "+B+"px; width: 1px;"),i.gutters=O("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=O("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=O("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),a&&l<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),s||n&&v||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,r.init(i)}(e,i,o);for(var c in u.wrapper.CodeMirror=this,ui(this),ga(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),zr(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 H,keySeq:null,specialChars:null},t.autofocus&&!v&&u.input.focus(),a&&l<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(e){var t=e.display;Je(t.scroller,"mousedown",$r(e,ca)),Je(t.scroller,"dblclick",a&&l<11?$r(e,function(t){if(!rt(e,t)){var n=ar(e,t);if(n&&!ha(e,t)&&!xn(e.display,t)){lt(t);var r=e.findWordAt(n);Ui(e.doc,r.anchor,r.head)}}}):function(t){return rt(e,t)||lt(t)});S||Je(t.scroller,"contextmenu",function(t){return pa(e,t)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}Je(t.scroller,"touchstart",function(i){if(!rt(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ha(e,i)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),Je(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Je(t.scroller,"touchend",function(n){var r=t.activeTouch;if(r&&!xn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,l=e.coordsChar(t.activeTouch,"page");a=!r.prev||o(r,r.prev)?new vi(l,l):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(l):new vi(ge(l.line,0),Ce(e.doc,ge(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),lt(n)}i()}),Je(t.scroller,"touchcancel",i),Je(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Or(e,t.scroller.scrollTop),Ar(e,t.scroller.scrollLeft,!0),nt(e,"scroll",e))}),Je(t.scroller,"mousewheel",function(t){return gi(e,t)}),Je(t.scroller,"DOMMouseScroll",function(t){return gi(e,t)}),Je(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){rt(e,t)||ct(t)},over:function(t){rt(e,t)||(!function(e,t){var n=ar(e,t);if(n){var r=document.createDocumentFragment();cr(e,n,r),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),_(e.display.dragCursor,r)}}(e,t),ct(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-To<100))ct(t);else if(!rt(e,t)&&!xn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var n=O("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}(e,t)},drop:$r(e,Mo),leave:function(t){rt(e,t)||_o(e)}};var s=t.input.getField();Je(s,"keyup",function(t){return oa.call(e,t)}),Je(s,"keydown",$r(e,ia)),Je(s,"keypress",$r(e,aa)),Je(s,"focus",function(t){return mr(e,t)}),Je(s,"blur",function(t){return vr(e,t)})}(this),Ao(),Rr(this),this.curOp.forceUpdate=!0,Oi(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout(W(mr,this),20):vr(this),ya)ya.hasOwnProperty(c)&&ya[c](r,t[c],ma);Cr(this),t.finishInit&&t.finishInit(this);for(var h=0;h<Sa.length;++h)Sa[h](r);Br(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(u.lineDiv).textRendering&&(u.lineDiv.style.textRendering="auto")}Ca.defaults=va,Ca.optionHandlers=ya;var Sa=[];function ka(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=Ft(e,t).state:n="prev");var a=e.options.tabSize,l=le(o,t),s=z(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u,c=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&((u=o.mode.indent(i,l.text.slice(c.length),l.text))==U||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?z(le(o,t-1).text,null,a):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)d+=a,f+="\t";if(d<u&&(f+=Y(u-d)),f!=c)return so(o,f,ge(t,0),ge(t,c.length),"+input"),l.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var m=ge(t,c.length);ji(o,p,new vi(m,m));break}}}Ca.defineInitHook=function(e){return Sa.push(e)};var La=null;function Ta(e){La=e}function Ma(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var a,l=e.state.pasteIncoming||"paste"==i,s=bt(t),u=null;if(l&&r.ranges.length>1)if(La&&La.text.join("\n")==t){if(r.ranges.length%La.text.length==0){u=[];for(var c=0;c<La.text.length;c++)u.push(o.splitLines(La.text[c]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=X(s,function(e){return[e]}));for(var f=r.ranges.length-1;f>=0;f--){var d=r.ranges[f],h=d.from(),p=d.to();d.empty()&&(n&&n>0?h=ge(h.line,h.ch-n):e.state.overwrite&&!l?p=ge(p.line,Math.min(le(o,p.line).text.length,p.ch+q(s).length)):La&&La.lineWise&&La.text.join("\n")==t&&(h=p=ge(h.line,0))),a=e.curOp.updateInput;var g={from:h,to:p,text:u?u[f%u.length]:s,origin:i||(l?"paste":e.state.cutIncoming?"cut":"+input")};ro(e.doc,g),ln(e,"inputRead",e,g)}t&&!l&&Oa(e,t),Lr(e),e.curOp.updateInput=a,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function _a(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kr(t,function(){return Ma(t,n,0,null,"paste")}),!0}function Oa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=ka(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(le(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=ka(e,i.head.line,"smart"));a&&ln(e,"electricInput",e,i.head.line)}}}function Da(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:ge(i,0),head:ge(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Aa(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Na(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Aa(e),t}function Pa(e,t,n,r,i){var o=t,a=n,l=le(e,t.line);function s(r){var o,a;if(null==(o=i?function(e,t,n,r){var i=Ze(t,e.doc.direction);if(!i)return $o(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=qe(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return $o(t,n,r);var l,s=function(e,n){return Ko(t,e instanceof ge?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(l=l||An(e,t),Zn(e,t,l,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?s(n,-1):n.ch);if("rtl"==e.doc.direction||1==a.level){var f=1==a.level==r<0,d=s(n,f?1:-1);if(null!=d&&(f?d<=a.to&&d<=c.end:d>=a.from&&d>=c.begin)){var h=f?"before":"after";return new ge(n.line,d,h)}}var p=function(e,t,r){for(var o=function(e,t){return t?new ge(n.line,s(e,1),"before"):new ge(n.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),u=l?r.begin:s(r.end,-1);if(a.from<=u&&u<a.to)return o(u,l);if(u=l?a.from:s(a.to,-1),r.begin<=u&&u<r.end)return o(u,l)}},g=p(o+r,r,c);if(g)return g;var m=r>0?c.end:s(c.begin,-1);return null==m||r>0&&m==t.text.length||!(g=p(r>0?0:i.length-1,r,u(m)))?null:g}(e.cm,l,t,n):$o(l,t,n))){if(r||(a=t.line+n)<e.first||a>=e.first+e.size||(t=new ge(a,t.ch,t.sticky),!(l=le(e,a))))return!1;t=Yo(i,e.cm,l,t.line,n)}else t=o;return!0}if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var u=null,c="group"==r,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||s(!d);d=!1){var h=l.text.charAt(t.ch)||"\n",p=te(h,f)?"w":c&&"\n"==h?"n":!c||/\s/.test(h)?null:"p";if(!c||d||p||(p="s"),u&&u!=p){n<0&&(n=1,s(),t.sticky="after");break}if(p&&(u=p),n>0&&!s(!d))break}var g=Ji(e,t,o,a,!0);return ve(o,g)&&(g.hitSide=!0),g}function Ia(e,t,n,r){var i,o,a=e.doc,l=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*er(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=qn(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Ea=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new H,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Wa(e,t){var n=Dn(e,t.line);if(!n||n.hidden)return null;var r=le(e.doc,t.line),i=_n(n,r,t.line),o=Ze(r,e.doc.direction),a="left";o&&(a=qe(o,t.ch)%2?"right":"left");var l=En(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Fa(e,t){return t&&(e.bad=!0),e}function za(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Fa(e.clipPos(ge(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return Ha(o,t,n)}}function Ha(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!A(r,t))return Fa(ge(fe(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?q(e.rest):e.line;return Fa(ge(fe(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,n&&(n=a.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var s=e.measure,u=s.maps;function c(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?s.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==n){var c=fe(i<0?e.line:e.rest[i]),f=o[a]+r;return(r<0||l!=t)&&(f=o[a+(r?1:0)]),ge(c,f)}}}var f=c(a,l,n);if(f)return Fa(f,i);for(var d=l.nextSibling,h=a?a.nodeValue.length-n:0;d;d=d.nextSibling){if(f=c(d,d.firstChild,0))return Fa(ge(f.line,f.ch-h),i);h+=d.textContent.length}for(var p=l.previousSibling,g=n;p;p=p.previousSibling){if(f=c(p,p.firstChild,-1))return Fa(ge(f.line,f.ch+g),i);g+=p.textContent.length}}Ea.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;function o(e){if(!rt(r,e)){if(r.somethingSelected())Ta({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=Da(r);Ta({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,V),r.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var o=La.text.join("\n");if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var a=Na(),l=a.firstChild;r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),l.value=La.text.join("\n");var s=document.activeElement;E(l),setTimeout(function(){r.display.lineSpace.removeChild(a),s.focus(),s==i&&n.showPrimarySelection()},50)}}Aa(i,r.options.spellcheck),Je(i,"paste",function(e){rt(r,e)||_a(e,r)||l<=11&&setTimeout($r(r,function(){return t.updateFromDOM()}),20)}),Je(i,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),Je(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),Je(i,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Je(i,"touchstart",function(){return n.forceCompositionEnd()}),Je(i,"input",function(){t.composing||t.readFromDOMSoon()}),Je(i,"copy",o),Je(i,"cut",o)},Ea.prototype.prepareSelection=function(){var e=ur(this.cm,!1);return e.focus=this.cm.state.focused,e},Ea.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ea.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var a=za(t,e.anchorNode,e.anchorOffset),l=za(t,e.focusNode,e.focusOffset);if(!a||a.bad||!l||l.bad||0!=me(we(a,l),i)||0!=me(be(a,l),o)){var s=t.display.view,u=i.line>=t.display.viewFrom&&Wa(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Wa(t,o);if(!c){var f=s[s.length-1].measure,d=f.maps?f.maps[f.maps.length-1]:f.map;c={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(u&&c){var h,p=e.rangeCount&&e.getRangeAt(0);try{h=L(u.node,u.offset,c.offset,c.node)}catch(e){}h&&(!n&&t.state.focused?(e.collapse(u.node,u.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Ea.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)},Ea.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},Ea.prototype.rememberSelection=function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ea.prototype.selectionInEditor=function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return A(this.div,t)},Ea.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ea.prototype.blur=function(){this.div.blur()},Ea.prototype.getField=function(){return this.div},Ea.prototype.supportsTouch=function(){return!0},Ea.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Kr(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))})},Ea.prototype.selectionChanged=function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ea.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;if(m&&c&&this.cm.options.gutters.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=za(t,e.anchorNode,e.anchorOffset),r=za(t,e.focusNode,e.focusOffset);n&&r&&Kr(t,function(){$i(t.doc,bi(n,r),V),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},Ea.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=ge(a.line-1,le(r.doc,a.line-1).length)),l.ch==le(r.doc,l.line).text.length&&l.line<r.lastLine()&&(l=ge(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(e=lr(r,a.line))?(t=fe(i.view[0].line),n=i.view[0].node):(t=fe(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,u,c=lr(r,l.line);if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=fe(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var f=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator();function s(){a&&(o+=l,a=!1)}function u(e){e&&(s(),o+=e)}function c(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return void u(n||t.textContent.replace(/\u200b/g,""));var o,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(ge(r,0),ge(i+1,0),(g=+f,function(e){return e.id==g}));return void(d.length&&(o=d[0].find(0))&&u(se(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var h=/^(pre|div|p)$/i.test(t.nodeName);h&&s();for(var p=0;p<t.childNodes.length;p++)c(t.childNodes[p]);h&&(a=!0)}else 3==t.nodeType&&u(t.nodeValue);var g}for(;c(t),t!=n;)t=t.nextSibling;return o}(r,n,u,t,s)),d=se(r.doc,ge(t,0),ge(s,le(r.doc,s).text.length));f.length>1&&d.length>1;)if(q(f)==q(d))f.pop(),d.pop(),s--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),t++}for(var h=0,p=0,g=f[0],m=d[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h;for(var y=q(f),b=q(d),w=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==f.length&&1==d.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var x=ge(t,h),C=ge(s,d.length?q(d).length-p:0);return f.length>1||f[0]||me(x,C)?(so(r.doc,f,x,C,"+input"),!0):void 0},Ea.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ea.prototype.reset=function(){this.forceCompositionEnd()},Ea.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ea.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))},Ea.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kr(this.cm,function(){return Xr(e.cm)})},Ea.prototype.setUneditable=function(e){e.contentEditable="false"},Ea.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||$r(this.cm,Ma)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ea.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ea.prototype.onContextMenu=function(){},Ea.prototype.resetPosition=function(){},Ea.prototype.needsContentAttribute=!0;var Ra=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};Ra.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!rt(r,e)){if(r.somethingSelected())Ta({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Da(r);Ta({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,V):(n.prevInput="",i.value=t.text.join("\n"),E(i))}"cut"==e.type&&(r.state.cutIncoming=!0)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),Je(i,"input",function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Je(i,"paste",function(e){rt(r,e)||_a(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Je(i,"cut",o),Je(i,"copy",o),Je(e.scroller,"paste",function(t){xn(e,t)||rt(r,t)||(r.state.pasteIncoming=!0,n.focus())}),Je(e.lineSpace,"selectstart",function(t){xn(e,t)||lt(t)}),Je(i,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Je(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ra.prototype.createField=function(e){this.wrapper=Na(),this.textarea=this.wrapper.firstChild},Ra.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ur(e);if(e.options.moveInputWithCursor){var i=Kn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Ra.prototype.showSelection=function(e){var t=this.cm.display;_(t.cursorDiv,e.cursors),_(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ra.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&E(this.textarea),a&&l>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Ra.prototype.getField=function(){return this.textarea},Ra.prototype.supportsTouch=function(){return!1},Ra.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ra.prototype.blur=function(){this.textarea.blur()},Ra.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ra.prototype.receivedFocus=function(){this.slowPoll()},Ra.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ra.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))})},Ra.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||wt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&l>=9&&this.hasSelection===i||y&&/[\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||r||(r=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,u=Math.min(r.length,i.length);s<u&&r.charCodeAt(s)==i.charCodeAt(s);)++s;return Kr(t,function(){Ma(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.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},Ra.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ra.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Ra.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea,o=ar(n,e),u=r.scroller.scrollTop;if(o&&!f){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&$r(n,$i)(n.doc,bi(o),V);var c=i.style.cssText,d=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var h,p=t.wrapper.getBoundingClientRect();if(i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(h=window.scrollY),r.input.focus(),s&&window.scrollTo(null,h),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=!0,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&l>=9&&m(),S){ct(e);var g=function(){tt(window,"mouseup",g),setTimeout(v,20)};Je(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var e=n.somethingSelected(),o=""+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=d,i.style.cssText=c,a&&l<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart){(!a||a&&l<9)&&m();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?$r(n,to)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Ra.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ra.prototype.setUneditable=function(){},Ra.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=ma&&i(e,t,n)}:i)}e.defineOption=n,e.Init=ma,n("value","",function(e,t){return e.setValue(t)},!0),n("mode",null,function(e,t){e.doc.modeOption=t,ki(e)},!0),n("indentUnit",2,ki,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(e){Li(e),Hn(e),Xr(e)},!0),n("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=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,n.push(ge(r,o))}r++});for(var i=n.length-1;i>=0;i--)so(e.doc,t,n[i],ge(n[i].line,n[i].ch+t.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ma&&e.refresh()}),n("specialCharPlaceholder",Zt,function(e){return e.refresh()},!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(e){ga(e),ba(e)},!0),n("keyMap","default",function(e,t,n){var r=jo(t),i=n!=ma&&jo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,xa,!0),n("gutters",[],function(e){ci(e.options),ba(e)},!0),n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rr(e.display)+"px":"0",e.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(e){return Er(e)},!0),n("scrollbarStyle","native",function(e){zr(e),Er(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),n("lineNumbers",!1,function(e){ci(e.options),ba(e)},!0),n("firstLineNumber",1,ba,!0),n("lineNumberFormatter",function(e){return e},ba,!0),n("showCursorWhenSelecting",!1,sr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("readOnly",!1,function(e,t){"nocursor"==t&&(vr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),n("dragDrop",!0,wa),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,sr,!0),n("singleCursorHeightPerLine",!0,sr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Li,!0),n("addModeClass",!1,Li,!0),n("pollInterval",100),n("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),n("historyEventDelay",1250),n("viewportMargin",10,function(e){return e.refresh()},!0),n("maxHighlightLength",1e4,Li,!0),n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),n("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),n("autofocus",null),n("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(Ca),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&$r(this,t[e])(this,n,i),nt(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"](jo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Yr(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");!function(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},function(e){return e.priority}),this.state.modeGen++,Xr(this)}),removeOverlay:Yr(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void Xr(this)}}),indentLine:Yr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),he(this.doc,e)&&ka(this,e,t,n)}),indentSelection:Yr(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(ka(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Lr(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<n;++s)ka(this,s,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[r].from().ch>0&&ji(this.doc,r,new vi(o,u[r].to()),V)}}}),getTokenAt:function(e,t){return Ut(this,e,t)},getLineTokens:function(e,t){return Ut(this,ge(e),t,!0)},getTokenTypeAt:function(e){e=Ce(this.doc,e);var t,n=Wt(this,le(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!n.hasOwnProperty(t))return r;var i=n[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&r.push(i[o[t]]);else if(o[t])for(var a=0;a<o[t].length;a++){var l=i[o[t][a]];l&&r.push(l)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var s=0;s<i._global.length;s++){var u=i._global[s];u.pred(o,this)&&-1==R(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(e,t){var n=this.doc;return Ft(this,(e=xe(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary();return Kn(this,null==e?n.head:"object"==typeof e?Ce(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return Gn(this,Ce(this.doc,e),t||"page")},coordsChar:function(e,t){return qn(this,(e=jn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=jn(this,{top:e,left:0},t||"page").top,de(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,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),r=le(this.doc,e)}else r=e;return Vn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Ge(r):0)},defaultTextHeight:function(){return er(this.display)},defaultCharWidth:function(){return tr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,l,s=this.display,u=(e=Kn(this,Ce(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r)u=e.top;else if("above"==r||"near"==r){var f=Math.max(s.wrapper.clientHeight,this.doc.height),d=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(u=e.bottom),c+t.offsetWidth>d&&(c=d-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(o=this,a={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(l=Sr(o,a)).scrollTop&&Or(o,l.scrollTop),null!=l.scrollLeft&&Ar(o,l.scrollLeft))},triggerOnKeyDown:Yr(ia),triggerOnKeyPress:Yr(aa),triggerOnKeyUp:oa,triggerOnMouseDown:Yr(ca),execCommand:function(e){if(qo.hasOwnProperty(e))return qo[e].call(null,this)},triggerElectric:Yr(function(e){Oa(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=Ce(this.doc,e),a=0;a<t&&!(o=Pa(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:Yr(function(e,t){var n=this;this.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Pa(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},G)}),deleteH:Yr(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Go(this,function(n){var i=Pa(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=Ce(this.doc,e),l=0;l<t;++l){var s=Kn(this,a,"div");if(null==o?o=s.left:s.left=o,(a=Ia(this,s,i,n)).hitSide)break}return a},moveV:Yr(function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(a){if(o)return e<0?a.from():a.to();var l=Kn(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Ia(n,l,e,t);return"page"==t&&a==r.sel.primary()&&kr(n,Gn(n,s,"div").top-l.top),s},G),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=le(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=t.length||!n?++r:--n;for(var o=t.charAt(n),a=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};n>0&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new vi(ge(e.line,n),ge(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?P(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),nt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Yr(function(e,t){Tr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ln(this)-this.display.barHeight,width:e.scrollWidth-Ln(this)-this.display.barWidth,clientHeight:Mn(this),clientWidth:Tn(this)}},scrollIntoView:Yr(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:ge(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?function(e,t){Mr(e),e.curOp.scrollToPos=t}(this,e):_r(this,e.from,e.to,e.margin)}),setSize:Yr(function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&zn(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){Zr(n,i,"widget");break}++i}),this.curOp.forceUpdate=!0,nt(this,"refresh",this)}),operation:function(e){return Kr(this,e)},startOperation:function(){return Rr(this)},endOperation:function(){return Br(this)},refresh:Yr(function(){var e=this.display.cachedTextHeight;Xr(this),this.curOp.forceUpdate=!0,Hn(this),Tr(this,this.doc.scrollLeft,this.doc.scrollTop),li(this),(null==e||Math.abs(e-er(this.display))>.5)&&or(this),nt(this,"refresh",this)}),swapDoc:Yr(function(e){var t=this.doc;return t.cm=null,Oi(this,e),Hn(this),this.display.input.reset(),Tr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ln(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},at(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(Ca);var Ba,Ua="iter insert remove copy getEditor constructor".split(" ");for(var Va in Lo.prototype)Lo.prototype.hasOwnProperty(Va)&&R(Ua,Va)<0&&(Ca.prototype[Va]=function(e){return function(){return e.apply(this.doc,arguments)}}(Lo.prototype[Va]));return at(Lo),Ca.inputStyles={textarea:Ra,contenteditable:Ea},Ca.defineMode=function(e){Ca.defaults.mode||"null"==e||(Ca.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),St[e]=t}.apply(this,arguments)},Ca.defineMIME=function(e,t){kt[e]=t},Ca.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ca.defineMIME("text/plain","null"),Ca.defineExtension=function(e,t){Ca.prototype[e]=t},Ca.defineDocExtension=function(e,t){Lo.prototype[e]=t},Ca.fromTextArea=function(e,t){if((t=t?F(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=N();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(Je(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&&(tt(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var l=Ca(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return l},(Ba=Ca).off=tt,Ba.on=Je,Ba.wheelEventPixels=pi,Ba.Doc=Lo,Ba.splitLines=bt,Ba.countColumn=z,Ba.findColumn=K,Ba.isWordChar=ee,Ba.Pass=U,Ba.signal=nt,Ba.Line=Gt,Ba.changeEnd=wi,Ba.scrollbarModel=Fr,Ba.Pos=ge,Ba.cmpPos=me,Ba.modes=St,Ba.mimeModes=kt,Ba.resolveMode=Lt,Ba.getMode=Tt,Ba.modeExtensions=Mt,Ba.extendMode=_t,Ba.copyState=Ot,Ba.startState=At,Ba.innerMode=Dt,Ba.commands=qo,Ba.keyMap=Fo,Ba.keyName=Vo,Ba.isModifierKey=Bo,Ba.lookupKey=Ro,Ba.normalizeKeyMap=Ho,Ba.StringStream=Nt,Ba.SharedTextMarker=xo,Ba.TextMarker=bo,Ba.LineWidget=mo,Ba.e_preventDefault=lt,Ba.e_stopPropagation=st,Ba.e_stop=ct,Ba.addClass=P,Ba.contains=A,Ba.rmClass=T,Ba.keyNames=Po,Ca.version="5.36.0",Ca},e.exports=r()},BXL0:function(e,t){},BwfY:function(e,t,n){n("fWfb"),n("M6a0"),n("OYls"),n("QWe/"),e.exports=n("FeBl").Symbol},JCyl:function(e,t){},Kh4W:function(e,t,n){t.f=n("dSzd")},Kk9m:function(e,t,n){(function(e){"use strict";e.defineOption("foldGutter",!1,function(t,n,r){r&&r!=e.Init&&(t.clearGutter(t.state.foldGutter.options.gutter),t.state.foldGutter=null,t.off("gutterClick",a),t.off("change",l),t.off("viewportChange",s),t.off("fold",u),t.off("unfold",u),t.off("swapDoc",l)),n&&(t.state.foldGutter=new function(e){this.options=e,this.from=this.to=0}(function(e){!0===e&&(e={});null==e.gutter&&(e.gutter="CodeMirror-foldgutter");null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open");null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded");return e}(n)),o(t),t.on("gutterClick",a),t.on("change",l),t.on("viewportChange",s),t.on("fold",u),t.on("unfold",u),t.on("swapDoc",l))});var t=e.Pos;function n(e,n){for(var r=e.findMarks(t(n,0),t(n+1,0)),i=0;i<r.length;++i)if(r[i].__isFold&&r[i].find().from.line==n)return r[i]}function r(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function i(e,i,o){var a=e.state.foldGutter.options,l=i,s=e.foldOption(a,"minFoldSize"),u=e.foldOption(a,"rangeFinder");e.eachLine(i,o,function(i){var o=null;if(n(e,l))o=r(a.indicatorFolded);else{var c=t(l,0),f=u&&u(e,c);f&&f.to.line-f.from.line>=s&&(o=r(a.indicatorOpen))}e.setGutterMarker(i,a.gutter,o),++l})}function o(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){i(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function a(e,r,i){var o=e.state.foldGutter;if(o){var a=o.options;if(i==a.gutter){var l=n(e,r);l?l.clear():e.foldCode(t(r,0),a.rangeFinder)}}}function l(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){o(e)},n.foldOnChangeTimeSpan||600)}}function s(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?o(e):e.operation(function(){n.from<t.from&&(i(e,n.from,t.from),t.from=n.from),n.to>t.to&&(i(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function u(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&r<n.to&&i(e,r,r+1)}}})(n("8U58"),n("THjC"))},LKZe:function(e,t,n){var r=n("NpIQ"),i=n("X8DO"),o=n("TcQ7"),a=n("MmMw"),l=n("D2L2"),s=n("SfB7"),u=Object.getOwnPropertyDescriptor;t.f=n("+E39")?u:function(e,t){if(e=o(e),t=a(t,!0),s)try{return u(e,t)}catch(e){}if(l(e,t))return i(!r.f.call(e,t),e[t])}},Lgoy:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("pFYg"),i=n.n(r),o=n("8U58");n("4/hK");var a={props:{value:{type:String,default:""},options:{type:Object,default:function(){return{mode:"text/javascript",lineNumbers:!0,lineWrapping:!0}}}},data:function(){return{skipNextChangeEvent:!1}},ready:function(){var e=this;this.editor=o.fromTextArea(this.$el.querySelector("textarea"),this.options),this.editor.setValue(this.value),this.editor.on("change",function(t){e.skipNextChangeEvent?e.skipNextChangeEvent=!1:(e.value=t.getValue(),e.$emit&&e.$emit("change",t.getValue()))})},mounted:function(){var e=this;this.editor=o.fromTextArea(this.$el.querySelector("textarea"),this.options),this.editor.setValue(this.value),this.editor.on("change",function(t){e.skipNextChangeEvent?e.skipNextChangeEvent=!1:e.$emit&&(e.$emit("change",t.getValue()),e.$emit("input",t.getValue()))})},watch:{value:function(e,t){if(e!==this.editor.getValue()){this.skipNextChangeEvent=!0;var n=this.editor.getScrollInfo();this.editor.setValue(e),this.editor.scrollTo(n.left,n.top)}},options:function(e,t){if("object"===(void 0===e?"undefined":i()(e)))for(var n in e)e.hasOwnProperty(n)&&this.editor.setOption(n,e[n])}},beforeDestroy:function(){this.editor&&this.editor.toTextArea()}},l={render:function(){this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"vue-codemirror-wrap"},[t("textarea")])}]};var s=n("VU/8")(a,l,!1,function(e){n("cNyp")},null,null);t.default=s.exports},OYls:function(e,t,n){n("crlp")("asyncIterator")},"QWe/":function(e,t,n){n("crlp")("observable")},RF21:function(e,t){},Rrel:function(e,t,n){var r=n("TcQ7"),i=n("n0T6").f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?function(e){try{return i(e)}catch(e){return a.slice()}}(e):i(r(e))}},THjC:function(e,t,n){(function(e){"use strict";function t(t,n,i,o){if(i&&i.call){var a=i;i=null}else a=r(t,i,"rangeFinder");"number"==typeof n&&(n=e.Pos(n,0));var l=r(t,i,"minFoldSize");function s(e){var r=a(t,n);if(!r||r.to.line-r.from.line<l)return null;for(var i=t.findMarksAt(r.from),s=0;s<i.length;++s)if(i[s].__isFold&&"fold"!==o){if(!e)return null;r.cleared=!0,i[s].clear()}return r}var u=s(!0);if(r(t,i,"scanUp"))for(;!u&&n.line>t.firstLine();)n=e.Pos(n.line-1,0),u=s(!1);if(u&&!u.cleared&&"unfold"!==o){var c=function(e,t){var n=r(e,t,"widget");if("string"==typeof n){var i=document.createTextNode(n);(n=document.createElement("span")).appendChild(i),n.className="CodeMirror-foldmarker"}else n&&(n=n.cloneNode(!0));return n}(t,i);e.on(c,"mousedown",function(t){f.clear(),e.e_preventDefault(t)});var f=t.markText(u.from,u.to,{replacedWith:c,clearOnEnter:r(t,i,"clearOnEnter"),__isFold:!0});f.on("clear",function(n,r){e.signal(t,"unfold",t,n,r)}),e.signal(t,"fold",t,u.from,u.to)}}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,r){t(this,e,n,r)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n<t.length;++n)if(t[n].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();n<=r;n++)t.foldCode(e.Pos(n,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();n<=r;n++)t.foldCode(e.Pos(n,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var r=0;r<e.length;++r){var i=e[r](t,n);if(i)return i}}}),e.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),r=0;r<n.length;r++){var i=n[r](e,t);if(i)return i}});var n={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function r(e,t,r){if(t&&void 0!==t[r])return t[r];var i=e.options.foldOptions;return i&&void 0!==i[r]?i[r]:n[r]}e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return r(this,e,t)})})(n("8U58"))},U3HU:function(e,t,n){(function(e){"use strict";function t(t,n){var r=t.getLine(n),i=r.search(/\S/);return-1==i||/\bcomment\b/.test(t.getTokenTypeAt(e.Pos(n,i+1)))?-1:e.countColumn(r,null,t.getOption("tabSize"))}e.registerHelper("fold","indent",function(n,r){var i=t(n,r.line);if(!(i<0)){for(var o=null,a=r.line+1,l=n.lastLine();a<=l;++a){var s=t(n,a);if(-1==s);else{if(!(s>i))break;o=a}}return o?{from:e.Pos(r.line,n.getLine(r.line).length),to:e.Pos(o,n.getLine(o).length)}:void 0}})})(n("8U58"))},UM8r:function(e,t){},WQH6:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("fZjL"),i=n.n(r),o=n("mvHQ"),a=n.n(o),l=n("Dd8w"),s=n.n(l),u=n("NYxO"),c=n("IcnI"),f=n("oAV5"),d=n("gZhU"),h=(n("UM8r"),n("Xdwu"),n("epNC"),n("6S2o"),n("tWbI"),n("aGTD"),n("Yokd"),n("Kk9m"),n("fo6W"),n("U3HU"),{name:"CodeMirror",components:{codemirror:d.codemirror},props:{value:{type:String,default:""},languages:{type:Array,default:function(){return["C","C++","Java","Python2"]}},language:{type:String,default:"C++"}},data:function(){return{options:{tabSize:4,mode:"text/x-csrc",theme:"solarized",lineNumbers:!0,line:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],styleSelectedText:!0,lineWrapping:!1,highlightSelectionMatches:{showToken:/\w/,annotateScrollbar:!0}},mode:{"C++":"text/x-csrc"},themes:[{label:"Monokai",value:"monokai"},{label:"Solarized Light",value:"solarized"},{label:"Material",value:"material"}]}},mounted:function(){var e=this;f.a.getLanguages().then(function(t){var n={};t.forEach(function(e){n[e.name]=e.content_type}),e.mode=n,e.editor.setOption("mode",e.mode[e.language])}),this.editor.focus()},methods:{onEditorCodeChange:function(e){this.$emit("update:value",e)},onLangChange:function(e){this.editor.setOption("mode",this.mode[e]),this.$emit("changeLang",e)},onThemeChange:function(e){this.editor.setOption("theme",e)}},computed:{editor:function(){return this.$refs.myEditor.editor}}}),p={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticStyle:{margin:"0px 0px 15px 0px"}},[n("Row",{staticClass:"header",attrs:{type:"flex",justify:"space-between"}},[n("Col",{attrs:{span:10}},[n("div",[n("span",[e._v("Language:")]),e._v(" "),n("Select",{staticClass:"adjust",attrs:{value:e.language},on:{"on-change":e.onLangChange}},e._l(e.languages,function(t){return n("Option",{key:t,attrs:{value:t}},[e._v(e._s(t)+"\n ")])}))],1)]),e._v(" "),n("Col",{attrs:{span:10}},[n("div",{staticClass:"fl-right"},[n("span",[e._v("Theme:")]),e._v(" "),n("Select",{staticClass:"adjust",on:{"on-change":e.onThemeChange},model:{value:e.options.theme,callback:function(t){e.$set(e.options,"theme",t)},expression:"options.theme"}},e._l(e.themes,function(t){return n("Option",{key:t.label,attrs:{value:t.value}},[e._v(e._s(t.label)+"\n ")])}))],1)])],1),e._v(" "),n("codemirror",{ref:"myEditor",attrs:{value:e.value,options:e.options},on:{change:e.onEditorCodeChange}})],1)},staticRenderFns:[]};var g=n("VU/8")(h,p,!1,function(e){n("BXL0"),n("JCyl")},"data-v-99628214",null).exports,m=n("VKKs"),v=n("y2MC"),y=n("FN8c"),b=n("8Q2T"),w={AC:{color:"#19be6b"},WA:{color:"#ed3f14"},TLE:{color:"#ff9300"},MLE:{color:"#f7de00"},RE:{color:"#ff6104"},CE:{color:"#80848f"},PAC:{color:"#2d8cf0"}};function x(e){return w[e.name].color}var C={legend:{left:"center",top:"10",orient:"horizontal",data:["AC","WA"]},series:[{name:"Summary",type:"pie",radius:"80%",center:["50%","55%"],itemStyle:{normal:{color:x}},data:[{value:0,name:"WA"},{value:0,name:"AC"}],label:{normal:{position:"inner",show:!0,formatter:"{b}: {c}\n {d}%",textStyle:{fontWeight:"bold"}}}}]},S={legend:{left:"center",top:"10",orient:"horizontal",itemGap:20,data:["AC","RE","WA","TLE","PAC","MLE"]},series:[{name:"Detail",type:"pie",radius:["45%","70%"],center:["50%","55%"],itemStyle:{normal:{color:x}},data:[{value:0,name:"RE"},{value:0,name:"WA"},{value:0,name:"TLE"},{value:0,name:"AC"},{value:0,name:"MLE"},{value:0,name:"PAC"}],label:{normal:{formatter:"{b}: {c}\n {d}%"}},labelLine:{normal:{}}},{name:"Summary",type:"pie",radius:"30%",center:["50%","55%"],itemStyle:{normal:{color:x}},data:[{value:"0",name:"WA"},{value:0,name:"AC",selected:!0}],label:{normal:{position:"inner",formatter:"{b}: {c}\n {d}%"}}}]},k=["-1","-2","0","1","2","3","4","8"],L={name:"Problem",components:{CodeMirror:g},mixins:[v.a],data:function(){return{statusVisible:!1,captchaRequired:!1,graphVisible:!1,submissionExists:!1,captchaCode:"",captchaSrc:"",contestID:"",problemID:"",submitting:!1,code:"",language:"C++",submissionId:"",result:{result:9},problem:{title:"",description:"",hint:"",my_status:"",template:{},languages:[],created_by:{username:""},tags:[]},pie:C,largePie:S,largePieInitOpts:{width:"500",height:"480"}}},beforeRouteEnter:function(e,t,n){var r=m.a.get(Object(y.j)(e.params.problemID,e.params.contestID));r?n(function(e){e.language=r.language,e.code=r.code}):n()},mounted:function(){this.$store.commit(c.b.CHANGE_CONTEST_ITEM_VISIBLE,{menu:!1}),this.init()},methods:s()({},Object(u.mapActions)(["changeDomTitle"]),{init:function(){var e=this;this.$Loading.start(),this.contestID=this.$route.params.contestID,this.problemID=this.$route.params.problemID;var t="problem-details"===this.$route.name?"getProblem":"getContestProblem";b.a[t](this.problemID,this.contestID).then(function(t){e.$Loading.finish(),e.$nextTick(function(){window.MathJax&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,"problem-content"])});var n=t.data.data;if(e.changeDomTitle({title:n.title}),b.a.submissionExists(n.id).then(function(t){e.submissionExists=t.data.data}),n.languages=n.languages.sort(),e.problem=n,e.changePie(n),"C++"===e.language&&""===e.code&&-1===e.problem.languages.indexOf(e.language)){e.language=e.problem.languages[0];var r=e.problem.template;r&&r[e.language]&&(e.code=r[e.language])}},function(){e.$Loading.error()})},changePie:function(e){for(var t in e.statistic_info)-1===k.indexOf(t)&&delete e.statistic_info[t];var n=e.accepted_number,r=[{name:"WA",value:e.submission_number-n},{name:"AC",value:n}];this.pie.series[0].data=r;var o=JSON.parse(a()(r));o[1].selected=!0,this.largePie.series[1].data=o;var l=i()(e.statistic_info).map(function(e){return y.e[e].short});0===l.length&&l.push("AC","WA"),this.largePie.legend.data=l;var s=e.statistic_info[0];delete e.statistic_info[0];var u=[];i()(e.statistic_info).forEach(function(t){u.push({name:y.e[t].short,value:e.statistic_info[t]})}),u.push({name:"AC",value:s}),this.largePie.series[0].data=u},handleRoute:function(e){this.$router.push(e)},onChangeLang:function(e){var t=this;this.problem.template[e]&&(""===this.code.trim()?this.code=this.problem.template[e]:this.$Modal.confirm({content:"The problem has template for "+e+", Do you want to replace your code with template?",onOk:function(){t.code=t.problem.template[e]}})),this.language=e},checkSubmissionStatus:function(){var e=this;this.refreshStatus&&clearTimeout(this.refreshStatus);this.refreshStatus=setTimeout(function t(){var n=e.submissionId;b.a.getSubmission(n).then(function(n){e.result=n.data.data,0!==i()(n.data.data.statistic_info).length?(e.submitting=!1,clearTimeout(e.refreshStatus),e.init()):e.refreshStatus=setTimeout(t,2e3)},function(t){e.submitting=!1,clearTimeout(e.refreshStatus)})},2e3)},submitCode:function(){var e=this;if(""!==this.code.trim()){this.submissionId="",this.result={result:9},this.submitting=!0;var t={problem_id:this.problem.id,language:this.language,code:this.code,contest_id:this.contestID};this.captchaRequired&&(t.captcha=this.captchaCode);var n=function(t,n){e.statusVisible=!0,b.a.submitCode(t).then(function(t){e.submissionId=t.data.data&&t.data.data.submission_id,e.submitting=!1,e.submissionExists=!0,n?e.checkSubmissionStatus():e.$Modal.success({title:"Success",content:"Submit code successfully"})},function(t){e.getCaptchaSrc(),t.data.data.startsWith("Captcha is required")&&(e.captchaRequired=!0),e.submitting=!1,e.statusVisible=!1})};"OI"!==this.contestRuleType||this.OIContestRealTimePermission?n(t,!0):this.submissionExists?this.$Modal.confirm({title:"",content:"<h3>You have submission in this problem, sure to cover it?<h3>",onOk:function(){setTimeout(function(){n(t,!1)},1e3)},onCancel:function(){e.submitting=!1}}):n(t,!1)}else this.$error("Code can not be empty")},onCopy:function(e){this.$success("Code copied")},onCopyError:function(e){this.$error("Failed to copy code")}}),computed:s()({},Object(u.mapGetters)(["problemSubmitDisabled","contestRuleType","OIContestRealTimePermission","contestStatus"]),{contest:function(){return this.$store.state.contest.contest},contestEnded:function(){return this.contestStatus===y.a.ENDED},submissionStatus:function(){return{text:y.e[this.result.result].name,color:y.e[this.result.result].color}},submissionRoute:function(){return this.contestID?{name:"contest-submission-list",query:{problemID:this.problemID}}:{name:"submission-list",query:{problemID:this.problemID}}}}),beforeRouteLeave:function(e,t,n){clearInterval(this.refreshStatus),this.$store.commit(c.b.CHANGE_CONTEST_ITEM_VISIBLE,{menu:!0}),m.a.set(Object(y.j)(this.problem._id,t.params.contestID),{code:this.code,language:this.language}),n()},watch:{$route:function(){this.init()}}},T={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"flex-container"},[n("div",{attrs:{id:"problem-main"}},[n("Panel",{attrs:{padding:40,shadow:""}},[n("div",{attrs:{slot:"title"},slot:"title"},[e._v(e._s(e.problem.title))]),e._v(" "),n("div",{staticClass:"markdown-body",attrs:{id:"problem-content"}},[n("p",{staticClass:"title"},[e._v("Description")]),e._v(" "),n("p",{staticClass:"content",domProps:{innerHTML:e._s(e.problem.description)}}),e._v(" "),n("p",{staticClass:"title"},[e._v("Input")]),e._v(" "),n("p",{staticClass:"content",domProps:{innerHTML:e._s(e.problem.input_description)}}),e._v(" "),n("p",{staticClass:"title"},[e._v("Output")]),e._v(" "),n("p",{staticClass:"content",domProps:{innerHTML:e._s(e.problem.output_description)}}),e._v(" "),e._l(e.problem.samples,function(t,r){return n("div",[n("div",{staticClass:"flex-container sample"},[n("div",{staticClass:"sample-input"},[n("p",{staticClass:"title"},[e._v("Sample Input "+e._s(r+1)+"\n "),n("a",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.input,expression:"sample.input",arg:"copy"},{name:"clipboard",rawName:"v-clipboard:success",value:e.onCopy,expression:"onCopy",arg:"success"},{name:"clipboard",rawName:"v-clipboard:error",value:e.onCopyError,expression:"onCopyError",arg:"error"}],staticClass:"copy"},[n("Icon",{attrs:{type:"clipboard"}})],1)]),e._v(" "),n("pre",[e._v(e._s(t.input))])]),e._v(" "),n("div",{staticClass:"sample-output"},[n("p",{staticClass:"title"},[e._v("Sample Output "+e._s(r+1))]),e._v(" "),n("pre",[e._v(e._s(t.output))])])])])}),e._v(" "),e.problem.hint?n("div",[n("p",{staticClass:"title"},[e._v("Hint")]),e._v(" "),n("Card",{attrs:{"dis-hover":""}},[n("div",{staticClass:"content",domProps:{innerHTML:e._s(e.problem.hint)}})])],1):e._e(),e._v(" "),e.problem.source?n("div",[n("p",{staticClass:"title"},[e._v("Source")]),e._v(" "),n("p",{staticClass:"content"},[e._v(e._s(e.problem.source))])]):e._e()],2)]),e._v(" "),n("Card",{attrs:{padding:20,id:"submit-code","dis-hover":""}},[n("CodeMirror",{attrs:{value:e.code,languages:e.problem.languages,language:e.language},on:{"update:value":function(t){e.code=t},changeLang:e.onChangeLang}}),e._v(" "),n("Row",{attrs:{type:"flex",justify:"space-between"}},[n("Col",{attrs:{span:10}},[e.statusVisible?n("div",{staticClass:"status"},[!this.contestID||this.contestID&&e.OIContestRealTimePermission?[n("span",[e._v("Status:")]),e._v(" "),n("Tag",{attrs:{type:"dot",color:e.submissionStatus.color},nativeOn:{click:function(t){e.handleRoute("/status/"+e.submissionId)}}},[e._v("\n "+e._s(e.submissionStatus.text)+"\n ")])]:this.contestID&&!e.OIContestRealTimePermission?[n("Alert",{attrs:{type:"success","show-icon":""}},[e._v("Submitted successfully")])]:e._e()],2):0===e.problem.my_status?n("div",[n("Alert",{attrs:{type:"success","show-icon":""}},[e._v("You have solved the problem")])],1):this.contestID&&!e.OIContestRealTimePermission&&e.submissionExists?n("div",[n("Alert",{attrs:{type:"success","show-icon":""}},[e._v("You have submitted a solution.")])],1):e._e(),e._v(" "),e.contestEnded?n("div",[n("Alert",{attrs:{type:"warning","show-icon":""}},[e._v("Contest has ended")])],1):e._e()]),e._v(" "),n("Col",{attrs:{span:12}},[e.captchaRequired?[n("div",{staticClass:"captcha-container"},[e.captchaRequired?n("Tooltip",{attrs:{content:"Click to refresh",placement:"top"}},[n("img",{attrs:{src:e.captchaSrc},on:{click:e.getCaptchaSrc}})]):e._e(),e._v(" "),n("Input",{staticClass:"captcha-code",model:{value:e.captchaCode,callback:function(t){e.captchaCode=t},expression:"captchaCode"}})],1)]:e._e(),e._v(" "),n("Button",{staticClass:"fl-right",attrs:{type:"warning",icon:"edit",loading:e.submitting,disabled:e.problemSubmitDisabled},on:{click:e.submitCode}},[e.submitting?n("span",[e._v("Submitting")]):n("span",[e._v("Submit")])])],2)],1)],1)],1),e._v(" "),n("div",{attrs:{id:"right-column"}},[n("VerticalMenu",{on:{"on-click":e.handleRoute}},[this.contestID?[n("VerticalMenu-item",{attrs:{route:{name:"contest-problem-list",params:{contestID:e.contestID}}}},[n("Icon",{attrs:{type:"ios-photos"}}),e._v("\n Problems\n ")],1),e._v(" "),n("VerticalMenu-item",{attrs:{route:{name:"contest-announcement-list",params:{contestID:e.contestID}}}},[n("Icon",{attrs:{type:"chatbubble-working"}}),e._v("\n Announcements\n ")],1)]:e._e(),e._v(" "),!this.contestID||e.OIContestRealTimePermission?n("VerticalMenu-item",{attrs:{route:e.submissionRoute}},[n("Icon",{attrs:{type:"navicon-round"}}),e._v("\n Submissions\n ")],1):e._e(),e._v(" "),this.contestID?[!this.contestID||e.OIContestRealTimePermission?n("VerticalMenu-item",{attrs:{route:{name:"contest-rank",params:{contestID:e.contestID}}}},[n("Icon",{attrs:{type:"stats-bars"}}),e._v("\n Rankings\n ")],1):e._e(),e._v(" "),n("VerticalMenu-item",{attrs:{route:{name:"contest-details",params:{contestID:e.contestID}}}},[n("Icon",{attrs:{type:"home"}}),e._v("\n View Contest\n ")],1)]:e._e()],2),e._v(" "),n("Card",{attrs:{id:"info"}},[n("div",{staticClass:"header",attrs:{slot:"title"},slot:"title"},[n("Icon",{attrs:{type:"information-circled"}}),e._v(" "),n("span",{staticClass:"card-title"},[e._v("Information")])],1),e._v(" "),n("ul",[n("li",[n("p",[e._v("ID")]),e._v(" "),n("p",[e._v(e._s(e.problem._id))])]),e._v(" "),n("li",[n("p",[e._v("Time Limit")]),e._v(" "),n("p",[e._v(e._s(e.problem.time_limit)+"MS")])]),e._v(" "),n("li",[n("p",[e._v("Memory Limit")]),e._v(" "),n("p",[e._v(e._s(e.problem.memory_limit)+"MB")])]),e._v(" "),n("li",[n("p",[e._v("Created By")]),e._v(" "),n("p",[e._v(e._s(e.problem.created_by.username))])]),e._v(" "),e.problem.difficulty?n("li",[n("p",[e._v("Level")]),e._v(" "),n("p",[e._v(e._s(e.problem.difficulty))])]):e._e(),e._v(" "),e.problem.total_score?n("li",[n("p",[e._v("Score")]),e._v(" "),n("p",[e._v(e._s(e.problem.total_score))])]):e._e(),e._v(" "),n("li",[n("p",[e._v("Tags")]),e._v(" "),n("p",[n("Poptip",{attrs:{trigger:"hover",placement:"left-end"}},[n("a",[e._v("Show")]),e._v(" "),n("div",{attrs:{slot:"content"},slot:"content"},e._l(e.problem.tags,function(t){return n("Tag",{key:t},[e._v(e._s(t))])}))])],1)])])]),e._v(" "),!this.contestID||e.OIContestRealTimePermission?n("Card",{attrs:{id:"pieChart",padding:0}},[n("div",{attrs:{slot:"title"},slot:"title"},[n("Icon",{attrs:{type:"ios-analytics"}}),e._v(" "),n("span",{staticClass:"card-title"},[e._v("Statistic")]),e._v(" "),n("Button",{attrs:{type:"ghost",size:"small",id:"detail"},on:{click:function(t){e.graphVisible=!e.graphVisible}}},[e._v("Details")])],1),e._v(" "),n("div",{staticClass:"echarts"},[n("ECharts",{attrs:{options:e.pie}})],1)]):e._e()],1),e._v(" "),n("Modal",{model:{value:e.graphVisible,callback:function(t){e.graphVisible=t},expression:"graphVisible"}},[n("div",{attrs:{id:"pieChart-detail"}},[n("ECharts",{attrs:{options:e.largePie,initOptions:e.largePieInitOpts}})],1),e._v(" "),n("div",{attrs:{slot:"footer"},slot:"footer"},[n("Button",{attrs:{type:"ghost"},on:{click:function(t){e.graphVisible=!1}}},[e._v("Close")])],1)])],1)},staticRenderFns:[]};var M=n("VU/8")(L,T,!1,function(e){n("RF21")},"data-v-5381850c",null);t.default=M.exports},Xc4G:function(e,t,n){var r=n("lktj"),i=n("1kS7"),o=n("NpIQ");e.exports=function(e){var t=r(e),n=i.f;if(n)for(var a,l=n(e),s=o.f,u=0;l.length>u;)s.call(e,a=l[u++])&&t.push(a);return t}},Xdwu:function(e,t){},Yokd:function(e,t){},Zzip:function(e,t,n){e.exports={default:n("/n6Q"),__esModule:!0}},aGTD:function(e,t,n){(function(e){"use strict";var t="CodeMirror-activeline",n="CodeMirror-activeline-background",r="CodeMirror-activeline-gutter";function i(e){for(var i=0;i<e.state.activeLines.length;i++)e.removeLineClass(e.state.activeLines[i],"wrap",t),e.removeLineClass(e.state.activeLines[i],"background",n),e.removeLineClass(e.state.activeLines[i],"gutter",r)}function o(e,o){for(var a=[],l=0;l<o.length;l++){var s=o[l],u=e.getOption("styleActiveLine");if("object"==typeof u&&u.nonEmpty?s.anchor.line==s.head.line:s.empty()){var c=e.getLineHandleVisualStart(s.head.line);a[a.length-1]!=c&&a.push(c)}}(function(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0})(e.state.activeLines,a)||e.operation(function(){i(e);for(var o=0;o<a.length;o++)e.addLineClass(a[o],"wrap",t),e.addLineClass(a[o],"background",n),e.addLineClass(a[o],"gutter",r);e.state.activeLines=a})}function a(e,t){o(e,t.ranges)}e.defineOption("styleActiveLine",!1,function(t,n,r){var l=r!=e.Init&&r;n!=l&&(l&&(t.off("beforeSelectionChange",a),i(t),delete t.state.activeLines),n&&(t.state.activeLines=[],o(t,t.listSelections()),t.on("beforeSelectionChange",a)))})})(n("8U58"))},cNyp:function(e,t){},crlp:function(e,t,n){var r=n("7KvD"),i=n("FeBl"),o=n("O4g8"),a=n("Kh4W"),l=n("evD5").f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||l(t,e,{value:a.f(e)})}},epNC:function(e,t){},fWfb:function(e,t,n){"use strict";var r=n("7KvD"),i=n("D2L2"),o=n("+E39"),a=n("kM2E"),l=n("880/"),s=n("06OY").KEY,u=n("S82l"),c=n("e8AB"),f=n("e6n0"),d=n("3Eo+"),h=n("dSzd"),p=n("Kh4W"),g=n("crlp"),m=n("Xc4G"),v=n("7UMu"),y=n("77Pl"),b=n("EqjI"),w=n("TcQ7"),x=n("MmMw"),C=n("X8DO"),S=n("Yobk"),k=n("Rrel"),L=n("LKZe"),T=n("evD5"),M=n("lktj"),_=L.f,O=T.f,D=k.f,A=r.Symbol,N=r.JSON,P=N&&N.stringify,I=h("_hidden"),E=h("toPrimitive"),W={}.propertyIsEnumerable,F=c("symbol-registry"),z=c("symbols"),H=c("op-symbols"),R=Object.prototype,B="function"==typeof A,U=r.QObject,V=!U||!U.prototype||!U.prototype.findChild,j=o&&u(function(){return 7!=S(O({},"a",{get:function(){return O(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=_(R,t);r&&delete R[t],O(e,t,n),r&&e!==R&&O(R,t,r)}:O,G=function(e){var t=z[e]=S(A.prototype);return t._k=e,t},K=B&&"symbol"==typeof A.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof A},$=function(e,t,n){return e===R&&$(H,t,n),y(e),t=x(t,!0),y(n),i(z,t)?(n.enumerable?(i(e,I)&&e[I][t]&&(e[I][t]=!1),n=S(n,{enumerable:C(0,!1)})):(i(e,I)||O(e,I,C(1,{})),e[I][t]=!0),j(e,t,n)):O(e,t,n)},Y=function(e,t){y(e);for(var n,r=m(t=w(t)),i=0,o=r.length;o>i;)$(e,n=r[i++],t[n]);return e},q=function(e){var t=W.call(this,e=x(e,!0));return!(this===R&&i(z,e)&&!i(H,e))&&(!(t||!i(this,e)||!i(z,e)||i(this,I)&&this[I][e])||t)},X=function(e,t){if(e=w(e),t=x(t,!0),e!==R||!i(z,t)||i(H,t)){var n=_(e,t);return!n||!i(z,t)||i(e,I)&&e[I][t]||(n.enumerable=!0),n}},Z=function(e){for(var t,n=D(w(e)),r=[],o=0;n.length>o;)i(z,t=n[o++])||t==I||t==s||r.push(t);return r},Q=function(e){for(var t,n=e===R,r=D(n?H:w(e)),o=[],a=0;r.length>a;)!i(z,t=r[a++])||n&&!i(R,t)||o.push(z[t]);return o};B||(l((A=function(){if(this instanceof A)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(n){this===R&&t.call(H,n),i(this,I)&&i(this[I],e)&&(this[I][e]=!1),j(this,e,C(1,n))};return o&&V&&j(R,e,{configurable:!0,set:t}),G(e)}).prototype,"toString",function(){return this._k}),L.f=X,T.f=$,n("n0T6").f=k.f=Z,n("NpIQ").f=q,n("1kS7").f=Q,o&&!n("O4g8")&&l(R,"propertyIsEnumerable",q,!0),p.f=function(e){return G(h(e))}),a(a.G+a.W+a.F*!B,{Symbol:A});for(var J="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;J.length>ee;)h(J[ee++]);for(var te=M(h.store),ne=0;te.length>ne;)g(te[ne++]);a(a.S+a.F*!B,"Symbol",{for:function(e){return i(F,e+="")?F[e]:F[e]=A(e)},keyFor:function(e){if(!K(e))throw TypeError(e+" is not a symbol!");for(var t in F)if(F[t]===e)return t},useSetter:function(){V=!0},useSimple:function(){V=!1}}),a(a.S+a.F*!B,"Object",{create:function(e,t){return void 0===t?S(e):Y(S(e),t)},defineProperty:$,defineProperties:Y,getOwnPropertyDescriptor:X,getOwnPropertyNames:Z,getOwnPropertySymbols:Q}),N&&a(a.S+a.F*(!B||u(function(){var e=A();return"[null]"!=P([e])||"{}"!=P({a:e})||"{}"!=P(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(b(t)||void 0!==e)&&!K(e))return v(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!K(t))return t}),r[1]=t,P.apply(N,r)}}),A.prototype[E]||n("hJx8")(A.prototype,E,A.prototype.valueOf),f(A,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},fo6W:function(e,t,n){(function(e){"use strict";e.registerHelper("fold","brace",function(t,n){var r,i=n.line,o=t.getLine(i);function a(a){for(var l=n.ch,s=0;;){var u=l<=0?-1:o.lastIndexOf(a,l-1);if(-1!=u){if(1==s&&u<n.ch)break;if(r=t.getTokenTypeAt(e.Pos(i,u+1)),!/^(comment|string)/.test(r))return u+1;l=u-1}else{if(1==s)break;s=1,l=o.length}}}var l="{",s="}",u=a("{");if(null==u&&(l="[",s="]",u=a("[")),null!=u){var c,f,d=1,h=t.lastLine();e:for(var p=i;p<=h;++p)for(var g=t.getLine(p),m=p==i?u:0;;){var v=g.indexOf(l,m),y=g.indexOf(s,m);if(v<0&&(v=g.length),y<0&&(y=g.length),(m=Math.min(v,y))==g.length)break;if(t.getTokenTypeAt(e.Pos(p,m+1))==r)if(m==v)++d;else if(!--d){c=p,f=m;break e}++m}if(null!=c&&(i!=c||f!=u))return{from:e.Pos(i,u),to:e.Pos(c,f)}}}),e.registerHelper("fold","import",function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(t.lastLine(),n+10);i<=o;++i){var a=t.getLine(i).indexOf(";");if(-1!=a)return{startCh:r.end,end:e.Pos(i,a)}}}var i,o=n.line,a=r(o);if(!a||r(o-1)||(i=r(o-2))&&i.end.line==o-1)return null;for(var l=a.end;;){var s=r(l.line+1);if(null==s)break;l=s.end}return{from:t.clipPos(e.Pos(o,a.startCh+1)),to:l}}),e.registerHelper("fold","include",function(t,n){function r(n){if(n<t.firstLine()||n>t.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));return/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var i=n.line,o=r(i);if(null==o||null!=r(i-1))return null;for(var a=i;;){if(null==r(a+1))break;++a}return{from:e.Pos(i,o+1),to:t.clipPos(e.Pos(a))}})})(n("8U58"))},gZhU:function(e,t,n){var r=n("8U58"),i=n("Lgoy");i=i.default||i,e.exports={CodeMirror:r,codemirror:i,install:function(e){e.component("codemirror",i)}}},n0T6:function(e,t,n){var r=n("Ibhu"),i=n("xnc9").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},pFYg:function(e,t,n){"use strict";t.__esModule=!0;var r=a(n("Zzip")),i=a(n("5QVw")),o="function"==typeof i.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":typeof e};function a(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof i.default&&"symbol"===o(r.default)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof i.default&&e.constructor===i.default&&e!==i.default.prototype?"symbol":void 0===e?"undefined":o(e)}},tWbI:function(e,t,n){(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],i=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function o(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",r.concat(i)),e.defineMode("python",function(a,l){for(var s="error",u=l.delimiters||l.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,c=[l.singleOperators,l.doubleOperators,l.doubleDelimiters,l.tripleDelimiters,l.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@])/],f=0;f<c.length;f++)c[f]||c.splice(f--,1);var d=l.hangingIndent||a.indentUnit,h=r,p=i;void 0!=l.extra_keywords&&(h=h.concat(l.extra_keywords)),void 0!=l.extra_builtins&&(p=p.concat(l.extra_builtins));var g=!(l.version&&Number(l.version)<3);if(g){var m=l.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;h=h.concat(["nonlocal","False","True","None","async","await"]),p=p.concat(["ascii","bytes","exec","print"]);var v=new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))","i")}else{m=l.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;h=h.concat(["exec","print"]),p=p.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);v=new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var y=t(h),b=t(p);function w(e,t){var n=e.sol()&&"\\"!=t.lastToken;if(n&&(t.indent=e.indentation()),n&&"py"==o(t).type){var r=o(t).offset;if(e.eatSpace()){var i=e.indentation();return i>r?C(t):i<r&&S(e,t)&&"#"!=e.peek()&&(t.errorToken=!0),null}var a=x(e,t);return r>0&&S(e,t)&&(a+=" "+s),a}return x(e,t)}function x(e,t){if(e.eatSpace())return null;if(e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var r=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^[\d_]+\.\d*/)&&(r=!0),e.match(/^\.\d+/)&&(r=!0),r)return e.eat(/J/i),"number";var i=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(i=!0),e.match(/^0b[01_]+/i)&&(i=!0),e.match(/^0o[0-7_]+/i)&&(i=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),i=!0),e.match(/^0(?![\dx])/i)&&(i=!0),i)return e.eat(/L/i),"number"}if(e.match(v))return t.tokenize=function(e){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var t=1==e.length,n="string";function r(r,i){for(;!r.eol();)if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),t&&r.eol())return n}else{if(r.match(e))return i.tokenize=w,n;r.eat(/['"]/)}if(t){if(l.singleLineStringErrors)return s;i.tokenize=w}return n}return r.isString=!0,r}(e.current()),t.tokenize(e,t);for(var o=0;o<c.length;o++)if(e.match(c[o]))return"operator";return e.match(u)?"punctuation":"."==t.lastToken&&e.match(m)?"property":e.match(y)||e.match(n)?"keyword":e.match(b)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(m)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),s)}function C(e){for(;"py"!=o(e).type;)e.scopes.pop();e.scopes.push({offset:o(e).offset+a.indentUnit,type:"py",align:null})}function S(e,t){for(var n=e.indentation();t.scopes.length>1&&o(t).offset>n;){if("py"!=o(t).type)return!0;t.scopes.pop()}return o(t).offset!=n}function k(e,t){e.sol()&&(t.beginningOfLine=!0);var n=t.tokenize(e,t),r=e.current();if(t.beginningOfLine&&"@"==r)return e.match(m,!1)?"meta":g?"operator":s;/\S/.test(r)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=r&&"return"!=r||(t.dedent+=1),"lambda"==r&&(t.lambda=!0),":"!=r||t.lambda||"py"!=o(t).type||C(t);var i=1==r.length?"[({".indexOf(r):-1;if(-1!=i&&function(e,t,n){var r=e.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+d,type:n,align:r})}(e,t,"])}".slice(i,i+1)),-1!=(i="])}".indexOf(r))){if(o(t).type!=r)return s;t.indent=t.scopes.pop().offset-d}return t.dedent>0&&e.eol()&&"py"==o(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}return{startState:function(e){return{tokenize:w,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=k(e,t);return r&&"comment"!=r&&(t.lastToken="keyword"==r||"punctuation"==r?e.current():r),"punctuation"==r&&(r=null),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+s:r},indent:function(t,n){if(t.tokenize!=w)return t.tokenize.isString?e.Pass:0;var r=o(t),i=r.type==n.charAt(0);return null!=r.align?r.align-(i?1:0):r.offset-(i?d:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-python","python");var a;e.defineMIME("text/x-cython",{name:"python",extra_keywords:(a="by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE",a.split(" "))})})(n("8U58"))}});