1 line
202 KiB
JavaScript
1 line
202 KiB
JavaScript
__NEXT_REGISTER_CHUNK("comps_CodeMirror_51c113b8f0eb112cf9be60e9d3293726",function(){webpackJsonp([1],{282:function(e,t,r){(function(t,r){e.exports=r()})(this,function(){"use strict";var e=navigator.userAgent;var t=navigator.platform;var r=/gecko\/\d/i.test(e);var n=/MSIE \d/.test(e);var i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e);var o=/Edge\/(\d+)/.exec(e);var a=n||i||o;var l=a&&(n?document.documentMode||6:+(o||i)[1]);var s=!o&&/WebKit\//.test(e);var u=s&&/Qt\/\d+\.\d+/.test(e);var c=!o&&/Chrome\//.test(e);var f=/Opera\//.test(e);var h=/Apple Computer/.test(navigator.vendor);var d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e);var p=/PhantomJS/.test(e);var m=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e);var v=/Android/.test(e);var g=m||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e);var x=m||/Mac/.test(t);var y=/\bCrOS\b/.test(e);var b=/win/i.test(t);var w=f&&e.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1]));if(w&&w>=15){f=false;s=true}var k=x&&(u||f&&(null==w||w<12.11));var C=r||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L=function(e,t){var r=e.className;var n=S(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function M(e,t){return T(e).appendChild(t)}function N(e,t,r,n){var i=document.createElement(e);r&&(i.className=r);n&&(i.style.cssText=n);if("string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function O(e,t,r,n){var i=N(e,t,r,n);i.setAttribute("role","presentation");return i}var A;A=document.createRange?function(e,t,r,n){var i=document.createRange();i.setEnd(n||e,r);i.setStart(e,t);return i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}n.collapse(true);n.moveEnd("character",r);n.moveStart("character",t);return n};function D(e,t){3==t.nodeType&&(t=t.parentNode);if(e.contains)return e.contains(t);do{11==t.nodeType&&(t=t.host);if(t==e)return true}while(t=t.parentNode)}function W(){var e;try{e=document.activeElement}catch(t){e=document.body||null}while(e&&e.shadowRoot&&e.shadowRoot.activeElement)e=e.shadowRoot.activeElement;return e}function H(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function E(e,t){var r=e.split(" ");for(var n=0;n<r.length;n++)r[n]&&!S(r[n]).test(t)&&(t+=" "+r[n]);return t}var F=function(e){e.select()};m?F=function(e){e.selectionStart=0;e.selectionEnd=e.value.length}:a&&(F=function(e){try{e.select()}catch(e){}});function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||false===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function z(e,t,r,n,i){if(null==t){t=e.search(/[^\s\u00a0]/);-1==t&&(t=e.length)}for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o;a+=r-a%r;o=l+1}}var R=function(){this.id=null};R.prototype.set=function(e,t){clearTimeout(this.id);this.id=setTimeout(t,e)};function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var j=30;var q={toString:function(){return"CodeMirror.Pass"}};var G={scroll:false};var U={origin:"*mouse"};var K={origin:"+move"};function V(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);i+=o-n;i+=r-i%r;n=o+1;if(i>=t)return n}}var _=[""];function X(e){while(_.length<=e)_.push($(_)+" ");return _[e]}function $(e){return e[e.length-1]}function Y(e,t){var r=[];for(var n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function J(e,t,r){var n=0,i=r(t);while(n<e.length&&r(e[n])<=i)n++;e.splice(n,0,t)}function Z(){}function Q(e,t){var r;if(Object.create)r=Object.create(e);else{Z.prototype=e;r=new Z}t&&I(t,r);return r}var ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function te(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function re(e,t){if(!t)return te(e);if(t.source.indexOf("\\w")>-1&&te(e))return true;return t.test(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return false;return true}var ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function oe(e){return e.charCodeAt(0)>=768&&ie.test(e)}function ae(e,t,r){while((r<0?t>0:t<e.length)&&oe(e.charAt(t)))t+=r;return t}function le(e,t,r){var n=t>r?-1:1;for(;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t,n){var i=this;this.input=n;i.scrollbarFiller=N("div",null,"CodeMirror-scrollbar-filler");i.scrollbarFiller.setAttribute("cm-not-content","true");i.gutterFiller=N("div",null,"CodeMirror-gutter-filler");i.gutterFiller.setAttribute("cm-not-content","true");i.lineDiv=O("div",null,"CodeMirror-code");i.selectionDiv=N("div",null,null,"position: relative; z-index: 1");i.cursorDiv=N("div",null,"CodeMirror-cursors");i.measure=N("div",null,"CodeMirror-measure");i.lineMeasure=N("div",null,"CodeMirror-measure");i.lineSpace=O("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=O("div",[i.lineSpace],"CodeMirror-lines");i.mover=N("div",[o],null,"position: relative");i.sizer=N("div",[i.mover],"CodeMirror-sizer");i.sizerWidth=null;i.heightForcer=N("div",null,null,"position: absolute; height: "+j+"px; width: 1px;");i.gutters=N("div",null,"CodeMirror-gutters");i.lineGutter=null;i.scroller=N("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll");i.scroller.setAttribute("tabIndex","-1");i.wrapper=N("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror");if(a&&l<8){i.gutters.style.zIndex=-1;i.scroller.style.paddingRight=0}s||r&&g||(i.scroller.draggable=true);e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper));i.viewFrom=i.viewTo=t.first;i.reportedViewFrom=i.reportedViewTo=t.first;i.view=[];i.renderedView=null;i.externalMeasured=null;i.viewOffset=0;i.lastWrapHeight=i.lastWrapWidth=0;i.updateLineNumbers=null;i.nativeBarWidth=i.barHeight=i.barWidth=0;i.scrollbarsClipped=false;i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null;i.alignWidgets=false;i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null;i.maxLine=null;i.maxLineLength=0;i.maxLineChanged=false;i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null;i.shift=false;i.selForContextMenu=null;i.activeTouch=null;n.init(i)}function ue(e,t){t-=e.first;if(t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var r=e;while(!r.lines)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function ce(e,t,r){var n=[],i=t.line;e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch));i==t.line&&(o=o.slice(t.ch));n.push(o);++i});return n}function fe(e,t,r){var n=[];e.iter(t,r,function(e){n.push(e.text)});return n}function he(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function de(e){if(null==e.parent)return null;var t=e.parent,r=B(t.lines,e);for(var n=t.parent;n;t=n,n=n.parent)for(var i=0;;++i){if(n.children[i]==t)break;r+=n.children[i].chunkSize()}return r+t.first}function pe(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o;r+=i.chunkSize()}return r}while(!e.lines);var a=0;for(;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return r+a}function me(e,t){return t>=e.first&&t<e.first+e.size}function ve(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ge(e,t,r){void 0===r&&(r=null);if(!(this instanceof ge))return new ge(e,t,r);this.line=e;this.ch=t;this.sticky=r}function xe(e,t){return e.line-t.line||e.ch-t.ch}function ye(e,t){return e.sticky==t.sticky&&0==xe(e,t)}function be(e){return ge(e.line,e.ch)}function we(e,t){return xe(e,t)<0?t:e}function ke(e,t){return xe(e,t)<0?e:t}function Ce(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Se(e,t){if(t.line<e.first)return ge(e.first,0);var r=e.first+e.size-1;if(t.line>r)return ge(r,ue(e,r).text.length);return Le(t,ue(e,t.line).text.length)}function Le(e,t){var r=e.ch;return null==r||r>t?ge(e.line,t):r<0?ge(e.line,0):e}function Te(e,t){var r=[];for(var n=0;n<t.length;n++)r[n]=Se(e,t[n]);return r}var Me=false;var Ne=false;function Oe(){Me=true}function Ae(){Ne=true}function De(e,t,r){this.marker=e;this.from=t;this.to=r}function We(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function He(e,t){var r;for(var n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ee(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t];t.marker.attachLine(e)}function Fe(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new De(a,o.from,s?null:o.to))}}return n}function Pe(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new De(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function Ie(e,t){if(t.full)return null;var r=me(e,t.from.line)&&ue(e,t.from.line).markedSpans;var n=me(e,t.to.line)&&ue(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==xe(t.from,t.to);var l=Fe(r,i,a);var s=Pe(n,o,a);var u=1==t.text.length,c=$(t.text).length+(u?i:0);if(l)for(var f=0;f<l.length;++f){var h=l[f];if(null==h.to){var d=We(s,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(s)for(var p=0;p<s.length;++p){var m=s[p];null!=m.to&&(m.to+=c);if(null==m.from){var v=We(l,m.marker);if(!v){m.from=c;u&&(l||(l=[])).push(m)}}else{m.from+=c;u&&(l||(l=[])).push(m)}}l&&(l=ze(l));s&&s!=l&&(s=ze(s));var g=[l];if(!u){var x=t.text.length-2,y;if(x>0&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(y||(y=[])).push(new De(l[b].marker,null,null));for(var w=0;w<x;++w)g.push(y);g.push(s)}return g}function ze(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&false!==r.marker.clearWhenEmpty&&e.splice(t--,1)}if(!e.length)return null;return e}function Re(e,t,r){var n=null;e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=B(n,r)||(n||(n=[])).push(r)}});if(!n)return null;var i=[{from:t,to:r}];for(var o=0;o<n.length;++o){var a=n[o],l=a.find(0);for(var s=0;s<i.length;++s){var u=i[s];if(xe(u.to,l.from)<0||xe(u.from,l.to)>0)continue;var c=[s,1],f=xe(u.from,l.from),h=xe(u.to,l.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from});(h>0||!a.inclusiveRight&&!h)&&c.push({from:l.to,to:u.to});i.splice.apply(i,c);s+=c.length-3}}return i}function Be(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function je(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function qe(e){return e.inclusiveLeft?-1:0}function Ge(e){return e.inclusiveRight?1:0}function Ue(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find();var o=xe(n.from,i.from)||qe(e)-qe(t);if(o)return-o;var a=xe(n.to,i.to)||Ge(e)-Ge(t);if(a)return a;return t.id-e.id}function Ke(e,t){var r=Ne&&e.markedSpans,n;if(r)for(var i=void 0,o=0;o<r.length;++o){i=r[o];i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ue(n,i.marker)<0)&&(n=i.marker)}return n}function Ve(e){return Ke(e,true)}function _e(e){return Ke(e,false)}function Xe(e,t,r,n,i){var o=ue(e,t);var a=Ne&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(!s.marker.collapsed)continue;var u=s.marker.find(0);var c=xe(u.from,r)||qe(s.marker)-qe(i);var f=xe(u.to,n)||Ge(s.marker)-Ge(i);if(c>=0&&f<=0||c<=0&&f>=0)continue;if(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?xe(u.to,r)>=0:xe(u.to,r)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?xe(u.from,n)<=0:xe(u.from,n)<0))return true}}function $e(e){var t;while(t=Ve(e))e=t.find(-1,true).line;return e}function Ye(e){var t;while(t=_e(e))e=t.find(1,true).line;return e}function Je(e){var t,r;while(t=_e(e)){e=t.find(1,true).line;(r||(r=[])).push(e)}return r}function Ze(e,t){var r=ue(e,t),n=$e(r);if(r==n)return t;return de(n)}function Qe(e,t){if(t>e.lastLine())return t;var r=ue(e,t),n;if(!et(e,r))return t;while(n=_e(r))r=n.find(1,true).line;return de(r)+1}function et(e,t){var r=Ne&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i){n=r[i];if(!n.marker.collapsed)continue;if(null==n.from)return true;if(n.marker.widgetNode)continue;if(0==n.from&&n.marker.inclusiveLeft&&tt(e,t,n))return true}}function tt(e,t,r){if(null==r.to){var n=r.marker.find(1,true);return tt(e,n.line,We(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return true;for(var i=void 0,o=0;o<t.markedSpans.length;++o){i=t.markedSpans[o];if(i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&tt(e,t,i))return true}}function rt(e){e=$e(e);var t=0,r=e.parent;for(var n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function nt(e){if(0==e.height)return 0;var t=e.text.length,r,n=e;while(r=Ve(n)){var i=r.find(0,true);n=i.from.line;t+=i.from.ch-i.to.ch}n=e;while(r=_e(n)){var o=r.find(0,true);t-=n.text.length-o.from.ch;n=o.to.line;t+=n.text.length-o.to.ch}return t}function it(e){var t=e.display,r=e.doc;t.maxLine=ue(r,r.first);t.maxLineLength=nt(t.maxLine);t.maxLineChanged=true;r.iter(function(e){var r=nt(e);if(r>t.maxLineLength){t.maxLineLength=r;t.maxLine=e}})}function ot(e,t,r,n){if(!e)return n(t,r,"ltr",0);var i=false;for(var o=0;o<e.length;++o){var a=e[o];if(a.from<r&&a.to>t||t==r&&a.to==t){n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o);i=true}}i||n(t,r,"ltr")}var at=null;function lt(e,t,r){var n;at=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:at=i);o.from==t&&(o.from!=o.to&&"before"!=r?n=i:at=i)}return null!=n?n:at}var st=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(r){return r<=247?e.charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?t.charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e;this.from=t;this.to=r}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!n.test(e))return false;var c=e.length,f=[];for(var h=0;h<c;++h)f.push(r(e.charCodeAt(h)));for(var d=0,p=u;d<c;++d){var m=f[d];"m"==m?f[d]=p:p=m}for(var v=0,g=u;v<c;++v){var x=f[v];if("1"==x&&"r"==g)f[v]="n";else if(o.test(x)){g=x;"r"==x&&(f[v]="R")}}for(var y=1,b=f[0];y<c-1;++y){var w=f[y];"+"==w&&"1"==b&&"1"==f[y+1]?f[y]="1":","!=w||b!=f[y+1]||"1"!=b&&"n"!=b||(f[y]=b);b=w}for(var k=0;k<c;++k){var C=f[k];if(","==C)f[k]="N";else if("%"==C){var S=void 0;for(S=k+1;S<c&&"%"==f[S];++S);var L=k&&"!"==f[k-1]||S<c&&"1"==f[S]?"1":"N";for(var T=k;T<S;++T)f[T]=L;k=S-1}}for(var M=0,N=u;M<c;++M){var O=f[M];"L"==N&&"1"==O?f[M]="L":o.test(O)&&(N=O)}for(var A=0;A<c;++A)if(i.test(f[A])){var D=void 0;for(D=A+1;D<c&&i.test(f[D]);++D);var W="L"==(A?f[A-1]:u);var H="L"==(D<c?f[D]:u);var E=W==H?W?"L":"R":u;for(var F=A;F<D;++F)f[F]=E;A=D-1}var P=[],I;for(var z=0;z<c;)if(a.test(f[z])){var R=z;for(++z;z<c&&a.test(f[z]);++z);P.push(new s(0,R,z))}else{var B=z,j=P.length;for(++z;z<c&&"L"!=f[z];++z);for(var q=B;q<z;)if(l.test(f[q])){B<q&&P.splice(j,0,new s(1,B,q));var G=q;for(++q;q<z&&l.test(f[q]);++q);P.splice(j,0,new s(2,G,q));B=q}else++q;B<z&&P.splice(j,0,new s(1,B,z))}if("ltr"==t){if(1==P[0].level&&(I=e.match(/^\s+/))){P[0].from=I[0].length;P.unshift(new s(0,0,I[0].length))}if(1==$(P).level&&(I=e.match(/\s+$/))){$(P).to-=I[0].length;P.push(new s(0,c-I[0].length,c))}}return"rtl"==t?P.reverse():P}}();function ut(e,t){var r=e.order;null==r&&(r=e.order=st(e.text,t));return r}var ct=[];var ft=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,false);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ct).concat(r)}};function ht(e,t){return e._handlers&&e._handlers[t]||ct}function dt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,false);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=B(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pt(e,t){var r=ht(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2);for(var i=0;i<r.length;++i)r[i].apply(null,n)}function mt(e,t,r){"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=true}});pt(e,r||t.type,e,t);return wt(t)||t.codemirrorIgnore}function vt(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]);for(var n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function gt(e,t){return ht(e,t).length>0}function xt(e){e.prototype.on=function(e,t){ft(this,e,t)};e.prototype.off=function(e,t){dt(this,e,t)}}function yt(e){e.preventDefault?e.preventDefault():e.returnValue=false}function bt(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=true}function wt(e){return null!=e.defaultPrevented?e.defaultPrevented:false==e.returnValue}function kt(e){yt(e);bt(e)}function Ct(e){return e.target||e.srcElement}function St(e){var t=e.which;null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2));x&&e.ctrlKey&&1==t&&(t=3);return t}var Lt=function(){if(a&&l<9)return false;var e=N("div");return"draggable"in e||"dragDrop"in e}();var Tt;function Mt(e){if(null==Tt){var t=N("span","");M(e,N("span",[t,document.createTextNode("x")]));0!=e.firstChild.offsetHeight&&(Tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var r=Tt?N("span",""):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");r.setAttribute("cm-text","");return r}var Nt;function Ot(e){if(null!=Nt)return Nt;var t=M(e,document.createTextNode("AخA"));var r=A(t,0,1).getBoundingClientRect();var n=A(t,1,2).getBoundingClientRect();T(e);if(!r||r.left==r.right)return false;return Nt=n.right-r.right<3}var At=3!="\n\nb".split(/\n/).length?function(e){var t=0,r=[],n=e.length;while(t<=n){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i);var a=o.indexOf("\r");if(-1!=a){r.push(o.slice(0,a));t+=a+1}else{r.push(o);t=i+1}}return r}:function(e){return e.split(/\r\n?|\n/)};var Dt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return false}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}if(!t||t.parentElement()!=e)return false;return 0!=t.compareEndPoints("StartToEnd",t)};var Wt=function(){var e=N("div");if("oncopy"in e)return true;e.setAttribute("oncopy","return;");return"function"==typeof e.oncopy}();var Ht=null;function Et(e){if(null!=Ht)return Ht;var t=M(e,N("span","x"));var r=t.getBoundingClientRect();var n=A(t,0,1).getBoundingClientRect();return Ht=Math.abs(r.left-n.left)>1}var Ft={};var Pt={};function It(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2));Ft[e]=t}function zt(e,t){Pt[e]=t}function Rt(e){if("string"==typeof e&&Pt.hasOwnProperty(e))e=Pt[e];else if(e&&"string"==typeof e.name&&Pt.hasOwnProperty(e.name)){var t=Pt[e.name];"string"==typeof t&&(t={name:t});e=Q(t,e);e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Rt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Rt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Bt(e,t){t=Rt(t);var r=Ft[t.name];if(!r)return Bt(e,"text/plain");var n=r(e,t);if(jt.hasOwnProperty(t.name)){var i=jt[t.name];for(var o in i){if(!i.hasOwnProperty(o))continue;n.hasOwnProperty(o)&&(n["_"+o]=n[o]);n[o]=i[o]}}n.name=t.name;t.helperType&&(n.helperType=t.helperType);if(t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}var jt={};function qt(e,t){var r=jt.hasOwnProperty(e)?jt[e]:jt[e]={};I(t,r)}function Gt(e,t){if(true===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([]));r[n]=i}return r}function Ut(e,t){var r;while(e.innerMode){r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state;e=r.mode}return r||{mode:e,state:t}}function Kt(e,t,r){return!e.startState||e.startState(t,r)}var Vt=function(e,t,r){this.pos=this.start=0;this.string=e;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=r};Vt.prototype.eol=function(){return this.pos>=this.string.length};Vt.prototype.sol=function(){return this.pos==this.lineStart};Vt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};Vt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};Vt.prototype.eat=function(e){var t=this.string.charAt(this.pos);var r;r="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(r){++this.pos;return t}};Vt.prototype.eatWhile=function(e){var t=this.pos;while(this.eat(e));return this.pos>t};Vt.prototype.eatSpace=function(){var e=this;var t=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++e.pos;return this.pos>t};Vt.prototype.skipToEnd=function(){this.pos=this.string.length};Vt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}};Vt.prototype.backUp=function(e){this.pos-=e};Vt.prototype.column=function(){if(this.lastColumnPos<this.start){this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)};Vt.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)};Vt.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);if(n&&n.index>0)return null;n&&false!==t&&(this.pos+=n[0].length);return n}var i=function(e){return r?e.toLowerCase():e};var o=this.string.substr(this.pos,e.length);if(i(o)==i(e)){false!==t&&(this.pos+=e.length);return true}};Vt.prototype.current=function(){return this.string.slice(this.start,this.pos)};Vt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}};Vt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)};Vt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var _t=function(e,t){this.state=e;this.lookAhead=t};var Xt=function(e,t,r,n){this.state=t;this.doc=e;this.line=r;this.maxLookAhead=n||0;this.baseTokens=null;this.baseTokenPos=1};Xt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e);return t};Xt.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=e)t.baseTokenPos+=2;var r=this.baseTokens[this.baseTokenPos+1];return{type:r&&r.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}};Xt.prototype.nextLine=function(){this.line++;this.maxLookAhead>0&&this.maxLookAhead--};Xt.fromSaved=function(e,t,r){return t instanceof _t?new Xt(e,Gt(e.mode,t.state),r,t.lookAhead):new Xt(e,Gt(e.mode,t),r)};Xt.prototype.save=function(e){var t=false!==e?Gt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new _t(t,this.maxLookAhead):t};function $t(e,t,r,n){var i=[e.state.modeGen],o={};ir(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);var a=r.state;var l=function(n){r.baseTokens=i;var l=e.state.overlays[n],s=1,u=0;r.state=true;ir(e,t.text,l.mode,r,function(e,t){var r=s;while(u<e){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n);s+=2;u=Math.min(e,n)}if(!t)return;if(l.opaque){i.splice(r,s-r,e,"overlay "+t);s=r+2}else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o);r.state=a;r.baseTokens=null;r.baseTokenPos=1};for(var s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Yt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Jt(e,de(t));var i=t.text.length>e.options.maxHighlightLength&&Gt(e.doc.mode,n.state);var o=$t(e,t,n);i&&(n.state=i);t.stateAfter=n.save(!i);t.styles=o.styles;o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null);r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Jt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Xt(n,true,t);var o=or(e,t,r);var a=o>n.first&&ue(n,o-1).stateAfter;var l=a?Xt.fromSaved(n,a,o):new Xt(n,Kt(n.mode),o);n.iter(o,t,function(r){Zt(e,r.text,l);var n=l.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?l.save():null;l.nextLine()});r&&(n.modeFrontier=l.line);return l}function Zt(e,t,r,n){var i=e.doc.mode;var o=new Vt(t,e.options.tabSize,r);o.start=o.pos=n||0;""==t&&Qt(i,r.state);while(!o.eol()){er(i,o,r.state);o.start=o.pos}}function Qt(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=Ut(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function er(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ut(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var tr=function(e,t,r){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=r};function rr(e,t,r,n){var i=e.doc,o=i.mode,a;t=Se(i,t);var l=ue(i,t.line),s=Jt(e,t.line,r);var u=new Vt(l.text,e.options.tabSize,s),c;n&&(c=[]);while((n||u.pos<t.ch)&&!u.eol()){u.start=u.pos;a=er(o,u,s.state);n&&c.push(new tr(u,a,Gt(i.mode,s.state)))}return n?c:new tr(u,a,s.state)}function nr(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function ir(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s=0,u=null;var c=new Vt(t,e.options.tabSize,n),f;var h=e.options.addModeClass&&[null];""==t&&nr(Qt(r,n.state),o);while(!c.eol()){if(c.pos>e.options.maxHighlightLength){l=false;a&&Zt(e,t,n,c.pos);c.pos=t.length;f=null}else f=nr(er(r,c,n.state,h),o);if(h){var d=h[0].name;d&&(f="m-"+(f?d+" "+f:d))}if(!l||u!=f){while(s<c.start){s=Math.min(c.start,s+5e3);i(s,u)}u=f}c.start=c.pos}while(s<c.pos){var p=Math.min(c.pos,s+5e3);i(p,u);s=p}}function or(e,t,r){var n,i,o=e.doc;var a=r?-1:t-(e.doc.mode.innerMode?1e3:100);for(var l=t;l>a;--l){if(l<=o.first)return o.first;var s=ue(o,l-1),u=s.stateAfter;if(u&&(!r||l+(u instanceof _t?u.lookAhead:0)<=o.modeFrontier))return l;var c=z(s.text,null,e.options.tabSize);if(null==i||n>c){i=l-1;n=c}}return i}function ar(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontier<t-10)return;var r=e.first;for(var n=t-1;n>r;n--){var i=ue(e,n).stateAfter;if(i&&(!(i instanceof _t)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var lr=function(e,t,r){this.text=e;je(this,t);this.height=r?r(this):1};lr.prototype.lineNo=function(){return de(this)};xt(lr);function sr(e,t,r,n){e.text=t;e.stateAfter&&(e.stateAfter=null);e.styles&&(e.styles=null);null!=e.order&&(e.order=null);Be(e);je(e,r);var i=n?n(e):1;i!=e.height&&he(e,i)}function ur(e){e.parent=null;Be(e)}var cr={};var fr={};function hr(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?fr:cr;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function dr(e,t){var r=O("span",null,null,s?"padding-right: .1px":null);var n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:false,splitSpaces:(a||s)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;n.pos=0;n.addToken=mr;Ot(e.display.measure)&&(l=ut(o,e.doc.direction))&&(n.addToken=gr(n.addToken,l));n.map=[];var u=t!=e.display.externalMeasured&&de(o);yr(o,n,Yt(e,o,u));if(o.styleClasses){o.styleClasses.bgClass&&(n.bgClass=E(o.styleClasses.bgClass,n.bgClass||""));o.styleClasses.textClass&&(n.textClass=E(o.styleClasses.textClass,n.textClass||""))}0==n.map.length&&n.map.push(0,0,n.content.appendChild(Mt(e.display.measure)));if(0==i){t.measure.map=n.map;t.measure.cache={}}else{(t.measure.maps||(t.measure.maps=[])).push(n.map);(t.measure.caches||(t.measure.caches=[])).push({})}}if(s){var c=n.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}pt(e,"renderLine",e,t.line,n.pre);n.pre.className&&(n.textClass=E(n.pre.className,n.textClass||""));return n}function pr(e){var t=N("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function mr(e,t,r,n,i,o,s){if(!t)return;var u=e.splitSpaces?vr(t,e.trailingSpace):t;var c=e.cm.state.specialChars,f=false;var h;if(c.test(t)){h=document.createDocumentFragment();var d=0;while(true){c.lastIndex=d;var p=c.exec(t);var m=p?p.index-d:t.length-d;if(m){var v=document.createTextNode(u.slice(d,d+m));a&&l<9?h.appendChild(N("span",[v])):h.appendChild(v);e.map.push(e.pos,e.pos+m,v);e.col+=m;e.pos+=m}if(!p)break;d+=m+1;var g=void 0;if("\t"==p[0]){var x=e.cm.options.tabSize,y=x-e.col%x;g=h.appendChild(N("span",X(y),"cm-tab"));g.setAttribute("role","presentation");g.setAttribute("cm-text","\t");e.col+=y}else if("\r"==p[0]||"\n"==p[0]){g=h.appendChild(N("span","\r"==p[0]?"␍":"","cm-invalidchar"));g.setAttribute("cm-text",p[0]);e.col+=1}else{g=e.cm.options.specialCharPlaceholder(p[0]);g.setAttribute("cm-text",p[0]);a&&l<9?h.appendChild(N("span",[g])):h.appendChild(g);e.col+=1}e.map.push(e.pos,e.pos+1,g);e.pos++}}else{e.col+=t.length;h=document.createTextNode(u);e.map.push(e.pos,e.pos+t.length,h);a&&l<9&&(f=true);e.pos+=t.length}e.trailingSpace=32==u.charCodeAt(t.length-1);if(r||n||i||f||s){var b=r||"";n&&(b+=n);i&&(b+=i);var w=N("span",[h],b,s);o&&(w.title=o);return e.content.appendChild(w)}e.content.appendChild(h)}function vr(e,t){if(e.length>1&&!/ /.test(e))return e;var r=t,n="";for(var i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" ");n+=o;r=" "==o}return n}function gr(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";var u=r.pos,c=u+n.length;for(;;){var f=void 0;for(var h=0;h<t.length;h++){f=t[h];if(f.to>u&&f.from<=u)break}if(f.to>=c)return e(r,n,i,o,a,l,s);e(r,n.slice(0,f.to-u),i,o,null,l,s);o=null;n=n.slice(f.to-u);u=f.to}}}function xr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i);if(!n&&e.cm.display.input.needsContentAttribute){i||(i=e.content.appendChild(document.createElement("span")));i.setAttribute("cm-marker",r.id)}if(i){e.cm.display.input.setUneditable(i);e.content.appendChild(i)}e.pos+=t;e.trailingSpace=false}function yr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(!n){for(var a=1;a<r.length;a+=2)t.addToken(t,i.slice(o,o=r[a]),hr(r[a+1],t.cm.options));return}var l=i.length,s=0,u=1,c="",f,h;var d=0,p,m,v,g,x;for(;;){if(d==s){p=m=v=g=h="";x=null;d=Infinity;var y=[],b=void 0;for(var w=0;w<n.length;++w){var k=n[w],C=k.marker;if("bookmark"==C.type&&k.from==s&&C.widgetNode)y.push(C);else if(k.from<=s&&(null==k.to||k.to>s||C.collapsed&&k.to==s&&k.from==s)){if(null!=k.to&&k.to!=s&&d>k.to){d=k.to;m=""}C.className&&(p+=" "+C.className);C.css&&(h=(h?h+";":"")+C.css);C.startStyle&&k.from==s&&(v+=" "+C.startStyle);C.endStyle&&k.to==d&&(b||(b=[])).push(C.endStyle,k.to);C.title&&!g&&(g=C.title);C.collapsed&&(!x||Ue(x.marker,C)<0)&&(x=k)}else k.from>s&&d>k.from&&(d=k.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==d&&(m+=" "+b[S]);if(!x||x.from==s)for(var L=0;L<y.length;++L)xr(t,0,y[L]);if(x&&(x.from||0)==s){xr(t,(null==x.to?l+1:x.to)-s,x.marker,null==x.from);if(null==x.to)return;x.to==s&&(x=false)}}if(s>=l)break;var T=Math.min(l,d);while(true){if(c){var M=s+c.length;if(!x){var N=M>T?c.slice(0,T-s):c;t.addToken(t,N,f?f+p:p,v,s+N.length==d?m:"",g,h)}if(M>=T){c=c.slice(T-s);s=T;break}s=M;v=""}c=i.slice(o,o=r[u++]);f=hr(r[u++],t.cm.options)}}}function br(e,t,r){this.line=t;this.rest=Je(t);this.size=this.rest?de($(this.rest))-r+1:1;this.node=this.text=null;this.hidden=et(e,t)}function wr(e,t,r){var n=[],i;for(var o=t;o<r;o=i){var a=new br(e.doc,ue(e.doc,o),o);i=o+a.size;n.push(a)}return n}var kr=null;function Cr(e){kr?kr.ops.push(e):e.ownsGroup=kr={ops:[e],delayedCallbacks:[]}}function Sr(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Lr(e,t){var r=e.ownsGroup;if(!r)return;try{Sr(r)}finally{kr=null;t(r)}}var Tr=null;function Mr(e,t){var r=ht(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),i;if(kr)i=kr.delayedCallbacks;else if(Tr)i=Tr;else{i=Tr=[];setTimeout(Nr,0)}var o=function(e){i.push(function(){return r[e].apply(null,n)})};for(var a=0;a<r.length;++a)o(a)}function Nr(){var e=Tr;Tr=null;for(var t=0;t<e.length;++t)e[t]()}function Or(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Hr(e,t):"gutter"==o?Fr(e,t,r,n):"class"==o?Er(e,t):"widget"==o&&Pr(e,t,n)}t.changes=null}function Ar(e){if(e.node==e.text){e.node=N("div",null,null,"position: relative");e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text);e.node.appendChild(e.text);a&&l<8&&(e.node.style.zIndex=2)}return e.node}function Dr(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;r&&(r+=" CodeMirror-linebackground");if(t.background)if(r)t.background.className=r;else{t.background.parentNode.removeChild(t.background);t.background=null}else if(r){var n=Ar(t);t.background=n.insertBefore(N("div",null,r),n.firstChild);e.display.input.setUneditable(t.background)}}function Wr(e,t){var r=e.display.externalMeasured;if(r&&r.line==t.line){e.display.externalMeasured=null;t.measure=r.measure;return r.built}return dr(e,t)}function Hr(e,t){var r=t.text.className;var n=Wr(e,t);t.text==t.node&&(t.node=n.pre);t.text.parentNode.replaceChild(n.pre,t.text);t.text=n.pre;if(n.bgClass!=t.bgClass||n.textClass!=t.textClass){t.bgClass=n.bgClass;t.textClass=n.textClass;Er(e,t)}else r&&(t.text.className=r)}function Er(e,t){Dr(e,t);t.line.wrapClass?Ar(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Fr(e,t,r,n){if(t.gutter){t.node.removeChild(t.gutter);t.gutter=null}if(t.gutterBackground){t.node.removeChild(t.gutterBackground);t.gutterBackground=null}if(t.line.gutterClass){var i=Ar(t);t.gutterBackground=N("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);i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=Ar(t);var l=t.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");e.display.input.setUneditable(l);a.insertBefore(l,t.text);t.line.gutterClass&&(l.className+=" "+t.line.gutterClass);!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(N("div",ve(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px")));if(o)for(var s=0;s<e.options.gutters.length;++s){var u=e.options.gutters[s],c=o.hasOwnProperty(u)&&o[u];c&&l.appendChild(N("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function Pr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i){i=n.nextSibling;"CodeMirror-linewidget"==n.className&&t.node.removeChild(n)}zr(e,t,r)}function Ir(e,t,r,n){var i=Wr(e,t);t.text=t.node=i.pre;i.bgClass&&(t.bgClass=i.bgClass);i.textClass&&(t.textClass=i.textClass);Er(e,t);Fr(e,t,r,n);zr(e,t,n);return t.node}function zr(e,t,r){Rr(e,t.line,t,r,true);if(t.rest)for(var n=0;n<t.rest.length;n++)Rr(e,t.rest[n],t,r,false)}function Rr(e,t,r,n,i){if(!t.widgets)return;var o=Ar(r);for(var a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=N("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||u.setAttribute("cm-ignore-events","true");Br(s,u,r,n);e.display.input.setUneditable(u);i&&s.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u);Mr(s,"redraw")}}function Br(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px";if(!e.coverGutter){i-=n.gutterTotalWidth;t.style.paddingLeft=n.gutterTotalWidth+"px"}t.style.width=i+"px"}if(e.coverGutter){t.style.zIndex=5;t.style.position="relative";e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px")}}function jr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;");e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;");M(t.display.measure,N("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function qr(e,t){for(var r=Ct(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return true}function Gr(e){return e.lineSpace.offsetTop}function Ur(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Kr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=M(e.measure,N("pre","x"));var r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle;var n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n);return n}function Vr(e){return j-e.display.nativeBarWidth}function _r(e){return e.display.scroller.clientWidth-Vr(e)-e.display.barWidth}function Xr(e){return e.display.scroller.clientHeight-Vr(e)-e.display.barHeight}function $r(e,t,r){var n=e.options.lineWrapping;var i=n&&_r(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;var a=t.text.firstChild.getClientRects();for(var l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Yr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(de(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:true}}function Jr(e,t){t=$e(t);var r=de(t);var n=e.display.externalMeasured=new br(e.doc,t,r);n.lineN=r;var i=n.built=dr(e,n);n.text=i.pre;M(e.display.lineMeasure,i.pre);return n}function Zr(e,t,r,n){return tn(e,en(e,t),r,n)}function Qr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Fn(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function en(e,t){var r=de(t);var n=Qr(e,r);if(n&&!n.text)n=null;else if(n&&n.changes){Or(e,n,r,An(e));e.curOp.forceUpdate=true}n||(n=Jr(e,t));var i=Yr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:false}}function tn(e,t,r,n,i){t.before&&(r=-1);var o=r+(n||""),a;if(t.cache.hasOwnProperty(o))a=t.cache[o];else{t.rect||(t.rect=t.view.text.getBoundingClientRect());if(!t.hasHeights){$r(e,t.view,t.rect);t.hasHeights=true}a=an(e,t,r,n);a.bogus||(t.cache[o]=a)}return{left:a.left,right:a.right,top:i?a.rtop:a.top,bottom:i?a.rbottom:a.bottom}}var rn={left:0,right:0,top:0,bottom:0};function nn(e,t,r){var n,i,o,a,l,s;for(var u=0;u<e.length;u+=3){l=e[u];s=e[u+1];if(t<l){i=0;o=1;a="left"}else if(t<s){i=t-l;o=i+1}else if(u==e.length-3||t==s&&e[u+3]>t){o=s-l;i=o-1;t>=s&&(a="right")}if(null!=i){n=e[u+2];l==s&&r==(n.insertLeft?"left":"right")&&(a=r);if("left"==r&&0==i)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft){n=e[2+(u-=3)];a="left"}if("right"==r&&i==s-l)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft){n=e[(u+=3)+2];a="right"}break}}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function on(e,t){var r=rn;if("left"==t){for(var n=0;n<e.length;n++)if((r=e[n]).left!=r.right)break}else for(var i=e.length-1;i>=0;i--)if((r=e[i]).left!=r.right)break;return r}function an(e,t,r,n){var i=nn(t.map,r,n);var o=i.node,s=i.start,u=i.end,c=i.collapse;var f;if(3==o.nodeType){for(var h=0;h<4;h++){while(s&&oe(t.line.text.charAt(i.coverStart+s)))--s;while(i.coverStart+u<i.coverEnd&&oe(t.line.text.charAt(i.coverStart+u)))++u;f=a&&l<9&&0==s&&u==i.coverEnd-i.coverStart?o.parentNode.getBoundingClientRect():on(A(o,s,u).getClientRects(),n);if(f.left||f.right||0==s)break;u=s;s-=1;c="right"}a&&l<11&&(f=ln(e.display.measure,f))}else{s>0&&(c=n="right");var d;f=e.options.lineWrapping&&(d=o.getClientRects()).length>1?d["right"==n?d.length-1:0]:o.getBoundingClientRect()}if(a&&l<9&&!s&&(!f||!f.left&&!f.right)){var p=o.parentNode.getClientRects()[0];f=p?{left:p.left,right:p.left+On(e.display),top:p.top,bottom:p.bottom}:rn}var m=f.top-t.rect.top,v=f.bottom-t.rect.top;var g=(m+v)/2;var x=t.view.measure.heights;var y=0;for(;y<x.length-1;y++)if(g<x[y])break;var b=y?x[y-1]:0,w=x[y];var k={left:("right"==c?f.right:f.left)-t.rect.left,right:("left"==c?f.left:f.right)-t.rect.left,top:b,bottom:w};f.left||f.right||(k.bogus=true);if(!e.options.singleCursorHeightPerLine){k.rtop=m;k.rbottom=v}return k}function ln(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Et(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI;var n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function sn(e){if(e.measure){e.measure.cache={};e.measure.heights=null;if(e.rest)for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}}function un(e){e.display.externalMeasure=null;T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)sn(e.display.view[t])}function cn(e){un(e);e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null;e.options.lineWrapping||(e.display.maxLineChanged=true);e.display.lineNumChars=null}function fn(){if(c&&v)return-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft));return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function hn(){if(c&&v)return-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop));return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dn(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=jr(e.widgets[r]));return t}function pn(e,t,r,n,i){if(!i){var o=dn(t);r.top+=o;r.bottom+=o}if("line"==n)return r;n||(n="local");var a=rt(t);"local"==n?a+=Gr(e.display):a-=e.display.viewOffset;if("page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:hn());var s=l.left+("window"==n?0:fn());r.left+=s;r.right+=s}r.top+=a;r.bottom+=a;return r}function mn(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r){n-=fn();i-=hn()}else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left;i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function vn(e,t,r,n,i){n||(n=ue(e.doc,t.line));return pn(e,n,Zr(e,n,t.ch,i),r)}function gn(e,t,r,n,i,o){n=n||ue(e.doc,t.line);i||(i=en(e,n));function a(t,a){var l=tn(e,i,t,a?"right":"left",o);a?l.left=l.right:l.right=l.left;return pn(e,n,l,r)}var l=ut(n,e.doc.direction),s=t.ch,u=t.sticky;if(s>=n.text.length){s=n.text.length;u="before"}else if(s<=0){s=0;u="after"}if(!l)return a("before"==u?s-1:s,"before"==u);function c(e,t,r){var n=l[t],i=1==n.level;return a(r?e-1:e,i!=r)}var f=lt(l,s,u);var h=at;var d=c(s,f,"before"==u);null!=h&&(d.other=c(s,h,"before"!=u));return d}function xn(e,t){var r=0;t=Se(e.doc,t);e.options.lineWrapping||(r=On(e.display)*t.ch);var n=ue(e.doc,t.line);var i=rt(n)+Gr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function yn(e,t,r,n,i){var o=ge(e,t,r);o.xRel=i;n&&(o.outside=true);return o}function bn(e,t,r){var n=e.doc;r+=e.display.viewOffset;if(r<0)return yn(n.first,0,null,true,-1);var i=pe(n,r),o=n.first+n.size-1;if(i>o)return yn(n.first+n.size-1,ue(n,o).text.length,null,true,1);t<0&&(t=0);var a=ue(n,i);for(;;){var l=Sn(e,a,i,t,r);var s=_e(a);var u=s&&s.find(0,true);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=de(a=u.to.line)}}function wn(e,t,r,n){n-=dn(t);var i=t.text.length;var o=le(function(t){return tn(e,r,t-1).bottom<=n},i,0);i=le(function(t){return tn(e,r,t).top>n},o,i);return{begin:o,end:i}}function kn(e,t,r,n){r||(r=en(e,t));var i=pn(e,t,tn(e,r,n),"line").top;return wn(e,t,r,i)}function Cn(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Sn(e,t,r,n,i){i-=rt(t);var o=en(e,t);var a=dn(t);var l=0,s=t.text.length,u=true;var c=ut(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?Tn:Ln)(e,t,r,o,c,n,i);u=1!=f.level;l=u?f.from:f.to-1;s=u?f.to:f.from-1}var h=null,d=null;var p=le(function(t){var r=tn(e,o,t);r.top+=a;r.bottom+=a;if(!Cn(r,n,i,false))return false;if(r.top<=i&&r.left<=n){h=t;d=r}return true},l,s);var m,v,g=false;if(d){var x=n-d.left<d.right-n,y=x==u;p=h+(y?0:1);v=y?"after":"before";m=x?d.left:d.right}else{u||p!=s&&p!=l||p++;v=0==p?"after":p==t.text.length?"before":tn(e,o,p-(u?1:0)).bottom+a<=i==u?"after":"before";var b=gn(e,ge(r,p,v),"line",t,o);m=b.left;g=i<b.top||i>=b.bottom}p=ae(t.text,p,1);return yn(r,p,v,g,n-m)}function Ln(e,t,r,n,i,o,a){var l=le(function(l){var s=i[l],u=1!=s.level;return Cn(gn(e,ge(r,u?s.to:s.from,u?"before":"after"),"line",t,n),o,a,true)},0,i.length-1);var s=i[l];if(l>0){var u=1!=s.level;var c=gn(e,ge(r,u?s.from:s.to,u?"after":"before"),"line",t,n);Cn(c,o,a,true)&&c.top>a&&(s=i[l-1])}return s}function Tn(e,t,r,n,i,o,a){var l=wn(e,t,n,a);var s=l.begin;var u=l.end;/\s/.test(t.text.charAt(u-1))&&u--;var c=null,f=null;for(var h=0;h<i.length;h++){var d=i[h];if(d.from>=u||d.to<=s)continue;var p=1!=d.level;var m=tn(e,n,p?Math.min(u,d.to)-1:Math.max(s,d.from)).right;var v=m<o?o-m+1e9:m-o;if(!c||f>v){c=d;f=v}}c||(c=i[i.length-1]);c.from<s&&(c={from:s,to:c.to,level:c.level});c.to>u&&(c={from:c.from,to:u,level:c.level});return c}var Mn;function Nn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Mn){Mn=N("pre");for(var t=0;t<49;++t){Mn.appendChild(document.createTextNode("x"));Mn.appendChild(N("br"))}Mn.appendChild(document.createTextNode("x"))}M(e.measure,Mn);var r=Mn.offsetHeight/50;r>3&&(e.cachedTextHeight=r);T(e.measure);return r||1}function On(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=N("span","xxxxxxxxxx");var r=N("pre",[t]);M(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;i>2&&(e.cachedCharWidth=i);return i||10}function An(e){var t=e.display,r={},n={};var i=t.gutters.clientLeft;for(var o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i;n[e.options.gutters[a]]=o.clientWidth}return{fixedPos:Dn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Dn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Wn(e){var t=Nn(e.display),r=e.options.lineWrapping;var n=r&&Math.max(5,e.display.scroller.clientWidth/On(e.display)-3);return function(i){if(et(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function Hn(e){var t=e.doc,r=Wn(e);t.iter(function(e){var t=r(e);t!=e.height&&he(e,t)})}function En(e,t,r,n){var i=e.display;if(!r&&"true"==Ct(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left;a=t.clientY-l.top}catch(t){return null}var s=bn(e,o,a),u;if(n&&1==s.xRel&&(u=ue(e.doc,s.line).text).length==s.ch){var c=z(u,u.length,e.options.tabSize)-u.length;s=ge(s.line,Math.max(0,Math.round((o-Kr(e.display).left)/On(e.display))-c))}return s}function Fn(e,t){if(t>=e.display.viewTo)return null;t-=e.display.viewFrom;if(t<0)return null;var r=e.display.view;for(var n=0;n<r.length;n++){t-=r[n].size;if(t<0)return n}}function Pn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function In(e,t){void 0===t&&(t=true);var r=e.doc,n={};var i=n.cursors=document.createDocumentFragment();var o=n.selection=document.createDocumentFragment();for(var a=0;a<r.sel.ranges.length;a++){if(!t&&a==r.sel.primIndex)continue;var l=r.sel.ranges[a];if(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)continue;var s=l.empty();(s||e.options.showCursorWhenSelecting)&&zn(e,l.head,i);s||Bn(e,l,o)}return n}function zn(e,t,r){var n=gn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine);var i=r.appendChild(N("div"," ","CodeMirror-cursor"));i.style.left=n.left+"px";i.style.top=n.top+"px";i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px";if(n.other){var o=r.appendChild(N("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="";o.style.left=n.other.left+"px";o.style.top=n.other.top+"px";o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Rn(e,t){return e.top-t.top||e.left-t.left}function Bn(e,t,r){var n=e.display,i=e.doc;var o=document.createDocumentFragment();var a=Kr(e.display),l=a.left;var s=Math.max(n.sizerWidth,_r(e)-n.sizer.offsetLeft)-a.right;var u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0);t=Math.round(t);n=Math.round(n);o.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?s-e:r)+"px;\n height: "+(n-t)+"px"))}function f(t,r,n){var o=ue(i,t);var a=o.text.length;var f,h;function d(r,n){return vn(e,ge(t,r),"div",o,n)}function p(t,r,n){var i=kn(e,o,null,t);var a="ltr"==r==("after"==n)?"left":"right";var l="after"==n?i.begin:i.end-(/\s/.test(o.text.charAt(i.end-1))?2:1);return d(l,a)[a]}var m=ut(o,i.direction);ot(m,r||0,null==n?a:n,function(e,t,i,o){var v="ltr"==i;var g=d(e,v?"left":"right");var x=d(t-1,v?"right":"left");var y=null==r&&0==e,b=null==n&&t==a;var w=0==o,k=!m||o==m.length-1;if(x.top-g.top<=3){var C=(u?y:b)&&w;var S=(u?b:y)&&k;var L=C?l:(v?g:x).left;var T=S?s:(v?x:g).right;c(L,g.top,T-L,g.bottom)}else{var M,N,O,A;if(v){M=u&&y&&w?l:g.left;N=u?s:p(e,i,"before");O=u?l:p(t,i,"after");A=u&&b&&k?s:x.right}else{M=u?p(e,i,"before"):l;N=!u&&y&&w?s:g.right;O=!u&&b&&k?l:x.left;A=u?p(t,i,"after"):s}c(M,g.top,N-M,g.bottom);g.bottom<x.top&&c(l,g.bottom,null,x.top);c(O,x.top,A-O,x.bottom)}(!f||Rn(g,f)<0)&&(f=g);Rn(x,f)<0&&(f=x);(!h||Rn(g,h)<0)&&(h=g);Rn(x,h)<0&&(h=x)});return{start:f,end:h}}var h=t.from(),d=t.to();if(h.line==d.line)f(h.line,h.ch,d.ch);else{var p=ue(i,h.line),m=ue(i,d.line);var v=$e(p)==$e(m);var g=f(h.line,h.ch,v?p.text.length+1:null).end;var x=f(d.line,v?0:null,d.ch).start;if(v)if(g.top<x.top-2){c(g.right,g.top,null,g.bottom);c(l,x.top,x.left,x.bottom)}else c(g.right,g.top,x.left-g.right,g.bottom);g.bottom<x.top&&c(l,g.bottom,null,x.top)}r.appendChild(o)}function jn(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=true;t.cursorDiv.style.visibility="";e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function qn(e){if(!e.state.focused){e.display.input.focus();Un(e)}}function Gn(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;Kn(e)}},100)}function Un(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=false);if("nocursor"==e.options.readOnly)return;if(!e.state.focused){pt(e,"focus",e,t);e.state.focused=true;H(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();s&&setTimeout(function(){return e.display.input.reset(true)},20)}e.display.input.receivedFocus()}jn(e)}function Kn(e,t){if(e.state.delayingBlurEvent)return;if(e.state.focused){pt(e,"blur",e,t);e.state.focused=false;L(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){e.state.focused||(e.display.shift=false)},150)}function Vn(e){var t=e.display;var r=t.lineDiv.offsetTop;for(var n=0;n<t.view.length;n++){var i=t.view[n],o=void 0;if(i.hidden)continue;if(a&&l<8){var s=i.node.offsetTop+i.node.offsetHeight;o=s-r;r=s}else{var u=i.node.getBoundingClientRect();o=u.bottom-u.top}var c=i.line.height-o;o<2&&(o=Nn(t));if(c>.005||c<-.005){he(i.line,o);_n(i.line);if(i.rest)for(var f=0;f<i.rest.length;f++)_n(i.rest[f])}}}function _n(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Xn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Gr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight;var o=pe(t,n),a=pe(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;if(l<o){o=l;a=pe(t,rt(ue(t,l))+e.wrapper.clientHeight)}else if(Math.min(s,t.lastLine())>=a){o=pe(t,rt(ue(t,s))-e.wrapper.clientHeight);a=s}}return{from:o,to:Math.max(a,o+1)}}function $n(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var n=Dn(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var i=t.gutters.offsetWidth,o=n+"px";for(var a=0;a<r.length;a++)if(!r[a].hidden){if(e.options.fixedGutter){r[a].gutter&&(r[a].gutter.style.left=o);r[a].gutterBackground&&(r[a].gutterBackground.style.left=o)}var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}function Yn(e){if(!e.options.lineNumbers)return false;var t=e.doc,r=ve(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(N("div",[N("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var o=i.firstChild.offsetWidth,a=i.offsetWidth-o;n.lineGutter.style.width="";n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1;n.lineNumWidth=n.lineNumInnerWidth+a;n.lineNumChars=n.lineNumInnerWidth?r.length:-1;n.lineGutter.style.width=n.lineNumWidth+"px";Vi(e);return true}return false}function Jn(e,t){if(mt(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;t.top+n.top<0?i=true:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=false);if(null!=i&&!p){var o=N("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Gr(e.display))+"px;\n height: "+(t.bottom-t.top+Vr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o);o.scrollIntoView(i);e.display.lineSpace.removeChild(o)}}function Zn(e,t,r,n){null==n&&(n=0);var i;if(!e.options.lineWrapping&&t==r){t=t.ch?ge(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t;r="before"==t.sticky?ge(t.line,t.ch+1,"before"):t}for(var o=0;o<5;o++){var a=false;var l=gn(e,t);var s=r&&r!=t?gn(e,r):l;i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n};var u=ei(e,i);var c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=u.scrollTop){li(e,u.scrollTop);Math.abs(e.doc.scrollTop-c)>1&&(a=true)}if(null!=u.scrollLeft){ui(e,u.scrollLeft);Math.abs(e.doc.scrollLeft-f)>1&&(a=true)}if(!a)break}return i}function Qn(e,t){var r=ei(e,t);null!=r.scrollTop&&li(e,r.scrollTop);null!=r.scrollLeft&&ui(e,r.scrollLeft)}function ei(e,t){var r=e.display,n=Nn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop;var o=Xr(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ur(r);var s=t.top<n,u=t.bottom>l-n;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?l:t.bottom)-o);c!=i&&(a.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft;var h=_r(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0);var d=t.right-t.left>h;d&&(t.right=t.left+h);t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left-(d?0:10)):t.right>h+f-3&&(a.scrollLeft=t.right+(d?0:10)-h);return a}function ti(e,t){if(null==t)return;oi(e);e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t}function ri(e){oi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ni(e,t,r){null==t&&null==r||oi(e);null!=t&&(e.curOp.scrollLeft=t);null!=r&&(e.curOp.scrollTop=r)}function ii(e,t){oi(e);e.curOp.scrollToPos=t}function oi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=xn(e,t.from),n=xn(e,t.to);ai(e,r,n,t.margin)}}function ai(e,t,r,n){var i=ei(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});ni(e,i.scrollLeft,i.scrollTop)}function li(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;r||Ui(e,{top:t});si(e,t,true);r&&Ui(e);Pi(e,100)}function si(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t);if(e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t;e.display.scrollbars.setScrollTop(t);e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ui(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth);if((r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t;$n(e);e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t);e.display.scrollbars.setScrollLeft(t)}function ci(e){var t=e.display,r=t.gutters.offsetWidth;var n=Math.round(e.doc.height+Ur(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Vr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var fi=function(e,t,r){this.cm=r;var n=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var i=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n);e(i);ft(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")});ft(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")});this.checkedZeroWidth=false;a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1;var r=e.scrollHeight>e.clientHeight+1;var n=e.nativeBarWidth;if(r){this.vert.style.display="block";this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(t){this.horiz.style.display="block";this.horiz.style.right=r?n+"px":"0";this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&e.clientHeight>0){0==n&&this.zeroWidthHack();this.checkedZeroWidth=true}return{right:r?n:0,bottom:t?n:0}};fi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};fi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};fi.prototype.zeroWidthHack=function(){var e=x&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new R;this.disableVert=new R};fi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var i=e.getBoundingClientRect();var o="vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)};fi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)};var hi=function(){};hi.prototype.update=function(){return{bottom:0,right:0}};hi.prototype.setScrollLeft=function(){};hi.prototype.setScrollTop=function(){};hi.prototype.clear=function(){};function di(e,t){t||(t=ci(e));var r=e.display.barWidth,n=e.display.barHeight;pi(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++){r!=e.display.barWidth&&e.options.lineWrapping&&Vn(e);pi(e,ci(e));r=e.display.barWidth;n=e.display.barHeight}}function pi(e,t){var r=e.display;var n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px";r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px";r.heightForcer.style.borderBottom=n.bottom+"px solid transparent";if(n.right&&n.bottom){r.scrollbarFiller.style.display="block";r.scrollbarFiller.style.height=n.bottom+"px";r.scrollbarFiller.style.width=n.right+"px"}else r.scrollbarFiller.style.display="";if(n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){r.gutterFiller.style.display="block";r.gutterFiller.style.height=n.bottom+"px";r.gutterFiller.style.width=t.gutterWidth+"px"}else r.gutterFiller.style.display=""}var mi={native:fi,null:hi};function vi(e){if(e.display.scrollbars){e.display.scrollbars.clear();e.display.scrollbars.addClass&&L(e.display.wrapper,e.display.scrollbars.addClass)}e.display.scrollbars=new mi[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller);ft(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)});t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?ui(e,t):li(e,t)},e);e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var gi=0;function xi(e){e.curOp={cm:e,viewChanged:false,startHeight:e.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++gi};Cr(e.curOp)}function yi(e){var t=e.curOp;Lr(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;bi(e)})}function bi(e){var t=e.ops;for(var r=0;r<t.length;r++)wi(t[r]);for(var n=0;n<t.length;n++)ki(t[n]);for(var i=0;i<t.length;i++)Ci(t[i]);for(var o=0;o<t.length;o++)Si(t[o]);for(var a=0;a<t.length;a++)Li(t[a])}function wi(e){var t=e.cm,r=t.display;Ri(t);e.updateMaxLine&&it(t);e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new zi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function ki(e){e.updatedDisplay=e.mustUpdate&&qi(e.cm,e.update)}function Ci(e){var t=e.cm,r=t.display;e.updatedDisplay&&Vn(t);e.barMeasure=ci(t);if(r.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=Zr(t,r.maxLine,r.maxLine.text.length).left+3;t.display.sizerWidth=e.adjustWidthTo;e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Vr(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-_r(t))}(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Si(e){var t=e.cm;if(null!=e.adjustWidthTo){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";e.maxScrollLeft<t.doc.scrollLeft&&ui(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),true);t.display.maxLineChanged=false}var r=e.focus&&e.focus==W();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r);(e.updatedDisplay||e.startHeight!=t.doc.height)&&di(t,e.barMeasure);e.updatedDisplay&&_i(t,e.barMeasure);e.selectionChanged&&jn(t);t.state.focused&&e.updateInput&&t.display.input.reset(e.typing);r&&qn(e.cm)}function Li(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&Gi(t,e.update);null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null);null!=e.scrollTop&&si(t,e.scrollTop,e.forceScroll);null!=e.scrollLeft&&ui(t,e.scrollLeft,true,true);if(e.scrollToPos){var i=Zn(t,Se(n,e.scrollToPos.from),Se(n,e.scrollToPos.to),e.scrollToPos.margin);Jn(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||pt(o[l],"hide");if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&pt(a[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop);e.changeObjs&&pt(t,"changes",t,e.changeObjs);e.update&&e.update.finish()}function Ti(e,t){if(e.curOp)return t();xi(e);try{return t()}finally{yi(e)}}function Mi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);xi(e);try{return t.apply(e,arguments)}finally{yi(e)}}}function Ni(e){return function(){if(this.curOp)return e.apply(this,arguments);xi(this);try{return e.apply(this,arguments)}finally{yi(this)}}}function Oi(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);xi(t);try{return e.apply(this,arguments)}finally{yi(t)}}}function Ai(e,t,r,n){null==t&&(t=e.doc.first);null==r&&(r=e.doc.first+e.doc.size);n||(n=0);var i=e.display;n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t);e.curOp.viewChanged=true;if(t>=i.viewTo)Ne&&Ze(e.doc,t)<i.viewTo&&Wi(e);else if(r<=i.viewFrom)if(Ne&&Qe(e.doc,r+n)>i.viewFrom)Wi(e);else{i.viewFrom+=n;i.viewTo+=n}else if(t<=i.viewFrom&&r>=i.viewTo)Wi(e);else if(t<=i.viewFrom){var o=Hi(e,r,r+n,1);if(o){i.view=i.view.slice(o.index);i.viewFrom=o.lineN;i.viewTo+=n}else Wi(e)}else if(r>=i.viewTo){var a=Hi(e,t,t,-1);if(a){i.view=i.view.slice(0,a.index);i.viewTo=a.lineN}else Wi(e)}else{var l=Hi(e,t,t,-1);var s=Hi(e,r,r+n,1);if(l&&s){i.view=i.view.slice(0,l.index).concat(wr(e,l.lineN,s.lineN)).concat(i.view.slice(s.index));i.viewTo+=n}else Wi(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function Di(e,t,r){e.curOp.viewChanged=true;var n=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null);if(t<n.viewFrom||t>=n.viewTo)return;var o=n.view[Fn(e,t)];if(null==o.node)return;var a=o.changes||(o.changes=[]);-1==B(a,r)&&a.push(r)}function Wi(e){e.display.viewFrom=e.display.viewTo=e.doc.first;e.display.view=[];e.display.viewOffset=0}function Hi(e,t,r,n){var i=Fn(e,t),o,a=e.display.view;if(!Ne||r==e.doc.first+e.doc.size)return{index:i,lineN:r};var l=e.display.viewFrom;for(var s=0;s<i;s++)l+=a[s].size;if(l!=t){if(n>0){if(i==a.length-1)return null;o=l+a[i].size-t;i++}else o=l-t;t+=o;r+=o}while(Ze(e.doc,r)!=r){if(i==(n<0?0:a.length-1))return null;r+=n*a[i-(n<0?1:0)].size;i+=n}return{index:i,lineN:r}}function Ei(e,t,r){var n=e.display,i=n.view;if(0==i.length||t>=n.viewTo||r<=n.viewFrom){n.view=wr(e,t,r);n.viewFrom=t}else{n.viewFrom>t?n.view=wr(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Fn(e,t)));n.viewFrom=t;n.viewTo<r?n.view=n.view.concat(wr(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Fn(e,r)))}n.viewTo=r}function Fi(e){var t=e.display.view,r=0;for(var n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Pi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(Ii,e))}function Ii(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime;var n=Jt(e,t.highlightFrontier);var i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var a=o.styles;var l=o.text.length>e.options.maxHighlightLength?Gt(t.mode,n.state):null;var s=$t(e,o,n,true);l&&(n.state=l);o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);var f=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass);for(var h=0;!f&&h<a.length;++h)f=a[h]!=o.styles[h];f&&i.push(n.line);o.stateAfter=n.save();n.nextLine()}else{o.text.length<=e.options.maxHighlightLength&&Zt(e,o.text,n);o.stateAfter=n.line%5==0?n.save():null;n.nextLine()}if(+new Date>r){Pi(e,e.options.workDelay);return true}});t.highlightFrontier=n.line;t.modeFrontier=Math.max(t.modeFrontier,n.line);i.length&&Ti(e,function(){for(var t=0;t<i.length;t++)Di(e,i[t],"text")})}var zi=function(e,t,r){var n=e.display;this.viewport=t;this.visible=Xn(n,e.doc,t);this.editorIsHidden=!n.wrapper.offsetWidth;this.wrapperHeight=n.wrapper.clientHeight;this.wrapperWidth=n.wrapper.clientWidth;this.oldDisplayWidth=_r(e);this.force=r;this.dims=An(e);this.events=[]};zi.prototype.signal=function(e,t){gt(e,t)&&this.events.push(arguments)};zi.prototype.finish=function(){var e=this;for(var t=0;t<this.events.length;t++)pt.apply(null,e.events[t])};function Ri(e){var t=e.display;if(!t.scrollbarsClipped&&t.scroller.offsetWidth){t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth;t.heightForcer.style.height=Vr(e)+"px";t.sizer.style.marginBottom=-t.nativeBarWidth+"px";t.sizer.style.borderRightWidth=Vr(e)+"px";t.scrollbarsClipped=true}}function Bi(e){if(e.hasFocus())return null;var t=W();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();if(n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)){r.anchorNode=n.anchorNode;r.anchorOffset=n.anchorOffset;r.focusNode=n.focusNode;r.focusOffset=n.focusOffset}}return r}function ji(e){if(!e||!e.activeElt||e.activeElt==W())return;e.activeElt.focus();if(e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset);r.collapse(false);t.removeAllRanges();t.addRange(r);t.extend(e.focusNode,e.focusOffset)}}function qi(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden){Wi(e);return false}if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Fi(e))return false;if(Yn(e)){Wi(e);t.dims=An(e)}var i=n.first+n.size;var o=Math.max(t.visible.from-e.options.viewportMargin,n.first);var a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom));r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo));if(Ne){o=Ze(e.doc,o);a=Qe(e.doc,a)}var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Ei(e,o,a);r.viewOffset=rt(ue(e.doc,r.viewFrom));e.display.mover.style.top=r.viewOffset+"px";var s=Fi(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return false;var u=Bi(e);s>4&&(r.lineDiv.style.display="none");Ki(e,r.updateLineNumbers,t.dims);s>4&&(r.lineDiv.style.display="");r.renderedView=r.view;ji(u);T(r.cursorDiv);T(r.selectionDiv);r.gutters.style.height=r.sizer.style.minHeight=0;if(l){r.lastWrapHeight=t.wrapperHeight;r.lastWrapWidth=t.wrapperWidth;Pi(e,400)}r.updateLineNumbers=null;return true}function Gi(e,t){var r=t.viewport;for(var n=true;;n=false){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ur(e.display)-Xr(e),r.top)});t.visible=Xn(e.display,e.doc,r);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}if(!qi(e,t))break;Vn(e);var i=ci(e);Pn(e);di(e,i);_i(e,i);t.force=false}t.signal(e,"update",e);if(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 Ui(e,t){var r=new zi(e,t);if(qi(e,r)){Vn(e);Gi(e,r);var n=ci(e);Pn(e);di(e,n);_i(e,n);r.finish()}}function Ki(e,t,r){var n=e.display,i=e.options.lineNumbers;var o=n.lineDiv,a=o.firstChild;function l(t){var r=t.nextSibling;s&&x&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t);return r}var u=n.view,c=n.viewFrom;for(var f=0;f<u.length;f++){var h=u[f];if(h.hidden);else if(h.node&&h.node.parentNode==o){while(a!=h.node)a=l(a);var d=i&&null!=t&&t<=c&&h.lineNumber;if(h.changes){B(h.changes,"gutter")>-1&&(d=false);Or(e,h,c,r)}if(d){T(h.lineNumber);h.lineNumber.appendChild(document.createTextNode(ve(e.options,c)))}a=h.node.nextSibling}else{var p=Ir(e,h,c,r);o.insertBefore(p,a)}c+=h.size}while(a)a=l(a)}function Vi(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function _i(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";e.display.heightForcer.style.top=t.docHeight+"px";e.display.gutters.style.height=t.docHeight+e.display.barHeight+Vr(e)+"px"}function Xi(e){var t=e.display.gutters,r=e.options.gutters;T(t);var n=0;for(;n<r.length;++n){var i=r[n];var o=t.appendChild(N("div",null,"CodeMirror-gutter "+i));if("CodeMirror-linenumbers"==i){e.display.lineGutter=o;o.style.width=(e.display.lineNumWidth||1)+"px"}}t.style.display=n?"":"none";Vi(e)}function $i(e){var t=B(e.gutters,"CodeMirror-linenumbers");if(-1==t&&e.lineNumbers)e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]);else if(t>-1&&!e.lineNumbers){e.gutters=e.gutters.slice(0);e.gutters.splice(t,1)}}var Yi=0;var Ji=null;a?Ji=-.53:r?Ji=15:c?Ji=-.7:h&&(Ji=-1/3);function Zi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail);null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta);return{x:t,y:r}}function Qi(e){var t=Zi(e);t.x*=Ji;t.y*=Ji;return t}function eo(e,t){var n=Zi(t),i=n.x,o=n.y;var a=e.display,l=a.scroller;var u=l.scrollWidth>l.clientWidth;var c=l.scrollHeight>l.clientHeight;if(!(i&&u||o&&c))return;if(o&&x&&s)e:for(var h=t.target,d=a.view;h!=l;h=h.parentNode)for(var p=0;p<d.length;p++)if(d[p].node==h){e.display.currentWheelTarget=h;break e}if(i&&!r&&!f&&null!=Ji){o&&c&&li(e,Math.max(0,l.scrollTop+o*Ji));ui(e,Math.max(0,l.scrollLeft+i*Ji));(!o||o&&c)&&yt(t);a.wheelStartX=null;return}if(o&&null!=Ji){var m=o*Ji;var v=e.doc.scrollTop,g=v+a.wrapper.clientHeight;m<0?v=Math.max(0,v+m-50):g=Math.min(e.doc.height,g+m+50);Ui(e,{top:v,bottom:g})}if(Yi<20)if(null==a.wheelStartX){a.wheelStartX=l.scrollLeft;a.wheelStartY=l.scrollTop;a.wheelDX=i;a.wheelDY=o;setTimeout(function(){if(null==a.wheelStartX)return;var e=l.scrollLeft-a.wheelStartX;var t=l.scrollTop-a.wheelStartY;var r=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null;if(!r)return;Ji=(Ji*Yi+r)/(Yi+1);++Yi},200)}else{a.wheelDX+=i;a.wheelDY+=o}}var to=function(e,t){this.ranges=e;this.primIndex=t};to.prototype.primary=function(){return this.ranges[this.primIndex]};to.prototype.equals=function(e){var t=this;if(e==this)return true;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return false;for(var r=0;r<this.ranges.length;r++){var n=t.ranges[r],i=e.ranges[r];if(!ye(n.anchor,i.anchor)||!ye(n.head,i.head))return false}return true};to.prototype.deepCopy=function(){var e=this;var t=[];for(var r=0;r<this.ranges.length;r++)t[r]=new ro(be(e.ranges[r].anchor),be(e.ranges[r].head));return new to(t,this.primIndex)};to.prototype.somethingSelected=function(){var e=this;for(var t=0;t<this.ranges.length;t++)if(!e.ranges[t].empty())return true;return false};to.prototype.contains=function(e,t){var r=this;t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=r.ranges[n];if(xe(t,i.from())>=0&&xe(e,i.to())<=0)return n}return-1};var ro=function(e,t){this.anchor=e;this.head=t};ro.prototype.from=function(){return ke(this.anchor,this.head)};ro.prototype.to=function(){return we(this.anchor,this.head)};ro.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function no(e,t){var r=e[t];e.sort(function(e,t){return xe(e.from(),t.from())});t=B(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(xe(o.to(),i.from())>=0){var a=ke(o.from(),i.from()),l=we(o.to(),i.to());var s=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t;e.splice(--n,2,new ro(s?l:a,s?a:l))}}return new to(e,t)}function io(e,t){return new to([new ro(e,t||e)],0)}function oo(e){if(!e.text)return e.to;return ge(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0))}function ao(e,t){if(xe(e,t.from)<0)return e;if(xe(e,t.to)<=0)return oo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;e.line==t.to.line&&(n+=oo(t).ch-t.to.ch);return ge(r,n)}function lo(e,t){var r=[];for(var n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new ro(ao(i.anchor,t),ao(i.head,t)))}return no(r,e.sel.primIndex)}function so(e,t,r){return e.line==t.line?ge(r.line,e.ch-t.ch+r.ch):ge(r.line+(e.line-t.line),e.ch)}function uo(e,t,r){var n=[];var i=ge(e.first,0),o=i;for(var a=0;a<t.length;a++){var l=t[a];var s=so(l.from,i,o);var u=so(oo(l),i,o);i=l.to;o=u;if("around"==r){var c=e.sel.ranges[a],f=xe(c.head,c.anchor)<0;n[a]=new ro(f?u:s,f?s:u)}else n[a]=new ro(s,s)}return new to(n,e.sel.primIndex)}function co(e){e.doc.mode=Bt(e.options,e.doc.modeOption);fo(e)}function fo(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;Pi(e,100);e.state.modeGen++;e.curOp&&Ai(e)}function ho(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function po(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){sr(e,r,i,n);Mr(e,"change",e,t)}function a(e,t){var r=[];for(var o=e;o<t;++o)r.push(new lr(u[o],i(o),n));return r}var l=t.from,s=t.to,u=t.text;var c=ue(e,l.line),f=ue(e,s.line);var h=$(u),d=i(u.length-1),p=s.line-l.line;if(t.full){e.insert(0,a(0,u.length));e.remove(u.length,e.size-u.length)}else if(ho(e,t)){var m=a(0,u.length-1);o(f,f.text,d);p&&e.remove(l.line,p);m.length&&e.insert(l.line,m)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,l.ch)+h+c.text.slice(s.ch),d);else{var v=a(1,u.length-1);v.push(new lr(h+c.text.slice(s.ch),d,n));o(c,c.text.slice(0,l.ch)+u[0],i(0));e.insert(l.line+1,v)}else if(1==u.length){o(c,c.text.slice(0,l.ch)+u[0]+f.text.slice(s.ch),i(0));e.remove(l.line+1,p)}else{o(c,c.text.slice(0,l.ch)+u[0],i(0));o(f,h+f.text.slice(s.ch),d);var g=a(1,u.length-1);p>1&&e.remove(l.line+1,p-1);e.insert(l.line+1,g)}Mr(e,"change",e,t)}function mo(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc==i)continue;var s=o&&l.sharedHist;if(r&&!s)continue;t(l.doc,s);n(l.doc,e,s)}}n(e,null,true)}function vo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t;t.cm=e;Hn(e);co(e);go(e);e.options.lineWrapping||it(e);e.options.mode=t.modeOption;Ai(e)}function go(e){("rtl"==e.doc.direction?H:L)(e.display.lineDiv,"CodeMirror-rtl")}function xo(e){Ti(e,function(){go(e);Ai(e)})}function yo(e){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=e||1}function bo(e,t){var r={from:be(t.from),to:oo(t),text:ce(e,t.from,t.to)};Mo(e,r,t.from.line,t.to.line+1);mo(e,function(e){return Mo(e,r,t.from.line,t.to.line+1)},true);return r}function wo(e){while(e.length){var t=$(e);if(!t.ranges)break;e.pop()}}function ko(e,t){if(t){wo(e.done);return $(e.done)}if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges){e.done.pop();return $(e.done)}}function Co(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,a;var l;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(a=ko(i,i.lastOp==n))){l=$(a.changes);0==xe(t.from,t.to)&&0==xe(t.from,l.to)?l.to=oo(t):a.changes.push(bo(e,t))}else{var s=$(i.done);s&&s.ranges||To(e.sel,i.done);a={changes:[bo(e,t)],generation:i.generation};i.done.push(a);while(i.done.length>i.undoDepth){i.done.shift();i.done[0].ranges||i.done.shift()}}i.done.push(r);i.generation=++i.maxGeneration;i.lastModTime=i.lastSelTime=o;i.lastOp=i.lastSelOp=n;i.lastOrigin=i.lastSelOrigin=t.origin;l||pt(e,"historyAdded")}function So(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Lo(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||So(e,o,$(i.done),t))?i.done[i.done.length-1]=t:To(t,i.done);i.lastSelTime=+new Date;i.lastSelOrigin=o;i.lastSelOp=r;n&&false!==n.clearRedo&&wo(i.undone)}function To(e,t){var r=$(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Mo(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans);++o})}function No(e){if(!e)return null;var t;for(var r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Oo(e,t){var r=t["spans_"+e.id];if(!r)return null;var n=[];for(var i=0;i<t.text.length;++i)n.push(No(r[i]));return n}function Ao(e,t){var r=Oo(e,t);var n=Ie(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){var s=a[l];for(var u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Do(e,t,r){var n=[];for(var i=0;i<e.length;++i){var o=e[i];if(o.ranges){n.push(r?to.prototype.deepCopy.call(o):o);continue}var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c=void 0;l.push({from:u.from,to:u.to,text:u.text});if(t)for(var f in u)if((c=f.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1){$(l)[f]=u[f];delete u[f]}}}return n}function Wo(e,t,r,n){if(n){var i=e.anchor;if(r){var o=xe(t,i)<0;if(o!=xe(r,i)<0){i=t;t=r}else o!=xe(t,r)<0&&(t=r)}return new ro(i,t)}return new ro(r||t,t)}function Ho(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend));Ro(e,new to([Wo(e.sel.primary(),t,r,i)],0),n)}function Eo(e,t,r){var n=[];var i=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o<e.sel.ranges.length;o++)n[o]=Wo(e.sel.ranges[o],t[o],null,i);var a=no(n,e.sel.primIndex);Ro(e,a,r)}function Fo(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r;Ro(e,no(i,e.sel.primIndex),n)}function Po(e,t,r,n){Ro(e,io(t,r),n)}function Io(e,t,r){var n={ranges:t.ranges,update:function(t){var r=this;this.ranges=[];for(var n=0;n<t.length;n++)r.ranges[n]=new ro(Se(e,t[n].anchor),Se(e,t[n].head))},origin:r&&r.origin};pt(e,"beforeSelectionChange",e,n);e.cm&&pt(e.cm,"beforeSelectionChange",e.cm,n);return n.ranges!=t.ranges?no(n.ranges,n.ranges.length-1):t}function zo(e,t,r){var n=e.history.done,i=$(n);if(i&&i.ranges){n[n.length-1]=t;Bo(e,t,r)}else Ro(e,t,r)}function Ro(e,t,r){Bo(e,t,r);Lo(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Bo(e,t,r){(gt(e,"beforeSelectionChange")||e.cm&>(e.cm,"beforeSelectionChange"))&&(t=Io(e,t,r));var n=r&&r.bias||(xe(t.primary().head,e.sel.primary().head)<0?-1:1);jo(e,Go(e,t,n,true));r&&false===r.scroll||!e.cm||ri(e.cm)}function jo(e,t){if(t.equals(e.sel))return;e.sel=t;if(e.cm){e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=true;vt(e.cm)}Mr(e,"cursorActivity",e)}function qo(e){jo(e,Go(e,e.sel,null,false))}function Go(e,t,r,n){var i;for(var o=0;o<t.ranges.length;o++){var a=t.ranges[o];var l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o];var s=Ko(e,a.anchor,l&&l.anchor,r,n);var u=Ko(e,a.head,l&&l.head,r,n);if(i||s!=a.anchor||u!=a.head){i||(i=t.ranges.slice(0,o));i[o]=new ro(s,u)}}return i?no(i,t.primIndex):t}function Uo(e,t,r,n,i){var o=ue(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i){pt(s,"beforeCursorEnter");if(s.explicitlyCleared){if(o.markedSpans){--a;continue}break}}if(!s.atomic)continue;if(r){var u=s.find(n<0?1:-1),c=void 0;(n<0?s.inclusiveRight:s.inclusiveLeft)&&(u=Vo(e,u,-n,u&&u.line==t.line?o:null));if(u&&u.line==t.line&&(c=xe(u,r))&&(n<0?c<0:c>0))return Uo(e,u,t,n,i)}var f=s.find(n<0?-1:1);(n<0?s.inclusiveLeft:s.inclusiveRight)&&(f=Vo(e,f,n,f.line==t.line?o:null));return f?Uo(e,f,t,n,i):null}}return t}function Ko(e,t,r,n,i){var o=n||1;var a=Uo(e,t,r,o,i)||!i&&Uo(e,t,r,o,true)||Uo(e,t,r,-o,i)||!i&&Uo(e,t,r,-o,true);if(!a){e.cantEdit=true;return ge(e.first,0)}return a}function Vo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?Se(e,ge(t.line-1)):null:r>0&&t.ch==(n||ue(e,t.line)).text.length?t.line<e.first+e.size-1?ge(t.line+1,0):null:new ge(t.line,t.ch+r)}function _o(e){e.setSelection(ge(e.firstLine(),0),ge(e.lastLine()),G)}function Xo(e,t,r){var n={canceled:false,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=true}};r&&(n.update=function(t,r,i,o){t&&(n.from=Se(e,t));r&&(n.to=Se(e,r));i&&(n.text=i);void 0!==o&&(n.origin=o)});pt(e,"beforeChange",e,n);e.cm&&pt(e.cm,"beforeChange",e.cm,n);if(n.canceled)return null;return{from:n.from,to:n.to,text:n.text,origin:n.origin}}function $o(e,t,r){if(e.cm){if(!e.cm.curOp)return Mi(e.cm,$o)(e,t,r);if(e.cm.state.suppressEdits)return}if(gt(e,"beforeChange")||e.cm&>(e.cm,"beforeChange")){t=Xo(e,t,true);if(!t)return}var n=Me&&!r&&Re(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Yo(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Yo(e,t)}function Yo(e,t){if(1==t.text.length&&""==t.text[0]&&0==xe(t.from,t.to))return;var r=lo(e,t);Co(e,t,r,e.cm?e.cm.curOp.id:NaN);Qo(e,t,r,Ie(e,t));var n=[];mo(e,function(e,r){if(!r&&-1==B(n,e.history)){ia(e.history,t);n.push(e.history)}Qo(e,t,null,Ie(e,t))})}function Jo(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;var i=e.history,o,a=e.sel;var l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done;var u=0;for(;u<l.length;u++){o=l[u];if(r?o.ranges&&!o.equals(e.sel):!o.ranges)break}if(u==l.length)return;i.lastOrigin=i.lastSelOrigin=null;for(;;){o=l.pop();if(!o.ranges){if(n){l.push(o);return}break}To(o,s);if(r&&!o.equals(e.sel)){Ro(e,o,{clearRedo:false});return}a=o}var c=[];To(a,s);s.push({changes:c,generation:i.generation});i.generation=o.generation||++i.maxGeneration;var f=gt(e,"beforeChange")||e.cm&>(e.cm,"beforeChange");var h=function(r){var n=o.changes[r];n.origin=t;if(f&&!Xo(e,n,false)){l.length=0;return{}}c.push(bo(e,n));var i=r?lo(e,n):$(l);Qo(e,n,i,Ao(e,n));!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:oo(n)});var a=[];mo(e,function(e,t){if(!t&&-1==B(a,e.history)){ia(e.history,n);a.push(e.history)}Qo(e,n,null,Ao(e,n))})};for(var d=o.changes.length-1;d>=0;--d){var p=h(d);if(p)return p.v}}function Zo(e,t){if(0==t)return;e.first+=t;e.sel=new to(Y(e.sel.ranges,function(e){return new ro(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){Ai(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Di(e.cm,n,"gutter")}}function Qo(e,t,r,n){if(e.cm&&!e.cm.curOp)return Mi(e.cm,Qo)(e,t,r,n);if(t.to.line<e.first){Zo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Zo(e,i);t={from:ge(e.first,0),to:ge(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ge(o,ue(e,o).text.length),text:[t.text[0]],origin:t.origin});t.removed=ce(e,t.from,t.to);r||(r=lo(e,t));e.cm?ea(e.cm,t,n):po(e,t,n);Bo(e,r,G)}function ea(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to;var l=false,s=o.line;if(!e.options.lineWrapping){s=de($e(ue(n,o.line)));n.iter(s,a.line+1,function(e){if(e==i.maxLine){l=true;return true}})}n.sel.contains(t.from,t.to)>-1&&vt(e);po(n,t,r,Wn(e));if(!e.options.lineWrapping){n.iter(s,o.line+t.text.length,function(e){var t=nt(e);if(t>i.maxLineLength){i.maxLine=e;i.maxLineLength=t;i.maxLineChanged=true;l=false}});l&&(e.curOp.updateMaxLine=true)}ar(n,o.line);Pi(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?Ai(e):o.line!=a.line||1!=t.text.length||ho(e.doc,t)?Ai(e,o.line,a.line+1,u):Di(e,o.line,"text");var c=gt(e,"changes"),f=gt(e,"change");if(f||c){var h={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};f&&Mr(e,"change",e,h);c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function ta(e,t,r,n,i){n||(n=r);if(xe(n,r)<0){var o;o=[n,r],r=o[0],n=o[1]}"string"==typeof t&&(t=e.splitLines(t));$o(e,{from:r,to:n,text:t,origin:i})}function ra(e,t,r,n){if(r<e.line)e.line+=n;else if(t<e.line){e.line=t;e.ch=0}}function na(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=true;if(o.ranges){if(!o.copied){o=e[i]=o.deepCopy();o.copied=true}for(var l=0;l<o.ranges.length;l++){ra(o.ranges[l].anchor,t,r,n);ra(o.ranges[l].head,t,r,n)}continue}for(var s=0;s<o.changes.length;++s){var u=o.changes[s];if(r<u.from.line){u.from=ge(u.from.line+n,u.from.ch);u.to=ge(u.to.line+n,u.to.ch)}else if(t<=u.to.line){a=false;break}}if(!a){e.splice(0,i+1);i=0}}}function ia(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;na(e.done,r,n,i);na(e.undone,r,n,i)}function oa(e,t,r,n){var i=t,o=t;"number"==typeof t?o=ue(e,Ce(e,t)):i=de(t);if(null==i)return null;n(o,i)&&e.cm&&Di(e.cm,i,r);return o}function aa(e){var t=this;this.lines=e;this.parent=null;var r=0;for(var n=0;n<e.length;++n){e[n].parent=t;r+=e[n].height}this.height=r}aa.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){var r=this;for(var n=e,i=e+t;n<i;++n){var o=r.lines[n];r.height-=o.height;ur(o);Mr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){var n=this;this.height+=r;this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=n},iterN:function(e,t,r){var n=this;for(var i=e+t;e<i;++e)if(r(n.lines[e]))return true}};function la(e){var t=this;this.children=e;var r=0,n=0;for(var i=0;i<e.length;++i){var o=e[i];r+=o.chunkSize();n+=o.height;o.parent=t}this.size=r;this.height=n;this.parent=null}la.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var r=this;this.size-=t;for(var n=0;n<this.children.length;++n){var i=r.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e),l=i.height;i.removeInner(e,a);r.height-=l-i.height;if(o==a){r.children.splice(n--,1);i.parent=null}if(0==(t-=a))break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof aa))){var s=[];this.collapse(s);this.children=[new aa(s)];this.children[0].parent=this}},collapse:function(e){var t=this;for(var r=0;r<this.children.length;++r)t.children[r].collapse(e)},insertInner:function(e,t,r){var n=this;this.size+=t.length;this.height+=r;for(var i=0;i<this.children.length;++i){var o=n.children[i],a=o.chunkSize();if(e<=a){o.insertInner(e,t,r);if(o.lines&&o.lines.length>50){var l=o.lines.length%25+25;for(var s=l;s<o.lines.length;){var u=new aa(o.lines.slice(s,s+=25));o.height-=u.height;n.children.splice(++i,0,u);u.parent=n}o.lines=o.lines.slice(0,l);n.maybeSpill()}break}e-=a}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5);var r=new la(t);if(e.parent){e.size-=r.size;e.height-=r.height;var n=B(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new la(e.children);i.parent=e;e.children=[i,r];e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){var n=this;for(var i=0;i<this.children.length;++i){var o=n.children[i],a=o.chunkSize();if(e<a){var l=Math.min(t,a-e);if(o.iterN(e,l,r))return true;if(0==(t-=l))break;e=0}else e-=a}}};var sa=function(e,t,r){var n=this;if(r)for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i]);this.doc=e;this.node=t};sa.prototype.clear=function(){var e=this;var t=this.doc.cm,r=this.line.widgets,n=this.line,i=de(n);if(null==i||!r)return;for(var o=0;o<r.length;++o)r[o]==e&&r.splice(o--,1);r.length||(n.widgets=null);var a=jr(this);he(n,Math.max(0,n.height-a));if(t){Ti(t,function(){ua(t,n,-a);Di(t,i,"widget")});Mr(t,"lineWidgetCleared",t,this,i)}};sa.prototype.changed=function(){var e=this;var t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=jr(this)-t;if(!i)return;he(n,n.height+i);r&&Ti(r,function(){r.curOp.forceUpdate=true;ua(r,n,i);Mr(r,"lineWidgetChanged",r,e,de(n))})};xt(sa);function ua(e,t,r){rt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ti(e,r)}function ca(e,t,r,n){var i=new sa(e,r,n);var o=e.cm;o&&i.noHScroll&&(o.display.alignWidgets=true);oa(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i);i.line=t;if(o&&!et(e,t)){var n=rt(t)<e.scrollTop;he(t,t.height+jr(i));n&&ti(o,i.height);o.curOp.forceUpdate=true}return true});o&&Mr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:de(t));return i}var fa=0;var ha=function(e,t){this.lines=[];this.type=t;this.doc=e;this.id=++fa};ha.prototype.clear=function(){var e=this;if(this.explicitlyCleared)return;var t=this.doc.cm,r=t&&!t.curOp;r&&xi(t);if(gt(this,"clear")){var n=this.find();n&&Mr(this,"clear",n.from,n.to)}var i=null,o=null;for(var a=0;a<this.lines.length;++a){var l=e.lines[a];var s=We(l.markedSpans,e);if(t&&!e.collapsed)Di(t,de(l),"text");else if(t){null!=s.to&&(o=de(l));null!=s.from&&(i=de(l))}l.markedSpans=He(l.markedSpans,s);null==s.from&&e.collapsed&&!et(e.doc,l)&&t&&he(l,Nn(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=$e(e.lines[u]),f=nt(c);if(f>t.display.maxLineLength){t.display.maxLine=c;t.display.maxLineLength=f;t.display.maxLineChanged=true}}null!=i&&t&&this.collapsed&&Ai(t,i,o+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;t&&qo(t.doc)}t&&Mr(t,"markerCleared",t,this,i,o);r&&yi(t);this.parent&&this.parent.clear()};ha.prototype.find=function(e,t){var r=this;null==e&&"bookmark"==this.type&&(e=1);var n,i;for(var o=0;o<this.lines.length;++o){var a=r.lines[o];var l=We(a.markedSpans,r);if(null!=l.from){n=ge(t?a:de(a),l.from);if(-1==e)return n}if(null!=l.to){i=ge(t?a:de(a),l.to);if(1==e)return i}}return n&&{from:n,to:i}};ha.prototype.changed=function(){var e=this;var t=this.find(-1,true),r=this,n=this.doc.cm;if(!t||!n)return;Ti(n,function(){var i=t.line,o=de(t.line);var a=Qr(n,o);if(a){sn(a);n.curOp.selectionChanged=n.curOp.forceUpdate=true}n.curOp.updateMaxLine=true;if(!et(r.doc,i)&&null!=r.height){var l=r.height;r.height=null;var s=jr(r)-l;s&&he(i,i.height+s)}Mr(n,"markerChanged",n,e)})};ha.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)};ha.prototype.detachLine=function(e){this.lines.splice(B(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};xt(ha);function da(e,t,r,n,i){if(n&&n.shared)return ma(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Mi(e.cm,da)(e,t,r,n,i);var o=new ha(e,i),a=xe(t,r);n&&I(n,o,false);if(a>0||0==a&&false!==o.clearWhenEmpty)return o;if(o.replacedWith){o.collapsed=true;o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget");n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true");n.insertLeft&&(o.widgetNode.insertLeft=true)}if(o.collapsed){if(Xe(e,t.line,t,r,o)||t.line!=r.line&&Xe(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ae()}o.addToHistory&&Co(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,u;e.iter(l,r.line+1,function(e){s&&o.collapsed&&!s.options.lineWrapping&&$e(e)==s.display.maxLine&&(u=true);o.collapsed&&l!=t.line&&he(e,0);Ee(e,new De(o,l==t.line?t.ch:null,l==r.line?r.ch:null));++l});o.collapsed&&e.iter(t.line,r.line+1,function(t){et(e,t)&&he(t,0)});o.clearOnEnter&&ft(o,"beforeCursorEnter",function(){return o.clear()});if(o.readOnly){Oe();(e.history.done.length||e.history.undone.length)&&e.clearHistory()}if(o.collapsed){o.id=++fa;o.atomic=true}if(s){u&&(s.curOp.updateMaxLine=true);if(o.collapsed)Ai(s,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Di(s,c,"text");o.atomic&&qo(s.doc);Mr(s,"markerAdded",s,o)}return o}var pa=function(e,t){var r=this;this.markers=e;this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=r};pa.prototype.clear=function(){var e=this;if(this.explicitlyCleared)return;this.explicitlyCleared=true;for(var t=0;t<this.markers.length;++t)e.markers[t].clear();Mr(this,"clear")};pa.prototype.find=function(e,t){return this.primary.find(e,t)};xt(pa);function ma(e,t,r,n,i){n=I(n);n.shared=false;var o=[da(e,t,r,n,i)],a=o[0];var l=n.widgetNode;mo(e,function(e){l&&(n.widgetNode=l.cloneNode(true));o.push(da(e,Se(e,t),Se(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=$(o)});return new pa(o,a)}function va(e){return e.findMarks(ge(e.first,0),e.clipPos(ge(e.lastLine())),function(e){return e.parent})}function ga(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find();var o=e.clipPos(i.from),a=e.clipPos(i.to);if(xe(o,a)){var l=da(e,o,a,n.primary,n.primary.type);n.markers.push(l);l.parent=n}}}function xa(e){var t=function(t){var r=e[t],n=[r.primary.doc];mo(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];if(-1==B(n,o.doc)){o.parent=null;r.markers.splice(i--,1)}}};for(var r=0;r<e.length;r++)t(r)}var ya=0;var ba=function(e,t,r,n,i){if(!(this instanceof ba))return new ba(e,t,r,n,i);null==r&&(r=0);la.call(this,[new aa([new lr("",null)])]);this.first=r;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=r;var o=ge(r,0);this.sel=io(o);this.history=new yo(null);this.id=++ya;this.modeOption=t;this.lineSep=n;this.direction="rtl"==i?"rtl":"ltr";this.extend=false;"string"==typeof e&&(e=this.splitLines(e));po(this,{from:o,to:o,text:e});Ro(this,io(o),G)};ba.prototype=Q(la.prototype,{constructor:ba,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var r=0;for(var n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fe(this,this.first,this.first+this.size);if(false===e)return t;return t.join(e||this.lineSeparator())},setValue:Oi(function(e){var t=ge(this.first,0),r=this.first+this.size-1;$o(this,{from:t,to:ge(r,ue(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:true},true);this.cm&&ni(this.cm,0,0);Ro(this,io(t),G)}),replaceRange:function(e,t,r,n){t=Se(this,t);r=r?Se(this,r):t;ta(this,e,t,r,n)},getRange:function(e,t,r){var n=ce(this,Se(this,e),Se(this,t));if(false===r)return n;return n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(me(this,e))return ue(this,e)},getLineNumber:function(e){return de(e)},getLineHandleVisualStart:function(e){"number"==typeof e&&(e=ue(this,e));return $e(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Se(this,e)},getCursor:function(e){var t=this.sel.primary(),r;r=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||false===e?t.to():t.from();return r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Oi(function(e,t,r){Po(this,Se(this,"number"==typeof e?ge(e,t||0):e),null,r)}),setSelection:Oi(function(e,t,r){Po(this,Se(this,e),Se(this,t||e),r)}),extendSelection:Oi(function(e,t,r){Ho(this,Se(this,e),t&&Se(this,t),r)}),extendSelections:Oi(function(e,t){Eo(this,Te(this,e),t)}),extendSelectionsBy:Oi(function(e,t){var r=Y(this.sel.ranges,e);Eo(this,Te(this,r),t)}),setSelections:Oi(function(e,t,r){var n=this;if(!e.length)return;var i=[];for(var o=0;o<e.length;o++)i[o]=new ro(Se(n,e[o].anchor),Se(n,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex));Ro(this,no(i,t),r)}),addSelection:Oi(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new ro(Se(this,e),Se(this,t||e)));Ro(this,no(n,n.length-1),r)}),getSelection:function(e){var t=this;var r=this.sel.ranges,n;for(var i=0;i<r.length;i++){var o=ce(t,r[i].from(),r[i].to());n=n?n.concat(o):o}return false===e?n:n.join(e||this.lineSeparator())},getSelections:function(e){var t=this;var r=[],n=this.sel.ranges;for(var i=0;i<n.length;i++){var o=ce(t,n[i].from(),n[i].to());false!==e&&(o=o.join(e||t.lineSeparator()));r[i]=o}return r},replaceSelection:function(e,t,r){var n=[];for(var i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Oi(function(e,t,r){var n=this;var i=[],o=this.sel;for(var a=0;a<o.ranges.length;a++){var l=o.ranges[a];i[a]={from:l.from(),to:l.to(),text:n.splitLines(e[a]),origin:r}}var s=t&&"end"!=t&&uo(this,i,t);for(var u=i.length-1;u>=0;u--)$o(n,i[u]);s?zo(this,s):this.cm&&ri(this.cm)}),undo:Oi(function(){Jo(this,"undo")}),redo:Oi(function(){Jo(this,"redo")}),undoSelection:Oi(function(){Jo(this,"undo",true)}),redoSelection:Oi(function(){Jo(this,"redo",true)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,r=0;for(var n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new yo(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(e){e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Do(this.history.done),undone:Do(this.history.undone)}},setHistory:function(e){var t=this.history=new yo(this.history.maxGeneration);t.done=Do(e.done.slice(0),null,true);t.undone=Do(e.undone.slice(0),null,true)},setGutterMarker:Oi(function(e,t,r){return oa(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});n[t]=r;!r&&ne(n)&&(e.gutterMarkers=null);return true})}),clearGutter:Oi(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&oa(t,r,"gutter",function(){r.gutterMarkers[e]=null;ne(r.gutterMarkers)&&(r.gutterMarkers=null);return true})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!me(this,e))return null;t=e;e=ue(this,e);if(!e)return null}else{t=de(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Oi(function(e,t,r){return oa(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(S(r).test(e[n]))return false;e[n]+=" "+r}else e[n]=r;return true})}),removeLineClass:Oi(function(e,t,r){return oa(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";var i=e[n];if(!i)return false;if(null==r)e[n]=null;else{var o=i.match(S(r));if(!o)return false;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return true})}),addLineWidget:Oi(function(e,t,r){return ca(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return da(this,Se(this,e),Se(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:false,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};e=Se(this,e);return da(this,e,e,r,"bookmark")},findMarksAt:function(e){e=Se(this,e);var t=[],r=ue(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=Se(this,e);t=Se(this,t);var n=[],i=e.line;this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i});return n},getAllMarks:function(){var e=[];this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)});return e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;this.iter(function(i){var o=i.text.length+n;if(o>e){t=e;return true}e-=o;++r});return Se(this,ge(r,t))},indexFromPos:function(e){e=Se(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;this.iter(this.first,e.line,function(e){t+=e.text.length+r});return t},copy:function(e){var t=new ba(fe(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);t.scrollTop=this.scrollTop;t.scrollLeft=this.scrollLeft;t.sel=this.sel;t.extend=false;if(e){t.history.undoDepth=this.history.undoDepth;t.setHistory(this.getHistory())}return t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from);null!=e.to&&e.to<r&&(r=e.to);var n=new ba(fe(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);e.sharedHist&&(n.history=this.history);(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist});n.linked=[{doc:this,isParent:true,sharedHist:e.sharedHist}];ga(n,va(this));return n},unlinkDoc:function(e){var t=this;e instanceof Fl&&(e=e.doc);if(this.linked)for(var r=0;r<this.linked.length;++r){var n=t.linked[r];if(n.doc!=e)continue;t.linked.splice(r,1);e.unlinkDoc(t);xa(va(t));break}if(e.history==this.history){var i=[e.id];mo(e,function(e){return i.push(e.id)},true);e.history=new yo(null);e.history.done=Do(this.history.done,i);e.history.undone=Do(this.history.undone,i)}},iterLinkedDocs:function(e){mo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){if(this.lineSep)return e.split(this.lineSep);return At(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Oi(function(e){"rtl"!=e&&(e="ltr");if(e==this.direction)return;this.direction=e;this.iter(function(e){return e.order=null});this.cm&&xo(this.cm)})});ba.prototype.eachLine=ba.prototype.iter;var wa=0;function ka(e){var t=this;La(t);if(mt(t,e)||qr(t.display,e))return;yt(e);a&&(wa=+new Date);var r=En(t,e,true),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File){var i=n.length,o=Array(i),l=0;var s=function(e,n){if(t.options.allowDropFileTypes&&-1==B(t.options.allowDropFileTypes,e.type))return;var a=new FileReader;a.onload=Mi(t,function(){var e=a.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e="");o[n]=e;if(++l==i){r=Se(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};$o(t.doc,s);zo(t.doc,io(r,oo(s)))}});a.readAsText(e)};for(var u=0;u<i;++u)s(n[u],u)}else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e);setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var f;t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections());Bo(t.doc,io(r,r));if(f)for(var h=0;h<f.length;++h)ta(t.doc,"",f[h].anchor,f[h].head,"drag");t.replaceSelection(c,"around","paste");t.display.input.focus()}}catch(e){}}}function Ca(e,t){if(a&&(!e.state.draggingText||+new Date-wa<100)){kt(t);return}if(mt(e,t)||qr(e.display,t))return;t.dataTransfer.setData("Text",e.getSelection());t.dataTransfer.effectAllowed="copyMove";if(t.dataTransfer.setDragImage&&!h){var r=N("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(f){r.width=r.height=1;e.display.wrapper.appendChild(r);r._top=r.offsetTop}t.dataTransfer.setDragImage(r,0,0);f&&r.parentNode.removeChild(r)}}function Sa(e,t){var r=En(e,t);if(!r)return;var n=document.createDocumentFragment();zn(e,r,n);if(!e.display.dragCursor){e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors");e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)}M(e.display.dragCursor,n)}function La(e){if(e.display.dragCursor){e.display.lineSpace.removeChild(e.display.dragCursor);e.display.dragCursor=null}}function Ta(e){if(!document.getElementsByClassName)return;var t=document.getElementsByClassName("CodeMirror");for(var r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}var Ma=false;function Na(){if(Ma)return;Oa();Ma=true}function Oa(){var e;ft(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null;Ta(Aa)},100))});ft(window,"blur",function(){return Ta(Kn)})}function Aa(e){var t=e.display;if(t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth)return;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null;t.scrollbarsClipped=false;e.setSize()}var Da={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};for(var Wa=0;Wa<10;Wa++)Da[Wa+48]=Da[Wa+96]=String(Wa);for(var Ha=65;Ha<=90;Ha++)Da[Ha]=String.fromCharCode(Ha);for(var Ea=1;Ea<=12;Ea++)Da[Ea+111]=Da[Ea+63235]="F"+Ea;var Fa={};Fa.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"};Fa.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"};Fa.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"};Fa.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"]};Fa["default"]=x?Fa.macDefault:Fa.pcDefault;function Pa(e){var t=e.split(/-(?!$)/);e=t[t.length-1];var r,n,i,o;for(var a=0;a<t.length-1;a++){var l=t[a];if(/^(cmd|meta|m)$/i.test(l))o=true;else if(/^a(lt)?$/i.test(l))r=true;else if(/^(c|ctrl|control)$/i.test(l))n=true;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);i=true}}r&&(e="Alt-"+e);n&&(e="Ctrl-"+e);o&&(e="Cmd-"+e);i&&(e="Shift-"+e);return e}function Ia(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}var i=Y(r.split(" "),Pa);for(var o=0;o<i.length;o++){var a=void 0,l=void 0;if(o==i.length-1){l=i.join(" ");a=n}else{l=i.slice(0,o+1).join(" ");a="..."}var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var u in t)e[u]=t[u];return e}function za(e,t,r,n){t=qa(t);var i=t.call?t.call(e,n):t[e];if(false===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return za(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=za(e,t.fallthrough[o],r,n);if(a)return a}}}function Ra(e){var t="string"==typeof e?e:Da[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Ba(e,t,r){var n=e;t.altKey&&"Alt"!=n&&(e="Alt-"+e);(k?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e);(k?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e);!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e);return e}function ja(e,t){if(f&&34==e.keyCode&&e["char"])return false;var r=Da[e.keyCode];if(null==r||e.altGraphKey)return false;3==e.keyCode&&e.code&&(r=e.code);return Ba(r,e,t)}function qa(e){return"string"==typeof e?Fa[e]:e}function Ga(e,t){var r=e.doc.sel.ranges,n=[];for(var i=0;i<r.length;i++){var o=t(r[i]);while(n.length&&xe(o.from,$(n).to)<=0){var a=n.pop();if(xe(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ti(e,function(){for(var t=n.length-1;t>=0;t--)ta(e.doc,"",n[t].from,n[t].to,"+delete");ri(e)})}function Ua(e,t,r){var n=ae(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ka(e,t,r){var n=Ua(e,t.ch,r);return null==n?null:new ge(t.line,n,r<0?"after":"before")}function Va(e,t,r,n,i){if(e){var o=ut(r,t.doc.direction);if(o){var a=i<0?$(o):o[0];var l=i<0==(1==a.level);var s=l?"after":"before";var u;if(a.level>0||"rtl"==t.doc.direction){var c=en(t,r);u=i<0?r.text.length-1:0;var f=tn(t,c,u).top;u=le(function(e){return tn(t,c,e).top==f},i<0==(1==a.level)?a.from:a.to-1,u);"before"==s&&(u=Ua(r,u,1))}else u=i<0?a.to:a.from;return new ge(n,u,s)}}return new ge(n,i<0?r.text.length:0,i<0?"before":"after")}function _a(e,t,r,n){var i=ut(t,e.doc.direction);if(!i)return Ka(t,r,n);if(r.ch>=t.text.length){r.ch=t.text.length;r.sticky="before"}else if(r.ch<=0){r.ch=0;r.sticky="after"}var o=lt(i,r.ch,r.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return Ka(t,r,n);var l=function(e,r){return Ua(t,e instanceof ge?e.ch:e,r)};var s;var u=function(r){if(!e.options.lineWrapping)return{begin:0,end:t.text.length};s=s||en(e,t);return kn(e,t,s,r)};var c=u("before"==r.sticky?l(r,-1):r.ch);if("rtl"==e.doc.direction||1==a.level){var f=1==a.level==n<0;var h=l(r,f?1:-1);if(null!=h&&(f?h<=a.to&&h<=c.end:h>=a.from&&h>=c.begin)){var d=f?"before":"after";return new ge(r.line,h,d)}}var p=function(e,t,n){var o=function(e,t){return t?new ge(r.line,l(e,1),"before"):new ge(r.line,e,"after")};for(;e>=0&&e<i.length;e+=t){var a=i[e];var s=t>0==(1!=a.level);var u=s?n.begin:l(n.end,-1);if(a.from<=u&&u<a.to)return o(u,s);u=s?a.from:l(a.to,-1);if(n.begin<=u&&u<n.end)return o(u,s)}};var m=p(o+n,n,c);if(m)return m;var v=n>0?c.end:l(c.begin,-1);if(null!=v&&!(n>0&&v==t.text.length)){m=p(n>0?0:i.length-1,n,u(v));if(m)return m}return null}var Xa={selectAll:_o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),G)},killLine:function(e){return Ga(e,function(t){if(t.empty()){var r=ue(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ge(t.head.line+1,0)}:{from:t.head,to:ge(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ga(e,function(t){return{from:ge(t.from().line,0),to:Se(e.doc,ge(t.to().line+1,0))}})},delLineLeft:function(e){return Ga(e,function(e){return{from:ge(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return Ga(e,function(t){var r=e.charCoords(t.head,"div").top+5;var n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return Ga(e,function(t){var r=e.charCoords(t.head,"div").top+5;var n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ge(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ge(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return $a(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ja(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Ya(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},K)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},K)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;var n=e.coordsChar({left:0,top:r},"div");if(n.ch<e.getLine(n.line).search(/\S/))return Ja(e,t.head);return n},K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){var t=[],r=e.listSelections(),n=e.options.tabSize;for(var i=0;i<r.length;i++){var o=r[i].from();var a=z(e.getLine(o.line),o.ch,n);t.push(X(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ti(e,function(){var t=e.listSelections(),r=[];for(var n=0;n<t.length;n++){if(!t[n].empty())continue;var i=t[n].head,o=ue(e.doc,i.line).text;if(o){i.ch==o.length&&(i=new ge(i.line,i.ch-1));if(i.ch>0){i=new ge(i.line,i.ch+1);e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose")}else if(i.line>e.doc.first){var a=ue(e.doc,i.line-1).text;if(a){i=new ge(i.line,1);e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),ge(i.line-1,a.length-1),i,"+transpose")}}}r.push(new ro(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Ti(e,function(){var t=e.listSelections();for(var r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,true);ri(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function $a(e,t){var r=ue(e.doc,t);var n=$e(r);n!=r&&(t=de(n));return Va(true,e,n,t,1)}function Ya(e,t){var r=ue(e.doc,t);var n=Ye(r);n!=r&&(t=de(n));return Va(true,e,r,t,-1)}function Ja(e,t){var r=$a(e,t.line);var n=ue(e.doc,r.line);var i=ut(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/));var a=t.line==r.line&&t.ch<=o&&t.ch;return ge(r.line,a?0:o,r.sticky)}return r}function Za(e,t,r){if("string"==typeof t){t=Xa[t];if(!t)return false}e.display.input.ensurePolled();var n=e.display.shift,i=false;try{e.isReadOnly()&&(e.state.suppressEdits=true);r&&(e.display.shift=false);i=t(e)!=q}finally{e.display.shift=n;e.state.suppressEdits=false}return i}function Qa(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=za(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&za(t,e.options.extraKeys,r,e)||za(t,e.options.keyMap,r,e)}var el=new R;function tl(e,t,r,n){var i=e.state.keySeq;if(i){if(Ra(t))return"handled";/\'$/.test(t)?e.state.keySeq=null:el.set(50,function(){if(e.state.keySeq==i){e.state.keySeq=null;e.display.input.reset()}});if(rl(e,i+" "+t,r,n))return true}return rl(e,t,r,n)}function rl(e,t,r,n){var i=Qa(e,t,n);"multi"==i&&(e.state.keySeq=t);"handled"==i&&Mr(e,"keyHandled",e,t,r);if("handled"==i||"multi"==i){yt(r);jn(e)}return!!i}function nl(e,t){var r=ja(t,true);if(!r)return false;return t.shiftKey&&!e.state.keySeq?tl(e,"Shift-"+r,t,function(t){return Za(e,t,true)})||tl(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return Za(e,t)}):tl(e,r,t,function(t){return Za(e,t)})}function il(e,t,r){return tl(e,"'"+r+"'",t,function(t){return Za(e,t,true)})}var ol=null;function al(e){var t=this;t.curOp.focus=W();if(mt(t,e))return;a&&l<11&&27==e.keyCode&&(e.returnValue=false);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=nl(t,e);if(f){ol=n?r:null;!n&&88==r&&!Wt&&(x?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")}18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||ll(t)}function ll(e){var t=e.display.lineDiv;H(t,"CodeMirror-crosshair");function r(e){if(18==e.keyCode||!e.altKey){L(t,"CodeMirror-crosshair");dt(document,"keyup",r);dt(document,"mouseover",r)}}ft(document,"keyup",r);ft(document,"mouseover",r)}function sl(e){16==e.keyCode&&(this.doc.sel.shift=false);mt(this,e)}function ul(e){var t=this;if(qr(t.display,e)||mt(t,e)||e.ctrlKey&&!e.altKey||x&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(f&&r==ol){ol=null;yt(e);return}if(f&&(!e.which||e.which<10)&&nl(t,e))return;var i=String.fromCharCode(null==n?r:n);if("\b"==i)return;if(il(t,e,i))return;t.display.input.onKeyPress(e)}var cl=400;var fl=function(e,t,r){this.time=e;this.pos=t;this.button=r};fl.prototype.compare=function(e,t,r){return this.time+cl>e&&0==xe(t,this.pos)&&r==this.button};var hl;var dl;function pl(e,t){var r=+new Date;if(dl&&dl.compare(r,e,t)){hl=dl=null;return"triple"}if(hl&&hl.compare(r,e,t)){dl=new fl(r,e,t);hl=null;return"double"}hl=new fl(r,e,t);dl=null;return"single"}function ml(e){var t=this,r=t.display;if(mt(t,e)||r.activeTouch&&r.input.supportsTouch())return;r.input.ensurePolled();r.shift=e.shiftKey;if(qr(r,e)){if(!s){r.scroller.draggable=false;setTimeout(function(){return r.scroller.draggable=true},100)}return}if(Sl(t,e))return;var n=En(t,e),i=St(e),o=n?pl(n,i):"single";window.focus();1==i&&t.state.selectingText&&t.state.selectingText(e);if(n&&vl(t,i,n,o,e))return;if(1==i)n?xl(t,n,o,e):Ct(e)==r.scroller&&yt(e);else if(2==i){n&&Ho(t.doc,n);setTimeout(function(){return r.input.focus()},20)}else 3==i&&(C?Ll(t,e):Gn(t))}function vl(e,t,r,n,i){var o="Click";"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o);o=(1==t?"Left":2==t?"Middle":"Right")+o;return tl(e,Ba(o,i),i,function(t){"string"==typeof t&&(t=Xa[t]);if(!t)return false;var n=false;try{e.isReadOnly()&&(e.state.suppressEdits=true);n=t(e,r)!=q}finally{e.state.suppressEdits=false}return n})}function gl(e,t,r){var n=e.getOption("configureMouse");var i=n?n(e,t,r):{};if(null==i.unit){var o=y?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=x?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(x?r.altKey:r.ctrlKey));return i}function xl(e,t,r,n){a?setTimeout(P(qn,e),0):e.curOp.focus=W();var i=gl(e,r,n);var o=e.doc.sel,l;e.options.dragDrop&&Lt&&!e.isReadOnly()&&"single"==r&&(l=o.contains(t))>-1&&(xe((l=o.ranges[l]).from(),t)<0||t.xRel>0)&&(xe(l.to(),t)>0||t.xRel<0)?yl(e,n,t,i):wl(e,n,t,i)}function yl(e,t,r,n){var i=e.display,o=false;var u=Mi(e,function(t){s&&(i.scroller.draggable=false);e.state.draggingText=false;dt(i.wrapper.ownerDocument,"mouseup",u);dt(i.wrapper.ownerDocument,"mousemove",c);dt(i.scroller,"dragstart",f);dt(i.scroller,"drop",u);if(!o){yt(t);n.addNew||Ho(e.doc,r,null,null,n.extend);s||a&&9==l?setTimeout(function(){i.wrapper.ownerDocument.body.focus();i.input.focus()},20):i.input.focus()}});var c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10};var f=function(){return o=true};s&&(i.scroller.draggable=true);e.state.draggingText=u;u.copy=!n.moveOnDrag;i.scroller.dragDrop&&i.scroller.dragDrop();ft(i.wrapper.ownerDocument,"mouseup",u);ft(i.wrapper.ownerDocument,"mousemove",c);ft(i.scroller,"dragstart",f);ft(i.scroller,"drop",u);Gn(e);setTimeout(function(){return i.input.focus()},20)}function bl(e,t,r){if("char"==r)return new ro(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new ro(ge(t.line,0),Se(e.doc,ge(t.line+1,0)));var n=r(e,t);return new ro(n.from,n.to)}function wl(e,t,r,n){var i=e.display,o=e.doc;yt(t);var a,l,s=o.sel,u=s.ranges;if(n.addNew&&!n.extend){l=o.sel.contains(r);a=l>-1?u[l]:new ro(r,r)}else{a=o.sel.primary();l=o.sel.primIndex}if("rectangle"==n.unit){n.addNew||(a=new ro(r,r));r=En(e,t,true,true);l=-1}else{var c=bl(e,r,n.unit);a=n.extend?Wo(a,c.anchor,c.head,n.extend):c}if(n.addNew)if(-1==l){l=u.length;Ro(o,no(u.concat([a]),l),{scroll:false,origin:"*mouse"})}else if(u.length>1&&u[l].empty()&&"char"==n.unit&&!n.extend){Ro(o,no(u.slice(0,l).concat(u.slice(l+1)),0),{scroll:false,origin:"*mouse"});s=o.sel}else Fo(o,l,a,U);else{l=0;Ro(o,new to([a],0),U);s=o.sel}var f=r;function h(t){if(0==xe(f,t))return;f=t;if("rectangle"==n.unit){var i=[],u=e.options.tabSize;var c=z(ue(o,r.line).text,r.ch,u);var h=z(ue(o,t.line).text,t.ch,u);var d=Math.min(c,h),p=Math.max(c,h);for(var m=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));m<=v;m++){var g=ue(o,m).text,x=V(g,d,u);d==p?i.push(new ro(ge(m,x),ge(m,x))):g.length>x&&i.push(new ro(ge(m,x),ge(m,V(g,p,u))))}i.length||i.push(new ro(r,r));Ro(o,no(s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:false});e.scrollIntoView(t)}else{var y=a;var b=bl(e,t,n.unit);var w=y.anchor,k;if(xe(b.anchor,w)>0){k=b.head;w=ke(y.from(),b.anchor)}else{k=b.anchor;w=we(y.to(),b.head)}var C=s.ranges.slice(0);C[l]=kl(e,new ro(Se(o,w),k));Ro(o,no(C,l),U)}}var d=i.wrapper.getBoundingClientRect();var p=0;function m(t){var r=++p;var a=En(e,t,true,"rectangle"==n.unit);if(!a)return;if(0!=xe(a,f)){e.curOp.focus=W();h(a);var l=Xn(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(Mi(e,function(){p==r&&m(t)}),150)}else{var s=t.clientY<d.top?-20:t.clientY>d.bottom?20:0;s&&setTimeout(Mi(e,function(){if(p!=r)return;i.scroller.scrollTop+=s;m(t)}),50)}}function v(t){e.state.selectingText=false;p=Infinity;yt(t);i.input.focus();dt(i.wrapper.ownerDocument,"mousemove",g);dt(i.wrapper.ownerDocument,"mouseup",x);o.history.lastSelOrigin=null}var g=Mi(e,function(e){St(e)?m(e):v(e)});var x=Mi(e,v);e.state.selectingText=x;ft(i.wrapper.ownerDocument,"mousemove",g);ft(i.wrapper.ownerDocument,"mouseup",x)}function kl(e,t){var r=t.anchor;var n=t.head;var i=ue(e.doc,r.line);if(0==xe(r,n)&&r.sticky==n.sticky)return t;var o=ut(i);if(!o)return t;var a=lt(o,r.ch,r.sticky),l=o[a];if(l.from!=r.ch&&l.to!=r.ch)return t;var s=a+(l.from==r.ch==(1!=l.level)?0:1);if(0==s||s==o.length)return t;var u;if(n.line!=r.line)u=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=lt(o,n.ch,n.sticky);var f=c-a||(n.ch-r.ch)*(1==l.level?-1:1);u=c==s-1||c==s?f<0:f>0}var h=o[s+(u?-1:0)];var d=u==(1==h.level);var p=d?h.from:h.to,m=d?"after":"before";return r.ch==p&&r.sticky==m?t:new ro(new ge(r.line,p,m),n)}function Cl(e,t,r,n){var i,o;if(t.touches){i=t.touches[0].clientX;o=t.touches[0].clientY}else try{i=t.clientX;o=t.clientY}catch(t){return false}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return false;n&&yt(t);var a=e.display;var l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!gt(e,r))return wt(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var u=a.gutters.childNodes[s];if(u&&u.getBoundingClientRect().right>=i){var c=pe(e.doc,o);var f=e.options.gutters[s];pt(e,r,e,c,f,t);return wt(t)}}}function Sl(e,t){return Cl(e,t,"gutterClick",true)}function Ll(e,t){if(qr(e.display,t)||Tl(e,t))return;if(mt(e,t,"contextmenu"))return;e.display.input.onContextMenu(t)}function Tl(e,t){if(!gt(e,"gutterContextMenu"))return false;return Cl(e,t,"gutterContextMenu",false)}function Ml(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");cn(e)}var Nl={toString:function(){return"CodeMirror.Init"}};var Ol={};var Al={};function Dl(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n;i&&(t[r]=o?function(e,t,r){r!=Nl&&i(e,t,r)}:i)}e.defineOption=r;e.Init=Nl;r("value","",function(e,t){return e.setValue(t)},true);r("mode",null,function(e,t){e.doc.modeOption=t;co(e)},true);r("indentUnit",2,co,true);r("indentWithTabs",false);r("smartIndent",true);r("tabSize",4,function(e){fo(e);cn(e);Ai(e)},true);r("lineSeparator",null,function(e,t){e.doc.lineSep=t;if(!t)return;var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length;r.push(ge(n,o))}n++});for(var i=r.length-1;i>=0;i--)ta(e.doc,t,r[i],ge(r[i].line,r[i].ch+t.length))});r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");r!=Nl&&e.refresh()});r("specialCharPlaceholder",pr,function(e){return e.refresh()},true);r("electricChars",true);r("inputStyle",g?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);r("spellcheck",false,function(e,t){return e.getInputField().spellcheck=t},true);r("rtlMoveVisually",!b);r("wholeLineUpdateBefore",true);r("theme","default",function(e){Ml(e);Wl(e)},true);r("keyMap","default",function(e,t,r){var n=qa(t);var i=r!=Nl&&qa(r);i&&i.detach&&i.detach(e,n);n.attach&&n.attach(e,i||null)});r("extraKeys",null);r("configureMouse",null);r("lineWrapping",false,El,true);r("gutters",[],function(e){$i(e.options);Wl(e)},true);r("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?Dn(e.display)+"px":"0";e.refresh()},true);r("coverGutterNextToScrollbar",false,function(e){return di(e)},true);r("scrollbarStyle","native",function(e){vi(e);di(e);e.display.scrollbars.setScrollTop(e.doc.scrollTop);e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},true);r("lineNumbers",false,function(e){$i(e.options);Wl(e)},true);r("firstLineNumber",1,Wl,true);r("lineNumberFormatter",function(e){return e},Wl,true);r("showCursorWhenSelecting",false,Pn,true);r("resetSelectionOnContextMenu",true);r("lineWiseCopyCut",true);r("pasteLinesPerSelection",true);r("readOnly",false,function(e,t){if("nocursor"==t){Kn(e);e.display.input.blur()}e.display.input.readOnlyChanged(t)});r("disableInput",false,function(e,t){t||e.display.input.reset()},true);r("dragDrop",true,Hl);r("allowDropFileTypes",null);r("cursorBlinkRate",530);r("cursorScrollMargin",0);r("cursorHeight",1,Pn,true);r("singleCursorHeightPerLine",true,Pn,true);r("workTime",100);r("workDelay",100);r("flattenSpans",true,fo,true);r("addModeClass",false,fo,true);r("pollInterval",100);r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t});r("historyEventDelay",1250);r("viewportMargin",10,function(e){return e.refresh()},true);r("maxHighlightLength",1e4,fo,true);r("moveInputWithCursor",true,function(e,t){t||e.display.input.resetPosition()});r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""});r("autofocus",null);r("direction","ltr",function(e,t){return e.doc.setDirection(t)},true)}function Wl(e){Xi(e);Ai(e);$n(e)}function Hl(e,t,r){var n=r&&r!=Nl;if(!t!=!n){var i=e.display.dragFunctions;var o=t?ft:dt;o(e.display.scroller,"dragstart",i.start);o(e.display.scroller,"dragenter",i.enter);o(e.display.scroller,"dragover",i.over);o(e.display.scroller,"dragleave",i.leave);o(e.display.scroller,"drop",i.drop)}}function El(e){if(e.options.lineWrapping){H(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{L(e.display.wrapper,"CodeMirror-wrap");it(e)}Hn(e);Ai(e);cn(e);setTimeout(function(){return di(e)},100)}function Fl(e,t){var r=this;if(!(this instanceof Fl))return new Fl(e,t);this.options=t=t?I(t):{};I(Ol,t,false);$i(t);var n=t.value;"string"==typeof n&&(n=new ba(n,t.mode,null,t.lineSeparator,t.direction));this.doc=n;var i=new Fl.inputStyles[t.inputStyle](this);var o=this.display=new se(e,n,i);o.wrapper.CodeMirror=this;Xi(this);Ml(this);t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");vi(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,selectingText:false,draggingText:false,highlight:new R,keySeq:null,specialChars:null};t.autofocus&&!g&&o.input.focus();a&&l<11&&setTimeout(function(){return r.display.input.reset(true)},20);Pl(this);Na();xi(this);this.curOp.forceUpdate=true;vo(this,n);t.autofocus&&!g||this.hasFocus()?setTimeout(P(Un,this),20):Kn(this);for(var u in Al)Al.hasOwnProperty(u)&&Al[u](r,t[u],Nl);Yn(this);t.finishInit&&t.finishInit(this);for(var c=0;c<Il.length;++c)Il[c](r);yi(this);s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Fl.defaults=Ol;Fl.optionHandlers=Al;function Pl(e){var t=e.display;ft(t.scroller,"mousedown",Mi(e,ml));ft(t.scroller,"dblclick",a&&l<11?Mi(e,function(t){if(mt(e,t))return;var r=En(e,t);if(!r||Sl(e,t)||qr(e.display,t))return;yt(t);var n=e.findWordAt(r);Ho(e.doc,n.anchor,n.head)}):function(t){return mt(e,t)||yt(t)});C||ft(t.scroller,"contextmenu",function(t){return Ll(e,t)});var r,n={end:0};function i(){if(t.activeTouch){r=setTimeout(function(){return t.activeTouch=null},1e3);n=t.activeTouch;n.end=+new Date}}function o(e){if(1!=e.touches.length)return false;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return true;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}ft(t.scroller,"touchstart",function(i){if(!mt(e,i)&&!o(i)&&!Sl(e,i)){t.input.ensurePolled();clearTimeout(r);var a=+new Date;t.activeTouch={start:a,moved:false,prev:a-n.end<=300?n:null};if(1==i.touches.length){t.activeTouch.left=i.touches[0].pageX;t.activeTouch.top=i.touches[0].pageY}}});ft(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=true)});ft(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!qr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var o=e.coordsChar(t.activeTouch,"page"),a;a=!n.prev||s(n,n.prev)?new ro(o,o):!n.prev.prev||s(n,n.prev.prev)?e.findWordAt(o):new ro(ge(o.line,0),Se(e.doc,ge(o.line+1,0)));e.setSelection(a.anchor,a.head);e.focus();yt(r)}i()});ft(t.scroller,"touchcancel",i);ft(t.scroller,"scroll",function(){if(t.scroller.clientHeight){li(e,t.scroller.scrollTop);ui(e,t.scroller.scrollLeft,true);pt(e,"scroll",e)}});ft(t.scroller,"mousewheel",function(t){return eo(e,t)});ft(t.scroller,"DOMMouseScroll",function(t){return eo(e,t)});ft(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0});t.dragFunctions={enter:function(t){mt(e,t)||kt(t)},over:function(t){if(!mt(e,t)){Sa(e,t);kt(t)}},start:function(t){return Ca(e,t)},drop:Mi(e,ka),leave:function(t){mt(e,t)||La(e)}};var u=t.input.getField();ft(u,"keyup",function(t){return sl.call(e,t)});ft(u,"keydown",Mi(e,al));ft(u,"keypress",Mi(e,ul));ft(u,"focus",function(t){return Un(e,t)});ft(u,"blur",function(t){return Kn(e,t)})}var Il=[];Fl.defineInitHook=function(e){return Il.push(e)};function zl(e,t,r,n){var i=e.doc,o;null==r&&(r="add");"smart"==r&&(i.mode.indent?o=Jt(e,t).state:r="prev");var a=e.options.tabSize;var l=ue(i,t),s=z(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u=l.text.match(/^\s*/)[0],c;if(n||/\S/.test(l.text)){if("smart"==r){c=i.mode.indent(o,l.text.slice(u.length),l.text);if(c==q||c>150){if(!n)return;r="prev"}}}else{c=0;r="not"}"prev"==r?c=t>i.first?z(ue(i,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r);c=Math.max(0,c);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/a);d;--d){h+=a;f+="\t"}h<c&&(f+=X(c-h));if(f!=u){ta(i,f,ge(t,0),ge(t,u.length),"+input");l.stateAfter=null;return true}for(var p=0;p<i.sel.ranges.length;p++){var m=i.sel.ranges[p];if(m.head.line==t&&m.head.ch<u.length){var v=ge(t,u.length);Fo(i,p,new ro(v,v));break}}}var Rl=null;function Bl(e){Rl=e}function jl(e,t,r,n,i){var o=e.doc;e.display.shift=false;n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i;var l=At(t),s=null;if(a&&n.ranges.length>1)if(Rl&&Rl.text.join("\n")==t){if(n.ranges.length%Rl.text.length==0){s=[];for(var u=0;u<Rl.text.length;u++)s.push(o.splitLines(Rl.text[u]))}}else l.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(s=Y(l,function(e){return[e]}));var c;for(var f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f];var d=h.from(),p=h.to();h.empty()&&(r&&r>0?d=ge(d.line,d.ch-r):e.state.overwrite&&!a?p=ge(p.line,Math.min(ue(o,p.line).text.length,p.ch+$(l).length)):Rl&&Rl.lineWise&&Rl.text.join("\n")==t&&(d=p=ge(d.line,0)));c=e.curOp.updateInput;var m={from:d,to:p,text:s?s[f%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};$o(e.doc,m);Mr(e,"inputRead",e,m)}t&&!a&&Gl(e,t);ri(e);e.curOp.updateInput=c;e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=false}function ql(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r){e.preventDefault();t.isReadOnly()||t.options.disableInput||Ti(t,function(){return jl(t,r,0,null,"paste")});return true}}function Gl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;var r=e.doc.sel;for(var n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)continue;var o=e.getModeAt(i.head);var a=false;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=zl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ue(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=zl(e,i.head.line,"smart"));a&&Mr(e,"electricInput",e,i.head.line)}}function Ul(e){var t=[],r=[];for(var n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line;var o={anchor:ge(i,0),head:ge(i+1,0)};r.push(o);t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Kl(e,t){e.setAttribute("autocorrect","off");e.setAttribute("autocapitalize","off");e.setAttribute("spellcheck",!!t)}function Vl(){var e=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");var t=N("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");s?e.style.width="1000px":e.setAttribute("wrap","off");m&&(e.style.border="1px solid black");Kl(e);return t}var _l=function(e){var t=e.optionHandlers;var r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus();this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];if(n[e]==r&&"mode"!=e)return;n[e]=r;t.hasOwnProperty(e)&&Mi(this,t[e])(this,r,i);pt(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"](qa(e))},removeKeyMap:function(e){var t=this.state.keyMaps;for(var r=0;r<t.length;++r)if(t[r]==e||t[r].name==e){t.splice(r,1);return true}},addOverlay:Ni(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");J(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},function(e){return e.priority});this.state.modeGen++;Ai(this)}),removeOverlay:Ni(function(e){var t=this;var r=this.state.overlays;for(var n=0;n<r.length;++n){var i=r[n].modeSpec;if(i==e||"string"==typeof e&&i.name==e){r.splice(n,1);t.state.modeGen++;Ai(t);return}}}),indentLine:Ni(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract");me(this.doc,e)&&zl(this,e,t,r)}),indentSelection:Ni(function(e){var t=this;var r=this.doc.sel.ranges,n=-1;for(var i=0;i<r.length;i++){var o=r[i];if(o.empty()){if(o.head.line>n){zl(t,o.head.line,e,true);n=o.head.line;i==t.doc.sel.primIndex&&ri(t)}}else{var a=o.from(),l=o.to();var s=Math.max(n,a.line);n=Math.min(t.lastLine(),l.line-(l.ch?0:1))+1;for(var u=s;u<n;++u)zl(t,u,e);var c=t.doc.sel.ranges;0==a.ch&&r.length==c.length&&c[i].from().ch>0&&Fo(t.doc,i,new ro(a,c[i].to()),G)}}}),getTokenAt:function(e,t){return rr(this,e,t)},getLineTokens:function(e,t){return rr(this,ge(e),t,true)},getTokenTypeAt:function(e){e=Se(this.doc,e);var t=Yt(this,ue(this.doc,e.line));var r=0,n=(t.length-1)/2,i=e.ch;var o;if(0==i)o=t[2];else for(;;){var a=r+n>>1;if((a?t[2*a-1]:0)>=i)n=a;else{if(!(t[2*a+1]<i)){o=t[2*a+2];break}r=a+1}}var l=o?o.indexOf("overlay "):-1;return l<0?o:0==l?null:o.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;if(!r.innerMode)return r;return e.innerMode(r,this.getTokenAt(t).state).mode},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=this;var i=[];if(!r.hasOwnProperty(t))return i;var o=r[t],a=this.getModeAt(e);if("string"==typeof a[t])o[a[t]]&&i.push(o[a[t]]);else if(a[t])for(var l=0;l<a[t].length;l++){var s=o[a[t][l]];s&&i.push(s)}else a.helperType&&o[a.helperType]?i.push(o[a.helperType]):o[a.name]&&i.push(o[a.name]);for(var u=0;u<o._global.length;u++){var c=o._global[u];c.pred(a,n)&&-1==B(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(e,t){var r=this.doc;e=Ce(r,null==e?r.first+r.size-1:e);return Jt(this,e+1,t).state},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();r=null==e?n.head:"object"==typeof e?Se(this.doc,e):e?n.from():n.to();return gn(this,r,t||"page")},charCoords:function(e,t){return vn(this,Se(this.doc,e),t||"page")},coordsChar:function(e,t){e=mn(this,e,t||"page");return bn(this,e.left,e.top)},lineAtHeight:function(e,t){e=mn(this,{top:e,left:0},t||"page").top;return pe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n=false,i;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;if(e<this.doc.first)e=this.doc.first;else if(e>o){e=o;n=true}i=ue(this.doc,e)}else i=e;return pn(this,i,{top:0,left:0},t||"page",r||n).top+(n?this.doc.height-rt(i):0)},defaultTextHeight:function(){return Nn(this.display)},defaultCharWidth:function(){return On(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=gn(this,Se(this.doc,e));var a=e.bottom,l=e.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);o.sizer.appendChild(t);if("over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom);l+t.offsetWidth>u&&(l=u-t.offsetWidth)}t.style.top=a+"px";t.style.left=t.style.right="";if("right"==i){l=o.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{"left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2);t.style.left=l+"px"}r&&Qn(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Ni(al),triggerOnKeyPress:Ni(ul),triggerOnKeyUp:sl,triggerOnMouseDown:Ni(ml),execCommand:function(e){if(Xa.hasOwnProperty(e))return Xa[e].call(null,this)},triggerElectric:Ni(function(e){Gl(this,e)}),findPosH:function(e,t,r,n){var i=this;var o=1;if(t<0){o=-1;t=-t}var a=Se(this.doc,e);for(var l=0;l<t;++l){a=Xl(i.doc,a,o,r,n);if(a.hitSide)break}return a},moveH:Ni(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Xl(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},K)}),deleteH:Ni(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Ga(this,function(r){var i=Xl(n,r.head,e,t,false);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=this;var o=1,a=n;if(t<0){o=-1;t=-t}var l=Se(this.doc,e);for(var s=0;s<t;++s){var u=gn(i,l,"div");null==a?a=u.left:u.left=a;l=$l(i,u,o,r);if(l.hitSide)break}return l},moveV:Ni(function(e,t){var r=this;var n=this.doc,i=[];var o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();n.extendSelectionsBy(function(a){if(o)return e<0?a.from():a.to();var l=gn(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn);i.push(l.left);var s=$l(r,l,e,t);"page"==t&&a==n.sel.primary()&&ti(r,vn(r,s,"div").top-l.top);return s},K);if(i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,r=ue(t,e.line).text;var n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=r.length||!n?++i:--n;var a=r.charAt(n);var l=re(a,o)?function(e){return re(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!re(e)};while(n>0&&l(r.charAt(n-1)))--n;while(i<r.length&&l(r.charAt(i)))++i}return new ro(ge(e.line,n),ge(e.line,i))},toggleOverwrite:function(e){if(null!=e&&e==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite");pt(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==W()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ni(function(e,t){ni(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Vr(this)-this.display.barHeight,width:e.scrollWidth-Vr(this)-this.display.barWidth,clientHeight:Xr(this),clientWidth:_r(this)}},scrollIntoView:Ni(function(e,t){if(null==e){e={from:this.doc.sel.primary().head,to:null};null==t&&(t=this.options.cursorScrollMargin)}else"number"==typeof e?e={from:ge(e,0),to:null}:null==e.from&&(e={from:e,to:null});e.to||(e.to=e.from);e.margin=t||0;null!=e.from.line?ii(this,e):ai(this,e.from,e.to,e.margin)}),setSize:Ni(function(e,t){var r=this;var n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e));null!=t&&(this.display.wrapper.style.height=n(t));this.options.lineWrapping&&un(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Di(r,i,"widget");break}++i});this.curOp.forceUpdate=true;pt(this,"refresh",this)}),operation:function(e){return Ti(this,e)},startOperation:function(){return xi(this)},endOperation:function(){return yi(this)},refresh:Ni(function(){var e=this.display.cachedTextHeight;Ai(this);this.curOp.forceUpdate=true;cn(this);ni(this,this.doc.scrollLeft,this.doc.scrollTop);Vi(this);(null==e||Math.abs(e-Nn(this.display))>.5)&&Hn(this);pt(this,"refresh",this)}),swapDoc:Ni(function(e){var t=this.doc;t.cm=null;vo(this,e);cn(this);this.display.input.reset();ni(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;Mr(this,"swapDoc",this,t);return t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};xt(e);e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]});r[t][n]=i};e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o);r[t]._global.push({pred:i,val:o})}};function Xl(e,t,r,n,i){var o=t;var a=r;var l=ue(e,t.line);function s(){var n=t.line+r;if(n<e.first||n>=e.first+e.size)return false;t=new ge(n,t.ch,t.sticky);return l=ue(e,n)}function u(n){var o;o=i?_a(e.cm,l,t,r):Ka(l,t,r);if(null==o){if(n||!s())return false;t=Va(i,e.cm,l,t.line,r)}else t=o;return true}if("char"==n)u();else if("column"==n)u(true);else if("word"==n||"group"==n){var c=null,f="group"==n;var h=e.cm&&e.cm.getHelper(t,"wordChars");for(var d=true;;d=false){if(r<0&&!u(!d))break;var p=l.text.charAt(t.ch)||"\n";var m=re(p,h)?"w":f&&"\n"==p?"n":!f||/\s/.test(p)?null:"p";!f||d||m||(m="s");if(c&&c!=m){if(r<0){r=1;u();t.sticky="after"}break}m&&(c=m);if(r>0&&!u(!d))break}}var v=Ko(e,t,o,a,true);ye(o,v)&&(v.hitSide=true);return v}function $l(e,t,r,n){var i=e.doc,o=t.left,a;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var s=Math.max(l-.5*Nn(e.display),3);a=(r>0?t.bottom:t.top)+r*s}else"line"==n&&(a=r>0?t.bottom+3:t.top-3);var u;for(;;){u=bn(e,o,a);if(!u.outside)break;if(r<0?a<=0:a>=i.height){u.hitSide=true;break}a+=5*r}return u}var Yl=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new R;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};Yl.prototype.init=function(e){var t=this;var r=this,n=r.cm;var i=r.div=e.lineDiv;Kl(i,n.options.spellcheck);ft(i,"paste",function(e){if(mt(n,e)||ql(e,n))return;l<=11&&setTimeout(Mi(n,function(){return t.updateFromDOM()}),20)});ft(i,"compositionstart",function(e){t.composing={data:e.data,done:false}});ft(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:false})});ft(i,"compositionend",function(e){if(t.composing){e.data!=t.composing.data&&t.readFromDOMSoon();t.composing.done=true}});ft(i,"touchstart",function(){return r.forceCompositionEnd()});ft(i,"input",function(){t.composing||t.readFromDOMSoon()});function o(e){if(mt(n,e))return;if(n.somethingSelected()){Bl({lineWise:false,text:n.getSelections()});"cut"==e.type&&n.replaceSelection("",null,"cut")}else{if(!n.options.lineWiseCopyCut)return;var t=Ul(n);Bl({lineWise:true,text:t.text});"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,G);n.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var o=Rl.text.join("\n");e.clipboardData.setData("Text",o);if(e.clipboardData.getData("Text")==o){e.preventDefault();return}}var a=Vl(),l=a.firstChild;n.display.lineSpace.insertBefore(a,n.display.lineSpace.firstChild);l.value=Rl.text.join("\n");var s=document.activeElement;F(l);setTimeout(function(){n.display.lineSpace.removeChild(a);s.focus();s==i&&r.showPrimarySelection()},50)}ft(i,"copy",o);ft(i,"cut",o)};Yl.prototype.prepareSelection=function(){var e=In(this.cm,false);e.focus=this.cm.state.focused;return e};Yl.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection();this.showMultipleSelections(e)};Yl.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary();var i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom){e.removeAllRanges();return}var a=ts(t,e.anchorNode,e.anchorOffset);var l=ts(t,e.focusNode,e.focusOffset);if(a&&!a.bad&&l&&!l.bad&&0==xe(ke(a,l),i)&&0==xe(we(a,l),o))return;var s=t.display.view;var u=i.line>=t.display.viewFrom&&Jl(t,i)||{node:s[0].measure.map[2],offset:0};var c=o.line<t.display.viewTo&&Jl(t,o);if(!c){var f=s[s.length-1].measure;var h=f.maps?f.maps[f.maps.length-1]:f.map;c={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(!u||!c){e.removeAllRanges();return}var d=e.rangeCount&&e.getRangeAt(0),p;try{p=A(u.node,u.offset,c.offset,c.node)}catch(e){}if(p){if(!r&&t.state.focused){e.collapse(u.node,u.offset);if(!p.collapsed){e.removeAllRanges();e.addRange(p)}}else{e.removeAllRanges();e.addRange(p)}d&&null==e.anchorNode?e.addRange(d):r&&this.startGracePeriod()}this.rememberSelection()};Yl.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){e.gracePeriod=false;e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=true})},20)};Yl.prototype.showMultipleSelections=function(e){M(this.cm.display.cursorDiv,e.cursors);M(this.cm.display.selectionDiv,e.selection)};Yl.prototype.rememberSelection=function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode;this.lastAnchorOffset=e.anchorOffset;this.lastFocusNode=e.focusNode;this.lastFocusOffset=e.focusOffset};Yl.prototype.selectionInEditor=function(){var e=window.getSelection();if(!e.rangeCount)return false;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)};Yl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly){this.selectionInEditor()||this.showSelection(this.prepareSelection(),true);this.div.focus()}};Yl.prototype.blur=function(){this.div.blur()};Yl.prototype.getField=function(){return this.div};Yl.prototype.supportsTouch=function(){return true};Yl.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ti(this.cm,function(){return e.cm.curOp.selectionChanged=true});function t(){if(e.cm.state.focused){e.pollSelection();e.polling.set(e.cm.options.pollInterval,t)}}this.polling.set(this.cm.options.pollInterval,t)};Yl.prototype.selectionChanged=function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset};Yl.prototype.pollSelection=function(){if(null!=this.readDOMTimeout||this.gracePeriod||!this.selectionChanged())return;var e=window.getSelection(),t=this.cm;if(v&&c&&this.cm.options.gutters.length&&Zl(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs});this.blur();this.focus();return}if(this.composing)return;this.rememberSelection();var r=ts(t,e.anchorNode,e.anchorOffset);var n=ts(t,e.focusNode,e.focusOffset);r&&n&&Ti(t,function(){Ro(t.doc,io(r,n),G);(r.bad||n.bad)&&(t.curOp.selectionChanged=true)})};Yl.prototype.pollContent=function(){if(null!=this.readDOMTimeout){clearTimeout(this.readDOMTimeout);this.readDOMTimeout=null}var e=this.cm,t=e.display,r=e.doc.sel.primary();var n=r.from(),i=r.to();0==n.ch&&n.line>e.firstLine()&&(n=ge(n.line-1,ue(e.doc,n.line-1).length));i.ch==ue(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=ge(i.line+1,0));if(n.line<t.viewFrom||i.line>t.viewTo-1)return false;var o,a,l;if(n.line==t.viewFrom||0==(o=Fn(e,n.line))){a=de(t.view[0].line);l=t.view[0].node}else{a=de(t.view[o].line);l=t.view[o-1].node.nextSibling}var s=Fn(e,i.line);var u,c;if(s==t.view.length-1){u=t.viewTo-1;c=t.lineDiv.lastChild}else{u=de(t.view[s+1].line)-1;c=t.view[s+1].node.previousSibling}if(!l)return false;var f=e.doc.splitLines(es(e,l,c,a,u));var h=ce(e.doc,ge(a,0),ge(u,ue(e.doc,u).text.length));while(f.length>1&&h.length>1)if($(f)==$(h)){f.pop();h.pop();u--}else{if(f[0]!=h[0])break;f.shift();h.shift();a++}var d=0,p=0;var m=f[0],v=h[0],g=Math.min(m.length,v.length);while(d<g&&m.charCodeAt(d)==v.charCodeAt(d))++d;var x=$(f),y=$(h);var b=Math.min(x.length-(1==f.length?d:0),y.length-(1==h.length?d:0));while(p<b&&x.charCodeAt(x.length-p-1)==y.charCodeAt(y.length-p-1))++p;if(1==f.length&&1==h.length&&a==n.line)while(d&&d>n.ch&&x.charCodeAt(x.length-p-1)==y.charCodeAt(y.length-p-1)){d--;p++}f[f.length-1]=x.slice(0,x.length-p).replace(/^\u200b+/,"");f[0]=f[0].slice(d).replace(/\u200b+$/,"");var w=ge(a,d);var k=ge(u,h.length?$(h).length-p:0);if(f.length>1||f[0]||xe(w,k)){ta(e.doc,f,w,k,"+input");return true}};Yl.prototype.ensurePolled=function(){this.forceCompositionEnd()};Yl.prototype.reset=function(){this.forceCompositionEnd()};Yl.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()};Yl.prototype.readFromDOMSoon=function(){var e=this;if(null!=this.readDOMTimeout)return;this.readDOMTimeout=setTimeout(function(){e.readDOMTimeout=null;if(e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80)};Yl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Ti(this.cm,function(){return Ai(e.cm)})};Yl.prototype.setUneditable=function(e){e.contentEditable="false"};Yl.prototype.onKeyPress=function(e){if(0==e.charCode||this.composing)return;e.preventDefault();this.cm.isReadOnly()||Mi(this.cm,jl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)};Yl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)};Yl.prototype.onContextMenu=function(){};Yl.prototype.resetPosition=function(){};Yl.prototype.needsContentAttribute=true;function Jl(e,t){var r=Qr(e,t.line);if(!r||r.hidden)return null;var n=ue(e.doc,t.line);var i=Yr(r,n,t.line);var o=ut(n,e.doc.direction),a="left";if(o){var l=lt(o,t.ch);a=l%2?"right":"left"}var s=nn(i.map,t.ch,a);s.offset="right"==s.collapse?s.end:s.start;return s}function Zl(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return true;return false}function Ql(e,t){t&&(e.bad=true);return e}function es(e,t,r,n,i){var o="",a=false,l=e.doc.lineSeparator();function s(e){return function(t){return t.id==e}}function u(){if(a){o+=l;a=false}}function c(e){if(e){u();o+=e}}function f(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r){c(r||t.textContent.replace(/\u200b/g,""));return}var o=t.getAttribute("cm-marker"),h;if(o){var d=e.findMarks(ge(n,0),ge(i+1,0),s(+o));d.length&&(h=d[0].find(0))&&c(ce(e.doc,h.from,h.to).join(l));return}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p)$/i.test(t.nodeName);p&&u();for(var m=0;m<t.childNodes.length;m++)f(t.childNodes[m]);p&&(a=true)}else 3==t.nodeType&&c(t.nodeValue)}for(;;){f(t);if(t==r)break;t=t.nextSibling}return o}function ts(e,t,r){var n;if(t==e.display.lineDiv){n=e.display.lineDiv.childNodes[r];if(!n)return Ql(e.clipPos(ge(e.display.viewTo-1)),true);t=null;r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return rs(o,t,r)}}function rs(e,t,r){var n=e.text.firstChild,i=false;if(!t||!D(n,t))return Ql(ge(de(e.line),0),true);if(t==n){i=true;t=n.childNodes[r];r=0;if(!t){var o=e.rest?$(e.rest):e.line;return Ql(ge(de(o),o.text.length),i)}}var a=3==t.nodeType?t:null,l=t;if(!a&&1==t.childNodes.length&&3==t.firstChild.nodeType){a=t.firstChild;r&&(r=a.nodeValue.length)}while(l.parentNode!=n)l=l.parentNode;var s=e.measure,u=s.maps;function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++){var o=i<0?s.map:u[i];for(var a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var c=de(i<0?e.line:e.rest[i]);var f=o[a]+n;(n<0||l!=t)&&(f=o[a+(n?1:0)]);return ge(c,f)}}}}var f=c(a,l,r);if(f)return Ql(f,i);for(var h=l.nextSibling,d=a?a.nodeValue.length-r:0;h;h=h.nextSibling){f=c(h,h.firstChild,0);if(f)return Ql(ge(f.line,f.ch-d),i);d+=h.textContent.length}for(var p=l.previousSibling,m=r;p;p=p.previousSibling){f=c(p,p.firstChild,-1);if(f)return Ql(ge(f.line,f.ch+m),i);m+=p.textContent.length}}var ns=function(e){this.cm=e;this.prevInput="";this.pollingFast=false;this.polling=new R;this.hasSelection=false;this.composing=null};ns.prototype.init=function(e){var t=this;var r=this,n=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild);m&&(i.style.width="0px");ft(i,"input",function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null);r.poll()});ft(i,"paste",function(e){if(mt(n,e)||ql(e,n))return;n.state.pasteIncoming=true;r.fastPoll()});function o(e){if(mt(n,e))return;if(n.somethingSelected())Bl({lineWise:false,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Ul(n);Bl({lineWise:true,text:t.text});if("cut"==e.type)n.setSelections(t.ranges,null,G);else{r.prevInput="";i.value=t.text.join("\n");F(i)}}"cut"==e.type&&(n.state.cutIncoming=true)}ft(i,"cut",o);ft(i,"copy",o);ft(e.scroller,"paste",function(t){if(qr(e,t)||mt(n,t))return;n.state.pasteIncoming=true;r.focus()});ft(e.lineSpace,"selectstart",function(t){qr(e,t)||yt(t)});ft(i,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear();r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}});ft(i,"compositionend",function(){if(r.composing){r.poll();r.composing.range.clear();r.composing=null}})};ns.prototype.createField=function(e){this.wrapper=Vl();this.textarea=this.wrapper.firstChild};ns.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc;var n=In(e);if(e.options.moveInputWithCursor){var i=gn(e,r.sel.primary().head,"div");var o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top));n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n};ns.prototype.showSelection=function(e){var t=this.cm,r=t.display;M(r.cursorDiv,e.cursors);M(r.selectionDiv,e.selection);if(null!=e.teTop){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}};ns.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r;t.state.focused&&F(this.textarea);a&&l>=9&&(this.hasSelection=r)}else if(!e){this.prevInput=this.textarea.value="";a&&l>=9&&(this.hasSelection=null)}};ns.prototype.getField=function(){return this.textarea};ns.prototype.supportsTouch=function(){return false};ns.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||W()!=this.textarea))try{this.textarea.focus()}catch(e){}};ns.prototype.blur=function(){this.textarea.blur()};ns.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ns.prototype.receivedFocus=function(){this.slowPoll()};ns.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll();e.cm.state.focused&&e.slowPoll()})};ns.prototype.fastPoll=function(){var e=false,t=this;t.pollingFast=true;function r(){var n=t.poll();if(n||e){t.pollingFast=false;t.slowPoll()}else{e=true;t.polling.set(60,r)}}t.polling.set(20,r)};ns.prototype.poll=function(){var e=this;var t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Dt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return false;var i=r.value;if(i==n&&!t.somethingSelected())return false;if(a&&l>=9&&this.hasSelection===i||x&&/[\uf700-\uf7ff]/.test(i)){t.display.input.reset();return false}if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);8203!=o||n||(n="");if(8666==o){this.reset();return this.cm.execCommand("undo")}}var s=0,u=Math.min(n.length,i.length);while(s<u&&n.charCodeAt(s)==i.charCodeAt(s))++s;Ti(t,function(){jl(t,i.slice(s),n.length-s,null,e.composing?"*compose":null);i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i;if(e.composing){e.composing.range.clear();e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"})}});return true};ns.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=false)};ns.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null);this.fastPoll()};ns.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;var o=En(r,e),u=n.scroller.scrollTop;if(!o||f)return;var c=r.options.resetSelectionOnContextMenu;c&&-1==r.doc.sel.contains(o)&&Mi(r,Ro)(r.doc,io(o),G);var h=i.style.cssText,d=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var p=t.wrapper.getBoundingClientRect();i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var m;s&&(m=window.scrollY);n.input.focus();s&&window.scrollTo(null,m);n.input.reset();r.somethingSelected()||(i.value=t.prevInput=" ");t.contextMenuPending=true;n.selForContextMenu=r.doc.sel;clearTimeout(n.detectingSelectAll);function v(){if(null!=i.selectionStart){var e=r.somethingSelected();var o=""+(e?i.value:"");i.value="⇚";i.value=o;t.prevInput=e?"":"";i.selectionStart=1;i.selectionEnd=o.length;n.selForContextMenu=r.doc.sel}}function g(){t.contextMenuPending=false;t.wrapper.style.cssText=d;i.style.cssText=h;a&&l<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u);if(null!=i.selectionStart){(!a||a&&l<9)&&v();var e=0,o=function(){if(n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput)Mi(r,_o)(r);else if(e++<10)n.detectingSelectAll=setTimeout(o,500);else{n.selForContextMenu=null;n.input.reset()}};n.detectingSelectAll=setTimeout(o,200)}}a&&l>=9&&v();if(C){kt(e);var x=function(){dt(window,"mouseup",x);setTimeout(g,20)};ft(window,"mouseup",x)}else setTimeout(g,50)};ns.prototype.readOnlyChanged=function(e){e||this.reset();this.textarea.disabled="nocursor"==e};ns.prototype.setUneditable=function(){};ns.prototype.needsContentAttribute=false;function is(e,t){t=t?I(t):{};t.value=e.value;!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex);!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder);if(null==t.autofocus){var r=W();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=l.getValue()}var i;if(e.form){ft(e.form,"submit",n);if(!t.leaveSubmitMethodAlone){var o=e.form;i=o.submit;try{var a=o.submit=function(){n();o.submit=i;o.submit();o.submit=a}}catch(e){}}}t.finishInit=function(t){t.save=n;t.getTextArea=function(){return e};t.toTextArea=function(){t.toTextArea=isNaN;n();e.parentNode.removeChild(t.getWrapperElement());e.style.display="";if(e.form){dt(e.form,"submit",n);"function"==typeof e.form.submit&&(e.form.submit=i)}}};e.style.display="none";var l=Fl(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return l}function os(e){e.off=dt;e.on=ft;e.wheelEventPixels=Qi;e.Doc=ba;e.splitLines=At;e.countColumn=z;e.findColumn=V;e.isWordChar=te;e.Pass=q;e.signal=pt;e.Line=lr;e.changeEnd=oo;e.scrollbarModel=mi;e.Pos=ge;e.cmpPos=xe;e.modes=Ft;e.mimeModes=Pt;e.resolveMode=Rt;e.getMode=Bt;e.modeExtensions=jt;e.extendMode=qt;e.copyState=Gt;e.startState=Kt;e.innerMode=Ut;e.commands=Xa;e.keyMap=Fa;e.keyName=ja;e.isModifierKey=Ra;e.lookupKey=za;e.normalizeKeyMap=Ia;e.StringStream=Vt;e.SharedTextMarker=pa;e.TextMarker=ha;e.LineWidget=sa;e.e_preventDefault=yt;e.e_stopPropagation=bt;e.e_stop=kt;e.addClass=H;e.contains=D;e.rmClass=L;e.keyNames=Da}Dl(Fl);_l(Fl);var as="iter insert remove copy getEditor constructor".split(" ");for(var ls in ba.prototype)ba.prototype.hasOwnProperty(ls)&&B(as,ls)<0&&(Fl.prototype[ls]=function(e){return function(){return e.apply(this.doc,arguments)}}(ba.prototype[ls]));xt(ba);Fl.inputStyles={textarea:ns,contenteditable:Yl};Fl.defineMode=function(e){Fl.defaults.mode||"null"==e||(Fl.defaults.mode=e);It.apply(this,arguments)};Fl.defineMIME=zt;Fl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}});Fl.defineMIME("text/plain","null");Fl.defineExtension=function(e,t){Fl.prototype[e]=t};Fl.defineDocExtension=function(e,t){ba.prototype[e]=t};Fl.fromTextArea=is;os(Fl);Fl.version="5.37.0";return Fl})},370:function(e,t,r){(function(e){true;e(r(282),r(371),r(372))})(function(e){"use strict";e.defineMode("markdown",function(t,r){var n=e.getMode(t,"text/html");var i="null"==n.name;function o(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}void 0===r.highlightFormatting&&(r.highlightFormatting=false);void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0);void 0===r.taskLists&&(r.taskLists=false);void 0===r.strikethrough&&(r.strikethrough=false);void 0===r.emoji&&(r.emoji=false);void 0===r.fencedCodeBlockHighlighting&&(r.fencedCodeBlockHighlighting=true);void 0===r.xml&&(r.xml=true);void 0===r.tokenTypeOverrides&&(r.tokenTypeOverrides={});var a={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var l in a)a.hasOwnProperty(l)&&r.tokenTypeOverrides[l]&&(a[l]=r.tokenTypeOverrides[l]);var s=/^([*\-_])(?:\s*\1){2,}\s*$/,u=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,f=r.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,h=/^ *(?:\={1,}|-{1,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,p=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,m=/^\s*\[[^\]]+?\]:.*$/,v=/[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~—]/,g=" ";function x(e,t,r){t.f=t.inline=r;return r(e,t)}function y(e,t,r){t.f=t.block=r;return r(e,t)}function b(e){return!e||!/\S/.test(e.string)}function w(e){e.linkTitle=false;e.linkHref=false;e.linkText=false;e.em=false;e.strong=false;e.strikethrough=false;e.quote=0;e.indentedCode=false;if(e.f==C){e.f=M;e.block=k}e.trailingSpace=0;e.trailingSpaceNewLine=false;e.prevLine=e.thisLine;e.thisLine={stream:null};return null}function k(t,n){var i=t.column()===n.indentation;var l=b(n.prevLine.stream);var d=n.indentedCode;var v=n.prevLine.hr;var g=false!==n.list;var y=(n.listStack[n.listStack.length-1]||0)+3;n.indentedCode=false;var w=n.indentation;if(null===n.indentationDiff){n.indentationDiff=n.indentation;if(g){n.em=false;n.strong=false;n.code=false;n.strikethrough=false;n.list=null;while(w<n.listStack[n.listStack.length-1]){n.listStack.pop();n.listStack.length?n.indentation=n.listStack[n.listStack.length-1]:n.list=false}false!==n.list&&(n.indentationDiff=w-n.listStack[n.listStack.length-1])}}var k=!l&&!v&&!n.prevLine.header&&(!g||!d)&&!n.prevLine.fencedCodeEnd;var C=(false===n.list||v||l)&&n.indentation<=y&&t.match(s);var T=null;if(n.indentationDiff>=4&&(d||n.prevLine.fencedCodeEnd||n.prevLine.header||l)){t.skipToEnd();n.indentedCode=true;return a.code}if(t.eatSpace())return null;if(i&&n.indentation<=y&&(T=t.match(f))&&T[1].length<=6){n.quote=0;n.header=T[1].length;n.thisLine.header=true;r.highlightFormatting&&(n.formatting="header");n.f=n.inline;return L(n)}if(n.indentation<=y&&t.eat(">")){n.quote=i?1:n.quote+1;r.highlightFormatting&&(n.formatting="quote");t.eatSpace();return L(n)}if(!C&&!n.setext&&i&&n.indentation<=y&&(T=t.match(u))){var M=T[1]?"ol":"ul";n.indentation=w+t.current().length;n.list=true;n.quote=0;n.listStack.push(n.indentation);r.taskLists&&t.match(c,false)&&(n.taskList=true);n.f=n.inline;r.highlightFormatting&&(n.formatting=["list","list-"+M]);return L(n)}if(i&&n.indentation<=y&&(T=t.match(p,true))){n.quote=0;n.fencedEndRE=new RegExp(T[1]+"+ *$");n.localMode=r.fencedCodeBlockHighlighting&&o(T[2]);n.localMode&&(n.localState=e.startState(n.localMode));n.f=n.block=S;r.highlightFormatting&&(n.formatting="code-block");n.code=-1;return L(n)}if(n.setext||!(k&&g||n.quote||false!==n.list||n.code||C||m.test(t.string))&&(T=t.lookAhead(1))&&(T=T.match(h))){if(n.setext){n.header=n.setext;n.setext=0;t.skipToEnd();r.highlightFormatting&&(n.formatting="header")}else{n.header="="==T[0].charAt(0)?1:2;n.setext=n.header}n.thisLine.header=true;n.f=n.inline;return L(n)}if(C){t.skipToEnd();n.hr=true;n.thisLine.hr=true;return a.hr}if("["===t.peek())return x(t,n,W);return x(t,n,n.inline)}function C(t,r){var o=n.token(t,r.htmlState);if(!i){var a=e.innerMode(n,r.htmlState);if("xml"==a.mode.name&&null===a.state.tagStart&&!a.state.context&&a.state.tokenize.isInText||r.md_inside&&t.current().indexOf(">")>-1){r.f=M;r.block=k;r.htmlState=null}}return o}function S(e,t){var n=t.listStack[t.listStack.length-1]||0;var i=t.indentation<n;var o=n+3;if(t.fencedEndRE&&t.indentation<=o&&(i||e.match(t.fencedEndRE))){r.highlightFormatting&&(t.formatting="code-block");var l;i||(l=L(t));t.localMode=t.localState=null;t.block=k;t.f=M;t.fencedEndRE=null;t.code=0;t.thisLine.fencedCodeEnd=true;if(i)return y(e,t,t.block);return l}if(t.localMode)return t.localMode.token(e,t.localState);e.skipToEnd();return a.code}function L(e){var t=[];if(e.formatting){t.push(a.formatting);"string"===typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n<e.formatting.length;n++){t.push(a.formatting+"-"+e.formatting[n]);"header"===e.formatting[n]&&t.push(a.formatting+"-"+e.formatting[n]+"-"+e.header);"quote"===e.formatting[n]&&(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(a.formatting+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}}if(e.taskOpen){t.push("meta");return t.length?t.join(" "):null}if(e.taskClosed){t.push("property");return t.length?t.join(" "):null}if(e.linkHref)t.push(a.linkHref,"url");else{e.strong&&t.push(a.strong);e.em&&t.push(a.em);e.strikethrough&&t.push(a.strikethrough);e.emoji&&t.push(a.emoji);e.linkText&&t.push(a.linkText);e.code&&t.push(a.code);e.image&&t.push(a.image);e.imageAltText&&t.push(a.imageAltText,"link");e.imageMarker&&t.push(a.imageMarker)}e.header&&t.push(a.header,a.header+"-"+e.header);if(e.quote){t.push(a.quote);!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(a.quote+"-"+e.quote):t.push(a.quote+"-"+r.maxBlockquoteDepth)}if(false!==e.list){var i=(e.listStack.length-1)%3;i?1===i?t.push(a.list2):t.push(a.list3):t.push(a.list1)}e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b"));return t.length?t.join(" "):null}function T(e,t){if(e.match(d,true))return L(t);return}function M(t,i){var o=i.text(t,i);if("undefined"!==typeof o)return o;if(i.list){i.list=null;return L(i)}if(i.taskList){var l=" "===t.match(c,true)[1];l?i.taskOpen=true:i.taskClosed=true;r.highlightFormatting&&(i.formatting="task");i.taskList=false;return L(i)}i.taskOpen=false;i.taskClosed=false;if(i.header&&t.match(/^#+$/,true)){r.highlightFormatting&&(i.formatting="header");return L(i)}var s=t.next();if(i.linkTitle){i.linkTitle=false;var u=s;"("===s&&(u=")");u=(u+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(f),true))return a.linkHref}if("`"===s){var h=i.formatting;r.highlightFormatting&&(i.formatting="code");t.eatWhile("`");var d=t.current().length;if(0!=i.code||i.quote&&1!=d){if(d==i.code){var p=L(i);i.code=0;return p}i.formatting=h;return L(i)}i.code=d;return L(i)}if(i.code)return L(i);if("\\"===s){t.next();if(r.highlightFormatting){var m=L(i);var g=a.formatting+"-escape";return m?m+" "+g:g}}if("!"===s&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,false)){i.imageMarker=true;i.image=true;r.highlightFormatting&&(i.formatting="image");return L(i)}if("["===s&&i.imageMarker&&t.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,false)){i.imageMarker=false;i.imageAltText=true;r.highlightFormatting&&(i.formatting="image");return L(i)}if("]"===s&&i.imageAltText){r.highlightFormatting&&(i.formatting="image");var m=L(i);i.imageAltText=false;i.image=false;i.inline=i.f=O;return m}if("["===s&&!i.image){i.linkText=true;r.highlightFormatting&&(i.formatting="link");return L(i)}if("]"===s&&i.linkText){r.highlightFormatting&&(i.formatting="link");var m=L(i);i.linkText=false;i.inline=i.f=t.match(/\(.*?\)| ?\[.*?\]/,false)?O:M;return m}if("<"===s&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,false)){i.f=i.inline=N;r.highlightFormatting&&(i.formatting="link");var m=L(i);m?m+=" ":m="";return m+a.linkInline}if("<"===s&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,false)){i.f=i.inline=N;r.highlightFormatting&&(i.formatting="link");var m=L(i);m?m+=" ":m="";return m+a.linkEmail}if(r.xml&&"<"===s&&t.match(/^(!--|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*>)/i,false)){var x=t.string.indexOf(">",t.pos);if(-1!=x){var b=t.string.substring(t.start,x);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(b)&&(i.md_inside=true)}t.backUp(1);i.htmlState=e.startState(n);return y(t,i,C)}if(r.xml&&"<"===s&&t.match(/^\/\w*?>/)){i.md_inside=false;return"tag"}if("*"===s||"_"===s){var w=1,k=1==t.pos?" ":t.string.charAt(t.pos-2);while(w<3&&t.eat(s))w++;var S=t.peek()||" ";var T=!/\s/.test(S)&&(!v.test(S)||/\s/.test(k)||v.test(k));var A=!/\s/.test(k)&&(!v.test(k)||/\s/.test(S)||v.test(S));var D=null,W=null;w%2&&(i.em||!T||"*"!==s&&A&&!v.test(k)?i.em!=s||!A||"*"!==s&&T&&!v.test(S)||(D=false):D=true);w>1&&(i.strong||!T||"*"!==s&&A&&!v.test(k)?i.strong!=s||!A||"*"!==s&&T&&!v.test(S)||(W=false):W=true);if(null!=W||null!=D){r.highlightFormatting&&(i.formatting=null==D?"strong":null==W?"em":"strong em");true===D&&(i.em=s);true===W&&(i.strong=s);var p=L(i);false===D&&(i.em=false);false===W&&(i.strong=false);return p}}else if(" "===s&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return L(i);t.backUp(1)}if(r.strikethrough)if("~"===s&&t.eatWhile(s)){if(i.strikethrough){r.highlightFormatting&&(i.formatting="strikethrough");var p=L(i);i.strikethrough=false;return p}if(t.match(/^[^\s]/,false)){i.strikethrough=true;r.highlightFormatting&&(i.formatting="strikethrough");return L(i)}}else if(" "===s&&t.match(/^~~/,true)){if(" "===t.peek())return L(i);t.backUp(2)}if(r.emoji&&":"===s&&t.match(/^[a-z_\d+-]+:/)){i.emoji=true;r.highlightFormatting&&(i.formatting="emoji");var H=L(i);i.emoji=false;return H}" "===s&&(t.match(/ +$/,false)?i.trailingSpace++:i.trailingSpace&&(i.trailingSpaceNewLine=true));return L(i)}function N(e,t){var n=e.next();if(">"===n){t.f=t.inline=M;r.highlightFormatting&&(t.formatting="link");var i=L(t);i?i+=" ":i="";return i+a.linkInline}e.match(/^[^>]+/,true);return a.linkInline}function O(e,t){if(e.eatSpace())return null;var n=e.next();if("("===n||"["===n){t.f=t.inline=D("("===n?")":"]");r.highlightFormatting&&(t.formatting="link-string");t.linkHref=true;return L(t)}return"error"}var A={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function D(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=M;r.highlightFormatting&&(n.formatting="link-string");var o=L(n);n.linkHref=false;return o}t.match(A[e]);n.linkHref=true;return L(n)}}function W(e,t){if(e.match(/^([^\]\\]|\\.)*\]:/,false)){t.f=H;e.next();r.highlightFormatting&&(t.formatting="link");t.linkText=true;return L(t)}return x(e,t,M)}function H(e,t){if(e.match(/^\]:/,true)){t.f=t.inline=E;r.highlightFormatting&&(t.formatting="link");var n=L(t);t.linkText=false;return n}e.match(/^([^\]\\]|\\.)+/,true);return a.linkText}function E(e,t){if(e.eatSpace())return null;e.match(/^[^\s]+/,true);void 0===e.peek()?t.linkTitle=true:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,true);t.f=t.inline=M;return a.linkHref+" url"}var F={startState:function(){return{f:k,prevLine:{stream:null},thisLine:{stream:null},block:k,htmlState:null,indentation:0,inline:M,text:T,formatting:false,linkText:false,linkHref:false,linkTitle:false,code:0,em:false,strong:false,header:0,setext:0,hr:false,taskList:false,list:false,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:false,strikethrough:false,emoji:false,fencedEndRE:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(n,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:false,linkText:t.linkText,linkTitle:t.linkTitle,linkHref:t.linkHref,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,emoji:t.emoji,header:t.header,setext:t.setext,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedEndRE:t.fencedEndRE}},token:function(e,t){t.formatting=false;if(e!=t.thisLine.stream){t.header=0;t.hr=false;if(e.match(/^\s*$/,true)){w(t);return null}t.prevLine=t.thisLine;t.thisLine={stream:e};t.taskList=false;t.trailingSpace=0;t.trailingSpaceNewLine=false;if(!t.localState){t.f=t.block;if(t.f!=C){var r=e.match(/^\s*/,true)[0].replace(/\t/g,g).length;t.indentation=r;t.indentationDiff=null;if(r>0)return null}}}return t.f(e,t)},innerMode:function(e){if(e.block==C)return{state:e.htmlState,mode:n};if(e.localState)return{state:e.localState,mode:e.localMode};return{state:e,mode:F}},indent:function(t,r,i){if(t.block==C&&n.indent)return n.indent(t.htmlState,r,i);if(t.localState&&t.localMode.indent)return t.localMode.indent(t.localState,r,i);return e.Pass},blankLine:w,getType:L,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return F},"xml");e.defineMIME("text/markdown","markdown");e.defineMIME("text/x-markdown","markdown")})},371:function(e,t,r){(function(e){true;e(r(282))})(function(e){"use strict";var t={autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true,menuitem:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true,caseFold:true};var r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false,allowMissingTagName:false,caseFold:false};e.defineMode("xml",function(n,i){var o=n.indentUnit;var a={};var l=i.htmlMode?t:r;for(var s in l)a[s]=l[s];for(var s in i)a[s]=i[s];var u,c;function f(e,t){function r(r){t.tokenize=r;return r(e,t)}var n=e.next();if("<"==n){if(e.eat("!")){if(e.eat("["))return e.match("CDATA[")?r(p("atom","]]>")):null;if(e.match("--"))return r(p("comment","--\x3e"));if(e.match("DOCTYPE",true,true)){e.eatWhile(/[\w\._\-]/);return r(m(1))}return null}if(e.eat("?")){e.eatWhile(/[\w\._\-]/);t.tokenize=p("meta","?>");return"meta"}u=e.eat("/")?"closeTag":"openTag";t.tokenize=h;return"tag bracket"}if("&"==n){var i;i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";");return i?"atom":"error"}e.eatWhile(/[^&<]/);return null}f.isInText=true;function h(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">")){t.tokenize=f;u=">"==r?"endTag":"selfcloseTag";return"tag bracket"}if("="==r){u="equals";return null}if("<"==r){t.tokenize=f;t.state=y;t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}if(/[\'\"]/.test(r)){t.tokenize=d(r);t.stringStartCol=e.column();return t.tokenize(e,t)}e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}function d(e){var t=function(t,r){while(!t.eol())if(t.next()==e){r.tokenize=h;break}return"string"};t.isInAttribute=true;return t}function p(e,t){return function(r,n){while(!r.eol()){if(r.match(t)){n.tokenize=f;break}r.next()}return e}}function m(e){return function(t,r){var n;while(null!=(n=t.next())){if("<"==n){r.tokenize=m(e+1);return r.tokenize(t,r)}if(">"==n){if(1==e){r.tokenize=f;break}r.tokenize=m(e-1);return r.tokenize(t,r)}}return"meta"}}function v(e,t,r){this.prev=e.context;this.tagName=t;this.indent=e.indented;this.startOfLine=r;(a.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=true)}function g(e){e.context&&(e.context=e.context.prev)}function x(e,t){var r;while(true){if(!e.context)return;r=e.context.tagName;if(!a.contextGrabbers.hasOwnProperty(r)||!a.contextGrabbers[r].hasOwnProperty(t))return;g(e)}}function y(e,t,r){if("openTag"==e){r.tagStart=t.column();return b}return"closeTag"==e?w:y}function b(e,t,r){if("word"==e){r.tagName=t.current();c="tag";return S}if(a.allowMissingTagName&&"endTag"==e){c="tag bracket";return S(e,t,r)}c="error";return b}function w(e,t,r){if("word"==e){var n=t.current();r.context&&r.context.tagName!=n&&a.implicitlyClosed.hasOwnProperty(r.context.tagName)&&g(r);if(r.context&&r.context.tagName==n||false===a.matchClosing){c="tag";return k}c="tag error";return C}if(a.allowMissingTagName&&"endTag"==e){c="tag bracket";return k(e,t,r)}c="error";return C}function k(e,t,r){if("endTag"!=e){c="error";return k}g(r);return y}function C(e,t,r){c="error";return k(e,t,r)}function S(e,t,r){if("word"==e){c="attribute";return L}if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;r.tagName=r.tagStart=null;if("selfcloseTag"==e||a.autoSelfClosers.hasOwnProperty(n))x(r,n);else{x(r,n);r.context=new v(r,n,i==r.indented)}return y}c="error";return S}function L(e,t,r){if("equals"==e)return T;a.allowMissing||(c="error");return S(e,t,r)}function T(e,t,r){if("string"==e)return M;if("word"==e&&a.allowUnquoted){c="string";return S}c="error";return S(e,t,r)}function M(e,t,r){if("string"==e)return M;return S(e,t,r)}return{startState:function(e){var t={tokenize:f,state:y,indented:e||0,tagName:null,tagStart:null,context:null};null!=e&&(t.baseIndent=e);return t},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;u=null;var r=t.tokenize(e,t);if((r||u)&&"comment"!=r){c=null;t.state=t.state(u||r,e,t);c&&(r="error"==c?r+" error":c)}return r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+o;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=h&&t.tokenize!=f)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return false!==a.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+o*(a.multilineTagIndentFactor||1);if(a.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])while(i){if(i.tagName==l[2]){i=i.prev;break}if(!a.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(l)while(i){var s=a.contextGrabbers[i.tagName];if(!s||!s.hasOwnProperty(l[2]))break;i=i.prev}while(i&&i.prev&&!i.startOfLine)i=i.prev;return i?i.indent+o:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:a.htmlMode?"html":"xml",helperType:a.htmlMode?"html":"xml",skipAttribute:function(e){e.state==T&&(e.state=S)}}});e.defineMIME("text/xml","xml");e.defineMIME("application/xml","xml");e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:true})})},372:function(e,t,r){(function(e){true;e(r(282))})(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"],alias:["objective-c","objc"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]}];for(var t=0;t<e.modeInfo.length;t++){var r=e.modeInfo[t];r.mimes&&(r.mime=r.mimes[0])}e.findModeByMIME=function(t){t=t.toLowerCase();for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.mime==t)return n;if(n.mimes)for(var i=0;i<n.mimes.length;i++)if(n.mimes[i]==t)return n}if(/\+xml$/.test(t))return e.findModeByMIME("application/xml");if(/\+json$/.test(t))return e.findModeByMIME("application/json")};e.findModeByExtension=function(t){for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.ext)for(var i=0;i<n.ext.length;i++)if(n.ext[i]==t)return n}};e.findModeByFileName=function(t){for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.file&&n.file.test(t))return n}var i=t.lastIndexOf(".");var o=i>-1&&t.substring(i+1,t.length);if(o)return e.findModeByExtension(o)};e.findModeByName=function(t){t=t.toLowerCase();for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.name.toLowerCase()==t)return n;if(n.alias)for(var i=0;i<n.alias.length;i++)if(n.alias[i].toLowerCase()==t)return n}}})},63:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});r.d(t,"default",function(){return g});var n=r(0);var i=r.n(n);var o=r(282);var a=r.n(o);var l=r(132);var s=r.n(l);function u(e){u="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function e(t){return typeof t}:function e(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return u(e)}function c(){c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};return c.apply(this,arguments)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;"value"in n&&(n.writable=true);Object.defineProperty(e,n.key,n)}}function d(e,t,r){t&&h(e.prototype,t);r&&h(e,r);return e}function p(e,t){if(t&&("object"===u(t)||"function"===typeof t))return t;return v(e)}function m(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}"undefined"!==typeof window&&r(370);var g=function(e){m(t,e);function t(){var e;var r,n;f(this,t);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return p(n,(r=n=p(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),Object.defineProperty(v(n),"handleChange",{configurable:true,enumerable:true,writable:true,value:function e(){if(!n.editor)return;var e=n.editor.getValue();if(e!==n.props.value){n.props.onChange&&n.props.onChange(e);n.editor.getValue()!==n.props.value&&(n.state.isControlled?n.editor.setValue(n.props.value):n.props.value=e)}}}),Object.defineProperty(v(n),"checkSubmit",{configurable:true,enumerable:true,writable:true,value:function e(t,r){var i=Object(l["getKey"])(r);Object(l["isCtrlKey"])(i)?n.ctrlKey=true:13===i&&n.ctrlKey&&n.props.onSubmit()}}),Object.defineProperty(v(n),"handleKeyUp",{configurable:true,enumerable:true,writable:true,value:function e(t,r){Object(l["isCtrlKey"])(Object(l["getKey"])(r))&&(n.ctrlKey=false)}}),r))}d(t,[{key:"componentDidMount",value:function e(){if("undefined"===typeof window)return;this.editor=a.a.fromTextArea(this.textarea,this.props.options);this.editor.on("change",this.handleChange);if("function"===typeof this.props.onSubmit){this.editor.on("keydown",this.checkSubmit);this.editor.on("keyup",this.handleKeyUp);this.setupSubmitKey=true}}},{key:"componentWillUnmount",value:function e(){if(this.setupSubmitKey){this.editor.off("keydown",this.checkSubmit);this.editor.off("keyup",this.handleKeyUp);this.setupSubmitKey=false}}},{key:"componentDidUpdate",value:function e(){if(!this.editor||!this.props.value)return;this.editor.getValue()!==this.props.value&&this.editor.setValue(this.props.value)}},{key:"render",value:function e(){var t=this;var r=this.props,n=r.value,o=r.className,a=r.onChange;return i.a.createElement("div",{className:o},i.a.createElement("textarea",c({value:n,onChange:a},{ref:function e(r){return t.textarea=r}})))}}]);return t}(n["Component"])}})}); |