diff --git a/assets/js/apitool-methods-ws.js b/assets/js/apitool-methods-ws.js new file mode 100644 index 0000000000..ddad52ee54 --- /dev/null +++ b/assets/js/apitool-methods-ws.js @@ -0,0 +1,13 @@ +Request("ACCOUNT METHODS"); + +Request('account_channels', { + description: "Returns information about an account's payment channels.", + link: "account_channels.html", + body: { + "id": 1, + "command": "account_channels", + "account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH", + "destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "ledger_index": "validated" + } +}) diff --git a/assets/js/apitool-websocket2.js b/assets/js/apitool-websocket2.js new file mode 100644 index 0000000000..4b3e03c5bc --- /dev/null +++ b/assets/js/apitool-websocket2.js @@ -0,0 +1,156 @@ +var commandlist = $("#command_list") +const request_body = $(".request-body.io") +const response_body = $(".response-body.io") + +const GET = "GET" +const POST = "POST" +const PUT = "PUT" +const DELETE = "DELETE" + +function slugify(str) { + str = str.replace(/^\s+|\s+$/g, '') // trim + str = str.toLowerCase() + + // remove accents, swap ñ for n, etc + const from = "à áäâèéëêìÃïîòóöôùúüûñç·/_,:;" + const to = "aaaaeeeeiiiioooouuuunc------" + for (let i=0, l=from.length ; i"+req.name+""); + } else { + commandlist.append(""+req.name+""); + } + }); +} + +function make_commands_clickable() { + commandlist.children("li").click(function() { + var cmd = slugify($(this).text().trim()); + + if (!requests[cmd]) return; + + select_request(cmd, true); + window.location.hash = cmd; + + $(this).siblings().removeClass('selected'); + $(this).addClass('selected'); + }); +} + +const cm_request = CodeMirror(request_body.get(0), { + mode: 'javascript', + json: true, + smartIndent: false +}) + +const cm_response = CodeMirror(response_body.get(0), { + mode: 'javascript', + json: true, + smartIndent: false, + readOnly: true +}) + +function select_request(request) { + if (request === undefined) { + var el = commandlist.children("li:not(.separator)").eq(0) + request = slugify(el.text()) + } else { + var el = commandlist.find("li a[href='#"+request+"']").parent() + } + $(el).siblings().removeClass('selected'); + $(el).addClass('selected'); + + command = requests[request]; + + if (command.description) { + $(".api-method-description-wrapper .blurb").html(command.description) + $(".api-method-description-wrapper .blurb").show() + } else { + $(".api-method-description-wrapper .blurb").hide() + } + if (command.link) { + $(".api-method-description-wrapper .api-readmore").attr("href", command.link) + $(".api-method-description-wrapper .api-readmore").show() + } else { + $(".api-method-description-wrapper .api-readmore").hide() + } + + $(".selected_command").attr('href', DOC_BASE+command.link).text(command.name) + + change_path(command); + + if (command.hasOwnProperty("body")) { + cm_request.setValue(JSON.stringify(command.body, null, 2)); + } else { + //No body, so wipe out the current contents. + cm_request.setValue(""); + } + cm_request.refresh(); + + reset_response_area(); +}; + +// TODO: more stuff + + +$(document).ready(function() { + //wait for the Requests to be populated by another file + generate_table_of_contents(); + make_commands_clickable(); + + if (window.location.hash) { + var cmd = window.location.hash.slice(1).toLowerCase(); + select_request(cmd); + } else { + select_request(); + } + + if (urlParams["base_url"]) { + change_base_url(urlParams["base_url"]); + } + + request_button.click(send_request); + +}); + +var urlParams; +(window.onpopstate = function () { + var match, + pl = /\+/g, // Regex for replacing addition symbol with a space + search = /([^&=]+)=?([^&]*)/g, + decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, + query = window.location.search.substring(1); + + urlParams = {}; + while (match = search.exec(query)) + urlParams[decode(match[1])] = decode(match[2]); +})(); diff --git a/assets/vendor/cm-javascript.min.js b/assets/vendor/cm-javascript.min.js deleted file mode 100644 index 0be93bda5a..0000000000 --- a/assets/vendor/cm-javascript.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// TODO actually recognize syntax of TypeScript constructs -CodeMirror.defineMode("javascript",function(e,t){function a(e,t,n){return t.tokenize=n,n(e,t)}function f(e,t){var n=!1,r;while((r=e.next())!=null){if(r==t&&!n)return!1;n=!n&&r=="\\"}return n}function h(e,t,n){return l=e,c=n,t}function p(e,t){var n=e.next();if(n=='"'||n=="'")return a(e,t,d(n));if(n=="."&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return h("number","number");if(/[\[\]{}\(\),;\:\.]/.test(n))return h(n);if(n=="0"&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),h("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),h("number","number");if(n=="/")return e.eat("*")?a(e,t,v):e.eat("/")?(e.skipToEnd(),h("comment","comment")):t.lastType=="operator"||t.lastType=="keyword c"||/^[\[{}\(,;:]$/.test(t.lastType)?(f(e,"/"),e.eatWhile(/[gimy]/),h("regexp","string-2")):(e.eatWhile(u),h("operator",null,e.current()));if(n=="#")return e.skipToEnd(),h("error","error");if(u.test(n))return e.eatWhile(u),h("operator",null,e.current());e.eatWhile(/[\w\$_]/);var r=e.current(),i=o.propertyIsEnumerable(r)&&o[r];return i&&t.lastType!="."?h(i.type,i.style,r):h("variable","variable",r)}function d(e){return function(t,n){return f(t,e)||(n.tokenize=p),h("string","string")}}function v(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=p;break}n=r=="*"}return h("comment","comment")}function g(e,t,n,r,i,s){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=s,r!=null&&(this.align=r)}function y(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0}function b(e,t,n,r,s){var o=e.cc;w.state=e,w.stream=s,w.marked=null,w.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=o.length?o.pop():i?M:O;if(u(n,r)){while(o.length&&o[o.length-1].lex)o.pop()();return w.marked?w.marked:n=="variable"&&y(e,r)?"variable-2":t}}}function E(){for(var e=arguments.length-1;e>=0;e--)w.cc.push(arguments[e])}function S(){return E.apply(null,arguments),!0}function x(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var n=w.state;if(n.context){w.marked="def";if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;n.globalVars={name:e,next:n.globalVars}}}function N(){w.state.context={prev:w.state.context,vars:w.state.localVars},w.state.localVars=T}function C(){w.state.localVars=w.state.context.vars,w.state.context=w.state.context.prev}function k(e,t){var n=function(){var n=w.state,r=n.indented;n.lexical.type=="stat"&&(r=n.lexical.indented),n.lexical=new g(r,w.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function L(){var e=w.state;e.lexical.prev&&(e.lexical.type==")"&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function A(e){return function(t){return t==e?S():e==";"?E():S(arguments.callee)}}function O(e){return e=="var"?S(k("vardef"),V,A(";"),L):e=="keyword a"?S(k("form"),M,O,L):e=="keyword b"?S(k("form"),O,L):e=="{"?S(k("}"),z,L):e==";"?S():e=="if"?S(k("form"),M,O,L,J):e=="function"?S(Z):e=="for"?S(k("form"),A("("),k(")"),K,A(")"),L,O,L):e=="variable"?S(k("stat"),F):e=="switch"?S(k("form"),M,k("}","switch"),A("{"),z,L,L):e=="case"?S(M,A(":")):e=="default"?S(A(":")):e=="catch"?S(k("form"),N,A("("),et,A(")"),O,L,C):E(k("stat"),M,A(";"),L)}function M(e){return D(e,!1)}function _(e){return D(e,!0)}function D(e,t){var n=t?j:B;return m.hasOwnProperty(e)?S(n):e=="function"?S(Z):e=="keyword c"?S(t?H:P):e=="("?S(k(")"),P,A(")"),L,n):e=="operator"?S(t?_:M):e=="["?S(k("]"),U(_,"]"),L,n):e=="{"?S(k("}"),U(q,"}"),L,n):S()}function P(e){return e.match(/[;\}\)\],]/)?E():E(M)}function H(e){return e.match(/[;\}\)\],]/)?E():E(_)}function B(e,t){return e==","?S(M):j(e,t,!1)}function j(e,t,n){var r=n==0?B:j,i=n==0?M:_;if(e=="operator")return/\+\+|--/.test(t)?S(r):t=="?"?S(M,A(":"),i):S(i);if(e==";")return;if(e=="(")return S(k(")","call"),U(_,")"),L,r);if(e==".")return S(I,r);if(e=="[")return S(k("]"),P,A("]"),L,r)}function F(e){return e==":"?S(L,O):E(B,A(";"),L)}function I(e){if(e=="variable")return w.marked="property",S()}function q(e,t){if(e=="variable"){w.marked="property";if(t=="get"||t=="set")return S(R)}else if(e=="number"||e=="string")w.marked=e+" property";if(m.hasOwnProperty(e))return S(A(":"),_)}function R(e){return e==":"?S(M):e!="variable"?S(A(":"),M):(w.marked="property",S(Z))}function U(e,t){function n(r){if(r==","){var i=w.state.lexical;return i.info=="call"&&(i.pos=(i.pos||0)+1),S(e,n)}return r==t?S():S(A(t))}return function(r){return r==t?S():E(e,n)}}function z(e){return e=="}"?S():E(O,z)}function W(e){return e==":"?S(X):E()}function X(e){return e=="variable"?(w.marked="variable-3",S()):E()}function V(e,t){return e=="variable"?(x(t),s?S(W,$):S($)):E()}function $(e,t){if(t=="=")return S(_,$);if(e==",")return S(V)}function J(e,t){if(e=="keyword b"&&t=="else")return S(k("form"),O,L)}function K(e){return e=="var"?S(V,A(";"),G):e==";"?S(G):e=="variable"?S(Q):E(M,A(";"),G)}function Q(e,t){return t=="in"?S(M):S(B,G)}function G(e,t){return e==";"?S(Y):t=="in"?S(M):E(M,A(";"),Y)}function Y(e){e!=")"&&S(M)}function Z(e,t){if(e=="variable")return x(t),S(Z);if(e=="(")return S(k(")"),N,U(et,")"),L,O,C)}function et(e,t){if(e=="variable")return x(t),s?S(W):S()}var n=e.indentUnit,r=t.statementIndent,i=t.json,s=t.typescript,o=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},u={"if":e("if"),"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,"undefined":o,NaN:o,Infinity:o,"this":e("this")};if(s){var a={type:"variable",style:"variable-3"},f={"interface":e("interface"),"class":e("class"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),"super":e("super"),string:a,number:a,bool:a,any:a};for(var l in f)u[l]=f[l]}return u}(),u=/[+\-*&%=<>!?|~^]/,l,c,m={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},w={state:null,column:null,marked:null,cc:null},T={name:"this",next:{name:"arguments"}};return L.lex=!0,{startState:function(e){return{tokenize:p,lastType:null,cc:[],lexical:new g((e||0)-n,0,"block",!1),localVars:t.localVars,globalVars:t.globalVars,context:t.localVars&&{vars:t.localVars},indented:0}},token:function(e,t){e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation());if(t.tokenize!=v&&e.eatSpace())return null;var n=t.tokenize(e,t);return l=="comment"?n:(t.lastType=l!="operator"||c!="++"&&c!="--"?l:"incdec",b(t,n,l,c,e))},indent:function(e,i){if(e.tokenize==v)return CodeMirror.Pass;if(e.tokenize!=p)return 0;var s=i&&i.charAt(0),o=e.lexical;for(var u=e.cc.length-1;u>=0;--u){var a=e.cc[u];if(a==L)o=o.prev;else if(a!=J||/^else\b/.test(i))break}o.type=="stat"&&s=="}"&&(o=o.prev),r&&o.type==")"&&o.prev.type=="stat"&&(o=o.prev);var f=o.type,l=s==f;return f=="vardef"?o.indented+(e.lastType=="operator"||e.lastType==","?4:0):f=="form"&&s=="{"?o.indented:f=="form"?o.indented+n:f=="stat"?o.indented+(e.lastType=="operator"||e.lastType==","?r||n:0):o.info=="switch"&&!l&&t.doubleIndentSwitch!=0?o.indented+(/^(?:case|default)\b/.test(i)?n:2*n):o.align?o.column+(l?0:1):o.indented+(l?0:n)},electricChars:":{}",blockCommentStart:i?null:"/*",blockCommentEnd:i?null:"*/",lineComment:i?null:"//",fold:"brace",helperType:i?"json":"javascript",jsonMode:i}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}); \ No newline at end of file diff --git a/assets/vendor/codemirror-with-js.min.js b/assets/vendor/codemirror-with-js.min.js new file mode 100644 index 0000000000..f9c3ab490a --- /dev/null +++ b/assets/vendor/codemirror-with-js.min.js @@ -0,0 +1 @@ +(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()})(this,function(){"use strict";function e(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function t(t){for(var e=t.childNodes.length;0a||a>=t)return d+(t-s);d+=a-s,d+=r-d%r,s=a+1}}function u(e,t){for(var n=0;n=t)return n+Math.min(l,t-r);if(r+=o-n,r+=i-r%i,n=o+1,r>=t)return n}}function f(e){for(;Kl.length<=e;)Kl.push(y(Kl)+" ");return Kl[e]}function y(e){return e[e.length-1]}function x(e,t){for(var n=[],r=0;ri?0i?-1:1;;){if(t==i)return t;var r=(t+i)/2,o=0>n?Math.ceil(r):Math.floor(r);if(o==t)return e(o)?t:i;e(o)?i=o:t=o+n}}function M(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var o=!1,l=0,s;lt||t==n&&s.to==t)&&(r(Math.max(s.from,t),Math.min(s.to,n),1==s.level?"rtl":"ltr",l),o=!0);o||r(t,n,"ltr")}function A(e,t,n){var r;ql=null;for(var o=0,l;ot)return o;l.to==t&&(l.from!=l.to&&"before"==n?r=o:ql=o),l.from==t&&(l.from!=l.to&&"before"!=n?r=o:ql=o)}return null==r?ql:r}function O(e,t){var i=e.order;return null==i&&(i=e.order=_l(e.text,t)),i}function W(e,t){return e._handlers&&e._handlers[t]||Zl}function D(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var n=e._handlers,r=n&&n[t];if(r){var o=u(r,i);-1=t.offsetWidth&&2ie))}var i=ls?r("span","\u200B"):r("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function $(e){if(null!=ss)return ss;var i=n(e,document.createTextNode("A\u062EA")),r=Rl(i,0,1).getBoundingClientRect(),o=Rl(i,1,2).getBoundingClientRect();return t(e),!!(r&&r.left!=r.right)&&(ss=3>o.right-r.right)}function K(e){if(null!=ts)return ts;var t=n(e,r("span","x")),i=t.getBoundingClientRect(),o=Rl(t,0,1).getBoundingClientRect();return ts=1t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var o=0;;++o){var l=r.children[o],s=l.chunkSize();if(t=e.first&&tpe(e,t)?t:e}function ge(e,t){return 0>pe(e,t)?e:t}function fe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.linei?ae(i,ee(e,i).text.length):ye(t,ee(e,t.line).text.length)}function ye(e,t){var i=e.ch;return null==i||i>t?ae(e.line,t):0>i?ae(e.line,0):e}function xe(e,t){for(var n=[],r=0;re&&l.splice(a,1,e,l[a+1],n),a+=2,p=Math.min(e,n);if(t)if(o.opaque)l.splice(i,a-i,e,"overlay "+t),a=i+2;else for(;ie.options.maxHighlightLength&&Z(e.doc.mode,n.state),o=ve(e,t,n);r&&(n.state=r),t.stateAfter=n.save(!r),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ce(e,t,i){var n=e.doc,r=e.display;if(!n.mode.startState)return new as(n,!0,t);var o=Me(e,t,i),l=o>n.first&&ee(n,o-1).stateAfter,s=l?as.fromSaved(n,l,o):new as(n,J(n.mode),o);return n.iter(o,t,function(i){we(e,i.text,s);var n=s.line;i.stateAfter=n==t-1||0==n%5||n>=r.viewFrom&&no;o++){r&&(r[0]=Q(e,n).mode);var l=e.token(t,n);if(t.pos>t.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}function Le(e,t,i,n){var r=e.doc,o=r.mode,l;t=me(r,t);var s=ee(r,t.line),d=Ce(e,t.line,i),a=new os(s.text,e.options.tabSize,d),p;for(n&&(p=[]);(n||a.pose.options.maxHighlightLength?(s=!1,l&&we(e,t,n,p.pos),p.pos=t.length,h=null):h=Te(Se(i,p,n.state,c),o),c){var u=c[0].name;u&&(h="m-"+(h?u+" "+h:u))}if(!s||a!=h){for(;dr;--o){if(o<=n.first)return n.first;var d=ee(n,o-1),a=d.stateAfter;if(a&&(!i||o+(a instanceof ds?a.lookAhead:0)<=n.modeFrontier))return o;var p=h(d.text,null,e.options.tabSize);(null==s||l>p)&&(s=o-1,l=p)}return s}function Ae(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;n--)if(r=ee(e,n).stateAfter,r&&(!(r instanceof ds)||n+r.lookAhead=t:l.to>t);(r||(r=[])).push(new De(s,l.from,a?null:l.to))}}return r}function ze(e,t,n){var r;if(e)for(var o=0;o=t:l.to>t);if(d||l.from==t&&"bookmark"==s.type&&(!n||l.marker.insertLeft)){var a=null==l.from||(s.inclusiveLeft?l.from<=t:l.frompe(c.to,d.from)||0g)&&(s.inclusiveLeft||g)||h.push({from:c.from,to:d.from}),!(0$e(r,o.marker))&&(r=o.marker);return r}function Xe(e){return Ke(e,!0)}function Ye(e){return Ke(e,!1)}function qe(e,t){var n=hs&&e.markedSpans,r;if(n)for(var o=0,l;ot)&&(!r||0>$e(r,l.marker))&&(r=l.marker);return r}function _e(e,t,n,r,o){var l=ee(e,t),s=hs&&l.markedSpans;if(s)for(var d=0,a;d=h||0>=c&&0<=h)&&(0>=c&&(a.marker.inclusiveRight&&o.inclusiveLeft?0<=pe(p.to,n):0=pe(p.from,r):0>pe(p.from,r))))return!0}}function Ze(e){for(var t;t=Xe(e);)e=t.find(-1,!0).line;return e}function Qe(e){for(var t;t=Ye(e);)e=t.find(1,!0).line;return e}function Je(e){for(var t,i;t=Ye(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function et(e,t){var i=ee(e,t),n=Ze(i);return i==n?t:oe(n)}function tt(e,t){if(t>e.lastLine())return t;var i=ee(e,t),n;if(!it(e,i))return t;for(;n=Ye(i);)i=n.find(1,!0).line;return oe(i)+1}function it(e,t){var n=hs&&t.markedSpans;if(n)for(var r=void 0,o=0;ot.maxLineLength&&(t.maxLineLength=i,t.maxLine=e)})}function st(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),je(e),Ve(e,i);var r=n?n(e):1;r!=e.height&&re(e,r)}function dt(e){e.parent=null,je(e)}function pt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?fs:gs;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ct(e,t){var n=o("span",null,null,at?"padding-right: .1px":null),r={pre:o("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var l=0;l<=(t.rest?t.rest.length:0);l++){var s=l?t.rest[l-1]:t.line,d=void 0;r.pos=0,r.addToken=ut,$(e.display.measure)&&(d=O(s,e.doc.direction))&&(r.addToken=ft(r.addToken,d)),r.map=[];var p=t!=e.display.externalMeasured&&oe(s);yt(s,r,be(e,s,p)),s.styleClasses&&(s.styleClasses.bgClass&&(r.bgClass=a(s.styleClasses.bgClass,r.bgClass||"")),s.styleClasses.textClass&&(r.textClass=a(s.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(U(e.display.measure))),0==l?(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(at){var c=r.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return H(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=a(r.pre.className,r.textClass||"")),r}function ht(e){var t=r("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ut(e,t,i,n,o,l,s){if(t){var d=e.splitSpaces?gt(t,e.trailingSpace):t,a=e.cm.state.specialChars,p=!1,c;if(!a.test(t))e.col+=t.length,c=document.createTextNode(d),e.map.push(e.pos,e.pos+t.length,c),wl&&9>ie&&(p=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var h=0;;){a.lastIndex=h;var u=a.exec(t),g=u?u.index-h:t.length-h;if(g){var m=document.createTextNode(d.slice(h,h+g));wl&&9>ie?c.appendChild(r("span",[m])):c.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!u)break;h+=g+1;var y=void 0;if("\t"==u[0]){var x=e.cm.options.tabSize,v=x-e.col%x;y=c.appendChild(r("span",f(v),"cm-tab")),y.setAttribute("role","presentation"),y.setAttribute("cm-text","\t"),e.col+=v}else"\r"==u[0]||"\n"==u[0]?(y=c.appendChild(r("span","\r"==u[0]?"\u240D":"\u2424","cm-invalidchar")),y.setAttribute("cm-text",u[0]),e.col+=1):(y=e.cm.options.specialCharPlaceholder(u[0]),y.setAttribute("cm-text",u[0]),wl&&9>ie?c.appendChild(r("span",[y])):c.appendChild(y),e.col+=1);e.map.push(e.pos,e.pos+1,y),e.pos++}}if(e.trailingSpace=32==d.charCodeAt(t.length-1),i||n||o||p||l){var b=i||"";n&&(b+=n),o&&(b+=o);var C=r("span",[c],b,l);if(s)for(var w in s)s.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&C.setAttribute(w,s[w]);return e.content.appendChild(C)}e.content.appendChild(c)}}function gt(e,t){if(1p&&h.from<=p));u++);if(h.to>=c)return e(n,r,o,l,s,d,a);e(n,r.slice(0,h.to-p),o,l,null,d,a),l=null,r=r.slice(h.to-p),p=h.to}}}function mt(e,t,i,n){var r=!n&&i.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!n&&e.cm.display.input.needsContentAttribute&&(!r&&(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function yt(e,t,n){var r=e.markedSpans,o=e.text,l=0;if(!r){for(var s=1;sa||L.collapsed&&S.to==a&&S.from==a)){if(null!=S.to&&S.to!=a&&h>S.to&&(h=S.to,y=""),L.className&&(f+=" "+L.className),L.css&&(g=(g?g+";":"")+L.css),L.startStyle&&S.from==a&&(x+=" "+L.startStyle),L.endStyle&&S.to==h&&(w||(w=[])).push(L.endStyle,S.to),L.title&&((b||(b={})).title=L.title),L.attributes)for(var m in L.attributes)(b||(b={}))[m]=L.attributes[m];L.collapsed&&(!v||0>$e(v.marker,L))&&(v=S)}else S.from>a&&h>S.from&&(h=S.from)}if(w)for(var T=0;T=d)break;for(var M=Math.min(d,h);;){if(c){var A=a+c.length;if(!v){var O=A>M?c.slice(0,M-a):c;t.addToken(t,O,u?u+f:f,x,a+O.length==h?y:"",g,b)}if(A>=M){c=c.slice(M-a),a=M;break}a=A,x=""}c=o.slice(l,l=n[p++]),u=pt(n[p++],t.cm.options)}}}function xt(e,t,i){this.line=t,this.rest=Je(t),this.size=this.rest?oe(y(this.rest))-i+1:1,this.node=this.text=null,this.hidden=it(e,t)}function vt(e,t,i){for(var n=[],r=t,o,l;rie&&(e.node.style.zIndex=2)),e.node}function Nt(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var n=Tt(t);t.background=n.insertBefore(r("div",null,i),n.firstChild),e.display.input.setUneditable(t.background)}}function Mt(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):ct(e,t)}function At(e,t){var i=t.text.className,n=Mt(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,Ot(e,t)):i&&(t.text.className=i)}function Ot(e,t){Nt(e,t),t.line.wrapClass?Tt(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Wt(e,t,i,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=Tt(t);t.gutterBackground=r("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var s=Tt(t),d=t.gutter=r("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(d),s.insertBefore(d,t.text),t.line.gutterClass&&(d.className+=" "+t.line.gutterClass),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(t.lineNumber=d.appendChild(r("div",de(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var a=0;an)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Xt(e,t){t=Ze(t);var i=oe(t),r=e.display.externalMeasured=new xt(e.doc,t,i);r.lineN=i;var o=r.built=ct(e,r);return r.text=o.pre,n(e.display.lineMeasure,o.pre),r}function Yt(e,t,i,n){return Zt(e,_t(e,t),i,n)}function qt(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(s=p-a,l=s-1,t>=p&&(d="right")),null!=l){if(o=e[r+2],a==p&&n==(o.insertLeft?"left":"right")&&(d=n),"left"==n&&0==l)for(;r&&e[r-2]==e[r-3]&&e[r-1].insertLeft;)o=e[(r-=3)+2],d="left";if("right"==n&&l==p-a)for(;rc;c++){for(;s&&L(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+die&&0==s&&d==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():Jt(Rl(l,s,d).getClientRects(),r),p.left||p.right||0==s)break;d=s,--s,a="right"}wl&&11>ie&&(p=ti(e.display.measure,p))}else{0ie&&!s&&(!p||!p.left&&!p.right)){var u=l.parentNode.getClientRects()[0];p=u?{left:u.left,right:u.left+wi(e.display),top:u.top,bottom:u.bottom}:xs}for(var g=p.top-t.rect.top,f=p.bottom-t.rect.top,m=t.view.measure.heights,y=0;y=n.text.length?(a=n.text.length,p="before"):0>=a&&(a=0,p="after"),!d)return l("before"==p?a-1:a,"before"==p);var c=A(d,a,p),h=ql,u=s(a,c,"before"==p);return null!=h&&(u.other=s(a,h,"before"!=p)),u}function hi(e,t){var i=0;t=me(e.doc,t),e.options.lineWrapping||(i=wi(e.display)*t.ch);var n=ee(e.doc,t.line),r=rt(n)+Rt(e.display);return{left:i,right:i,top:r,bottom:r+n.height}}function ui(e,t,i,n,r){var o=ae(e,t,i);return o.xRel=r,n&&(o.outside=!0),o}function gi(e,t,i){var n=e.doc;if(i+=e.display.viewOffset,0>i)return ui(n.first,0,null,!0,-1);var r=le(n,i),o=n.first+n.size-1;if(r>o)return ui(n.first+n.size-1,ee(n,o).text.length,null,!0,1);0>t&&(t=0);for(var l=ee(n,r);;){var s=xi(e,l,r,t,i),d=qe(l,s.ch+(0n},o,r),{begin:o,end:r}}function mi(e,t,i,n){i||(i=_t(e,t));var r=di(e,t,Zt(e,i,n),"line").top;return fi(e,t,i,r)}function yi(e,t,i,n){return!(e.bottom<=i)&&(!!(e.top>i)||(n?e.left:e.right)>t)}function xi(e,t,i,n,r){r-=rt(t);var o=_t(e,t),l=si(t),s=0,d=t.text.length,a=!0,p=O(t,e.doc.direction);if(p){var c=(e.options.lineWrapping?bi:vi)(e,t,i,o,p,n,r);a=1!=c.level,s=a?c.from:c.to-1,d=a?c.to:c.from-1}var h=null,u=null,g=N(function(t){var i=Zt(e,o,t);return(i.top+=l,i.bottom+=l,!!yi(i,n,r,!1))&&(i.top<=r&&i.left<=n&&(h=t,u=i),!0)},s,d),f=!1,m,x;if(u){var v=n-u.left=C.bottom}return g=T(t.text,g,1),ui(i,g,x,f,n-m)}function vi(e,t,n,r,o,l,s){var i=N(function(d){var i=o[d],a=1!=i.level;return yi(ci(e,ae(n,a?i.to:i.from,a?"before":"after"),"line",t,r),l,s,!0)},0,o.length-1),d=o[i];if(0s&&(d=o[i-1])}return d}function bi(e,t,n,r,o,l,s){var d=fi(e,t,r,s),a=d.begin,c=d.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var h=null,u=null,g=0,f;g=c||f.to<=a)){var m=1!=f.level,y=Zt(e,r,m?Math.min(c,f.to)-1:Math.max(a,f.from)).right,x=yx)&&(h=f,u=x)}return h||(h=o[o.length-1]),h.fromc&&(h={from:h.from,to:c,level:h.level}),h}function Ci(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==bs){bs=r("pre");for(var o=0;49>o;++o)bs.appendChild(document.createTextNode("x")),bs.appendChild(r("br"));bs.appendChild(document.createTextNode("x"))}n(e.measure,bs);var l=bs.offsetHeight/50;return 3=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,o=0;ot)return o}function Ai(e,t,i,n){null==t&&(t=e.doc.first),null==i&&(i=e.doc.first+e.doc.size),n||(n=0);var r=e.display;if(n&&it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)hs&&et(e.doc,t)r.viewFrom?Wi(e):(r.viewFrom+=n,r.viewTo+=n);else if(t<=r.viewFrom&&i>=r.viewTo)Wi(e);else if(t<=r.viewFrom){var o=Di(e,i,i+n,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=n):Wi(e)}else if(i>=r.viewTo){var l=Di(e,t,t,-1);l?(r.view=r.view.slice(0,l.index),r.viewTo=l.lineN):Wi(e)}else{var s=Di(e,t,t,-1),d=Di(e,i,i+n,1);s&&d?(r.view=r.view.slice(0,s.index).concat(vt(e,s.lineN,d.lineN)).concat(r.view.slice(d.index)),r.viewTo+=n):Wi(e)}var a=r.externalMeasured;a&&(i=r.lineN&&t=n.viewTo)){var o=n.view[Mi(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==u(l,i)&&l.push(i)}}}function Wi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Di(e,t,r,o){var l=Mi(e,t),s=e.display.view,d;if(!hs||r==e.doc.first+e.doc.size)return{index:l,lineN:r};for(var a=e.display.viewFrom,p=0;po?0:s.length-1))return null;r+=o*s[l-(0>o?1:0)].size,l+=o}return{index:l,lineN:r}}function Hi(e,t,i){var n=e.display,r=n.view;0==r.length||t>=n.viewTo||i<=n.viewFrom?(n.view=vt(e,t,i),n.viewFrom=t):(n.viewFrom>t?n.view=vt(e,t,n.viewFrom).concat(n.view):n.viewFromi&&(n.view=n.view.slice(0,Mi(e,i)))),n.viewTo=i}function Pi(e){for(var t=e.display.view,n=0,r=0,o;r=e.display.viewTo||d.to().linet&&(t=0),t=Math.round(t),n=Math.round(n),d.appendChild(r("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==i?c-e:i)+"px;\n height: "+(n-t)+"px"))}function o(t,r,o){function l(i,n){return pi(e,ae(t,i),"div",a,n)}function d(t,i,n){var r=mi(e,a,null,t),o="ltr"==i==("after"==n)?"left":"right",s="after"==n?r.begin:r.end-(/\s/.test(a.text.charAt(r.end-1))?2:1);return l(s,o)[o]}var a=ee(s,t),u=a.text.length,g=O(a,s.direction),f,m;return M(g,r||0,null==o?u:o,function(e,t,s,a){var i="ltr"==s,y=l(e,i?"left":"right"),x=l(t-1,i?"right":"left"),v=null==r&&0==e,b=null==o&&t==u,C=0==a,w=!g||a==g.length-1;if(3>=x.top-y.top){var k=(h?v:b)&&C,S=(h?b:v)&&w,L=k?p:(i?y:x).left,T=S?c:(i?x:y).right;n(L,y.top,T-L,y.bottom)}else{var N,M,A,O;i?(N=h&&v&&C?p:y.left,M=h?c:d(e,s,"before"),A=h?p:d(t,s,"after"),O=h&&b&&w?c:x.right):(N=h?d(e,s,"before"):p,M=!h&&v&&C?c:y.right,A=!h&&b&&w?p:x.left,O=h?d(t,s,"after"):c),n(N,y.top,M-N,y.bottom),y.bottomEi(y,f))&&(f=y),0>Ei(x,f)&&(f=x),(!m||0>Ei(y,m))&&(m=y),0>Ei(x,m)&&(m=x)}),{start:f,end:m}}var l=e.display,s=e.doc,d=document.createDocumentFragment(),a=jt(e.display),p=a.left,c=Math.max(l.sizerWidth,Gt(e)-l.sizer.offsetLeft)-a.right,h="ltr"==s.direction,u=t.from(),g=t.to();if(u.line==g.line)o(u.line,u.ch,g.ch);else{var f=ee(s,u.line),m=ee(s,g.line),y=Ze(f)==Ze(m),x=o(u.line,u.ch,y?f.text.length+1:null).end,v=o(g.line,y?0:null,g.ch).start;y&&(x.tope.options.cursorBlinkRate&&(t.cursorDiv.style.visibility="hidden")}}function ji(e){e.state.focused||(e.display.input.focus(),Gi(e))}function Vi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ui(e))},100)}function Gi(t,i){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"==t.options.readOnly||(!t.state.focused&&(H(t,"focus",t,i),t.state.focused=!0,d(t.display.wrapper,"CodeMirror-focused"),!t.curOp&&t.display.selForContextMenu!=t.doc.sel&&(t.display.input.reset(),at&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Bi(t))}function Ui(t,i){t.state.delayingBlurEvent||(t.state.focused&&(H(t,"blur",t,i),t.state.focused=!1,El(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function $i(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;rie){var a=o.node.offsetTop+o.node.offsetHeight;s=a-n,n=a}else{var p=o.node.getBoundingClientRect();s=p.bottom-p.top,!l&&o.text.firstChild&&(d=o.text.firstChild.getBoundingClientRect().right-p.left-1)}var c=o.line.height-s;if((.005c)&&(re(o.line,s),Ki(o.line),o.rest))for(var h=0;he.display.sizerWidth){var u=Math.ceil(d/wi(e.display));u>e.display.maxLineLength&&(e.display.maxLineLength=u,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}}function Ki(e){if(e.widgets)for(var t=0;t=l&&(o=le(t,rt(ee(t,d))-e.wrapper.clientHeight),l=d)}return{from:o,to:Math.max(l,o+1)}}function Yi(e,t){if(!P(e,"scrollCursorIntoView")){var i=e.display,n=i.sizer.getBoundingClientRect(),o=null;if(0>t.top+n.top?o=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Ml){var l=r("div","\u200B",null,"position: absolute;\n top: "+(t.top-i.viewOffset-Rt(e.display))+"px;\n height: "+(t.bottom-t.top+Vt(e)+i.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(o),e.display.lineSpace.removeChild(l)}}}function qi(e,t,i,n){null==n&&(n=0);var r;e.options.lineWrapping||t!=i||(t=t.ch?ae(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,i="before"==t.sticky?ae(t.line,t.ch+1,"before"):t);for(var o=0;5>o;o++){var l=!1,s=ci(e,t),d=i&&i!=t?ci(e,i):s;r={left:Math.min(s.left,d.left),top:Math.min(s.top,d.top)-n,right:Math.max(s.left,d.left),bottom:Math.max(s.bottom,d.bottom)+n};var a=Zi(e,r),p=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(ln(e,a.scrollTop),1t.top&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:i.scroller.scrollTop,o=Ut(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Bt(i),d=t.tops-n;if(t.topr+o){var p=Math.min(t.top,(a?s:t.bottom)-o);p!=r&&(l.scrollTop=p)}var c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:i.scroller.scrollLeft,h=Gt(e)-(e.options.fixedGutter?i.gutters.offsetWidth:0),u=t.right-t.left>h;return u&&(t.right=t.left+h),10>t.left?l.scrollLeft=0:t.lefth+c-3&&(l.scrollLeft=t.right+(u?0:10)-h),l}function Qi(e,t){null==t||(nn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Ji(e){nn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function en(e,t,i){(null!=t||null!=i)&&nn(e),null!=t&&(e.curOp.scrollLeft=t),null!=i&&(e.curOp.scrollTop=i)}function tn(e,t){nn(e),e.curOp.scrollToPos=t}function nn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=hi(e,t.from),n=hi(e,t.to);rn(e,i,n,t.margin)}}function rn(e,t,i,n){var r=Zi(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});en(e,r.scrollLeft,r.scrollTop)}function ln(e,t){2>Math.abs(e.doc.scrollTop-t)||(!xl&&Dn(e,{top:t}),sn(e,t,!0),xl&&Dn(e),Ln(e,100))}function sn(e,t,i){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function dn(e,t,i,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(i?t==e.doc.scrollLeft:2>Math.abs(e.doc.scrollLeft-t))&&!n||(e.doc.scrollLeft=t,In(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function an(e){var t=e.display,i=t.gutters.offsetWidth,n=Math.round(e.doc.height+Bt(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?i:0,docHeight:n,scrollHeight:n+Vt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function pn(e,t){t||(t=an(e));var n=e.display.barWidth,r=e.display.barHeight;cn(e,t);for(var o=0;4>o&&n!=e.display.barWidth||r!=e.display.barHeight;o++)n!=e.display.barWidth&&e.options.lineWrapping&&$i(e),cn(e,an(e)),n=e.display.barWidth,r=e.display.barHeight}function cn(e,t){var i=e.display,n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}function hn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&El(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ws[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ql(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){"horizontal"==i?dn(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&d(e.display.wrapper,e.display.scrollbars.addClass)}function un(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++ks},bt(e.curOp)}function gn(e){var t=e.curOp;t&&wt(t,function(e){for(var t=0;t=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ss(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function yn(e){e.updatedDisplay=e.mustUpdate&&On(e.cm,e.update)}function xn(e){var t=e.cm,i=t.display;e.updatedDisplay&&$i(t),e.barMeasure=an(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Yt(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Vt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Gt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function vn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=Ce(e,t.highlightFrontier),o=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var s=l.styles,d=l.text.length>e.options.maxHighlightLength?Z(t.mode,r.state):null,a=ve(e,l,r,!0);d&&(r.state=d),l.styles=a.styles;var p=l.styleClasses,c=a.classes;c?l.styleClasses=c:p&&(l.styleClasses=null);for(var h=!s||s.length!=l.styles.length||p!=c&&(!p||!c||p.bgClass!=c.bgClass||p.textClass!=c.textClass),u=0;!h&&un?(Ln(e,e.options.workDelay),!0):void 0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),o.length&&Cn(e,function(){for(var t=0;t=n.viewFrom&&i.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Pi(e))return!1;zn(e)&&(Wi(e),i.dims=ki(e));var o=r.first+r.size,l=Math.max(i.visible.from-e.options.viewportMargin,r.first),s=Math.min(o,i.visible.to+e.options.viewportMargin);n.viewFroml-n.viewFrom&&(l=Math.max(r.first,n.viewFrom)),n.viewTo>s&&20>n.viewTo-s&&(s=Math.min(o,n.viewTo)),hs&&(l=et(e.doc,l),s=tt(e.doc,s));var d=l!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=i.wrapperHeight||n.lastWrapWidth!=i.wrapperWidth;Hi(e,l,s),n.viewOffset=rt(ee(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var a=Pi(e);if(!d&&0==a&&!i.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var p=Mn(e);return 4=e.display.viewFrom&&t.visible.to<=e.display.viewTo))break;if(!On(e,t))break;$i(e);var r=an(e);Fi(e),pn(e,r),Fn(e,r),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Dn(e,t){var i=new Ss(e,t);if(On(e,i)){$i(e),Wn(e,i);var n=an(e);Fi(e),pn(e,n),Fn(e,n),i.finish()}}function Hn(e,n,r){function o(t){var i=t.nextSibling;return at&&Dl&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var l=e.display,s=e.options.lineNumbers,d=l.lineDiv,a=d.firstChild,p=l.view,c=l.viewFrom,h=0,g;hie&&(l.gutters.style.zIndex=-1,l.scroller.style.paddingRight=0),at||xl&&Wl||(l.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(l.wrapper):e(l.wrapper)),l.viewFrom=l.viewTo=t.first,l.reportedViewFrom=l.reportedViewTo=t.first,l.view=[],l.renderedView=null,l.externalMeasured=null,l.viewOffset=0,l.lastWrapHeight=l.lastWrapWidth=0,l.updateLineNumbers=null,l.nativeBarWidth=l.barHeight=l.barWidth=0,l.scrollbarsClipped=!1,l.lineNumWidth=l.lineNumInnerWidth=l.lineNumChars=null,l.alignWidgets=!1,l.cachedCharWidth=l.cachedTextHeight=l.cachedPaddingH=null,l.maxLine=null,l.maxLineLength=0,l.maxLineChanged=!1,l.wheelDX=l.wheelDY=l.wheelStartX=l.wheelStartY=null,l.shift=!1,l.selForContextMenu=null,l.activeTouch=null,l.gutterSpecs=En(n.gutters,n.lineNumbers),Rn(l),i.init(l)}function Vn(t){var e=t.wheelDeltaX,i=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta),{x:e,y:i}}function Gn(t){var e=Vn(t);return e.x*=Ts,e.y*=Ts,e}function Un(t,n){var e=Vn(n),r=e.x,o=e.y,l=t.display,s=l.scroller,d=s.scrollWidth>s.clientWidth,a=s.scrollHeight>s.clientHeight;if(r&&d||o&&a){if(o&&Dl&&at)outer:for(var p=n.target,c=l.view;p!=s;p=p.parentNode)for(var h=0;hu?g=Math.max(0,g+u-50):f=Math.min(t.doc.height,f+u+50),Dn(t,{top:g,bottom:f})}20>Ls&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=r,l.wheelDY=o,setTimeout(function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,i=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,i&&(Ts=(Ts*Ls+i)/(Ls+1),++Ls)}},200)):(l.wheelDX+=r,l.wheelDY+=o))}}function $n(e,t,n){var r=e&&e.options.selectionsMayTouch,o=t[n];t.sort(function(e,t){return pe(e.from(),t.from())}),n=u(t,o);for(var l=1;lpe(e,t.from))return e;if(0>=pe(e,t.to))return Xn(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Xn(t).ch-t.to.ch),ae(i,n)}function qn(e,t){for(var n=[],r=0,o;rpe(c.head,c.anchor);r[s]=new Ms(h?p:a,h?a:p)}else r[s]=new Ms(a,a)}return new Ns(r,e.sel.primIndex)}function Qn(e){e.doc.mode=q(e.options,e.doc.modeOption),Jn(e)}function Jn(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,Ln(e,100),e.state.modeGen++,e.curOp&&Ai(e)}function er(e,t){return 0==t.from.ch&&0==t.to.ch&&""==y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function tr(e,t,i,n){function r(e){return i?i[e]:null}function o(e,i,r){st(e,i,r,n),kt(e,"change",e,t)}function l(e,t){for(var o=[],l=e;lo-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(l=ar(r,r.lastOp==n)))s=y(l.changes),0==pe(t.from,t.to)&&0==pe(t.from,s.to)?s.to=Xn(t):l.changes.push(sr(e,t));else{var d=y(r.done);for(d&&d.ranges||ur(e.sel,r.done),l={changes:[sr(e,t)],generation:r.generation},r.done.push(l);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=o,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=t.origin,s||H(e,"historyAdded")}function cr(e,t,i,n){var r=t.charAt(0);return"*"==r||"+"==r&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function hr(e,t,i,n){var r=e.history,o=n&&n.origin;i==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||cr(e,o,y(r.done),t))?r.done[r.done.length-1]=t:ur(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=i,n&&!1!==n.clearRedo&&dr(r.undone)}function ur(e,t){var i=y(t);i&&i.ranges&&i.equals(e)||t.push(e)}function gr(e,t,i,r){var o=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(i){i.markedSpans&&((o||(o=t["spans_"+e.id]={}))[l]=i.markedSpans),++l})}function fr(e){if(!e)return null;for(var t=0,n;tpe(t,r);o==0>pe(i,r)?o!=0>pe(t,i)&&(t=i):(r=t,t=i)}return new Ms(r,t)}return new Ms(i||t,t)}function br(e,t,i,n,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),Tr(e,new Ns([vr(e.sel.primary(),t,i,r)],0),n)}function Cr(e,t,n){for(var r=[],o=e.cm&&(e.cm.display.shift||e.extend),l=0;lpe(t.primary().head,e.sel.primary().head)?-1:1);Mr(e,Or(e,t,n,!0)),!(i&&!1===i.scroll)&&e.cm&&Ji(e.cm)}function Mr(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,F(e.cm)),kt(e,"cursorActivity",e))}function Ar(e){Mr(e,Or(e,e.sel,null,!1))}function Or(e,t,n,r){for(var o=0,l;o=t.ch:d.to>t.ch))){if(o&&(H(a,"beforeCursorEnter"),a.explicitlyCleared))if(!l.markedSpans)break;else{--s;continue}if(!a.atomic)continue;if(n){var p=a.find(0>r?1:-1),c=void 0;if((0>r?a.inclusiveRight:a.inclusiveLeft)&&(p=Hr(e,p,-r,p&&p.line==t.line?l:null)),p&&p.line==t.line&&(c=pe(p,n))&&(0>r?0>c:0r?-1:1);return(0>r?a.inclusiveLeft:a.inclusiveRight)&&(h=Hr(e,h,r,h.line==t.line?l:null)),h?Wr(e,h,t,r,o):null}}return t}function Dr(e,t,i,n,r){var o=n||1,l=Wr(e,t,i,o,r)||!r&&Wr(e,t,i,o,!0)||Wr(e,t,i,-o,r)||!r&&Wr(e,t,i,-o,!0);return l?l:(e.cantEdit=!0,ae(e.first,0))}function Hr(e,t,i,n){return 0>i&&0==t.ch?t.line>e.first?me(e,ae(t.line-1)):null:0e.lastLine())){if(t.from.lineo&&(t={from:t.from,to:ae(o,ee(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=te(e,t.from,t.to),i||(i=qn(e,t)),e.cm?jr(e.cm,t,n):tr(e,t,n),Nr(e,i,Gl)}}function jr(e,t,i){var n=e.doc,r=e.display,o=t.from,l=t.to,s=!1,d=o.line;e.options.lineWrapping||(d=oe(Ze(ee(n,o.line))),n.iter(d,l.line+1,function(e){if(e==r.maxLine)return s=!0,!0})),-1r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),Ae(n,o.line),Ln(e,400);var a=t.text.length-(l.line-o.line)-1;t.full?Ai(e):o.line!=l.line||1!=t.text.length||er(e.doc,t)?Ai(e,o.line,l.line+1,a):Oi(e,o.line,"text");var p=I(e,"changes"),c=I(e,"change");if(c||p){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};c&&kt(e,"change",e,h),p&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Vr(e,t,i,n,r){var o;n||(n=i),0>pe(n,i)&&(o=[n,i],i=o[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Ir(e,{from:i,to:n,text:t,origin:r})}function Gr(e,t,i,n){i+new Date-Fs))return void j(i);if(!(P(t,i)||Et(t.display,i))&&(i.dataTransfer.setData("Text",t.getSelection()),i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setDragImage&&!Tl)){var e=r("img",null,null,"position: fixed; left: 0; top: 0;");e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Ll&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),i.dataTransfer.setDragImage(e,0,0),Ll&&e.parentNode.removeChild(e)}}function ro(t,i){var e=Ni(t,i);if(e){var o=document.createDocumentFragment();zi(t,e,o),t.display.dragCursor||(t.display.dragCursor=r("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),n(t.display.dragCursor,o)}}function oo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function lo(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0,o;r=pe(l.from,y(r).to);){var s=r.pop();if(0>pe(s.from,l.from)){l.from=s.from;break}}r.push(l)}Cn(e,function(){for(var t=r.length-1;0<=t;t--)Vr(e.doc,"",r[t].from,r[t].to,"+delete");Ji(e)})}function vo(e,t,i){var n=T(e.text,t+i,i);return 0>n||n>e.text.length?null:n}function bo(e,t,i){var n=vo(e,t.ch,i);return null==n?null:new ae(t.line,n,0>i?"after":"before")}function Co(e,t,i,n,r){if(e){var o=O(i,t.doc.direction);if(o){var l=0>r?y(o):o[0],s=0>r==(1==l.level),d=s?"after":"before",a;if(0r?i.text.length-1:0;var c=Zt(t,p,a).top;a=N(function(e){return Zt(t,p,e).top==c},0>r==(1==l.level)?l.from:l.to-1,a),"before"==d&&(a=vo(i,a,1))}else a=0>r?l.to:l.from;return new ae(n,a,d)}}return new ae(n,0>r?i.text.length:0,0>r?"before":"after")}function wo(e,t,i,n){var r=O(t,e.doc.direction);if(!r)return bo(t,i,n);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):0>=i.ch&&(i.ch=0,i.sticky="after");var o=A(r,i.ch,i.sticky),l=r[o];if("ltr"==e.doc.direction&&0==l.level%2&&(0i.ch:l.fromn,h=s(i,c?1:-1);if(null!=h&&(c?h<=l.to&&h<=a.end:h>=l.from&&h>=a.begin)){var u=c?"before":"after";return new ae(i.line,h,u)}}var g=function(e,t,n){for(var o=function(e,t){return t?new ae(i.line,s(e,1),"before"):new ae(i.line,e,"after")};0<=e&&eie&&27==t.keyCode&&(t.returnValue=!1);var i=t.keyCode;e.display.shift=16==i||t.shiftKey;var n=Oo(e,t);Ll&&(Us=n?i:null,!n&&88==i&&!es&&(Dl?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")),18!=i||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Ho(e)}}function Ho(e){function t(n){18!=n.keyCode&&n.altKey||(El(i,"CodeMirror-crosshair"),D(document,"keyup",t),D(document,"mouseover",t))}var i=e.display.lineDiv;d(i,"CodeMirror-crosshair"),Ql(document,"keyup",t),Ql(document,"mouseover",t)}function Po(t){16==t.keyCode&&(this.doc.sel.shift=!1),P(this,t)}function Fo(t){var e=this;if(!(Et(e.display,t)||P(e,t)||t.ctrlKey&&!t.altKey||Dl&&t.metaKey)){var i=t.keyCode,n=t.charCode;if(Ll&&i==Us)return Us=null,void E(t);if(!(Ll&&(!t.which||10>t.which)&&Oo(e,t))){var r=String.fromCharCode(null==n?i:n);"\b"==r||Wo(e,t,r)||e.display.input.onKeyPress(t)}}}function Io(e,t){var i=+new Date;return _s&&_s.compare(i,e,t)?(qs=_s=null,"triple"):qs&&qs.compare(i,e,t)?(_s=new $s(i,e,t),qs=null,"double"):(qs=new $s(i,e,t),_s=null,"single")}function zo(t){var e=this,i=e.display;if(!(P(e,t)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=t.shiftKey,Et(i,t))return void(at||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100)));if(!Ko(e,t)){var n=Ni(e,t),r=G(t),o=n?Io(n,r):"single";window.focus(),1==r&&e.state.selectingText&&e.state.selectingText(t),n&&Eo(e,r,n,o,t)||(1==r?n?Bo(e,n,o,t):V(t)==i.scroller&&E(t):2==r?(n&&br(e.doc,n),setTimeout(function(){return i.input.focus()},20)):3==r&&(zl?e.display.input.onContextMenu(t):Vi(e)))}}}function Eo(e,t,i,n,r){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,Mo(e,fo(o,r),r,function(t){if("string"==typeof t&&(t=Vs[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,i)!=Vl}finally{e.state.suppressEdits=!1}return n})}function Ro(e,t,i){var n=e.getOption("configureMouse"),r=n?n(e,t,i):{};if(null==r.unit){var o=Hl?i.shiftKey&&i.metaKey:i.altKey;r.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==r.extend||e.doc.extend)&&(r.extend=e.doc.extend||i.shiftKey),null==r.addNew&&(r.addNew=Dl?i.metaKey:i.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=Dl?!i.altKey:!i.ctrlKey),r}function Bo(e,t,i,n){wl?setTimeout(p(ji,e),0):e.curOp.focus=s();var r=Ro(e,i,n),o=e.doc.sel,l;e.options.dragDrop&&m&&!e.isReadOnly()&&"single"==i&&-1<(l=o.contains(t))&&(0>pe((l=o.ranges[l]).from(),t)||0t.xRel)?jo(e,n,t,r):Go(e,n,t,r)}function jo(t,e,i,n){var r=t.display,o=!1,l=wn(t,function(a){at&&(r.scroller.draggable=!1),t.state.draggingText=!1,D(r.wrapper.ownerDocument,"mouseup",l),D(r.wrapper.ownerDocument,"mousemove",s),D(r.scroller,"dragstart",d),D(r.scroller,"drop",l),o||(E(a),!n.addNew&&br(t.doc,i,null,null,n.extend),at||wl&&9==ie?setTimeout(function(){r.wrapper.ownerDocument.body.focus(),r.input.focus()},20):r.input.focus())}),s=function(t){o=o||10<=Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)},d=function(){return o=!0};at&&(r.scroller.draggable=!0),t.state.draggingText=l,l.copy=!n.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),Ql(r.wrapper.ownerDocument,"mouseup",l),Ql(r.wrapper.ownerDocument,"mousemove",s),Ql(r.scroller,"dragstart",d),Ql(r.scroller,"drop",l),Vi(t),setTimeout(function(){return r.input.focus()},20)}function Vo(e,t,i){if("char"==i)return new Ms(t,t);if("word"==i)return e.findWordAt(t);if("line"==i)return new Ms(ae(t.line,0),me(e.doc,ae(t.line+1,0)));var n=i(e,t);return new Ms(n.from,n.to)}function Go(t,e,i,n){function r(e){if(0!=pe(y,e))if(y=e,"rectangle"==n.unit){for(var r=[],o=t.options.tabSize,l=h(ee(a,i.line).text,i.ch,o),s=h(ee(a,e.line).text,e.ch,o),d=Math.min(l,s),c=Math.max(l,s),m=Math.min(i.line,e.line),x=Math.min(t.lastLine(),Math.max(i.line,e.line));m<=x;m++){var v=ee(a,m).text,b=g(v,d,o);d==c?r.push(new Ms(ae(m,b),ae(m,b))):v.length>b&&r.push(new Ms(ae(m,b),ae(m,g(v,c,o))))}r.length||r.push(new Ms(i,i)),Tr(a,$n(t,p.ranges.slice(0,f).concat(r),f),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var C=u,w=Vo(t,e,n.unit),k=C.anchor,S;0=p.to||l.linex.bottom?20:0;c&&setTimeout(wn(t,function(){v!=e||(d.scroller.scrollTop+=c,o(i))}),50)}}function l(i){t.state.selectingText=!1,v=1/0,i&&(E(i),d.input.focus()),D(d.wrapper.ownerDocument,"mousemove",b),D(d.wrapper.ownerDocument,"mouseup",C),a.history.lastSelOrigin=null}var d=t.display,a=t.doc;E(e);var p=a.sel,c=p.ranges,u,f;if(n.addNew&&!n.extend?(f=a.sel.contains(i),u=-1c:0=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&E(n);var s=t.display,d=s.lineDiv.getBoundingClientRect();if(l>d.bottom||!I(t,e))return B(n);l-=d.top-s.viewOffset;for(var a=0,p;a=o){var c=le(t.doc,l),h=t.display.gutterSpecs[a];return H(t,e,t,c,h.className,n),B(n)}}function Ko(t,i){return $o(t,i,"gutterClick",!0)}function Xo(t,i){Et(t.display,i)||Yo(t,i)||P(t,i,"contextmenu")||!zl&&t.display.input.onContextMenu(i)}function Yo(t,i){return!!I(t,"gutterContextMenu")&&$o(t,i,"gutterContextMenu",!1)}function qo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}function _o(e,t,i){if(!t!=!(i&&i!=Ks)){var n=e.display.dragFunctions,r=t?Ql:D;r(e.display.scroller,"dragstart",n.start),r(e.display.scroller,"dragenter",n.enter),r(e.display.scroller,"dragover",n.over),r(e.display.scroller,"dragleave",n.leave),r(e.display.scroller,"drop",n.drop)}}function Zo(e){e.options.lineWrapping?(d(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(El(e.display.wrapper,"CodeMirror-wrap"),lt(e)),Ti(e),Ai(e),ri(e),setTimeout(function(){return pn(e)},100)}function Qo(e,t){var n=this;if(!(this instanceof Qo))return new Qo(e,t);this.options=t=t?c(t):{},c(Xs,t,!1);var r=t.value;"string"==typeof r?r=new Ps(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var o=new Qo.inputStyles[t.inputStyle](this),l=this.display=new jn(e,r,o,t);for(var s in l.wrapper.CodeMirror=this,qo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),hn(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 jl,keySeq:null,specialChars:null},t.autofocus&&!Wl&&l.input.focus(),wl&&11>ie&&setTimeout(function(){return n.display.input.reset(!0)},20),Jo(this),so(),un(this),this.curOp.forceUpdate=!0,nr(this,r),t.autofocus&&!Wl||this.hasFocus()?setTimeout(p(Gi,this),20):Ui(this),Ys)Ys.hasOwnProperty(s)&&Ys[s](this,t[s],Ks);zn(this),t.finishInit&&t.finishInit(this);for(var d=0;d=e.radiusX&&1>=e.radiusY}function r(e,t){if(null==t.left)return!0;var i=t.left-e.left,n=t.top-e.top;return 400ie?Ql(o.scroller,"dblclick",wn(t,function(i){if(!P(t,i)){var e=Ni(t,i);if(!(!e||Ko(t,i)||Et(t.display,i))){E(i);var n=t.findWordAt(e);br(t.doc,n.anchor,n.head)}}})):Ql(o.scroller,"dblclick",function(i){return P(t,i)||E(i)}),Ql(o.scroller,"contextmenu",function(i){return Xo(t,i)});var l={end:0},s;Ql(o.scroller,"touchstart",function(i){if(!P(t,i)&&!n(i)&&!Ko(t,i)){o.input.ensurePolled(),clearTimeout(s);var e=+new Date;o.activeTouch={start:e,moved:!1,prev:300>=e-l.end?l:null},1==i.touches.length&&(o.activeTouch.left=i.touches[0].pageX,o.activeTouch.top=i.touches[0].pageY)}}),Ql(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),Ql(o.scroller,"touchend",function(n){var e=o.activeTouch;if(e&&!Et(o,n)&&null!=e.left&&!e.moved&&300>new Date-e.start){var l=t.coordsChar(o.activeTouch,"page"),s;s=!e.prev||r(e,e.prev)?new Ms(l,l):!e.prev.prev||r(e,e.prev.prev)?t.findWordAt(l):new Ms(ae(l.line,0),me(t.doc,ae(l.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),E(n)}i()}),Ql(o.scroller,"touchcancel",i),Ql(o.scroller,"scroll",function(){o.scroller.clientHeight&&(ln(t,o.scroller.scrollTop),dn(t,o.scroller.scrollLeft,!0),H(t,"scroll",t))}),Ql(o.scroller,"mousewheel",function(i){return Un(t,i)}),Ql(o.scroller,"DOMMouseScroll",function(i){return Un(t,i)}),Ql(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(i){P(t,i)||j(i)},over:function(i){P(t,i)||(ro(t,i),j(i))},start:function(i){return no(t,i)},drop:wn(t,io),leave:function(i){P(t,i)||oo(t)}};var d=o.input.getField();Ql(d,"keyup",function(i){return Po.call(t,i)}),Ql(d,"keydown",wn(t,Do)),Ql(d,"keypress",wn(t,Fo)),Ql(d,"focus",function(i){return Gi(t,i)}),Ql(d,"blur",function(i){return Ui(t,i)})}function el(e,t,n,r){var o=e.doc,l;null==n&&(n="add"),"smart"==n&&(o.mode.indent?l=Ce(e,t).state:n="prev");var s=e.options.tabSize,d=ee(o,t),a=h(d.text,null,s);d.stateAfter&&(d.stateAfter=null);var p=d.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(d.text))c=0,n="not";else if("smart"==n&&(c=o.mode.indent(l,d.text.slice(p.length),d.text),c==Vl||150o.first?c=h(ee(o,t-1).text,null,s):c=0:"add"==n?c=a+e.options.indentUnit:"subtract"==n?c=a-e.options.indentUnit:"number"==typeof n&&(c=a+n),c=Math.max(0,c);var u="",g=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/s);m;--m)g+=s,u+="\t";if(gs,a=on(t),p=null;if(d&&1s?"cut":"+input")};Ir(e.doc,v),kt(e,"inputRead",e,v)}t&&!d&&rl(e,t),Ji(e),2>e.curOp.updateInput&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function nl(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Cn(e,function(){return il(e,i,0,null,"paste")}),!0}function rl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1,o;0<=r;r--)if(o=n.ranges[r],!(100=e.first+e.size)&&(t=new ae(n,t.ch,t.sticky),a=ee(e,n))}function l(n){var l;if(l=r?wo(e.cm,a,t,i):bo(a,t,i),null!=l)t=l;else if(!n&&o())t=Co(r,e.cm,a,t.line,i);else return!1;return!0}var s=t,d=i,a=ee(e,t.line);if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var p=null,c="group"==n,h=e.cm&&e.cm.getHelper(t,"wordChars"),u=!0;;u=!1){if(0>i&&!l(!u))break;var g=a.text.charAt(t.ch)||"\n",f=k(g,h)?"w":c&&"\n"==g?"n":!c||/\s/.test(g)?null:"p";if(!c||u||f||(f="s"),p&&p!=f){0>i&&(i=1,l(),t.sticky="after");break}if(f&&(p=f),0i?0>=l:l>=r.height){a.hitSide=!0;break}l+=5*i}return a}function pl(e,t){var i=qt(e,t.line);if(!i||i.hidden)return null;var n=ee(e.doc,t.line),r=Kt(i,n,t.line),o=O(n,e.doc.direction),l="left";if(o){var s=A(o,t.ch);l=s%2?"right":"left"}var d=Qt(r.map,t.ch,l);return d.offset="right"==d.collapse?d.end:d.start,d}function cl(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function hl(e,t){return t&&(e.bad=!0),e}function ul(e,t,i,n,r){function o(e){return function(t){return t.id==e}}function l(){p&&(a+=c,h&&(a+=c),p=h=!1)}function s(e){e&&(l(),a+=e)}function d(t){if(1==t.nodeType){var a=t.getAttribute("cm-text");if(a)return void s(a);var u=t.getAttribute("cm-marker"),g;if(u){var f=e.findMarks(ae(n,0),ae(r+1,0),o(+u));return void(f.length&&(g=f[0].find(0))&&s(te(e.doc,g.from,g.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&l();for(var y=0;yo?p.map:c[o];for(var s=0,d;so?e.line:e.rest[o]),h=l[s]+r;return(0>r||d!=t)&&(h=l[s+(r?1:0)]),ae(a,h)}}}var r=e.text.firstChild,o=!1;if(!t||!l(r,t))return hl(ae(oe(e.line),0),!0);if(t==r&&(o=!0,t=r.childNodes[i],i=0,!t)){var s=e.rest?y(e.rest):e.line;return hl(ae(oe(s),s.text.length),o)}var d=3==t.nodeType?t:null,a=t;for(d||1!=t.childNodes.length||3!=t.firstChild.nodeType||(d=t.firstChild,i&&(i=d.nodeValue.length));a.parentNode!=r;)a=a.parentNode;var p=e.measure,c=p.maps,h=n(d,a,i);if(h)return hl(h,o);for(var u=a.nextSibling,g=d?d.nodeValue.length-i:0;u;u=u.nextSibling){if(h=n(u,u.firstChild,0),h)return hl(ae(h.line,h.ch-g),o);g+=u.textContent.length}for(var f=a.previousSibling,m=i;f;f=f.previousSibling){if(h=n(f,f.firstChild,-1),h)return hl(ae(h.line,h.ch+m),o);m+=f.textContent.length}}var ml=navigator.userAgent,yl=navigator.platform,xl=/gecko\/\d/i.test(ml),vl=/MSIE \d/.test(ml),bl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ml),Cl=/Edge\/(\d+)/.exec(ml),wl=vl||bl||Cl,ie=wl&&(vl?document.documentMode||6:+(Cl||bl)[1]),at=!Cl&&/WebKit\//.test(ml),kl=at&&/Qt\/\d+\.\d+/.test(ml),Sl=!Cl&&/Chrome\//.test(ml),Ll=/Opera\//.test(ml),Tl=/Apple Computer/.test(navigator.vendor),Nl=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ml),Ml=/PhantomJS/.test(ml),Al=!Cl&&/AppleWebKit/.test(ml)&&/Mobile\/\w+/.test(ml),Ol=/Android/.test(ml),Wl=Al||Ol||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ml),Dl=Al||/Mac/.test(yl),Hl=/\bCrOS\b/.test(ml),Pl=/win/i.test(yl),Fl=Ll&&ml.match(/Version\/(\d*\.\d*)/);Fl&&(Fl=+Fl[1]),Fl&&15<=Fl&&(Ll=!1,at=!0);var Il=Dl&&(kl||Ll&&(null==Fl||12.11>Fl)),zl=xl||wl&&9<=ie,El=function(t,i){var n=t.className,r=e(i).exec(n);if(r){var o=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(o?r[1]+o:"")}},Rl;Rl=document.createRange?function(e,t,i,n){var o=document.createRange();return o.setEnd(n||e,i),o.setStart(e,t),o}:function(e,t,i){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(t){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};var Bl=function(e){e.select()};Al?Bl=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:wl&&(Bl=function(e){try{e.select()}catch(e){}});var jl=function(){this.id=null};jl.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Vl={toString:function(){return"CodeMirror.Pass"}},Gl={scroll:!1},Ul={origin:"*mouse"},$l={origin:"+move"},Kl=[""],Xl=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Yl=/[\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]/,ql=null,_l=function(){function e(e){return 247>=e?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(e):1424<=e&&1524>=e?"R":1536<=e&&1785>=e?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(e-1536):1774<=e&&2220>=e?"r":8192<=e&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,i){this.level=e,this.from=t,this.to=i}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,s=/[1n]/;return function(d,a){var p="ltr"==a?"L":"R";if(0==d.length||"ltr"==a&&!n.test(d))return!1;for(var c=d.length,h=[],u=0;uie)return!1;var e=r("div");return"draggable"in e||"dragDrop"in e}(),on=3=="\n\nb".split(/\n/).length?function(e){return e.split(/\r\n?|\n/)}:function(e){for(var t=0,i=[],n=e.length,r;t<=n;){r=e.indexOf("\n",t),-1==r&&(r=e.length);var o=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),l=o.indexOf("\r");-1==l?(i.push(o),t=r+1):(i.push(o.slice(0,l)),t+=l+1)}return i},Jl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(t){}return!!(t&&t.parentElement()==e)&&0!=t.compareEndPoints("StartToEnd",t)},es=function(){var t=r("div");return!!("oncopy"in t)||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),ts=null,is={},ns={},rs={},os=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i},ls,ss;os.prototype.eol=function(){return this.pos>=this.string.length},os.prototype.sol=function(){return this.pos==this.lineStart},os.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},os.prototype.next=function(){if(this.post},os.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},os.prototype.skipToEnd=function(){this.pos=this.string.length},os.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=e),t},as.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}},as.prototype.nextLine=function(){this.line++,0ie&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")},bs;vs.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var r=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0=pe(e,r.to()))return n;return-1};var Ms=function(e,t){this.anchor=e,this.head=t};Ms.prototype.from=function(){return ge(this.anchor,this.head)},Ms.prototype.to=function(){return ue(this.anchor,this.head)},Ms.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Xr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r;nthis.size-t&&(1=this.children.length)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Yr(t);if(!e.parent){var n=new Yr(e.children);n.parent=e,e.children=[n,i],e=n}else{e.size-=i.size,e.height-=i.height;var r=u(e.parent.children,e);e.parent.children.splice(r+1,0,i)}i.parent=e.parent}while(10e.display.maxLineLength&&(e.display.maxLine=p,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Ai(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ar(e.doc)),e&&kt(e,"markerCleared",e,this,r,o),t&&gn(e),this.parent&&this.parent.clear()}},Ws.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n=0,r,o;n=e.ch)&&t.push(o.marker.parent||o.marker);return t},findMarks:function(e,t,n){e=me(this,e),t=me(this,t);var r=[],o=e.line;return this.iter(e.line,t.line+1,function(l){var s=l.markedSpans;if(s)for(var d=0,a;d=a.to||null==a.from&&o!=e.line||null!=a.from&&o==t.line&&a.from>=t.ch||n&&!n(a.marker)||r.push(a.marker.parent||a.marker);++o}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(n=e,!0):void(e-=o,++t)}),me(this,ae(t,n))},indexFromPos:function(e){e=me(this,e);var t=e.ch;if(e.linee.ch)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+i}),t},copy:function(e){var t=new Ps(ne(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,i=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.toEs;Es++)zs[Es+48]=zs[Es+96]=Es+"";for(var Rs=65;90>=Rs;Rs++)zs[Rs]=String.fromCharCode(Rs);for(var Bs=1;12>=Bs;Bs++)zs[Bs+111]=zs[Bs+63235]="F"+Bs;var js={};js.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"},js.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"},js.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"},js.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"]},js["default"]=Dl?js.macDefault:js.pcDefault;var Vs={selectAll:Pr,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Gl)},killLine:function(e){return xo(e,function(t){if(t.empty()){var i=ee(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.linee.doc.first){var s=ee(e.doc,o.line-1).text;s&&(o=new ae(o.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),ae(o.line-1,s.length-1),o,"+transpose"))}n.push(new Ms(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return Cn(e,function(){for(var t=e.listSelections(),n=t.length-1;0<=n;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&0==pe(t,this.pos)&&i==this.button};var Ks={toString:function(){return"CodeMirror.Init"}},Xs={},Ys={},qs,_s;Qo.defaults=Xs,Qo.optionHandlers=Ys;var Zs=[];Qo.defineInitHook=function(e){return Zs.push(e)};var Qs=null,Js=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new jl,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Js.prototype.init=function(e){function t(t){if(!P(r,t)){if(r.somethingSelected())tl({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=ol(r);tl({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation(function(){r.setSelections(e.ranges,0,Gl),r.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var i=Qs.text.join("\n");if(t.clipboardData.setData("Text",i),t.clipboardData.getData("Text")==i)return void t.preventDefault()}var l=sl(),s=l.firstChild;r.display.lineSpace.insertBefore(l,r.display.lineSpace.firstChild),s.value=Qs.text.join("\n");var d=document.activeElement;Bl(s),setTimeout(function(){r.display.lineSpace.removeChild(l),d.focus(),d==o&&n.showPrimarySelection()},50)}}var i=this,n=this,r=n.cm,o=n.div=e.lineDiv;ll(o,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),Ql(o,"paste",function(t){P(r,t)||nl(t,r)||11>=ie&&setTimeout(wn(r,function(){return i.updateFromDOM()}),20)}),Ql(o,"compositionstart",function(t){i.composing={data:t.data,done:!1}}),Ql(o,"compositionupdate",function(t){i.composing||(i.composing={data:t.data,done:!1})}),Ql(o,"compositionend",function(t){i.composing&&(t.data!=i.composing.data&&i.readFromDOMSoon(),i.composing.done=!0)}),Ql(o,"touchstart",function(){return n.forceCompositionEnd()}),Ql(o,"input",function(){i.composing||i.readFromDOMSoon()}),Ql(o,"copy",t),Ql(o,"cut",t)},Js.prototype.prepareSelection=function(){var e=Ii(this.cm,!1);return e.focus=this.cm.state.focused,e},Js.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Js.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Js.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),n=i.from(),r=i.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||r.line=t.display.viewFrom&&pl(t,n)||{node:s[0].measure.map[2],offset:0},a=r.linee.firstLine()&&(n=ae(n.line-1,ee(e.doc,n.line-1).length)),r.ch==ee(e.doc,r.line).text.length&&r.linet.viewTo-1)return!1;var o,l,s;n.line==t.viewFrom||0==(o=Mi(e,n.line))?(l=oe(t.view[0].line),s=t.view[0].node):(l=oe(t.view[o].line),s=t.view[o-1].node.nextSibling);var d=Mi(e,r.line),a,p;if(d==t.view.length-1?(a=t.viewTo-1,p=t.lineDiv.lastChild):(a=oe(t.view[d+1].line)-1,p=t.view[d+1].node.previousSibling),!s)return!1;for(var c=e.doc.splitLines(ul(e,s,p,l,a)),h=te(e.doc,ae(l,0),ae(a,ee(e.doc,a).text.length));1n.ch&&v.charCodeAt(v.length-g-1)==b.charCodeAt(b.length-g-1);)u--,g++;c[c.length-1]=v.slice(0,v.length-g).replace(/^\u200b+/,""),c[0]=c[0].slice(u).replace(/\u200b+$/,"");var w=ae(l,u),k=ae(a,h.length?y(h).length-g:0);if(1ie&&l.scrollbars.setScrollTop(l.scroller.scrollTop=d),null!=s.selectionStart)){(!wl||wl&&9>ie)&&e();var t=0,a=function(){l.selForContextMenu==o.doc.sel&&0==s.selectionStart&&0t++?l.detectingSelectAll=setTimeout(a,500):(l.selForContextMenu=null,l.input.reset())};l.detectingSelectAll=setTimeout(a,200)}}var r=this,o=r.cm,l=o.display,s=r.textarea;r.contextMenuPending&&r.contextMenuPending();var i=Ni(o,t),d=l.scroller.scrollTop;if(i&&!Ll){var a=o.options.resetSelectionOnContextMenu;a&&-1==o.doc.sel.contains(i)&&wn(o,Tr)(o.doc,Kn(i),Gl);var p=s.style.cssText,c=r.wrapper.style.cssText,h=r.wrapper.offsetParent.getBoundingClientRect();r.wrapper.style.cssText="position: static",s.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-h.top-5)+"px; left: "+(t.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(wl?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var u;if(at&&(u=window.scrollY),l.input.focus(),at&&window.scrollTo(null,u),l.input.reset(),o.somethingSelected()||(s.value=r.prevInput=" "),r.contextMenuPending=n,l.selForContextMenu=o.doc.sel,clearTimeout(l.detectingSelectAll),wl&&9<=ie&&e(),zl){j(t);var g=function(){D(window,"mouseup",g),setTimeout(n,20)};Ql(window,"mouseup",g)}else setTimeout(n,50)}},ed.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},ed.prototype.setUneditable=function(){},ed.prototype.needsContentAttribute=!1,function(e){function t(t,n,r,o){e.defaults[t]=n,r&&(i[t]=o?function(e,t,i){i!=Ks&&r(e,t,i)}:r)}var i=e.optionHandlers;e.defineOption=t,e.Init=Ks,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,Qn(e)},!0),t("indentUnit",2,Qn,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Jn(e),ri(e),Ai(e)},!0),t("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,o;;){if(o=e.text.indexOf(t,i),-1==o)break;i=o+t.length,n.push(ae(r,o))}r++});for(var o=n.length-1;0<=o;o--)Vr(e.doc,t,n[o],ae(n[o].line,n[o].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,i){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),i!=Ks&&e.refresh()}),t("specialCharPlaceholder",ht,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Wl?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),t("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),t("rtlMoveVisually",!Pl),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){qo(e),Bn(e)},!0),t("keyMap","default",function(e,t,i){var n=yo(t),r=i!=Ks&&yo(i);r&&r.detach&&r.detach(e,n),n.attach&&n.attach(e,r||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Zo,!0),t("gutters",[],function(e,t){e.display.gutterSpecs=En(t,e.options.lineNumbers),Bn(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Si(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return pn(e)},!0),t("scrollbarStyle","native",function(e){hn(e),pn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e,t){e.display.gutterSpecs=En(e.options.gutters,t),Bn(e)},!0),t("firstLineNumber",1,Bn,!0),t("lineNumberFormatter",function(e){return e},Bn,!0),t("showCursorWhenSelecting",!1,Fi,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("selectionsMayTouch",!1),t("readOnly",!1,function(e,t){"nocursor"==t&&(Ui(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,_o),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,Fi,!0),t("singleCursorHeightPerLine",!0,Fi,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Jn,!0),t("addModeClass",!1,Jn,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Jn,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),t("phrases",null)}(Qo),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,i){var n=this.options,r=n[e];n[e]==i&&"mode"!=e||(n[e]=i,t.hasOwnProperty(e)&&wn(this,t[e])(this,i,r),H(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"](yo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(el(this,o.head.line,e,!0),n=o.head.line,r==this.doc.sel.primIndex&&Ji(this))}),getTokenAt:function(e,t){return Le(this,e,t)},getLineTokens:function(e,t){return Le(this,ae(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t=be(this,ee(this.doc,e.line)),i=0,n=(t.length-1)/2,r=e.ch,o;if(0==r)o=t[2];else for(;;){var l=i+n>>1;if((l?t[2*l-1]:0)>=r)n=l;else if(t[2*l+1]s?o:0==s?null:o.slice(0,s-1)},getModeAt:function(t){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(t).state).mode:i},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!n.hasOwnProperty(t))return r;var o=n[t],l=this.getModeAt(e);if("string"==typeof l[t])o[l[t]]&&r.push(o[l[t]]);else if(l[t])for(var s=0,d;so&&(e=o,n=!0),r=ee(this.doc,e)}else r=e;return di(this,r,{top:0,left:0},t||"page",i||n).top+(n?this.doc.height-rt(r):0)},defaultTextHeight:function(){return Ci(this.display)},defaultCharWidth:function(){return wi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,r){var o=this.display;e=ci(this,me(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var d=Math.max(o.wrapper.clientHeight,this.doc.height),a=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(l=e.bottom),s+t.offsetWidth>a&&(s=a-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==r?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),i&&_i(this,{left:s,top:l,right:s+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:kn(Do),triggerOnKeyPress:kn(Fo),triggerOnKeyUp:Po,triggerOnMouseDown:kn(zo),execCommand:function(e){if(Vs.hasOwnProperty(e))return Vs[e].call(null,this)},triggerElectric:kn(function(e){rl(this,e)}),findPosH:function(e,t,n,r){var o=1;0>t&&(o=-1,t=-t);for(var l=me(this.doc,e),s=0;se?n.from():n.to()},$l)}),deleteH:kn(function(e,t){var i=this.doc.sel,n=this.doc;i.somethingSelected()?n.replaceSelection("",null,"+delete"):xo(this,function(i){var r=dl(n,i.head,e,t,!1);return 0>e?{from:r,to:i.head}:{from:i.head,to:r}})}),findPosV:function(e,t,n,r){var o=1,l=r;0>t&&(o=-1,t=-t);for(var s=me(this.doc,e),d=0,a;de?i.from():i.to();var s=ci(n,i.head,"div");null!=i.goalColumn&&(s.left=i.goalColumn),o.push(s.left);var d=al(n,s,e,t);return"page"==t&&i==r.sel.primary()&&Qi(n,pi(n,d,"div").top-s.top),d},$l),o.length)for(var s=0;su(td,id)&&(Qo.prototype[id]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ps.prototype[id]));return z(Ps),Qo.inputStyles={textarea:ed,contenteditable:Js},Qo.defineMode=function(e){Qo.defaults.mode||"null"==e||(Qo.defaults.mode=e),X.apply(this,arguments)},Qo.defineMIME=function(e,t){ns[e]=t},Qo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qo.defineMIME("text/plain","null"),Qo.defineExtension=function(e,t){Qo.prototype[e]=t},Qo.defineDocExtension=function(e,t){Ps.prototype[e]=t},Qo.fromTextArea=function(e,t){function i(){e.value=d.getValue()}if(t=t?c(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=s();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}var r;if(e.form&&(Ql(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var o=e.form;r=o.submit;try{var l=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=l}}catch(t){}}t.finishInit=function(t){t.save=i,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,i(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(D(e.form,"submit",i),"function"==typeof e.form.submit&&(e.form.submit=r))}},e.style.display="none";var d=Qo(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return d},function(e){e.off=D,e.on=Ql,e.wheelEventPixels=Gn,e.Doc=Ps,e.splitLines=on,e.countColumn=h,e.findColumn=g,e.isWordChar=w,e.Pass=Vl,e.signal=H,e.Line=us,e.changeEnd=Xn,e.scrollbarModel=ws,e.Pos=ae,e.cmpPos=pe,e.modes=is,e.mimeModes=ns,e.resolveMode=Y,e.getMode=q,e.modeExtensions=rs,e.extendMode=_,e.copyState=Z,e.startState=J,e.innerMode=Q,e.commands=Vs,e.keyMap=js,e.keyName=mo,e.isModifierKey=go,e.lookupKey=uo,e.normalizeKeyMap=ho,e.StringStream=os,e.SharedTextMarker=Ds,e.TextMarker=Ws,e.LineWidget=As,e.e_preventDefault=E,e.e_stopPropagation=R,e.e_stop=j,e.addClass=d,e.contains=l,e.rmClass=El,e.keyNames=zs}(Qo),Qo.version="5.47.1",Qo});(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";e.defineMode("javascript",function(t,n){function r(e){for(var t=!1,i=!1,n;null!=(n=e.next());){if(!t){if("/"==n&&!i)return;"["==n?i=!0:i&&"]"==n&&(i=!1)}t=!t&&"\\"==n}}function o(e,t,i){return Ze=e,Qe=i,t}function l(e,t){var i=e.next();if("\""==i||"'"==i)return t.tokenize=s(i),t.tokenize(e,t);if("."==i&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==i&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return o(i);if("="==i&&e.eat(">"))return o("=>","operator");if("0"==i&&e.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return o("number","number");if(/\d/.test(i))return e.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),o("number","number");if("/"==i)return e.eat("*")?(t.tokenize=d,d(e,t)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):Re(e,t,1)?(r(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),o("regexp","string-2")):(e.eat("="),o("operator","operator",e.current()));if("`"==i)return t.tokenize=a,a(e,t);if("#"==i)return e.skipToEnd(),o("error","error");if(Xe.test(i))return">"==i&&t.lexical&&">"==t.lexical.type||(e.eat("=")?("!"==i||"="==i)&&e.eat("="):/[<>*+\-]/.test(i)&&(e.eat(i),">"==i&&e.eat(i))),o("operator","operator",e.current());if($e.test(i)){e.eatWhile($e);var n=e.current();if("."!=t.lastType){if(Ke.propertyIsEnumerable(n)){var l=Ke[n];return o(l.type,l.style,n)}if("async"==n&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return o("async","keyword",n)}return o("variable","variable",n)}}function s(e){return function(t,i){var n=!1,r;if(Ve&&"@"==t.peek()&&t.match(Ye))return i.tokenize=l,o("jsonld-keyword","meta");for(;null!=(r=t.next())&&(r!=e||n);)n=!n&&"\\"==r;return n||(i.tokenize=l),o("string","string")}}function d(e,t){for(var i=!1,n;n=e.next();){if("/"==n&&i){t.tokenize=l;break}i="*"==n}return o("comment","comment")}function a(e,t){for(var i=!1,n;null!=(n=e.next());){if(!i&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=l;break}i=!i&&"\\"==n}return o("quasi","string-2",e.current())}function p(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var i=e.string.indexOf("=>",e.start);if(!(0>i)){if(Ue){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,i));n&&(i=n.index)}for(var r=0,o=!1,l=i-1;0<=l;--l){var s=e.string.charAt(l),d="([{}])".indexOf(s);if(0<=d&&3>d){if(!r){++l;break}if(0==--r){"("==s&&(o=!0);break}}else if(3<=d&&6>d)++r;else if($e.test(s))o=!0;else{if(/["'\/]/.test(s))return;if(o&&!r){++l;break}}}o&&!r&&(t.fatArrowAt=l)}}function c(e,t,i,n,r,o){this.indented=e,this.column=t,this.type=i,this.prev=r,this.info=o,null!=n&&(this.align=n)}function h(e,t){for(var i=e.localVars;i;i=i.next)if(i.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var i=n.vars;i;i=i.next)if(i.name==t)return!0}function u(e,t,i,n,r){var o=e.cc;for(_e.state=e,_e.stream=r,_e.marked=null,_e.cc=o,_e.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var l=o.length?o.pop():Ge?O:M;if(l(i,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return _e.marked?_e.marked:"variable"==i&&h(e,n)?"variable-2":t}}}function g(){for(var e=arguments.length-1;0<=e;e--)_e.cc.push(arguments[e])}function f(){return g.apply(null,arguments),!0}function m(e,t){for(var i=t;i;i=i.next)if(i.name==e)return!0;return!1}function y(e){var t=_e.state;if(_e.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var i=x(e,t.context);if(null!=i)return void(t.context=i)}else if(!m(e,t.localVars))return void(t.localVars=new C(e,t.localVars));n.globalVars&&!m(e,t.globalVars)&&(t.globalVars=new C(e,t.globalVars))}function x(e,t){if(!t)return null;if(t.block){var i=x(e,t.prev);return i?i==t.prev?t:new b(i,t.vars,!0):null}return m(e,t.vars)?t:new b(t.prev,new C(e,t.vars),!1)}function v(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function b(e,t,i){this.prev=e,this.vars=t,this.block=i}function C(e,t){this.name=e,this.next=t}function w(){_e.state.context=new b(_e.state.context,_e.state.localVars,!1),_e.state.localVars=i}function k(){_e.state.context=new b(_e.state.context,_e.state.localVars,!0),_e.state.localVars=null}function S(){_e.state.localVars=_e.state.context.vars,_e.state.context=_e.state.context.prev}function L(e,t){var i=function(){var i=_e.state,n=i.indented;if("stat"==i.lexical.type)n=i.lexical.indented;else for(var r=i.lexical;r&&")"==r.type&&r.align;r=r.prev)n=r.indented;i.lexical=new c(n,_e.stream.column(),e,null,i.lexical,t)};return i.lex=!0,i}function T(){var e=_e.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function N(e){function t(i){return i==e?f():";"==e||"}"==i||")"==i||"]"==i?g():f(t)}return t}function M(e,t){return"var"==e?f(L("vardef",t),ae,N(";"),T):"keyword a"==e?f(L("form"),D,M,T):"keyword b"==e?f(L("form"),M,T):"keyword d"==e?_e.stream.match(/^\s*$/,!1)?f():f(L("stat"),P,N(";"),T):"debugger"==e?f(N(";")):"{"==e?f(L("}"),k,Z,T,S):";"==e?f():"if"==e?("else"==_e.state.lexical.info&&_e.state.cc[_e.state.cc.length-1]==T&&_e.state.cc.pop()(),f(L("form"),D,M,T,fe)):"function"==e?f(ve):"for"==e?f(L("form"),me,M,T):"class"==e||Ue&&"interface"==t?(_e.marked="keyword",f(L("form","class"==e?e:t),Se,T)):"variable"==e?Ue&&"declare"==t?(_e.marked="keyword",f(M)):Ue&&("module"==t||"enum"==t||"type"==t)&&_e.stream.match(/^\s*\w/,!1)?(_e.marked="keyword","enum"==t?f(Ie):"type"==t?f(Ce,N("operator"),te,N(";")):f(L("form"),pe,N("{"),L("}"),Z,T,T)):Ue&&"namespace"==t?(_e.marked="keyword",f(L("form"),O,M,T)):Ue&&"abstract"==t?(_e.marked="keyword",f(M)):f(L("stat"),U):"switch"==e?f(L("form"),D,N("{"),L("}","switch"),k,Z,T,T,S):"case"==e?f(O,N(":")):"default"==e?f(N(":")):"catch"==e?f(L("form"),w,A,M,T,S):"export"==e?f(L("stat"),Me,T):"import"==e?f(L("stat"),Oe,T):"async"==e?f(M):"@"==t?f(O,M):g(L("stat"),O,N(";"),T)}function A(e){if("("==e)return f(we,N(")"))}function O(e,t){return H(e,t,!1)}function W(e,t){return H(e,t,!0)}function D(e){return"("==e?f(L(")"),O,N(")"),T):g()}function H(e,t,i){if(_e.state.fatArrowAt==_e.stream.start){var n=i?B:R;if("("==e)return f(w,L(")"),q(we,")"),T,N("=>"),n,S);if("variable"==e)return g(w,pe,N("=>"),n,S)}var r=i?I:F;return qe.hasOwnProperty(e)?f(r):"function"==e?f(ve,r):"class"==e||Ue&&"interface"==t?(_e.marked="keyword",f(L("form"),ke,T)):"keyword c"==e||"async"==e?f(i?W:O):"("==e?f(L(")"),P,N(")"),T,r):"operator"==e||"spread"==e?f(i?W:O):"["==e?f(L("]"),Fe,T,r):"{"==e?_(K,"}",null,r):"quasi"==e?g(z,r):"new"==e?f(j(i)):"import"==e?f(O):f()}function P(e){return e.match(/[;\}\)\],]/)?g():g(O)}function F(e,t){return","==e?f(O):I(e,t,!1)}function I(e,t,i){var n=!1==i?F:I,r=!1==i?O:W;return"=>"==e?f(w,i?B:R,S):"operator"==e?/\+\+|--/.test(t)||Ue&&"!"==t?f(n):Ue&&"<"==t&&_e.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?f(L(">"),q(te,">"),T,n):"?"==t?f(O,N(":"),r):f(r):"quasi"==e?g(z,n):";"==e?void 0:"("==e?_(W,")","call",n):"."==e?f($,n):"["==e?f(L("]"),P,N("]"),T,n):Ue&&"as"==t?(_e.marked="keyword",f(te,n)):"regexp"==e?(_e.state.lastType=_e.marked="operator",_e.stream.backUp(_e.stream.pos-_e.stream.start-1),f(r)):void 0}function z(e,t){return"quasi"==e?"${"==t.slice(t.length-2)?f(O,E):f(z):g()}function E(e){if("}"==e)return _e.marked="string-2",_e.state.tokenize=a,f(z)}function R(e){return p(_e.stream,_e.state),g("{"==e?M:O)}function B(e){return p(_e.stream,_e.state),g("{"==e?M:W)}function j(e){return function(t){return"."==t?f(e?G:V):"variable"==t&&Ue?f(le,e?I:F):g(e?W:O)}}function V(e,t){if("target"==t)return _e.marked="keyword",f(F)}function G(e,t){if("target"==t)return _e.marked="keyword",f(I)}function U(e){return":"==e?f(T,M):g(F,N(";"),T)}function $(e){if("variable"==e)return _e.marked="property",f()}function K(e,t){if("async"==e)return _e.marked="property",f(K);if("variable"==e||"keyword"==_e.style){if(_e.marked="property","get"==t||"set"==t)return f(X);var i;return Ue&&_e.state.fatArrowAt==_e.stream.start&&(i=_e.stream.match(/^\s*:\s*/,!1))&&(_e.state.fatArrowAt=_e.stream.pos+i[0].length),f(Y)}return"number"==e||"string"==e?(_e.marked=Ve?"property":_e.style+" property",f(Y)):"jsonld-keyword"==e?f(Y):Ue&&v(t)?(_e.marked="keyword",f(K)):"["==e?f(O,Q,N("]"),Y):"spread"==e?f(W,Y):"*"==t?(_e.marked="keyword",f(K)):":"==e?g(Y):void 0}function X(e){return"variable"==e?(_e.marked="property",f(ve)):g(Y)}function Y(e){return":"==e?f(W):"("==e?g(ve):void 0}function q(e,t,i){function n(r,o){if(i?-1"),te):void 0}function ie(e){if("=>"==e)return f(te)}function ne(e,t){return"variable"==e||"keyword"==_e.style?(_e.marked="property",f(ne)):"?"==t||"number"==e||"string"==e?f(ne):":"==e?f(te):"["==e?f(N("variable"),Q,N("]"),ne):"("==e?g(be,ne):void 0}function re(e,t){return"variable"==e&&_e.stream.match(/^\s*[?:]/,!1)||"?"==t?f(re):":"==e?f(te):"spread"==e?f(re):g(te)}function oe(e,t){return"<"==t?f(L(">"),q(te,">"),T,oe):"|"==t||"."==e||"&"==t?f(te):"["==e?f(te,N("]"),oe):"extends"==t||"implements"==t?(_e.marked="keyword",f(te)):"?"==t?f(te,N(":"),te):void 0}function le(e,t){if("<"==t)return f(L(">"),q(te,">"),T,oe)}function se(){return g(te,de)}function de(e,t){if("="==t)return f(te)}function ae(e,t){return"enum"==t?(_e.marked="keyword",f(Ie)):g(pe,Q,ue,ge)}function pe(e,t){return Ue&&v(t)?(_e.marked="keyword",f(pe)):"variable"==e?(y(t),f()):"spread"==e?f(pe):"["==e?_(he,"]"):"{"==e?_(ce,"}"):void 0}function ce(e,t){return"variable"!=e||_e.stream.match(/^\s*:/,!1)?("variable"==e&&(_e.marked="property"),"spread"==e?f(pe):"}"==e?g():"["==e?f(O,N("]"),N(":"),ce):f(N(":"),pe,ue)):(y(t),f(ue))}function he(){return g(pe,ue)}function ue(e,t){if("="==t)return f(W)}function ge(e){if(","==e)return f(ae)}function fe(e,t){if("keyword b"==e&&"else"==t)return f(L("form","else"),M,T)}function me(e,t){return"await"==t?f(me):"("==e?f(L(")"),ye,T):void 0}function ye(e){return"var"==e?f(ae,xe):"variable"==e?f(xe):g(xe)}function xe(e,t){return")"==e?f():";"==e?f(xe):"in"==t||"of"==t?(_e.marked="keyword",f(O,xe)):g(O,xe)}function ve(e,t){return"*"==t?(_e.marked="keyword",f(ve)):"variable"==e?(y(t),f(ve)):"("==e?f(w,L(")"),q(we,")"),T,J,M,S):Ue&&"<"==t?f(L(">"),q(se,">"),T,ve):void 0}function be(e,t){return"*"==t?(_e.marked="keyword",f(be)):"variable"==e?(y(t),f(be)):"("==e?f(w,L(")"),q(we,")"),T,J,S):Ue&&"<"==t?f(L(">"),q(se,">"),T,be):void 0}function Ce(e,t){return"keyword"==e||"variable"==e?(_e.marked="type",f(Ce)):"<"==t?f(L(">"),q(se,">"),T):void 0}function we(e,t){return"@"==t&&f(O,we),"spread"==e?f(we):Ue&&v(t)?(_e.marked="keyword",f(we)):Ue&&"this"==e?f(Q,ue):g(pe,Q,ue)}function ke(e,t){return"variable"==e?Se(e,t):Le(e,t)}function Se(e,t){if("variable"==e)return y(t),f(Le)}function Le(e,t){return"<"==t?f(L(">"),q(se,">"),T,Le):"extends"==t||"implements"==t||Ue&&","==e?("implements"==t&&(_e.marked="keyword"),f(Ue?te:O,Le)):"{"==e?f(L("}"),Te,T):void 0}function Te(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||Ue&&v(t))&&_e.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(_e.marked="keyword",f(Te)):"variable"==e||"keyword"==_e.style?(_e.marked="property",f(Ue?Ne:ve,Te)):"number"==e||"string"==e?f(Ue?Ne:ve,Te):"["==e?f(O,Q,N("]"),Ue?Ne:ve,Te):"*"==t?(_e.marked="keyword",f(Te)):Ue&&"("==e?g(be,Te):";"==e||","==e?f(Te):"}"==e?f():"@"==t?f(O,Te):void 0}function Ne(e,t){if("?"==t)return f(Ne);if(":"==e)return f(te,ue);if("="==t)return f(W);var i=_e.state.lexical.prev,n=i&&"interface"==i.info;return g(n?be:ve)}function Me(e,t){return"*"==t?(_e.marked="keyword",f(Pe,N(";"))):"default"==t?(_e.marked="keyword",f(O,N(";"))):"{"==e?f(q(Ae,"}"),Pe,N(";")):g(M)}function Ae(e,t){return"as"==t?(_e.marked="keyword",f(N("variable"))):"variable"==e?g(W,Ae):void 0}function Oe(e){return"string"==e?f():"("==e?g(O):g(We,De,Pe)}function We(e,t){return"{"==e?_(We,"}"):("variable"==e&&y(t),"*"==t&&(_e.marked="keyword"),f(He))}function De(e){if(","==e)return f(We,De)}function He(e,t){if("as"==t)return _e.marked="keyword",f(We)}function Pe(e,t){if("from"==t)return _e.marked="keyword",f(O)}function Fe(e){return"]"==e?f():g(q(W,"]"))}function Ie(){return g(L("form"),pe,N("{"),L("}"),q(ze,"}"),T,T)}function ze(){return g(pe,ue)}function Ee(e,t){return"operator"==e.lastType||","==e.lastType||Xe.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}function Re(e,t,i){return t.tokenize==l&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(i||0)))}var Be=t.indentUnit,je=n.statementIndent,Ve=n.jsonld,Ge=n.json||Ve,Ue=n.typescript,$e=n.wordCharacters||/[\w$\xa1-\uffff]/,Ke=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),i=e("keyword b"),n=e("keyword c"),r=e("keyword d"),o=e("operator"),l={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:i,do:i,try:i,finally:i,return:r,break:r,continue:r,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:l,false:l,null:l,undefined:l,NaN:l,Infinity:l,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),Xe=/[+\-*&%=<>!?|~^@]/,Ye=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,qe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},_e={state:null,column:null,marked:null,cc:null},i=new C("this",new C("arguments",null)),Ze,Qe;return S.lex=!0,T.lex=!0,{startState:function(e){var t={tokenize:l,lastType:"sof",cc:[],lexical:new c((e||0)-Be,0,"block",!1),localVars:n.localVars,context:n.localVars&&new b(null,null,!1),indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(!t.lexical.hasOwnProperty("align")&&(t.lexical.align=!1),t.indented=e.indentation(),p(e,t)),t.tokenize!=d&&e.eatSpace())return null;var i=t.tokenize(e,t);return"comment"==Ze?i:(t.lastType="operator"==Ze&&("++"==Qe||"--"==Qe)?"incdec":Ze,u(t,i,Ze,Qe,e))},indent:function(t,r){if(t.tokenize==d)return e.Pass;if(t.tokenize!=l)return 0;var o=r&&r.charAt(0),s=t.lexical,a;if(!/^\s*else\b/.test(r))for(var p=t.cc.length-1,h;0<=p;--p)if(h=t.cc[p],h==T)s=s.prev;else if(h!=fe)break;for(;("stat"==s.type||"form"==s.type)&&("}"==o||(a=t.cc[t.cc.length-1])&&(a==F||a==I)&&!/^[,\.=+\-*:?[\(]/.test(r));)s=s.prev;je&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var u=s.type,g=o==u;return"vardef"==u?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==u&&"{"==o?s.indented:"form"==u?s.indented+Be:"stat"==u?s.indented+(Ee(t,r)?je||Be:0):"switch"!=s.info||g||!1==n.doubleIndentSwitch?s.align?s.column+(g?0:1):s.indented+(g?0:Be):s.indented+(/^(?:case|default)\b/.test(r)?Be:2*Be)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ge?null:"/*",blockCommentEnd:Ge?null:"*/",blockCommentContinue:Ge?null:" * ",lineComment:Ge?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ge?"json":"javascript",jsonldMode:Ve,jsonMode:Ge,expressionAllowed:Re,skipExpression:function(e){var t=e.cc[e.cc.length-1];(t==O||t==W)&&e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}); \ No newline at end of file diff --git a/assets/vendor/codemirror.min.js b/assets/vendor/codemirror.min.js deleted file mode 100644 index 9a206ea479..0000000000 --- a/assets/vendor/codemirror.min.js +++ /dev/null @@ -1,4 +0,0 @@ -window.CodeMirror=function(){"use strict";function t(r,n){if(!(this instanceof t))return new t(r,n);this.options=n=n||{};for(var i in no)!n.hasOwnProperty(i)&&no.hasOwnProperty(i)&&(n[i]=no[i]);h(n);var o="string"==typeof n.value?0:n.value.first,l=this.display=e(r,o);l.wrapper.CodeMirror=this,u(this),n.autofocus&&!Pi&&de(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Xn},s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var a=n.value;"string"==typeof a&&(a=new yo(n.value,n.mode)),oe(this,cn)(this,a),ki&&setTimeout(ti(he,this,!0),20),ge(this);var c;try{c=document.activeElement==l.input}catch(f){}c||n.autofocus&&!Pi?setTimeout(ti(De,this),20):We(this),oe(this,function(){for(var t in ro)ro.propertyIsEnumerable(t)&&ro[t](this,n[t],io);for(var e=0;ee.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}function h(t){for(var e=!1,r=0;re.scroller.clientWidth+1,l=i>e.scroller.clientHeight+1;l?(e.scrollbarV.style.display="block",e.scrollbarV.style.bottom=o?ui(e.measure)+"px":"0",e.scrollbarV.firstChild.style.height=i-e.scroller.clientHeight+e.scrollbarV.clientHeight+"px"):(e.scrollbarV.style.display="",e.scrollbarV.firstChild.style.height="0"),o?(e.scrollbarH.style.display="block",e.scrollbarH.style.right=l?ui(e.measure)+"px":"0",e.scrollbarH.firstChild.style.width=e.scroller.scrollWidth-e.scroller.clientWidth+e.scrollbarH.clientWidth+"px"):(e.scrollbarH.style.display="",e.scrollbarH.firstChild.style.width="0"),o&&l?(e.scrollbarFiller.style.display="block",e.scrollbarFiller.style.height=e.scrollbarFiller.style.width=ui(e.measure)+"px"):e.scrollbarFiller.style.display="",o&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(e.gutterFiller.style.display="block",e.gutterFiller.style.height=ui(e.measure)+"px",e.gutterFiller.style.width=e.gutters.offsetWidth+"px"):e.gutterFiller.style.display="",Oi&&0===ui(e.measure)&&(e.scrollbarV.style.minWidth=e.scrollbarH.style.minHeight=Ei?"18px":"12px")}function p(t,e,r){var n=t.scroller.scrollTop,i=t.wrapper.clientHeight;"number"==typeof r?n=r:r&&(n=r.top,i=r.bottom-r.top),n=Math.floor(n-I(t));var o=Math.ceil(n+i);return{from:mn(e,n),to:mn(e,o)}}function g(t){var e=t.display;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=y(e)-e.scroller.scrollLeft+t.doc.scrollLeft,n=e.gutters.offsetWidth,i=r+"px",o=e.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var l=0,s=o.alignable;l=t.display.showingFrom&&s.to<=t.display.showingTo));)e=[];return i&&(Bn(t,"update",t),(t.display.showingFrom!=o||t.display.showingTo!=l)&&Bn(t,"viewportChange",t,t.display.showingFrom,t.display.showingTo)),i}function x(t,e,r,n){var i=t.display,o=t.doc;if(!i.wrapper.clientWidth)return i.showingFrom=i.showingTo=o.first,i.viewOffset=0,void 0;if(!(!n&&0==e.length&&r.from>i.showingFrom&&r.tof&&i.showingTo-f<20&&(f=Math.min(u,i.showingTo)),Yi)for(c=gn(Fr(o,fn(o,c)));u>f&&Rr(o,fn(o,f));)++f;var h=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,u)}];if(h=h[0].from>=h[0].to?[]:L(h,e),Yi)for(var a=0;ap.from)){h.splice(a--,1);break}p.to=g}for(var v=0,a=0;af&&(p.to=f),p.from>=p.to?h.splice(a--,1):v+=p.to-p.from}if(!n&&v==f-c&&c==i.showingFrom&&f==i.showingTo)return w(t),void 0;h.sort(function(t,e){return t.from-e.from});try{var y=document.activeElement}catch(b){}.7*(f-c)>v&&(i.lineDiv.style.display="none"),S(t,c,f,h,s),i.lineDiv.style.display="",y&&document.activeElement!=y&&y.offsetHeight&&y.focus();var x=c!=i.showingFrom||f!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;return x&&(i.lastSizeC=i.wrapper.clientHeight,W(t,400)),i.showingFrom=c,i.showingTo=f,C(t),w(t),!0}}function C(t){for(var e,r=t.display,n=r.lineDiv.offsetTop,i=r.lineDiv.firstChild;i;i=i.nextSibling)if(i.lineObj){if(Si){var o=i.offsetTop+i.offsetHeight;e=o-n,n=o}else{var l=si(i);e=l.bottom-l.top}var s=i.lineObj.height-e;if(2>e&&(e=ee(r)),s>.001||-.001>s){pn(i.lineObj,e);var a=i.lineObj.widgets;if(a)for(var u=0;ur;++r){for(var i=e[r],o=[],l=i.diff||0,s=0,a=t.length;a>s;++s){var u=t[s];i.to<=u.from&&i.diff?o.push({from:u.from+l,to:u.to+l}):i.to<=u.from||i.from>=u.to?o.push(u):(i.from>u.from&&o.push({from:u.from,to:i.from}),i.toh){for(;c.lineObj!=e;)c=o(c);a&&h>=i&&c.lineNumber&&li(c.lineNumber,v(t.options,h)),c=c.nextSibling}else{if(e.widgets)for(var m,y=0,b=c;b&&20>y;++y,b=b.nextSibling)if(b.lineObj==e&&/div/i.test(b.nodeName)){m=b;break}var x=M(t,e,h,l,m);if(x!=m)u.insertBefore(x,c);else{for(;c!=m;)c=o(c);c=c.nextSibling}x.lineObj=e}++h});c;)c=o(c)}function M(t,e,r,n,i){var o,l=Qr(t,e),s=e.gutterMarkers,a=t.display;if(!(t.options.lineNumbers||s||e.bgClass||e.wrapClass||e.widgets))return l;if(i){i.alignable=null;for(var u,c=!0,f=0,h=null,d=i.firstChild;d;d=u)if(u=d.nextSibling,/\bCodeMirror-linewidget\b/.test(d.className)){for(var p=0;pe&&(e=0),l.appendChild(ni("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==r?s-t:r)+"px; height: "+(n-e)+"px"))}function r(r,n,o){function l(e,n){return Z(t,Ue(r,e),"div",f,n)}var u,c,f=fn(i,r),h=f.text.length;return fi(yn(f),n||0,null==o?h:o,function(t,r,i){var f,d,p,g=l(t,"left");if(t==r)f=g,d=p=g.left;else{if(f=l(r-1,"right"),"rtl"==i){var m=g;g=f,f=m}d=g.left,p=f.right}null==n&&0==t&&(d=a),f.top-g.top>3&&(e(d,g.top,null,g.bottom),d=a,g.bottomc.bottom||f.bottom==c.bottom&&f.right>c.right)&&(c=f),a+1>d&&(d=a),e(d,f.top,p-d,f.bottom)}),{start:u,end:c}}var n=t.display,i=t.doc,o=t.doc.sel,l=document.createDocumentFragment(),s=n.lineSpace.offsetWidth,a=F(t.display);if(o.from.line==o.to.line)r(o.from.line,o.from.ch,o.to.ch);else{var u=fn(i,o.from.line),c=fn(i,o.to.line),f=Fr(i,u)==Fr(i,c),h=r(o.from.line,o.from.ch,f?u.text.length:null).end,d=r(o.to.line,f?0:null,o.to.ch).start;f&&(h.top0&&(e.blinker=setInterval(function(){e.cursor.style.visibility=e.otherCursor.style.visibility=(r=!r)?"":"hidden"},t.options.cursorBlinkRate))}}function W(t,e){t.doc.mode.startState&&t.doc.frontier=t.display.showingTo)){var r,n=+new Date+t.options.workTime,i=mr(e.mode,z(t,e.frontier)),o=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.showingTo+500),function(l){if(e.frontier>=t.display.showingFrom){var s=l.styles;l.styles=$r(t,l,i);for(var a=!s||s.length!=l.styles.length,u=0;!a&&un?(W(t,t.options.workDelay),!0):void 0}),o.length&&oe(t,function(){for(var t=0;ta;--s){if(s<=o.first)return o.first;var u=fn(o,s-1);if(u.stateAfter&&(!r||s<=o.frontier))return s;var c=_n(u.text,null,t.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}function z(t,e,r){var n=t.doc,i=t.display;if(!n.mode.startState)return!0;var o=E(t,e,r),l=o>n.first&&fn(n,o-1).stateAfter;return l=l?mr(n.mode,l):vr(n.mode),n.iter(o,e,function(r){qr(t,r,l);var s=o==e-1||0==o%5||o>=i.showingFrom&&oo&&0==l&&(o=1)}return i=l>r?"left":r>l?"right":i,"left"==i&&s.leftSide?s=s.leftSide:"right"==i&&s.rightSide&&(s=s.rightSide),{left:r>l?s.right:s.left,right:l>r?s.left:s.right,top:s.top,bottom:s.bottom}}function B(t,e){for(var r=t.display.measureLineCache,n=0;nv&&(r=v),0>e&&(e=0);for(var n=g.length-2;n>=0;n-=2){var i=g[n],o=g[n+1];if(!(i>r||e>o)&&(e>=i&&o>=r||i>=e&&r>=o||Math.min(r,o)-Math.max(e,i)>=r-e>>1)){g[n]=Math.min(e,i),g[n+1]=Math.max(r,o);break}}return 0>n&&(n=g.length,g.push(e,r)),{left:t.left-p.left,right:t.right-p.left,top:n,bottom:null}}function n(t){t.bottom=g[t.top+1],t.top=g[t.top]}var i=t.display,o=Qn(e.text.length),l=Qr(t,e,o,!0);if(ki&&!Si&&!t.options.lineWrapping&&l.childNodes.length>100){for(var s=document.createDocumentFragment(),a=10,u=l.childNodes.length,c=0,f=Math.ceil(u/a);f>c;++c){for(var h=ni("div",null,null,"display: inline-block"),d=0;a>d&&u;++d)h.appendChild(l.firstChild),--u;s.appendChild(h)}l.appendChild(s)}oi(i.measure,l);var p=si(i.lineDiv),g=[],m=Qn(e.text.length),v=l.offsetHeight;Mi&&i.measure.first!=l&&oi(i.measure,l);for(var y,c=0;c1&&(x=m[c]=r(C[0]),x.rightSide=r(C[C.length-1]))}x||(x=m[c]=r(si(b))),y.measureRight&&(x.right=si(y.measureRight).left),y.leftSide&&(x.leftSide=r(si(y.leftSide)))}ii(t.display.measure);for(var y,c=0;cr.from?o(t-1):o(t,n)}n=n||fn(t.doc,e.line),i||(i=V(t,n));var s=yn(n),a=e.ch;if(!s)return o(a);var u=bi(s,a),c=l(a,u);return null!=zo&&(c.other=l(a,zo)),c}function J(t,e,r,n){var i=new Ue(t,e);return i.xRel=n,r&&(i.outside=!0),i}function Q(t,e,r){var n=t.doc;if(r+=t.display.viewOffset,0>r)return J(n.first,0,!0,-1);var i=mn(n,r),o=n.first+n.size-1;if(i>o)return J(n.first+n.size-1,fn(n,o).text.length,!0,1);for(0>e&&(e=0);;){var l=fn(n,i),s=te(t,l,i,e,r),a=Pr(l),u=a&&a.find();if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=u.to.line}}function te(t,e,r,n,i){function o(n){var i=q(t,Ue(r,n),"line",e,u);return s=!0,l>i.bottom?i.left-a:lm)return J(r,d,v,1);for(;;){if(c?d==h||d==Ci(e,h,1):1>=d-h){for(var y=p>n||m-n>=n-p?h:d,b=n-(y==h?p:m);To.test(e.text.charAt(y));)++y;var x=J(r,y,y==h?g:v,0>b?-1:b?1:0);return x}var C=Math.ceil(f/2),w=h+C;if(c){w=h;for(var L=0;C>L;++L)w=Ci(e,w,1)}var k=o(w);k>n?(d=w,m=k,(v=s)&&(m+=1e3),f=C):(h=w,p=k,g=s,f-=C)}}function ee(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Gi){Gi=ni("pre");for(var e=0;49>e;++e)Gi.appendChild(document.createTextNode("x")),Gi.appendChild(ni("br"));Gi.appendChild(document.createTextNode("x"))}oi(t.measure,Gi);var r=Gi.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),ii(t.measure),r||1}function re(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=ni("span","x"),r=ni("pre",[e]);oi(t.measure,r);var n=e.offsetWidth;return n>2&&(t.cachedCharWidth=n),n||10}function ne(t){t.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++ji},wo++||(Co=[])}function ie(t){var e=t.curOp,r=t.doc,n=t.display;if(t.curOp=null,e.updateMaxLine&&f(t),n.maxLineChanged&&!t.options.lineWrapping&&n.maxLine){var i=U(t,n.maxLine);n.sizer.style.minWidth=Math.max(0,i+3+Lo)+"px",n.maxLineChanged=!1;var o=Math.max(0,n.sizer.offsetLeft+n.sizer.offsetWidth-n.scroller.clientWidth);os&&r.charCodeAt(s)==o.charCodeAt(s);)++s;var u=i.from,c=i.to;s1e3||o.indexOf("\n")>-1?e.value=t.display.prevInput="":t.display.prevInput=o,l&&ie(t),t.state.pasteIncoming=!1,!0}function he(t,e){var r,n,i=t.doc;if(Xe(i.sel.from,i.sel.to))e&&(t.display.prevInput=t.display.input.value="",ki&&!Mi&&(t.display.inputHasSelection=null));else{t.display.prevInput="",r=Oo&&(i.sel.to.line-i.sel.from.line>100||(n=t.getSelection()).length>1e3);var o=r?"-":n||t.getSelection();t.display.input.value=o,t.state.focused&&$n(t.display.input),ki&&!Mi&&(t.display.inputHasSelection=o)}t.display.inaccurateSelection=r}function de(t){"nocursor"==t.options.readOnly||Pi&&document.activeElement==t.display.input||t.display.input.focus()}function pe(t){return t.options.readOnly||t.doc.cantEdit}function ge(t){function e(){t.state.focused&&setTimeout(ti(de,t),0)}function r(){null==s&&(s=setTimeout(function(){s=null,l.cachedCharWidth=l.cachedTextHeight=No=null,X(t),se(t,ti(ae,t))},100))}function n(){for(var t=l.wrapper.parentNode;t&&t!=document.body;t=t.parentNode);t?setTimeout(n,5e3):Fn(window,"resize",r)}function i(e){Gn(t,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Hn(e))||En(e)}function o(){l.inaccurateSelection&&(l.prevInput="",l.inaccurateSelection=!1,l.input.value=t.getSelection(),$n(l.input))}var l=t.display;Pn(l.scroller,"mousedown",oe(t,ye)),ki?Pn(l.scroller,"dblclick",oe(t,function(e){if(!Gn(t,e)){var r=ve(t,e);if(r&&!be(t,e)&&!me(t.display,e)){Dn(e);var n=dr(fn(t.doc,r.line).text,r);Je(t.doc,n.from,n.to)}}})):Pn(l.scroller,"dblclick",function(e){Gn(t,e)||Dn(e)}),Pn(l.lineSpace,"selectstart",function(t){me(l,t)||Dn(t)}),Xi||Pn(l.scroller,"contextmenu",function(e){Oe(t,e)}),Pn(l.scroller,"scroll",function(){l.scroller.clientHeight&&(we(t,l.scroller.scrollTop),Le(t,l.scroller.scrollLeft,!0),Rn(t,"scroll",t))}),Pn(l.scrollbarV,"scroll",function(){l.scroller.clientHeight&&we(t,l.scrollbarV.scrollTop)}),Pn(l.scrollbarH,"scroll",function(){l.scroller.clientHeight&&Le(t,l.scrollbarH.scrollLeft)}),Pn(l.scroller,"mousewheel",function(e){ke(t,e)}),Pn(l.scroller,"DOMMouseScroll",function(e){ke(t,e)}),Pn(l.scrollbarH,"mousedown",e),Pn(l.scrollbarV,"mousedown",e),Pn(l.wrapper,"scroll",function(){l.wrapper.scrollTop=l.wrapper.scrollLeft=0});var s;Pn(window,"resize",r),setTimeout(n,5e3),Pn(l.input,"keyup",oe(t,function(e){Gn(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Hn(e))||16==e.keyCode&&(t.doc.sel.shift=!1)})),Pn(l.input,"input",ti(ce,t)),Pn(l.input,"keydown",oe(t,Ne)),Pn(l.input,"keypress",oe(t,He)),Pn(l.input,"focus",ti(De,t)),Pn(l.input,"blur",ti(We,t)),t.options.dragDrop&&(Pn(l.scroller,"dragstart",function(e){Ce(t,e)}),Pn(l.scroller,"dragenter",i),Pn(l.scroller,"dragover",i),Pn(l.scroller,"drop",oe(t,xe))),Pn(l.scroller,"paste",function(e){me(l,e)||(de(t),ce(t))}),Pn(l.input,"paste",function(){if(Ti&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=l.input.selectionStart,r=l.input.selectionEnd;l.input.value+="$",l.input.selectionStart=e,l.input.selectionEnd=r,t.state.fakedLastChar=!0}t.state.pasteIncoming=!0,ce(t)}),Pn(l.input,"cut",o),Pn(l.input,"copy",o),Wi&&Pn(l.sizer,"mouseup",function(){document.activeElement==l.input&&l.input.blur(),de(t)})}function me(t,e){for(var r=zn(e);r!=t.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==t.sizer&&r!=t.mover)return!0}function ve(t,e,r){var n=t.display;if(!r){var i=zn(e);if(i==n.scrollbarH||i==n.scrollbarH.firstChild||i==n.scrollbarV||i==n.scrollbarV.firstChild||i==n.scrollbarFiller||i==n.gutterFiller)return null}var o,l,s=si(n.lineSpace);try{o=e.clientX,l=e.clientY}catch(e){return null}return Q(t,o-s.left,l-s.top)}function ye(t){function e(t){if(!Xe(v,t)){if(v=t,"single"==c)return Je(i.doc,$e(l,a),t),void 0;if(g=$e(l,g),m=$e(l,m),"double"==c){var e=dr(fn(l,t.line).text,t);_e(t,g)?Je(i.doc,e.from,m):Je(i.doc,g,e.to)}else"triple"==c&&(_e(t,g)?Je(i.doc,m,$e(l,Ue(t.line,0))):Je(i.doc,g,$e(l,Ue(t.line+1,0))))}}function r(t){var n=++b,s=ve(i,t,!0);if(s)if(Xe(s,h)){var a=t.clientYy.bottom?20:0;a&&setTimeout(oe(i,function(){b==n&&(o.scroller.scrollTop+=a,r(t))}),50)}else{i.state.focused||De(i),h=s,e(s);var u=p(o,l);(s.line>=u.to||s.lineu-400&&Xe(Ki.pos,a))c="triple",Dn(t),setTimeout(ti(de,i),20),pr(i,a.line);else if(Vi&&Vi.time>u-400&&Xe(Vi.pos,a)){c="double",Ki={time:u,pos:a},Dn(t);var f=dr(fn(l,a.line).text,a);Je(i.doc,f.from,f.to)}else Vi={time:u,pos:a};var h=a;if(i.options.dragDrop&&Ao&&!pe(i)&&!Xe(s.from,s.to)&&!_e(a,s.from)&&!_e(s.to,a)&&"single"==c){var d=oe(i,function(e){Ti&&(o.scroller.draggable=!1),i.state.draggingText=!1,Fn(document,"mouseup",d),Fn(o.scroller,"drop",d),Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)<10&&(Dn(e),Je(i.doc,a),de(i))});return Ti&&(o.scroller.draggable=!0),i.state.draggingText=d,o.scroller.dragDrop&&o.scroller.dragDrop(),Pn(document,"mouseup",d),Pn(o.scroller,"drop",d),void 0}Dn(t),"single"==c&&Je(i.doc,$e(l,a));var g=s.from,m=s.to,v=a,y=si(o.wrapper),b=0,x=oe(i,function(t){ki||In(t)?r(t):n(t)}),C=oe(i,n);Pn(document,"mousemove",x),Pn(document,"mouseup",C)}}}function be(t,e){var r=t.display;try{var n=e.clientX,i=e.clientY}catch(e){return!1}if(n>=Math.floor(si(r.gutters).right))return!1;if(Dn(e),!Kn(t,"gutterClick"))return!0;var o=si(r.lineDiv);if(i>o.bottom)return!0;i-=o.top-r.viewOffset;for(var l=0;l=n){var a=mn(t.doc,i),u=t.options.gutters[l];Bn(t,"gutterClick",t,a,u,e);break}}return!0}function xe(t){var e=this;if(!(Gn(e,t)||me(e.display,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Hn(t)))){Dn(t),ki&&($i=+new Date);var r=ve(e,t,!0),n=t.dataTransfer.files;if(r&&!pe(e))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(t,n){var s=new FileReader;s.onload=function(){o[n]=s.result,++l==i&&(r=$e(e.doc,r),Pe(e.doc,{from:r,to:r,text:Do(o.join("\n")),origin:"paste"},"around"))},s.readAsText(t)},a=0;i>a;++a)s(n[a],a);else{if(e.state.draggingText&&!_e(r,e.doc.sel.from)&&!_e(e.doc.sel.to,r))return e.state.draggingText(t),setTimeout(ti(de,e),20),void 0;try{var o=t.dataTransfer.getData("Text");if(o){var u=e.doc.sel.from,c=e.doc.sel.to;tr(e.doc,r,r),e.state.draggingText&&Ke(e.doc,"",u,c,"paste"),e.replaceSelection(o,null,"paste"),de(e),De(e)}}catch(t){}}}}function Ce(t,e){if(ki&&(!t.state.draggingText||+new Date-$i<100))return En(e),void 0;if(!Gn(t,e)&&!me(t.display,e)){var r=t.getSelection();if(e.dataTransfer.setData("Text",r),e.dataTransfer.setDragImage&&!Di){var n=ni("img",null,null,"position: fixed; left: 0; top: 0;");Hi&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),Hi&&n.parentNode.removeChild(n)}}}function we(t,e){Math.abs(t.doc.scrollTop-e)<2||(t.doc.scrollTop=e,Li||b(t,[],e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbarV.scrollTop!=e&&(t.display.scrollbarV.scrollTop=e),Li&&b(t,[]),W(t,100))}function Le(t,e,r){(r?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,g(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbarH.scrollLeft!=e&&(t.display.scrollbarH.scrollLeft=e))}function ke(t,e){var r=e.wheelDeltaX,n=e.wheelDeltaY;null==r&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(r=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta);var i=t.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Fi&&Ti)for(var l=e.target;l!=o;l=l.parentNode)if(l.lineObj){t.display.currentWheelTarget=l;break}if(r&&!Li&&!Hi&&null!=qi)return n&&we(t,Math.max(0,Math.min(o.scrollTop+n*qi,o.scrollHeight-o.clientHeight))),Le(t,Math.max(0,Math.min(o.scrollLeft+r*qi,o.scrollWidth-o.clientWidth))),Dn(e),i.wheelStartX=null,void 0;if(n&&null!=qi){var s=n*qi,a=t.doc.scrollTop,u=a+i.wrapper.clientHeight;0>s?a=Math.max(0,a+s-50):u=Math.min(t.doc.height,u+s+50),b(t,[],{top:a,bottom:u})}20>Zi&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var t=o.scrollLeft-i.wheelStartX,e=o.scrollTop-i.wheelStartY,r=e&&i.wheelDY&&e/i.wheelDY||t&&i.wheelDX&&t/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(qi=(qi*Zi+r)/(Zi+1),++Zi)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function Se(t,e,r){if("string"==typeof e&&(e=co[e],!e))return!1;t.display.pollingFast&&fe(t)&&(t.display.pollingFast=!1);var n=t.doc,i=n.sel.shift,o=!1;try{pe(t)&&(t.state.suppressEdits=!0),r&&(n.sel.shift=!1),o=e(t)!=ko}finally{n.sel.shift=i,t.state.suppressEdits=!1}return o}function Me(t){var e=t.state.keyMaps.slice(0);return t.options.extraKeys&&e.push(t.options.extraKeys),e.push(t.options.keyMap),e}function Te(t,e){var r=yr(t.options.keyMap),n=r.auto;clearTimeout(Ji),n&&!xr(e)&&(Ji=setTimeout(function(){yr(t.options.keyMap)==r&&(t.options.keyMap=n.call?n.call(null,t):n,l(t))},50));var i=Cr(e,!0),o=!1;if(!i)return!1;var s=Me(t);return o=e.shiftKey?br("Shift-"+i,s,function(e){return Se(t,e,!0)})||br(i,s,function(e){return("string"==typeof e?/^go[A-Z]/.test(e):e.motion)?Se(t,e):void 0}):br(i,s,function(e){return Se(t,e)}),o&&(Dn(e),D(t),Mi&&(e.oldKeyCode=e.keyCode,e.keyCode=0),Bn(t,"keyHandled",t,i,e)),o}function Ae(t,e,r){var n=br("'"+r+"'",Me(t),function(e){return Se(t,e,!0)});return n&&(Dn(e),D(t),Bn(t,"keyHandled",t,"'"+r+"'",e)),n}function Ne(t){var e=this;if(e.state.focused||De(e),!(Gn(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Hn(t)))){ki&&27==t.keyCode&&(t.returnValue=!1);var r=t.keyCode;e.doc.sel.shift=16==r||t.shiftKey;var n=Te(e,t);Hi&&(to=n?r:null,!n&&88==r&&!Oo&&(Fi?t.metaKey:t.ctrlKey)&&e.replaceSelection(""))}}function He(t){var e=this;if(!(Gn(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Hn(t)))){var r=t.keyCode,n=t.charCode;if(Hi&&r==to)return to=null,Dn(t),void 0;if(!(Hi&&(!t.which||t.which<10)||Wi)||!Te(e,t)){var i=String.fromCharCode(null==n?r:n);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!pe(this)&&this.doc.mode.electricChars.indexOf(i)>-1&&setTimeout(oe(e,function(){ur(e,e.doc.sel.to.line,"smart")}),75),Ae(e,t,i)||(ki&&!Mi&&(e.display.inputHasSelection=null),ce(e))}}}function De(t){"nocursor"!=t.options.readOnly&&(t.state.focused||(Rn(t,"focus",t),t.state.focused=!0,-1==t.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(t.display.wrapper.className+=" CodeMirror-focused"),t.curOp||(he(t,!0),Ti&&setTimeout(ti(he,t,!0),0))),ue(t),D(t))}function We(t){t.state.focused&&(Rn(t,"blur",t),t.state.focused=!1,t.display.wrapper.className=t.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.doc.sel.shift=!1)},150)}function Oe(t,e){function r(){if(null!=i.input.selectionStart){var t=i.input.value=" "+(Xe(o.from,o.to)?"":i.input.value);i.prevInput=" ",i.input.selectionStart=1,i.input.selectionEnd=t.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=a,Mi&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=s),ue(t),null!=i.input.selectionStart){(!ki||Mi)&&r(),clearTimeout(Qi);var e=0,n=function(){" "==i.prevInput&&0==i.input.selectionStart?oe(t,co.selectAll)(t):e++<10?Qi=setTimeout(n,500):he(t)};Qi=setTimeout(n,200)}}if(!Gn(t,e,"contextmenu")){var i=t.display,o=t.doc.sel;if(!me(i,e)){var l=ve(t,e),s=i.scroller.scrollTop;if(l&&!Hi){(Xe(o.from,o.to)||_e(l,o.from)||!_e(l,o.to))&&oe(t,tr)(t.doc,l,l);var a=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",de(t),he(t,!0),Xe(o.from,o.to)&&(i.input.value=i.prevInput=" "),ki&&!Mi&&r(),Xi){En(e);var u=function(){Fn(window,"mouseup",u),setTimeout(n,20)};Pn(window,"mouseup",u)}else setTimeout(n,50)}}}}function Ee(t,e,r){if(!_e(e.from,r))return $e(t,r);var n=e.text.length-1-(e.to.line-e.from.line);if(r.line>e.to.line+n){var i=r.line-n,o=t.first+t.size-1;return i>o?Ue(o,fn(t,o).text.length):Ze(r,fn(t,i).text.length)}if(r.line==e.to.line+n)return Ze(r,jn(e.text).length+(1==e.text.length?e.from.ch:0)+fn(t,e.to.line).text.length-e.to.ch);var l=r.line-e.from.line;return Ze(r,e.text[l].length+(l?0:e.from.ch))}function ze(t,e,r){if(r&&"object"==typeof r)return{anchor:Ee(t,e,r.anchor),head:Ee(t,e,r.head)};if("start"==r)return{anchor:e.from,head:e.from};var n=eo(e);if("around"==r)return{anchor:e.from,head:n};if("end"==r)return{anchor:n,head:n};var i=function(t){if(_e(t,e.from))return t;if(!_e(e.to,t))return n;var r=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=n.ch-e.to.ch),Ue(r,i)};return{anchor:i(t.sel.anchor),head:i(t.sel.head)}}function Ie(t,e,r){var n={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(e,r,n,i){e&&(this.from=$e(t,e)),r&&(this.to=$e(t,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Rn(t,"beforeChange",t,n),t.cm&&Rn(t.cm,"beforeChange",t.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Pe(t,e,r,n){if(t.cm){if(!t.cm.curOp)return oe(t.cm,Pe)(t,e,r,n);if(t.cm.state.suppressEdits)return}if(!(Kn(t,"beforeChange")||t.cm&&Kn(t.cm,"beforeChange"))||(e=Ie(t,e,!0))){var i=_i&&!n&&Er(t,e.from,e.to);if(i){for(var o=i.length-1;o>=1;--o)Fe(t,{from:i[o].from,to:i[o].to,text:[""]});i.length&&Fe(t,{from:i[0].from,to:i[0].to,text:e.text},r)}else Fe(t,e,r)}}function Fe(t,e,r){var n=ze(t,e,r);wn(t,e,n,t.cm?t.cm.curOp.id:0/0),Ge(t,e,n,Wr(t,e));var i=[];un(t,function(t,r){r||-1!=Zn(i,t.history)||(An(t.history,e),i.push(t.history)),Ge(t,e,null,Wr(t,e))})}function Re(t,e){if(!t.cm||!t.cm.state.suppressEdits){var r=t.history,n=("undo"==e?r.done:r.undone).pop();if(n){var i={changes:[],anchorBefore:n.anchorAfter,headBefore:n.headAfter,anchorAfter:n.anchorBefore,headAfter:n.headBefore,generation:r.generation};("undo"==e?r.undone:r.done).push(i),r.generation=n.generation||++r.maxGeneration;for(var o=Kn(t,"beforeChange")||t.cm&&Kn(t.cm,"beforeChange"),l=n.changes.length-1;l>=0;--l){var s=n.changes[l];if(s.origin=e,o&&!Ie(t,s,!1))return("undo"==e?r.done:r.undone).length=0,void 0;i.changes.push(Cn(t,s));var a=l?ze(t,s,null):{anchor:n.anchorBefore,head:n.headBefore};Ge(t,s,a,Or(t,s));var u=[];un(t,function(t,e){e||-1!=Zn(u,t.history)||(An(t.history,s),u.push(t.history)),Ge(t,s,null,Or(t,s))})}}}}function Be(t,e){function r(t){return Ue(t.line+e,t.ch)}t.first+=e,t.cm&&ae(t.cm,t.first,t.first,e),t.sel.head=r(t.sel.head),t.sel.anchor=r(t.sel.anchor),t.sel.from=r(t.sel.from),t.sel.to=r(t.sel.to)}function Ge(t,e,r,n){if(t.cm&&!t.cm.curOp)return oe(t.cm,Ge)(t,e,r,n);if(e.to.linet.lastLine())){if(e.from.lineo&&(e={from:e.from,to:Ue(o,fn(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=hn(t,e.from,e.to),r||(r=ze(t,e,null)),t.cm?Ve(t.cm,e,n,r):ln(t,e,n,r)}}function Ve(t,e,r,n){var o=t.doc,l=t.display,s=e.from,a=e.to,u=!1,f=s.line;t.options.lineWrapping||(f=gn(Fr(o,fn(o,s.line))),o.iter(f,a.line+1,function(t){return t==l.maxLine?(u=!0,!0):void 0})),_e(o.sel.head,e.from)||_e(e.to,o.sel.head)||(t.curOp.cursorActivity=!0),ln(o,e,r,n,i(t)),t.options.lineWrapping||(o.iter(f,s.line+e.text.length,function(t){var e=c(o,t);e>l.maxLineLength&&(l.maxLine=t,l.maxLineLength=e,l.maxLineChanged=!0,u=!1)}),u&&(t.curOp.updateMaxLine=!0)),o.frontier=Math.min(o.frontier,s.line),W(t,400);var h=e.text.length-(a.line-s.line)-1;if(ae(t,s.line,a.line+1,h),Kn(t,"change")){var d={from:s,to:a,text:e.text,removed:e.removed,origin:e.origin};if(t.curOp.textChanged){for(var p=t.curOp.textChanged;p.next;p=p.next);p.next=d}else t.curOp.textChanged=d}}function Ke(t,e,r,n,i){if(n||(n=r),_e(n,r)){var o=n;n=r,r=o}"string"==typeof e&&(e=Do(e)),Pe(t,{from:r,to:n,text:e,origin:i},null)}function Ue(t,e){return this instanceof Ue?(this.line=t,this.ch=e,void 0):new Ue(t,e)}function Xe(t,e){return t.line==e.line&&t.ch==e.ch}function _e(t,e){return t.liner?Ue(r,fn(t,r).text.length):Ze(e,fn(t,e.line).text.length)}function Ze(t,e){var r=t.ch;return null==r||r>e?Ue(t.line,e):0>r?Ue(t.line,0):t}function qe(t,e){return e>=t.first&&e=o.ch:u.to>o.ch))){if(n&&(Rn(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(!c.atomic)continue;var f=c.find()[0>l?"from":"to"];if(Xe(f,o)&&(f.ch+=l,f.ch<0?f=f.line>t.first?$e(t,Ue(f.line-1)):null:f.ch>s.text.length&&(f=f.line(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!zi){var o="none"==r.cursor.style.display;o&&(r.cursor.style.display="",r.cursor.style.left=e.left+"px",r.cursor.style.top=e.top-r.viewOffset+"px"),r.cursor.scrollIntoView(i),o&&(r.cursor.style.display="none")}}}function ir(t,e,r){for(null==r&&(r=0);;){var n=!1,i=q(t,e),o=lr(t,i.left,i.top-r,i.left,i.bottom+r),l=t.doc.scrollTop,s=t.doc.scrollLeft;if(null!=o.scrollTop&&(we(t,o.scrollTop),Math.abs(t.doc.scrollTop-l)>1&&(n=!0)),null!=o.scrollLeft&&(Le(t,o.scrollLeft),Math.abs(t.doc.scrollLeft-s)>1&&(n=!0)),!n)return i}}function or(t,e,r,n,i){var o=lr(t,e,r,n,i);null!=o.scrollTop&&we(t,o.scrollTop),null!=o.scrollLeft&&Le(t,o.scrollLeft)}function lr(t,e,r,n,i){var o=t.display,l=ee(t.display);0>r&&(r=0);var s=o.scroller.clientHeight-Lo,a=o.scroller.scrollTop,u={},c=t.doc.height+P(o),f=l>r,h=i>c-l;if(a>r)u.scrollTop=f?0:r;else if(i>a+s){var d=Math.min(r,(h?c:i)-s);d!=a&&(u.scrollTop=d)}var p=o.scroller.clientWidth-Lo,g=o.scroller.scrollLeft;e+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var m=o.gutters.offsetWidth,v=m+10>e;return g+m>e||v?(v&&(e=0),u.scrollLeft=Math.max(0,e-10-m)):n>p+g-3&&(u.scrollLeft=n+10-p),u}function sr(t,e,r){t.curOp.updateScrollPos={scrollLeft:null==e?t.doc.scrollLeft:e,scrollTop:null==r?t.doc.scrollTop:r}}function ar(t,e,r){var n=t.curOp.updateScrollPos||(t.curOp.updateScrollPos={scrollLeft:t.doc.scrollLeft,scrollTop:t.doc.scrollTop}),i=t.display.scroller;n.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,n.scrollTop+r)),n.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,n.scrollLeft+e))}function ur(t,e,r,n){var i=t.doc;if(null==r&&(r="add"),"smart"==r)if(t.doc.mode.indent)var o=z(t,e);else r="prev";var l,s=t.options.tabSize,a=fn(i,e),u=_n(a.text,null,s),c=a.text.match(/^\s*/)[0];if("smart"==r&&(l=t.doc.mode.indent(o,a.text.slice(c.length),a.text),l==ko)){if(!n)return;r="prev"}"prev"==r?l=e>i.first?_n(fn(i,e-1).text,null,s):0:"add"==r?l=u+t.options.indentUnit:"subtract"==r?l=u-t.options.indentUnit:"number"==typeof r&&(l=u+r),l=Math.max(0,l);var f="",h=0;if(t.options.indentWithTabs)for(var d=Math.floor(l/s);d;--d)h+=s,f+=" ";l>h&&(f+=Yn(l-h)),f!=c&&Ke(t.doc,f,Ue(e,0),Ue(e,c.length),"+input"),a.stateAfter=null}function cr(t,e,r){var n=e,i=e,o=t.doc;return"number"==typeof e?i=fn(o,je(o,e)):n=gn(e),null==n?null:r(i,n)?(ae(t,n,n+1),i):null}function fr(t,e,r,n,i){function o(){var e=s+r;return e=t.first+t.size?f=!1:(s=e,c=fn(t,e))}function l(t){var e=(i?Ci:wi)(c,a,r,!0);if(null==e){if(t||!o())return f=!1;a=i?(0>r?gi:pi)(c):0>r?c.text.length:0}else a=e;return!0}var s=e.line,a=e.ch,u=r,c=fn(t,s),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,d="group"==n,p=!0;!(0>r)||l(!p);p=!1){var g=c.text.charAt(a)||"\n",m=ei(g)?"w":d?/\s/.test(g)?null:"p":null;if(h&&h!=m){0>r&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!p))break}var v=rr(t,Ue(s,a),u,!0);return f||(v.hitSide=!0),v}function hr(t,e,r,n){var i,o=t.doc,l=e.left;if("page"==n){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=e.top+r*(s-(0>r?1.5:.5)*ee(t.display))}else"line"==n&&(i=r>0?e.bottom+3:e.top-3);for(;;){var a=Q(t,l,i);if(!a.outside)break;if(0>r?0>=i:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function dr(t,e){var r=e.ch,n=e.ch;if(t){(e.xRel<0||n==t.length)&&r?--r:++n;for(var i=t.charAt(r),o=ei(i)?ei:/\s/.test(i)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!ei(t)};r>0&&o(t.charAt(r-1));)--r;for(;nl;++l){var a=n(o[l]);if(a)return a}return!1}for(var i=0;i=e:o.to>e);(n||(n=[])).push({from:o.from,to:a?null:o.to,marker:l})}}return n}function Dr(t,e,r){if(t)for(var n,i=0;i=e:o.to>e);if(s||"bookmark"==l.type&&o.from==e&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=e:o.from0&&s)for(var f=0;ff;++f)p.push(g);p.push(a)}return p}function Or(t,e){var r=kn(t,e),n=Wr(t,e);if(!r)return n;if(!n)return r;for(var i=0;ie)&&(!r||r.widtht.options.maxHighlightLength?(o=!1,u.pos=Math.min(e.length,u.start+5e4),l=null):l=r.token(u,n),o&&a==l||(ss;){var i=n[l];i>t&&n.splice(l,1,t,n[l+1],i),l+=2,s=Math.min(t,i)}if(e)if(o.opaque)n.splice(r,l-r,t,e),l=r+2;else for(;l>r;r+=2){var a=n[r+1];n[r+1]=a?a+" "+e:e}})}return n}function Zr(t,e){return e.styles&&e.styles[0]==t.state.modeGen||(e.styles=$r(t,e,e.stateAfter=z(t,gn(e)))),e.styles}function qr(t,e,r){var n=t.doc.mode,i=new wr(e.text,t.options.tabSize);for(""==e.text&&n.blankLine&&n.blankLine(r);!i.eol()&&i.pos<=t.options.maxHighlightLength;)n.token(i,r),i.start=i.pos}function Jr(t){return t?go[t]||(go[t]="cm-"+t.replace(/ +/g," cm-")):null}function Qr(t,e,r,n){for(var i,o=e,l=!0;i=Ir(o);)o=fn(t.doc,i.find().from.line);var s={pre:ni("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:t,copyWidgets:n};o.textClass&&(s.pre.className=o.textClass);do{o.text&&(l=!1),s.measure=o==e&&r,s.pos=0,s.addToken=s.measure?en:tn,(ki||Ti)&&t.getOption("lineWrapping")&&(s.addToken=rn(s.addToken));var a=on(o,s,Zr(t,o));r&&o==e&&!s.measuredSomething&&(r[0]=s.pre.appendChild(ci(t.display.measure)),s.measuredSomething=!0),a&&(o=fn(t.doc,a.to.line))}while(a);!r||s.measuredSomething||r[0]||(r[0]=s.pre.appendChild(l?ni("span"," "):ci(t.display.measure))),s.pre.firstChild||Rr(t.doc,e)||s.pre.appendChild(document.createTextNode(" "));var u;if(r&&ki&&(u=yn(o))){var c=u.length-1;u[c].from==u[c].to&&--c;var f=u[c],h=u[c-1];if(f.from+1==f.to&&h&&f.level="í €"&&"í¯¿">s&&ld)?(null!=b.to&&m>b.to&&(m=b.to,a=""),x.className&&(s+=" "+x.className),x.startStyle&&b.from==d&&(u+=" "+x.startStyle),x.endStyle&&b.to==m&&(a+=" "+x.endStyle),x.title&&!c&&(c=x.title),x.collapsed&&(!f||f.marker.sized&&m>b.from&&(m=b.from),"bookmark"==x.type&&b.from==d&&x.replacedWith&&v.push(x)}if(f&&(f.from||0)==d&&(nn(e,(null==f.to?h:f.to)-d,f.marker,null==f.from),null==f.to))return f.marker.find();if(!f&&v.length)for(var y=0;y=h)break;for(var C=Math.min(h,m);;){if(g){var w=d+g.length;if(!f){var L=w>C?g.slice(0,C-d):g;e.addToken(e,L,l?l+s:s,u,d+L.length==m?a:"",c)}if(w>=C){g=g.slice(C-d),d=C;break}d=w,u=""}g=i.slice(o,o=r[p++]),l=Jr(r[p++])}}else for(var p=1;pg;++g)v.push(new po(u[g],o(g),i));l(f,f.text,d),p&&t.remove(s.line,p),v.length&&t.insert(s.line,v)}else if(c==f)if(1==u.length)l(c,c.text.slice(0,s.ch)+h+c.text.slice(a.ch),d);else{for(var v=[],g=1,m=u.length-1;m>g;++g)v.push(new po(u[g],o(g),i));v.push(new po(h+c.text.slice(a.ch),d,i)),l(c,c.text.slice(0,s.ch)+u[0],o(0)),t.insert(s.line+1,v)}else if(1==u.length)l(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),o(0)),t.remove(s.line+1,p);else{l(c,c.text.slice(0,s.ch)+u[0],o(0)),l(f,h+f.text.slice(a.ch),d);for(var g=1,m=u.length-1,v=[];m>g;++g)v.push(new po(u[g],o(g),i));p>1&&t.remove(s.line+1,p-1),t.insert(s.line+1,v)}Bn(t,"change",t,e),tr(t,n.anchor,n.head,null,!0)}function sn(t){this.lines=t,this.parent=null;for(var e=0,r=t.length,n=0;r>e;++e)t[e].parent=this,n+=t[e].height;this.height=n}function an(t){this.children=t;for(var e=0,r=0,n=0,i=t.length;i>n;++n){var o=t[n];e+=o.chunkSize(),r+=o.height,o.parent=this}this.size=e,this.height=r,this.parent=null}function un(t,e,r){function n(t,i,o){if(t.linked)for(var l=0;le){t=n;break}e-=i}return t.lines[e]}function hn(t,e,r){var n=[],i=e.line;return t.iter(e.line,r.line+1,function(t){var o=t.text;i==r.line&&(o=o.slice(0,r.ch)),i==e.line&&(o=o.slice(e.ch)),n.push(o),++i}),n}function dn(t,e,r){var n=[];return t.iter(e,r,function(t){n.push(t.text)}),n}function pn(t,e){for(var r=e-t.height,n=t;n;n=n.parent)n.height+=r}function gn(t){if(null==t.parent)return null;for(var e=t.parent,r=Zn(e.lines,t),n=e.parent;n;e=n,n=n.parent)for(var i=0;n.children[i]!=e;++i)r+=n.children[i].chunkSize();return r+e.first}function mn(t,e){var r=t.first;t:do{for(var n=0,i=t.children.length;i>n;++n){var o=t.children[n],l=o.height;if(l>e){t=o;continue t}e-=l,r+=o.chunkSize()}return r}while(!t.lines);for(var n=0,i=t.lines.length;i>n;++n){var s=t.lines[n],a=s.height;if(a>e)break;e-=a}return r+n}function vn(t,e){e=Fr(t.doc,e);for(var r=0,n=e.parent,i=0;io-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))){var s=jn(l.changes);Xe(e.from,e.to)&&Xe(e.from,s.to)?s.to=eo(e):l.changes.push(Cn(t,e)),l.anchorAfter=r.anchor,l.headAfter=r.head}else for(l={changes:[Cn(t,e)],generation:i.generation,anchorBefore:t.sel.anchor,headBefore:t.sel.head,anchorAfter:r.anchor,headAfter:r.head},i.done.push(l),i.generation=++i.maxGeneration;i.done.length>i.undoDepth;)i.done.shift();i.lastTime=o,i.lastOp=n,i.lastOrigin=e.origin}function Ln(t){if(!t)return null;for(var e,r=0;r-1&&(jn(l)[c]=u[c],delete u[c])}}return n}function Mn(t,e,r,n){r0}function Un(t){t.prototype.on=function(t,e){Pn(this,t,e)},t.prototype.off=function(t,e){Fn(this,t,e)}}function Xn(){this.id=null}function _n(t,e,r,n,i){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var o=n||0,l=i||0;e>o;++o)" "==t.charAt(o)?l+=r-l%r:++l;return l}function Yn(t){for(;So.length<=t;)So.push(jn(So)+" ");return So[t]}function jn(t){return t[t.length-1]}function $n(t){if(Ii)t.selectionStart=0,t.selectionEnd=t.value.length;else try{t.select()}catch(e){}}function Zn(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;n>r;++r)if(t[r]==e)return r;return-1}function qn(t,e){function r(){}r.prototype=t;var n=new r;return e&&Jn(e,n),n}function Jn(t,e){e||(e={});for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function Qn(t){for(var e=[],r=0;t>r;++r)e.push(void 0);return e}function ti(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function ei(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Mo.test(t))}function ri(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function ni(t,e,r,n){var i=document.createElement(t);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof e)li(i,e);else if(e)for(var o=0;o0;--e)t.removeChild(t.firstChild);return t}function oi(t,e){return ii(t).appendChild(e)}function li(t,e){Mi?(t.innerHTML="",t.appendChild(document.createTextNode(e))):t.textContent=e}function si(t){return t.getBoundingClientRect()}function ai(){return!1}function ui(t){if(null!=No)return No;var e=ni("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return oi(t,e),e.offsetWidth&&(No=e.offsetHeight-e.clientHeight),No||0}function ci(t){if(null==Ho){var e=ni("span","​");oi(t,ni("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Ho=e.offsetWidth<=1&&e.offsetHeight>2&&!Si)}return Ho?ni("span","​"):ni("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function fi(t,e,r,n){if(!t)return n(e,r,"ltr");for(var i=!1,o=0;oe||e==r&&l.to==e)&&(n(Math.max(l.from,e),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(e,r,"ltr")}function hi(t){return t.level%2?t.to:t.from}function di(t){return t.level%2?t.from:t.to}function pi(t){var e=yn(t);return e?hi(e[0]):0}function gi(t){var e=yn(t);return e?di(jn(e)):t.text.length}function mi(t,e){var r=fn(t.doc,e),n=Fr(t.doc,r);n!=r&&(e=gn(n));var i=yn(n),o=i?i[0].level%2?gi(n):pi(n):0;return Ue(e,o)}function vi(t,e){for(var r,n;r=Pr(n=fn(t.doc,e));)e=r.find().to.line;var i=yn(n),o=i?i[0].level%2?pi(n):gi(n):n.text.length;return Ue(e,o)}function yi(t,e,r){var n=t[0].level;return e==n?!0:r==n?!1:r>e}function bi(t,e){for(var r,n=0;ne)return zo=null,n;if(i.from==e||i.to==e){if(null!=r)return yi(t,i.level,t[r].level)?(zo=r,n):(zo=n,r);r=n}}return zo=null,r}function xi(t,e,r,n){if(!n)return e+r;do e+=r;while(e>0&&To.test(t.text.charAt(e)));return e}function Ci(t,e,r,n){var i=yn(t);if(!i)return wi(t,e,r,n);for(var o=bi(i,e),l=i[o],s=xi(t,e,l.level%2?-r:r,n);;){if(s>l.from&&s0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?xi(t,l.to,-1,n):xi(t,l.from,1,n)}}function wi(t,e,r,n){var i=e+r;if(n)for(;i>0&&To.test(t.text.charAt(i));)i+=r;return 0>i||i>t.text.length?null:i}var Li=/gecko\/\d/i.test(navigator.userAgent),ki=/MSIE \d/.test(navigator.userAgent),Si=ki&&(null==document.documentMode||document.documentMode<8),Mi=ki&&(null==document.documentMode||document.documentMode<9),Ti=/WebKit\//.test(navigator.userAgent),Ai=Ti&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Ni=/Chrome\//.test(navigator.userAgent),Hi=/Opera\//.test(navigator.userAgent),Di=/Apple Computer/.test(navigator.vendor),Wi=/KHTML\//.test(navigator.userAgent),Oi=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Ei=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),zi=/PhantomJS/.test(navigator.userAgent),Ii=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Pi=Ii||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Fi=Ii||/Mac/.test(navigator.platform),Ri=/win/i.test(navigator.platform),Bi=Hi&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Bi&&(Bi=Number(Bi[1])),Bi&&Bi>=15&&(Hi=!1,Ti=!0);var Gi,Vi,Ki,Ui=Fi&&(Ai||Hi&&(null==Bi||12.11>Bi)),Xi=Li||ki&&!Mi,_i=!1,Yi=!1,ji=0,$i=0,Zi=0,qi=null;ki?qi=-.53:Li?qi=15:Ni?qi=-.7:Di&&(qi=-1/3);var Ji,Qi,to=null,eo=t.changeEnd=function(t){return t.text?Ue(t.from.line+t.text.length-1,jn(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.Pos=Ue,t.prototype={constructor:t,focus:function(){window.focus(),de(this),De(this),ce(this)},setOption:function(t,e){var r=this.options,n=r[t];(r[t]!=e||"mode"==t)&&(r[t]=e,ro.hasOwnProperty(t)&&oe(this,ro[t])(this,e,n))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](t)},removeKeyMap:function(t){for(var e=this.state.keyMaps,r=0;r=n;++n)ur(this,n,t)}),getTokenAt:function(t,e){var r=this.doc;t=$e(r,t);for(var n=z(this,t.line,e),i=this.doc.mode,o=fn(r,t.line),l=new wr(o.text,this.options.tabSize);l.pos>1;if((o?e[2*o-1]:0)>=i)n=o;else{if(!(e[2*o+1]n&&(t=n,r=!0);var i=fn(this.doc,t);return j(this,fn(this.doc,t),{top:0,left:0},e||"page").top+(r?i.height:0)},defaultTextHeight:function(){return ee(this.display)},defaultCharWidth:function(){return re(this.display)},setGutterMarker:oe(null,function(t,e,r){return cr(this,t,function(t){var n=t.gutterMarkers||(t.gutterMarkers={});return n[e]=r,!r&&ri(n)&&(t.gutterMarkers=null),!0})}),clearGutter:oe(null,function(t){var e=this,r=e.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[t]&&(r.gutterMarkers[t]=null,ae(e,n,n+1),ri(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:oe(null,function(t,e,r){return cr(this,t,function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass";if(t[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(t[n]))return!1;t[n]+=" "+r}else t[n]=r;return!0})}),removeLineClass:oe(null,function(t,e,r){return cr(this,t,function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass",i=t[n];if(!i)return!1;if(null==r)t[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var l=o.index+o[0].length;t[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:oe(null,function(t,e,r){return Xr(this,t,e,r)}),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!qe(this.doc,t))return null;var e=t;if(t=fn(this.doc,t),!t)return null}else{var e=gn(t);if(null==e)return null}return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(t,e,r,n,i){var o=this.display;t=q(this,$e(this.doc,t));var l=t.bottom,s=t.left;if(e.style.position="absolute",o.sizer.appendChild(e),"over"==n)l=t.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>a)&&t.top>e.offsetHeight?l=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=a&&(l=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=l+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),r&&or(this,s,l,s+e.offsetWidth,l+e.offsetHeight)},triggerOnKeyDown:oe(null,Ne),execCommand:function(t){return co[t](this)},findPosH:function(t,e,r,n){var i=1;0>e&&(i=-1,e=-e);for(var o=0,l=$e(this.doc,t);e>o&&(l=fr(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:oe(null,function(t,e){var r,n=this.doc.sel;r=n.shift||n.extend||Xe(n.from,n.to)?fr(this.doc,n.head,t,e,this.options.rtlMoveVisually):0>t?n.from:n.to,Je(this.doc,r,r,t)}),deleteH:oe(null,function(t,e){var r=this.doc.sel;Xe(r.from,r.to)?Ke(this.doc,"",r.from,fr(this.doc,r.head,t,e,!1),"+delete"):Ke(this.doc,"",r.from,r.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(t,e,r,n){var i=1,o=n;0>e&&(i=-1,e=-e);for(var l=0,s=$e(this.doc,t);e>l;++l){var a=q(this,s,"div");if(null==o?o=a.left:a.left=o,s=hr(this,a,i,r),s.hitSide)break}return s},moveV:oe(null,function(t,e){var r=this.doc.sel,n=q(this,r.head,"div");null!=r.goalColumn&&(n.left=r.goalColumn);var i=hr(this,n,t,e);"page"==e&&ar(this,0,Z(this,i,"div").top-n.top),Je(this.doc,i,i,t),r.goalColumn=n.left}),toggleOverwrite:function(t){(null==t||t!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:oe(null,function(t,e){sr(this,t,e)}),getScrollInfo:function(){var t=this.display.scroller,e=Lo;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-e,width:t.scrollWidth-e,clientHeight:t.clientHeight-e,clientWidth:t.clientWidth-e}},scrollIntoView:oe(null,function(t,e){"number"==typeof t&&(t=Ue(t,0)),e||(e=0);var r=t;t&&null==t.line||(this.curOp.scrollToPos=t?$e(this.doc,t):this.doc.sel.head,this.curOp.scrollToPosMargin=e,r=q(this,this.curOp.scrollToPos));var n=lr(this,r.left,r.top-e,r.right,r.bottom+e);sr(this,n.scrollLeft,n.scrollTop)}),setSize:oe(null,function(t,e){function r(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t}null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(t){return se(this,t)},refresh:oe(null,function(){X(this),sr(this,this.doc.scrollLeft,this.doc.scrollTop),ae(this)}),swapDoc:oe(null,function(t){var e=this.doc;return e.cm=null,cn(this,t),X(this),he(this,!0),sr(this,t.scrollLeft,t.scrollTop),e}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Un(t);var ro=t.optionHandlers={},no=t.defaults={},io=t.Init={toString:function(){return"CodeMirror.Init"}};gr("value","",function(t,e){t.setValue(e)},!0),gr("mode",null,function(t,e){t.doc.modeOption=e,r(t)},!0),gr("indentUnit",2,r,!0),gr("indentWithTabs",!1),gr("smartIndent",!0),gr("tabSize",4,function(t){r(t),X(t),ae(t)},!0),gr("electricChars",!0),gr("rtlMoveVisually",!Ri),gr("theme","default",function(t){s(t),a(t)},!0),gr("keyMap","default",l),gr("extraKeys",null),gr("onKeyEvent",null),gr("onDragEvent",null),gr("lineWrapping",!1,n,!0),gr("gutters",[],function(t){h(t.options),a(t)},!0),gr("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?y(t.display)+"px":"0",t.refresh()},!0),gr("coverGutterNextToScrollbar",!1,d,!0),gr("lineNumbers",!1,function(t){h(t.options),a(t)},!0),gr("firstLineNumber",1,a,!0),gr("lineNumberFormatter",function(t){return t},a,!0),gr("showCursorWhenSelecting",!1,A,!0),gr("readOnly",!1,function(t,e){"nocursor"==e?(We(t),t.display.input.blur()):e||he(t,!0)}),gr("dragDrop",!0),gr("cursorBlinkRate",530),gr("cursorScrollMargin",0),gr("cursorHeight",1),gr("workTime",100),gr("workDelay",100),gr("flattenSpans",!0),gr("pollInterval",100),gr("undoDepth",40,function(t,e){t.doc.history.undoDepth=e}),gr("historyEventDelay",500),gr("viewportMargin",10,function(t){t.refresh()},!0),gr("maxHighlightLength",1e4,function(t){r(t),t.refresh()},!0),gr("moveInputWithCursor",!0,function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)}),gr("tabindex",null,function(t,e){t.display.input.tabIndex=e||""}),gr("autofocus",null);var oo=t.modes={},lo=t.mimeModes={};t.defineMode=function(e,r){if(t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2){r.dependencies=[];for(var n=2;n0&&e.ch=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pose},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);return e>-1?(this.pos=e,!0):void 0},backUp:function(t){this.pos-=t},column:function(){return this.lastColumnPos0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}var i=function(t){return r?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);return i(o)==i(t)?(e!==!1&&(this.pos+=t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},t.StringStream=wr,t.TextMarker=Lr,Un(Lr),Lr.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&ne(t),Kn(this,"clear")){var r=this.find();r&&Bn(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;ot.display.maxLineLength&&(t.display.maxLine=a,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=n&&t&&ae(t,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&er(t)),e&&ie(t)}},Lr.prototype.find=function(){for(var t,e,r=0;r=e.display.showingFrom&&t.liner;++r){var i=this.lines[r];this.height-=i.height,Yr(i),Bn(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.splice.apply(t,[t.length,0].concat(this.lines))},insertInner:function(t,e,r){this.height+=r,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var n=0,i=e.length;i>n;++n)e[n].parent=this},iterN:function(t,e,r){for(var n=t+e;n>t;++t)if(r(this.lines[t]))return!0}},an.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var r=0;rt){var o=Math.min(e,i-t),l=n.height;if(n.removeInner(t,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(e-=o))break;t=0}else t-=i}if(this.size-e<25){var s=[];this.collapse(s),this.children=[new sn(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0,r=this.children.length;r>e;++e)this.children[e].collapse(t)},insertInner:function(t,e,r){this.size+=e.length,this.height+=r; -for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>=t){if(o.insertInner(t,e,r),o.lines&&o.lines.length>50){for(;o.lines.length>50;){var s=o.lines.splice(o.lines.length-25,25),a=new sn(s);o.height-=a.height,this.children.splice(n+1,0,a),a.parent=this}this.maybeSpill()}break}t-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),r=new an(e);if(t.parent){t.size-=r.size,t.height-=r.height;var n=Zn(t.parent.children,t);t.parent.children.splice(n+1,0,r)}else{var i=new an(t.children);i.parent=t,t.children=[i,r],t=i}r.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,r){for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>t){var s=Math.min(e,l-t);if(o.iterN(t,s,r))return!0;if(0==(e-=s))break;t=0}else t-=l}}};var vo=0,yo=t.Doc=function(t,e,r){if(!(this instanceof yo))return new yo(t,e,r);null==r&&(r=0),an.call(this,[new sn([new po("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=bn(),this.cleanGeneration=1,this.frontier=r;var n=Ue(r,0);this.sel={from:n,to:n,head:n,anchor:n,shift:!1,extend:!1,goalColumn:null},this.id=++vo,this.modeOption=e,"string"==typeof t&&(t=Do(t)),ln(this,{from:n,to:n,text:t},null,{head:n,anchor:n})};yo.prototype=qn(an.prototype,{constructor:yo,iter:function(t,e,r){r?this.iterN(t-this.first,e-t,r):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var r=0,n=0,i=e.length;i>n;++n)r+=e[n].height;this.insertInner(t-this.first,e,r)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=dn(this,this.first,this.first+this.size);return t===!1?e:e.join(t||"\n")},setValue:function(t){var e=Ue(this.first,0),r=this.first+this.size-1;Pe(this,{from:e,to:Ue(r,fn(this,r).text.length),text:Do(t),origin:"setValue"},{head:e,anchor:e},!0)},replaceRange:function(t,e,r,n){e=$e(this,e),r=r?$e(this,r):e,Ke(this,t,e,r,n)},getRange:function(t,e,r){var n=hn(this,$e(this,t),$e(this,e));return r===!1?n:n.join(r||"\n")},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},setLine:function(t,e){qe(this,t)&&Ke(this,e,Ue(t,0),$e(this,Ue(t)))},removeLine:function(t){t?Ke(this,"",$e(this,Ue(t-1)),$e(this,Ue(t))):Ke(this,"",Ue(0,0),$e(this,Ue(1,0)))},getLineHandle:function(t){return qe(this,t)?fn(this,t):void 0},getLineNumber:function(t){return gn(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=fn(this,t)),Fr(this,t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return $e(this,t)},getCursor:function(t){var e,r=this.sel;return e=null==t||"head"==t?r.head:"anchor"==t?r.anchor:"end"==t||t===!1?r.to:r.from,Ye(e)},somethingSelected:function(){return!Xe(this.sel.head,this.sel.anchor)},setCursor:le(function(t,e,r){var n=$e(this,"number"==typeof t?Ue(t,e||0):t);r?Je(this,n):tr(this,n,n)}),setSelection:le(function(t,e,r){tr(this,$e(this,t),$e(this,e||t),r)}),extendSelection:le(function(t,e,r){Je(this,$e(this,t),e&&$e(this,e),r)}),getSelection:function(t){return this.getRange(this.sel.from,this.sel.to,t)},replaceSelection:function(t,e,r){Pe(this,{from:this.sel.from,to:this.sel.to,text:Do(t),origin:r},e||"around")},undo:le(function(){Re(this,"undo")}),redo:le(function(){Re(this,"redo")}),setExtending:function(t){this.sel.extend=t},historySize:function(){var t=this.history;return{undo:t.done.length,redo:t.undone.length}},clearHistory:function(){this.history=bn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Sn(this.history.done),undone:Sn(this.history.undone)}},setHistory:function(t){var e=this.history=bn(this.history.maxGeneration);e.done=t.done.slice(0),e.undone=t.undone.slice(0)},markText:function(t,e,r){return kr(this,$e(this,t),$e(this,e),r,"range")},setBookmark:function(t,e){var r={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft};return t=$e(this,t),kr(this,t,t,r,"bookmark")},findMarksAt:function(t){t=$e(this,t);var e=[],r=fn(this,t.line).markedSpans;if(r)for(var n=0;n=t.ch)&&e.push(i.marker.parent||i.marker)}return e},getAllMarks:function(){var t=[];return this.iter(function(e){var r=e.markedSpans;if(r)for(var n=0;nt?(e=t,!0):(t-=i,++r,void 0)}),$e(this,Ue(r,e))},indexFromPos:function(t){t=$e(this,t);var e=t.ch;return t.linee&&(e=t.from),null!=t.to&&t.to1&&45==t.charCodeAt(e-1)){if(/\w/.test(t.charAt(e-2))&&/[^\-?\.]/.test(t.charAt(e)))return!0;if(e>2&&/[\d\.,]/.test(t.charAt(e-2))&&/[\d\.,]/.test(t.charAt(e)))return!1}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(t.slice(e-1,e+1))});var No,Ho,Do=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,r=[],n=t.length;n>=e;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),e+=l+1):(r.push(o),e=i+1)}return r}:function(t){return t.split(/\r\n?|\n/)};t.splitLines=Do;var Wo=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(r){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1},Oo=function(){var t=ni("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),Eo={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};t.keyNames=Eo,function(){for(var t=0;10>t;t++)Eo[t+48]=String(t);for(var t=65;90>=t;t++)Eo[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)Eo[t+111]=Eo[t+63235]="F"+t}();var zo,Io=function(){function t(t){return 255>=t?e.charAt(t):t>=1424&&1524>=t?"R":t>=1536&&1791>=t?r.charAt(t-1536):t>=1792&&2220>=t?"r":"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,a="L";return function(e){if(!n.test(e))return!1;for(var r,u=e.length,c=[],f=0;u>f;++f)c.push(r=t(e.charCodeAt(f)));for(var f=0,h=a;u>f;++f){var r=c[f];"m"==r?c[f]=h:h=r}for(var f=0,d=a;u>f;++f){var r=c[f];"1"==r&&"r"==d?c[f]="n":o.test(r)&&(d=r,"r"==r&&(c[f]="R"))}for(var f=1,h=c[0];u-1>f;++f){var r=c[f];"+"==r&&"1"==h&&"1"==c[f+1]?c[f]="1":","!=r||h!=c[f+1]||"1"!=h&&"n"!=h||(c[f]=h),h=r}for(var f=0;u>f;++f){var r=c[f];if(","==r)c[f]="N";else if("%"==r){for(var p=f+1;u>p&&"%"==c[p];++p);for(var g=f&&"!"==c[f-1]||u-1>p&&"1"==c[p]?"1":"N",m=f;p>m;++m)c[m]=g;f=p-1}}for(var f=0,d=a;u>f;++f){var r=c[f];"L"==d&&"1"==r?c[f]="L":o.test(r)&&(d=r)}for(var f=0;u>f;++f)if(i.test(c[f])){for(var p=f+1;u>p&&i.test(c[p]);++p);for(var v="L"==(f?c[f-1]:a),y="L"==(u-1>p?c[p]:a),g=v||y?"L":"R",m=f;p>m;++m)c[m]=g;f=p-1}for(var b,x=[],f=0;u>f;)if(l.test(c[f])){var C=f;for(++f;u>f&&l.test(c[f]);++f);x.push({from:C,to:f,level:0})}else{var w=f,L=x.length;for(++f;u>f&&"L"!=c[f];++f);for(var m=w;f>m;)if(s.test(c[m])){m>w&&x.splice(L,0,{from:w,to:m,level:1});var k=m;for(++m;f>m&&s.test(c[m]);++m);x.splice(L,0,{from:k,to:m,level:2}),w=m}else++m;f>w&&x.splice(L,0,{from:w,to:f,level:1})}return 1==x[0].level&&(b=e.match(/^\s+/))&&(x[0].from=b[0].length,x.unshift({from:0,to:b[0].length,level:0})),1==jn(x).level&&(b=e.match(/\s+$/))&&(jn(x).to-=b[0].length,x.push({from:u-b[0].length,to:u,level:0})),x[0].level!=jn(x).level&&x.push({from:u,to:u,level:x[0].level}),x}}();return t.version="3.16.1",t}(); \ No newline at end of file diff --git a/tool/template-websocket-api-tool.html b/tool/template-websocket-api-tool.html index 41c7d56386..e2fa2a8915 100644 --- a/tool/template-websocket-api-tool.html +++ b/tool/template-websocket-api-tool.html @@ -5,90 +5,96 @@ API Methods - - server_info - server_state - ping - - subscribe - unsubscribe - - ledger - ledger_closed - ledger_current - ledger_entry - - account_info - account_lines - account_offers - account_tx - account_currencies - - transaction_entry - tx - tx_history - - sign - submit - - ripple_path_find - path_find - book_offers - + {% endblock %} {% block main %} - + WebSocket Tool - Offline - - - - - - Test accounts only! - Never submit account secrets to a server you do not control, unless you are prepared to lose ownership of the account! - - - server_info - - Invalid JSON - JSON - - - Send request - - - - Response - - - - - - - - Stream output - - show - pause - - - - - - - + + server_info + Get information about the state of the server, formatted for human consumption. + Read more + + + Request + + + + Send request + + + + + + + + Online (Main Net) + Permanlink + cURL + + + + + + Responses + + + + {% endblock %} {% block endbody %} - - - - - - - + + + + + + Connection Settings + + × + + + + + + + + s1.ripple.com (Main Net Public Server) + + + + + + s2.ripple.com (Full History Public Server) + + + + + + s.altnet.rippletest.net (Test Net Public Server) + + + + + + localhost:6006 (Local rippled Server on port 6006) + (Requires that you run rippled on this machine with default WebSocket settings) + + + + + + + + + + + + + {% endblock %}
Never submit account secrets to a server you do not control, unless you are prepared to lose ownership of the account!
JSON
Get information about the state of the server, formatted for human consumption.
rippled